* [PATCH] hisi_acc_vfio_pci: simplify the command for reading device information.
@ 2026-05-14 9:20 Longfang Liu
2026-05-20 21:11 ` Alex Williamson
0 siblings, 1 reply; 3+ messages in thread
From: Longfang Liu @ 2026-05-14 9:20 UTC (permalink / raw)
To: alex.williamson, jgg; +Cc: kvm, linux-kernel, liulongfang
From: Weili Qian <qianweili@huawei.com>
The mailbox operation for the Hisi accelerator device now
provides a new read function that supports direct information retrieval
by specifying commands, thereby simplifying the related mailbox command
handling in the driver.
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Longfang Liu <liulongfang@huawei.com>
---
.../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 39 ++-----------------
1 file changed, 3 insertions(+), 36 deletions(-)
diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index bb121f635b9f..86362ec424a5 100644
--- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
+++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
@@ -81,13 +81,10 @@ static int qm_get_vft(struct hisi_qm *qm, u32 *base)
u32 qp_num;
int ret;
- ret = hisi_qm_mb(qm, QM_MB_CMD_SQC_VFT_V2, 0, 0, 1);
+ ret = hisi_qm_mb_read(qm, &sqc_vft, QM_MB_CMD_SQC_VFT_V2, 0);
if (ret)
return ret;
- sqc_vft = readl(qm->io_base + QM_MB_CMD_DATA_ADDR_L) |
- ((u64)readl(qm->io_base + QM_MB_CMD_DATA_ADDR_H) <<
- QM_XQC_ADDR_OFFSET);
*base = QM_SQC_VFT_BASE_MASK_V2 & (sqc_vft >> QM_SQC_VFT_BASE_SHIFT_V2);
qp_num = (QM_SQC_VFT_NUM_MASK_V2 &
(sqc_vft >> QM_SQC_VFT_NUM_SHIFT_V2)) + 1;
@@ -95,36 +92,6 @@ static int qm_get_vft(struct hisi_qm *qm, u32 *base)
return qp_num;
}
-static int qm_get_sqc(struct hisi_qm *qm, u64 *addr)
-{
- int ret;
-
- ret = hisi_qm_mb(qm, QM_MB_CMD_SQC_BT, 0, 0, 1);
- if (ret)
- return ret;
-
- *addr = readl(qm->io_base + QM_MB_CMD_DATA_ADDR_L) |
- ((u64)readl(qm->io_base + QM_MB_CMD_DATA_ADDR_H) <<
- QM_XQC_ADDR_OFFSET);
-
- return 0;
-}
-
-static int qm_get_cqc(struct hisi_qm *qm, u64 *addr)
-{
- int ret;
-
- ret = hisi_qm_mb(qm, QM_MB_CMD_CQC_BT, 0, 0, 1);
- if (ret)
- return ret;
-
- *addr = readl(qm->io_base + QM_MB_CMD_DATA_ADDR_L) |
- ((u64)readl(qm->io_base + QM_MB_CMD_DATA_ADDR_H) <<
- QM_XQC_ADDR_OFFSET);
-
- return 0;
-}
-
static void qm_xqc_reg_offsets(struct hisi_qm *qm,
u32 *eqc_addr, u32 *aeqc_addr)
{
@@ -575,13 +542,13 @@ static int vf_qm_read_data(struct hisi_qm *vf_qm, struct acc_vf_data *vf_data)
vf_data->aeqe_dma |= vf_data->qm_aeqc_dw[QM_XQC_ADDR_LOW];
/* Through SQC_BT/CQC_BT to get sqc and cqc address */
- ret = qm_get_sqc(vf_qm, &vf_data->sqc_dma);
+ ret = hisi_qm_mb_read(vf_qm, &vf_data->sqc_dma, QM_MB_CMD_SQC_BT, 0);
if (ret) {
dev_err(dev, "failed to read SQC addr!\n");
return ret;
}
- ret = qm_get_cqc(vf_qm, &vf_data->cqc_dma);
+ ret = hisi_qm_mb_read(vf_qm, &vf_data->cqc_dma, QM_MB_CMD_CQC_BT, 0);
if (ret) {
dev_err(dev, "failed to read CQC addr!\n");
return ret;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] hisi_acc_vfio_pci: simplify the command for reading device information.
2026-05-14 9:20 [PATCH] hisi_acc_vfio_pci: simplify the command for reading device information Longfang Liu
@ 2026-05-20 21:11 ` Alex Williamson
2026-05-21 1:31 ` liulongfang
0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2026-05-20 21:11 UTC (permalink / raw)
To: Longfang Liu; +Cc: alex.williamson, jgg, kvm, linux-kernel, alex
On Thu, 14 May 2026 17:20:26 +0800
Longfang Liu <liulongfang@huawei.com> wrote:
> From: Weili Qian <qianweili@huawei.com>
>
> The mailbox operation for the Hisi accelerator device now
> provides a new read function that supports direct information retrieval
> by specifying commands, thereby simplifying the related mailbox command
> handling in the driver.
>
> Signed-off-by: Weili Qian <qianweili@huawei.com>
> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> ---
> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 39 ++-----------------
> 1 file changed, 3 insertions(+), 36 deletions(-)
Applied to vfio next branch for v7.2. Thanks,
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hisi_acc_vfio_pci: simplify the command for reading device information.
2026-05-20 21:11 ` Alex Williamson
@ 2026-05-21 1:31 ` liulongfang
0 siblings, 0 replies; 3+ messages in thread
From: liulongfang @ 2026-05-21 1:31 UTC (permalink / raw)
To: Alex Williamson; +Cc: alex.williamson, jgg, kvm, linux-kernel
On 2026/5/21 5:11, Alex Williamson wrote:
> On Thu, 14 May 2026 17:20:26 +0800
> Longfang Liu <liulongfang@huawei.com> wrote:
>
>> From: Weili Qian <qianweili@huawei.com>
>>
>> The mailbox operation for the Hisi accelerator device now
>> provides a new read function that supports direct information retrieval
>> by specifying commands, thereby simplifying the related mailbox command
>> handling in the driver.
>>
>> Signed-off-by: Weili Qian <qianweili@huawei.com>
>> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
>> ---
>> .../vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 39 ++-----------------
>> 1 file changed, 3 insertions(+), 36 deletions(-)
>
> Applied to vfio next branch for v7.2. Thanks,
>
Thanks.
Longfang.
> Alex
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-21 1:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-14 9:20 [PATCH] hisi_acc_vfio_pci: simplify the command for reading device information Longfang Liu
2026-05-20 21:11 ` Alex Williamson
2026-05-21 1:31 ` liulongfang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®