[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.20] AMD/IOMMU: correct devtab size writing



commit b95f8b25bbd316573d7b08211d30c58e00988d1b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Nov 17 17:29:42 2026 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Nov 17 17:29:42 2026 +0100

    AMD/IOMMU: correct devtab size writing
    
    The fix for XSA-524 inadvertently converted a page-granular value to a
    byte-granular one, thus always setting maximum size (2Mb) without the
    table always being that size.
    
    Fixes: d7378932b1fc ("AMD/IOMMU: allocate (at least) one spare device table 
entry")
    Reported-by: Roger Pau Monné <roger.pau@xxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxx>
    master commit: ab77da87e9b38022341eb6a54593e681485d203a
    master date: 2026-11-17 17:02:47 +0100
---
 xen/drivers/passthrough/amd/iommu_init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c 
b/xen/drivers/passthrough/amd/iommu_init.c
index 5ca18cb2a3..0e2275d8fe 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -80,9 +80,8 @@ static void register_iommu_dev_table_in_mmio_space(struct 
amd_iommu *iommu)
 
     entry = 0;
     iommu_set_addr_lo_to_reg(&entry, addr_lo >> PAGE_SHIFT);
-    set_field_in_reg_u32(ROUNDUP(iommu->dev_table.entries *
-                                 IOMMU_DEV_TABLE_ENTRY_SIZE,
-                                 PAGE_SIZE) - 1,
+    set_field_in_reg_u32(PFN_UP(iommu->dev_table.entries *
+                                IOMMU_DEV_TABLE_ENTRY_SIZE) - 1,
                          entry, IOMMU_DEV_TABLE_SIZE_MASK,
                          IOMMU_DEV_TABLE_SIZE_SHIFT, &entry);
     writel(entry, iommu->mmio_base + IOMMU_DEV_TABLE_BASE_LOW_OFFSET);
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.