From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Sairaj Kodilkar" <sarunkod@amd.com>,
"Vasant Hegde" <vasant.hegde@amd.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Eduardo Habkost" <eduardo@habkost.net>
Subject: [PULL 06/17] hw/i386/amd_iommu: Fix MMIO register write tracing
Date: Fri, 1 Aug 2025 10:25:14 -0400 [thread overview]
Message-ID: <96c75abc872c1a90c8e1f4a4d2ed35e89a1befe9.1754058276.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1754058276.git.mst@redhat.com>
From: Sairaj Kodilkar <sarunkod@amd.com>
Define separate functions to trace MMIO write accesses instead of using
`trace_amdvi_mmio_read()` for both read and write.
Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com>
Reviewed-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250801060507.3382-2-sarunkod@amd.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/amd_iommu.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 5a24c17548..7fb0bb68f0 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -592,18 +592,31 @@ static void amdvi_cmdbuf_run(AMDVIState *s)
}
}
-static void amdvi_mmio_trace(hwaddr addr, unsigned size)
+static inline uint8_t amdvi_mmio_get_index(hwaddr addr)
{
uint8_t index = (addr & ~0x2000) / 8;
if ((addr & 0x2000)) {
/* high table */
index = index >= AMDVI_MMIO_REGS_HIGH ? AMDVI_MMIO_REGS_HIGH : index;
- trace_amdvi_mmio_read(amdvi_mmio_high[index], addr, size, addr & ~0x07);
} else {
index = index >= AMDVI_MMIO_REGS_LOW ? AMDVI_MMIO_REGS_LOW : index;
- trace_amdvi_mmio_read(amdvi_mmio_low[index], addr, size, addr & ~0x07);
}
+
+ return index;
+}
+
+static void amdvi_mmio_trace_read(hwaddr addr, unsigned size)
+{
+ uint8_t index = amdvi_mmio_get_index(addr);
+ trace_amdvi_mmio_read(amdvi_mmio_low[index], addr, size, addr & ~0x07);
+}
+
+static void amdvi_mmio_trace_write(hwaddr addr, unsigned size, uint64_t val)
+{
+ uint8_t index = amdvi_mmio_get_index(addr);
+ trace_amdvi_mmio_write(amdvi_mmio_low[index], addr, size, val,
+ addr & ~0x07);
}
static uint64_t amdvi_mmio_read(void *opaque, hwaddr addr, unsigned size)
@@ -623,7 +636,7 @@ static uint64_t amdvi_mmio_read(void *opaque, hwaddr addr, unsigned size)
} else if (size == 8) {
val = amdvi_readq(s, addr);
}
- amdvi_mmio_trace(addr, size);
+ amdvi_mmio_trace_read(addr, size);
return val;
}
@@ -770,7 +783,7 @@ static void amdvi_mmio_write(void *opaque, hwaddr addr, uint64_t val,
return;
}
- amdvi_mmio_trace(addr, size);
+ amdvi_mmio_trace_write(addr, size, val);
switch (addr & ~0x07) {
case AMDVI_MMIO_CONTROL:
amdvi_mmio_reg_write(s, size, val, addr);
--
MST
next prev parent reply other threads:[~2025-08-01 14:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-01 14:24 [PULL 00/17] virtio,pci,pc: bugfixes Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 01/17] virtio: fix off-by-one and invalid access in virtqueue_ordered_fill Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 02/17] vhost: Do not abort on log-start error Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 03/17] vhost: Do not abort on log-stop error Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 04/17] virtio-net: Fix VLAN filter table reset timing Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 05/17] pcie_sriov: Fix configuration and state synchronization Michael S. Tsirkin
2025-08-01 14:25 ` Michael S. Tsirkin [this message]
2025-08-01 14:25 ` [PULL 07/17] hw/i386/amd_iommu: Remove unused and wrongly set ats_enabled field Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 08/17] hw/i386/amd_iommu: Move IOAPIC memory region initialization to the end Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 09/17] hw/i386/amd_iommu: Fix amdvi_write*() Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 10/17] hw/i386/amd_iommu: Support MMIO writes to the status register Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 11/17] hw/i386/amd_iommu: Fix event log generation Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 12/17] tests/acpi: virt: add an empty HEST file Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 13/17] tests/qtest/bios-tables-test: extend to also check HEST table Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 14/17] tests/acpi: virt: update HEST file with its current data Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 15/17] intel_iommu: Allow both Status Write and Interrupt Flag in QI wait Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 16/17] MAINTAINERS: add net/vhost* files under `vhost` Michael S. Tsirkin
2025-08-01 14:25 ` [PULL 17/17] net/vdpa: fix potential fd leak in net_init_vhost_vdpa() Michael S. Tsirkin
2025-08-01 19:34 ` [PULL 00/17] virtio,pci,pc: bugfixes Stefan Hajnoczi
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=96c75abc872c1a90c8e1f4a4d2ed35e89a1befe9.1754058276.git.mst@redhat.com \
--to=mst@redhat.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sarunkod@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).