From: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
To: qemu-devel@nongnu.org
Cc: ethan.milon@eviden.com, mst@redhat.com, pbonzini@redhat.com,
mjt@tls.msk.ru, marcel.apfelbaum@gmail.com,
richard.henderson@linaro.org, eduardo@habkost.net,
vasant.hegde@amd.com, suravee.suthikulpanit@amd.com,
santosh.shukla@amd.com, sarunkod@amd.com, brijesh.singh@amd.com,
joao.m.martins@oracle.com, boris.ostrovsky@oracle.com,
alejandro.j.jimenez@oracle.com, philmd@linaro.org
Subject: [PATCH v4 6/8] amd_iommu: Fix the calculation for Device Table size
Date: Tue, 17 Jun 2025 15:04:25 +0000 [thread overview]
Message-ID: <20250617150427.20585-7-alejandro.j.jimenez@oracle.com> (raw)
In-Reply-To: <20250617150427.20585-1-alejandro.j.jimenez@oracle.com>
Correctly calculate the Device Table size using the format encoded in the
Device Table Base Address Register (MMIO Offset 0000h).
Cc: qemu-stable@nongnu.org
Fixes: d29a09ca6842 ("hw/i386: Introduce AMD IOMMU")
Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
---
hw/i386/amd_iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 6e78047919cb6..92f94dc788c3d 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -665,8 +665,8 @@ static inline void amdvi_handle_devtab_write(AMDVIState *s)
uint64_t val = amdvi_readq(s, AMDVI_MMIO_DEVICE_TABLE);
s->devtab = (val & AMDVI_MMIO_DEVTAB_BASE_MASK);
- /* set device table length */
- s->devtab_len = ((val & AMDVI_MMIO_DEVTAB_SIZE_MASK) + 1 *
+ /* set device table length (i.e. number of entries table can hold) */
+ s->devtab_len = (((val & AMDVI_MMIO_DEVTAB_SIZE_MASK) + 1) *
(AMDVI_MMIO_DEVTAB_SIZE_UNIT /
AMDVI_MMIO_DEVTAB_ENTRY_SIZE));
}
--
2.43.5
next prev parent reply other threads:[~2025-06-17 15:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 15:04 [PATCH v4 0/8] amd_iommu: Fixes to align with AMDVi specification Alejandro Jimenez
2025-06-17 15:04 ` [PATCH v4 1/8] amd_iommu: Fix Miscellaneous Information Register 0 encoding Alejandro Jimenez
2025-06-26 17:53 ` Vasant Hegde
2025-06-17 15:04 ` [PATCH v4 2/8] amd_iommu: Fix Device ID decoding for INVALIDATE_IOTLB_PAGES command Alejandro Jimenez
2025-06-17 15:04 ` [PATCH v4 3/8] amd_iommu: Update bitmasks representing DTE reserved fields Alejandro Jimenez
2025-06-17 15:04 ` [PATCH v4 4/8] amd_iommu: Fix masks for various IOMMU MMIO Registers Alejandro Jimenez
2025-06-17 15:04 ` [PATCH v4 5/8] amd_iommu: Fix mask to retrieve Interrupt Table Root Pointer from DTE Alejandro Jimenez
2025-06-17 15:04 ` Alejandro Jimenez [this message]
2025-06-17 15:04 ` [PATCH v4 7/8] amd_iommu: Remove duplicated definitions Alejandro Jimenez
2025-06-17 15:04 ` [PATCH v4 8/8] amd_iommu: Fix truncation of oldval in amdvi_writeq Alejandro Jimenez
2025-06-26 12:36 ` Vasant Hegde
2025-06-26 17:55 ` [PATCH v4 0/8] amd_iommu: Fixes to align with AMDVi specification Vasant Hegde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250617150427.20585-7-alejandro.j.jimenez@oracle.com \
--to=alejandro.j.jimenez@oracle.com \
--cc=boris.ostrovsky@oracle.com \
--cc=brijesh.singh@amd.com \
--cc=eduardo@habkost.net \
--cc=ethan.milon@eviden.com \
--cc=joao.m.martins@oracle.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mjt@tls.msk.ru \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=santosh.shukla@amd.com \
--cc=sarunkod@amd.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).