aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio
diff options
context:
space:
mode:
authorCai Huoqing <caihuoqing@baidu.com>2021-07-13 17:37:43 +0800
committerAlex Williamson <alex.williamson@redhat.com>2021-07-14 13:47:17 -0600
commit1bd9f1b14d1e9c1498bb03faf4e2bb945cf6542d (patch)
treedbd86641cc12be46c2801b62243717e69cfec638 /hw/vfio
parent936555bc4f9efce1a9d35466845169c2c7566794 (diff)
vfio/pci: Add pba_offset PCI quirk for BAIDU KUNLUN AI processor
Fix pba_offset initialization value for BAIDU KUNLUN Virtual Function device. The KUNLUN hardware returns an incorrect value for the VF PBA offset, and add a quirk to instead return a hardcoded value of 0xb400. Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Link: https://lore.kernel.org/r/20210713093743.942-1-caihuoqing@baidu.com [aw: comment & whitespace tuning] Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio')
-rw-r--r--hw/vfio/pci.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 971273fd45..e1ea1d8a23 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -1499,6 +1499,14 @@ static void vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
if (vdev->vendor_id == PCI_VENDOR_ID_CHELSIO &&
(vdev->device_id & 0xff00) == 0x5800) {
msix->pba_offset = 0x1000;
+ /*
+ * BAIDU KUNLUN Virtual Function devices for KUNLUN AI processor
+ * return an incorrect value of 0x460000 for the VF PBA offset while
+ * the BAR itself is only 0x10000. The correct value is 0xb400.
+ */
+ } else if (vfio_pci_is(vdev, PCI_VENDOR_ID_BAIDU,
+ PCI_DEVICE_ID_KUNLUN_VF)) {
+ msix->pba_offset = 0xb400;
} else if (vdev->msix_relo == OFF_AUTOPCIBAR_OFF) {
error_setg(errp, "hardware reports invalid configuration, "
"MSIX PBA outside of specified BAR");