Re: [PATCH v4 2/8] iommu/amd: Add debugfs support to dump IOMMU MMIO registers

From: Dheeraj Kumar Srivastava
Date: Tue Apr 08 2025 - 01:42:25 EST


Hi Vasant,

On 3/19/2025 10:20 PM, Vasant Hegde wrote:
Dheeraj,


On 3/17/2025 5:28 PM, Dheeraj Kumar Srivastava wrote:
Analyzing IOMMU MMIO registers gives a view of what IOMMU is
configured with on the system and is helpful to debug issues
with IOMMU.

eg.
-> To get mmio registers value at offset 0x18 for iommu<x> (say, iommu00)
# echo "0x18" > /sys/kernel/debug/iommu/amd/iommu00/mmio
# cat /sys/kernel/debug/iommu/amd/iommu00/mmio

Signed-off-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@xxxxxxx>
---
drivers/iommu/amd/debugfs.c | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

diff --git a/drivers/iommu/amd/debugfs.c b/drivers/iommu/amd/debugfs.c
index ff9520e002be..c61d52420c5f 100644
--- a/drivers/iommu/amd/debugfs.c
+++ b/drivers/iommu/amd/debugfs.c
@@ -15,6 +15,50 @@
static struct dentry *amd_iommu_debugfs;
#define MAX_NAME_LEN 20
+#define OFS_IN_SZ 8
+
+static int mmio_offset = -1;


Somehow I missed to catch this earlier. Here you have global variable but mmio
is defined per IOMMU. Shouldn't we track it per IOMMU ?

Yes correct we need to maintain per iommu global variables for mmio and capability registers offset. I have sent v5 addressing this. Please find some time to review it.

Thanks
Dheeraj


-Vasant