Skip to content

Commit

Permalink
iommu/amd: Log IOMMU control register in event log path
Browse files Browse the repository at this point in the history
Useful for debugging ILLEGAL_DEV_TABLE_ENTRY events as some of the
DTE settings depends on Control register settings.

Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20250227162320.5805-2-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Vasant Hegde authored and Joerg Roedel committed Mar 10, 2025
1 parent 0ad2507 commit 558d2bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iommu/amd/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
int type, devid, flags, tag;
volatile u32 *event = __evt;
int count = 0;
u64 address;
u64 address, ctrl;
u32 pasid;

retry:
Expand All @@ -878,6 +878,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
(event[1] & EVENT_DOMID_MASK_LO);
flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
address = (u64)(((u64)event[3]) << 32) | event[2];
ctrl = readq(iommu->mmio_base + MMIO_CONTROL_OFFSET);

if (type == 0) {
/* Did we hit the erratum? */
Expand All @@ -899,6 +900,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
dev_err(dev, "Event logged [ILLEGAL_DEV_TABLE_ENTRY device=%04x:%02x:%02x.%x pasid=0x%05x address=0x%llx flags=0x%04x]\n",
iommu->pci_seg->id, PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
pasid, address, flags);
dev_err(dev, "Control Reg : 0x%llx\n", ctrl);
dump_dte_entry(iommu, devid);
break;
case EVENT_TYPE_DEV_TAB_ERR:
Expand Down

0 comments on commit 558d2bb

Please sign in to comment.