Skip to content

Commit ec21f17

Browse files
ssuthiku-amdjoergroedel
authored andcommitted
iommu/amd: Fix incorrect PASID decoding from event log
IOMMU Event Log encodes 20-bit PASID for events: ILLEGAL_DEV_TABLE_ENTRY IO_PAGE_FAULT PAGE_TAB_HARDWARE_ERROR INVALID_DEVICE_REQUEST as: PASID[15:0] = bit 47:32 PASID[19:16] = bit 19:16 Note that INVALID_PPR_REQUEST event has different encoding from the rest of the events as the following: PASID[15:0] = bit 31:16 PASID[19:16] = bit 45:42 So, fixes the decoding logic. Fixes: d64c048 ("iommu/amd: Update the PASID information printed to the system log") Cc: Joerg Roedel <[email protected]> Cc: Gary R Hook <[email protected]> Signed-off-by: Suravee Suthikulpanit <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent ec37d4e commit ec21f17

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
583583
retry:
584584
type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK;
585585
devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
586-
pasid = PPR_PASID(*(u64 *)&event[0]);
586+
pasid = (event[0] & EVENT_DOMID_MASK_HI) |
587+
(event[1] & EVENT_DOMID_MASK_LO);
587588
flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
588589
address = (u64)(((u64)event[3]) << 32) | event[2];
589590

@@ -616,7 +617,7 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt)
616617
address, flags);
617618
break;
618619
case EVENT_TYPE_PAGE_TAB_ERR:
619-
dev_err(dev, "Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n",
620+
dev_err(dev, "Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x pasid=0x%04x address=0x%llx flags=0x%04x]\n",
620621
PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
621622
pasid, address, flags);
622623
break;

drivers/iommu/amd_iommu_types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@
130130
#define EVENT_TYPE_INV_PPR_REQ 0x9
131131
#define EVENT_DEVID_MASK 0xffff
132132
#define EVENT_DEVID_SHIFT 0
133-
#define EVENT_DOMID_MASK 0xffff
134-
#define EVENT_DOMID_SHIFT 0
133+
#define EVENT_DOMID_MASK_LO 0xffff
134+
#define EVENT_DOMID_MASK_HI 0xf0000
135135
#define EVENT_FLAGS_MASK 0xfff
136136
#define EVENT_FLAGS_SHIFT 0x10
137137

0 commit comments

Comments
 (0)