This is necessary to demonstrate the issue in the next commit.
It is also useful when developing drivers.
Signed-off-by: David Hoppenbrouwers <qemu@demindiro.com>
---
hw/i386/amd_iommu.c | 8 ++++++++
hw/i386/trace-events | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 789e09d6f2..29999fd776 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -667,6 +667,8 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
uint8_t level, mode;
uint64_t pte_addr;
+ trace_amdvi_fetch_pte_translate(address);
+
*pte = dte;
*page_size = 0;
@@ -691,7 +693,11 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
return -AMDVI_FR_PT_ROOT_INV;
}
+ trace_amdvi_fetch_pte_root(level, *pte);
+
do {
+ trace_amdvi_fetch_pte_walk(level, *pte, PTE_NEXT_LEVEL(*pte), *page_size);
+
level -= 1;
/* Update the page_size */
@@ -750,6 +756,8 @@ static uint64_t fetch_pte(AMDVIAddressSpace *as, hwaddr address, uint64_t dte,
*page_size = large_pte_page_size(*pte);
}
+ trace_amdvi_fetch_pte_found(level, *pte, PTE_NEXT_LEVEL(*pte), *page_size);
+
return 0;
}
diff --git a/hw/i386/trace-events b/hw/i386/trace-events
index 5fa5e93b68..5e7d7ba30d 100644
--- a/hw/i386/trace-events
+++ b/hw/i386/trace-events
@@ -118,6 +118,10 @@ amdvi_ir_intctl(uint8_t val) "int_ctl 0x%"PRIx8
amdvi_ir_target_abort(const char *str) "%s"
amdvi_ir_delivery_mode(const char *str) "%s"
amdvi_ir_irte_ga_val(uint64_t hi, uint64_t lo) "hi 0x%"PRIx64" lo 0x%"PRIx64
+amdvi_fetch_pte_translate(uint64_t address) "0x%016"PRIx64
+amdvi_fetch_pte_root(uint8_t level, uint64_t pte) "level=%d pte=%016"PRIx64
+amdvi_fetch_pte_walk(uint8_t level, uint64_t pte, uint8_t nextlevel, uint64_t page_size) "level=%d pte=%016"PRIx64" NextLevel=%d page_size=0x%"PRIx64
+amdvi_fetch_pte_found(uint8_t level, uint64_t pte, uint8_t nextlevel, uint64_t page_size) "level=%d pte=%016"PRIx64" NextLevel=%d page_size=0x%"PRIx64
# vmport.c
vmport_register(unsigned char command, void *func, void *opaque) "command: 0x%02x func: %p opaque: %p"
--
2.52.0