Skip to content

Commit 90c635c

Browse files
aljimenezbMichael Tokarev
authored andcommitted
amd_iommu: Fix the calculation for Device Table size
Correctly calculate the Device Table size using the format encoded in the Device Table Base Address Register (MMIO Offset 0000h). Cc: [email protected] Fixes: d29a09c ("hw/i386: Introduce AMD IOMMU") Signed-off-by: Alejandro Jimenez <[email protected]> Reviewed-by: Vasant Hegde <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> (cherry picked from commit 67d3077ee403472d45794399e97c9f329242fce9) Signed-off-by: Michael Tokarev <[email protected]>
1 parent 18e70a4 commit 90c635c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hw/i386/amd_iommu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,8 +665,8 @@ static inline void amdvi_handle_devtab_write(AMDVIState *s)
665665
uint64_t val = amdvi_readq(s, AMDVI_MMIO_DEVICE_TABLE);
666666
s->devtab = (val & AMDVI_MMIO_DEVTAB_BASE_MASK);
667667

668-
/* set device table length */
669-
s->devtab_len = ((val & AMDVI_MMIO_DEVTAB_SIZE_MASK) + 1 *
668+
/* set device table length (i.e. number of entries table can hold) */
669+
s->devtab_len = (((val & AMDVI_MMIO_DEVTAB_SIZE_MASK) + 1) *
670670
(AMDVI_MMIO_DEVTAB_SIZE_UNIT /
671671
AMDVI_MMIO_DEVTAB_ENTRY_SIZE));
672672
}

0 commit comments

Comments
 (0)