Re: [PATCH 06/22] iommu/amd: Map vIOMMU VF MMIO and VF Control MMIO regions
From: Suthikulpanit, Suravee
Date: Mon Apr 06 2026 - 04:58:09 EST
On 3/31/2026 12:30 PM, Weinan Liu wrote:
On Mon, Mar 30, 2026 at 1:43 AM Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> wrote:
diff --git a/drivers/iommu/amd/viommu.c b/drivers/iommu/amd/viommu.cIf this mapping fails, the previously successful mapping of iommu->vf_base need to be clean up
index f4b5f96d4785..887a9eb8122d 100644
--- a/drivers/iommu/amd/viommu.c
+++ b/drivers/iommu/amd/viommu.c
+static int __init viommu_vf_vfcntl_init(struct amd_iommu *iommu)
+{...
+ /* Mapping 256MB of VF and 4MB of VF_CNTL BARs */
+ vf_phys &= ~1ULL;
+ iommu->vf_base = iommu_map_mmio_space(vf_phys, 0x10000000);
+ if (!iommu->vf_base) {
+ pr_err("Can't reserve vf_base\n");
+ return -ENOMEM;
+ }
+
+ vf_cntl_phys &= ~1ULL;
+ iommu->vfctrl_base = iommu_map_mmio_space(vf_cntl_phys, 0x400000);
+
+ if (!iommu->vfctrl_base) {
Thank for catching. I'll fix this in V2.
Suravee
+ pr_err("Can't reserve vfctrl_base\n");
+ return -ENOMEM;
+ }
+