[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/41] amd_iommu: Use correct bitmask to set capability BAR
From: |
Michael S. Tsirkin |
Subject: |
[PULL 27/41] amd_iommu: Use correct bitmask to set capability BAR |
Date: |
Fri, 21 Feb 2025 07:24:03 -0500 |
From: Sairaj Kodilkar <sarunkod@amd.com>
AMD IOMMU provides the base address of control registers through
IVRS table and PCI capability. Since this base address is of 64 bit,
use 32 bits mask (instead of 16 bits) to set BAR low and high.
Fixes: d29a09ca68 ("hw/i386: Introduce AMD IOMMU")
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Message-Id: <20250207045354.27329-3-sarunkod@amd.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/amd_iommu.h | 2 +-
hw/i386/amd_iommu.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h
index e0dac4d9a9..28125130c6 100644
--- a/hw/i386/amd_iommu.h
+++ b/hw/i386/amd_iommu.h
@@ -187,7 +187,7 @@
AMDVI_CAPAB_FLAG_HTTUNNEL | AMDVI_CAPAB_EFR_SUP)
/* AMDVI default address */
-#define AMDVI_BASE_ADDR 0xfed80000
+#define AMDVI_BASE_ADDR 0xfed80000ULL
/* page management constants */
#define AMDVI_PAGE_SHIFT 12
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 98f1209a38..044fe43256 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1593,9 +1593,9 @@ static void amdvi_pci_realize(PCIDevice *pdev, Error
**errp)
/* reset AMDVI specific capabilities, all r/o */
pci_set_long(pdev->config + s->capab_offset, AMDVI_CAPAB_FEATURES);
pci_set_long(pdev->config + s->capab_offset + AMDVI_CAPAB_BAR_LOW,
- AMDVI_BASE_ADDR & ~(0xffff0000));
+ AMDVI_BASE_ADDR & MAKE_64BIT_MASK(14, 18));
pci_set_long(pdev->config + s->capab_offset + AMDVI_CAPAB_BAR_HIGH,
- (AMDVI_BASE_ADDR & ~(0xffff)) >> 16);
+ AMDVI_BASE_ADDR >> 32);
pci_set_long(pdev->config + s->capab_offset + AMDVI_CAPAB_RANGE,
0xff000000);
pci_set_long(pdev->config + s->capab_offset + AMDVI_CAPAB_MISC, 0);
--
MST
- [PULL 18/41] hw/i386/microvm: Fix crash that occurs when introspecting the microvm machine, (continued)
- [PULL 18/41] hw/i386/microvm: Fix crash that occurs when introspecting the microvm machine, Michael S. Tsirkin, 2025/02/21
- [PULL 17/41] hw/i386/pc: Fix crash that occurs when introspecting TYPE_PC_MACHINE machines, Michael S. Tsirkin, 2025/02/21
- [PULL 19/41] tests/qtest/vhost-user-test: Use modern virtio for vhost-user tests, Michael S. Tsirkin, 2025/02/21
- [PULL 20/41] hw/cxl: Introduce CXL_T3_MSIX_VECTOR enumeration, Michael S. Tsirkin, 2025/02/21
- [PULL 22/41] hw/mem/cxl_type3: Fix special_ops memory leak on msix_init_exclusive_bar() failure, Michael S. Tsirkin, 2025/02/21
- [PULL 23/41] hw/mem/cxl_type3: Ensure errp is set on realization failure, Michael S. Tsirkin, 2025/02/21
- [PULL 24/41] mem/cxl_type3: support 3, 6, 12 and 16 interleave ways, Michael S. Tsirkin, 2025/02/21
- [PULL 25/41] hw/virtio: reset virtio balloon stats on machine reset, Michael S. Tsirkin, 2025/02/21
- [PULL 26/41] amd_iommu: Use correct DTE field for interrupt passthrough, Michael S. Tsirkin, 2025/02/21
- [PULL 28/41] vhost-iova-tree: Implement an IOVA-only tree, Michael S. Tsirkin, 2025/02/21
- [PULL 27/41] amd_iommu: Use correct bitmask to set capability BAR,
Michael S. Tsirkin <=
- [PULL 31/41] cryptodev/vhost: allocate CryptoDevBackendVhost using g_mem0(), Michael S. Tsirkin, 2025/02/21
- [PULL 29/41] vhost-iova-tree, svq: Implement GPA->IOVA & partial IOVA->HVA trees, Michael S. Tsirkin, 2025/02/21
- [PULL 32/41] MAINTAINERS: add more files to `vhost`, Michael S. Tsirkin, 2025/02/21
- [PULL 33/41] vdpa: Fix endian bugs in shadow virtqueue, Michael S. Tsirkin, 2025/02/21
- [PULL 30/41] vhost-iova-tree: Update documentation, Michael S. Tsirkin, 2025/02/21
- [PULL 13/41] pcie_sriov: Register VFs after migration, Michael S. Tsirkin, 2025/02/21
- [PULL 34/41] hw/virtio/virtio-nsm: Respond with correct length, Michael S. Tsirkin, 2025/02/21
- [PULL 35/41] net: vhost-user: add QAPI events to report connection state, Michael S. Tsirkin, 2025/02/21
- [PULL 36/41] vhost-user-snd: correct the calculation of config_size, Michael S. Tsirkin, 2025/02/21
- [PULL 37/41] hw/virtio/virtio-iommu: Migrate to 3-phase reset, Michael S. Tsirkin, 2025/02/21