Re: [PATCH 1/3] iommu/arm-smmu-v3: Print PCI vendor:device ID in SMMU translation fault logs

From: Pranjal Shrivastava

Date: Thu May 07 2026 - 13:03:31 EST


On Wed, May 06, 2026 at 03:05:37PM +0000, Yigit Oguz wrote:
> From: Lilit Janpoladyan <lilitj@xxxxxxxxxx>
>
> For translation, address-size, access, and permission faults, look up
> the pci_dev from the event and append the PCI vendor:device ID after
> the device name, e.g.:
>
> event: F_TRANSLATION client: 0001:02:02.4 [1d0f:8061] sid: ...
>
> For non-PCI devices or unassigned SIDs the output is unchanged.
>
> Signed-off-by: Lilit Janpoladyan <lilitj@xxxxxxxxxx>
> Signed-off-by: Yigit Oguz <yigitogu@xxxxxxxxx>
> ---
> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 29 ++++++++++++++++++---
> 1 file changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> index e8d7dbe495f0..ab1afa36965a 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
> @@ -2213,12 +2213,30 @@ static void arm_smmu_dump_raw_event(struct arm_smmu_device *smmu, u64 *raw,
>
> #define ARM_SMMU_EVT_KNOWN(e) ((e)->id < ARRAY_SIZE(event_str) && event_str[(e)->id])
> #define ARM_SMMU_LOG_EVT_STR(e) ARM_SMMU_EVT_KNOWN(e) ? event_str[(e)->id] : "UNKNOWN"
> -#define ARM_SMMU_LOG_CLIENT(e) (e)->dev ? dev_name((e)->dev) : "(unassigned sid)"
> +
> +/* "SSSS:BB:DD.F [VVVV:DDDD]\0" — 12 + 1 + 11 + 1 = 25; round to power of 2 */
> +#define ARM_SMMU_CLIENT_LEN 32
> +

Nit: s/ARM_SMMU_CLIENT_LEN/ARM_SMMU_LOG_CLIENT_LEN to maintain the
convention?

> +static const char *arm_smmu_fmt_client(struct arm_smmu_event *e, char *buf, size_t sz)
> +{
> + struct pci_dev *p;

Minor nit: maybe we could intialized it here?

struct pci_dev *p = to_pci_dev(e->dev);

Not a strong opinion though.

> +
> + if (!e->dev)
> + return "(unassigned sid)";
> + if (!dev_is_pci(e->dev))
> + return dev_name(e->dev);
> +
> + p = to_pci_dev(e->dev);
> + snprintf(buf, sz, "%s [%04x:%04x]", dev_name(e->dev), p->vendor, p->device);
> + return buf;
> +}
>
> static void arm_smmu_dump_event(struct arm_smmu_device *smmu, u64 *raw,
> struct arm_smmu_event *evt,
> struct ratelimit_state *rs)
> {
> + char clientbuf[ARM_SMMU_CLIENT_LEN];

Nit: s/clientbuf/client_str ?

I was able to test this with 7.1-rc1 & it looks good:

[ 106.880820] arm-smmu-v3 9050000.smmuv3: event: F_TRANSLATION client: 0000:00:01.0 [8086:10c9] sid: 0x8 ssid: 0x0 iova: 0xffffc000 ipa: 0x0
[ 106.880855] arm-smmu-v3 9050000.smmuv3: unpriv data read s1 "Input address caused fault" stag: 0x0
[ 106.880894] arm-smmu-v3 9050000.smmuv3: event 0x10 received:
[ 106.880922] arm-smmu-v3 9050000.smmuv3: 0x0000000800000010
[ 106.880948] arm-smmu-v3 9050000.smmuv3: 0x0000020800000000
[ 106.880974] arm-smmu-v3 9050000.smmuv3: 0x00000000ffffc004
[ 106.881001] arm-smmu-v3 9050000.smmuv3: 0x0000000000000000
[ 106.881030] arm-smmu-v3 9050000.smmuv3: event: F_TRANSLATION client: 0000:00:01.0 [8086:10c9] sid: 0x8 ssid: 0x0 iova: 0xffffc004 ipa: 0x0
[ 106.881061] arm-smmu-v3 9050000.smmuv3: unpriv data read s1 "Input address caused fault" stag: 0x0
[ 106.881104] arm-smmu-v3 9050000.smmuv3: event 0x10 received:
[ 106.881136] arm-smmu-v3 9050000.smmuv3: 0x0000000800000010
[ 106.881163] arm-smmu-v3 9050000.smmuv3: 0x0000020800000000
[ 106.881189] arm-smmu-v3 9050000.smmuv3: 0x00000000ffffc008
[ 106.881215] arm-smmu-v3 9050000.smmuv3: 0x0000000000000000

Apart from the nits above:

Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>
Tested-by: Pranjal Shrivastava <praan@xxxxxxxxxx>

Thanks,
Praan