Skip to contentSkip to conversation

iommu/arm-smmu-v3: Use str_read_write helper w/ logs

PATCH Applied Pranjal Shrivastava 5 participants 9 messages Jan 7, 2025 – Jan 14, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/arm-smmu-v3: Use str_read_write helper w/ logs

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -1
index 34b424c87be0..0e4cbb2c64d7 100644
@@ -1907,7 +1907,7 @@ static void arm_smmu_dump_event(struct arm_smmu_device *smmu, u64 *raw,
 		dev_err(smmu->dev, "%s %s %s %s \"%s\"%s%s stag: %#x",
 			evt->privileged ? "priv" : "unpriv",
 			evt->instruction ? "inst" : "data",
-			evt->read ? "read" : "write",
+			str_read_write(evt->read),
 			evt->s2 ? "s2" : "s1", event_class_str[evt->class],
 			evt->class_tt ? (evt->ttrnw ? " ttd_read" : " ttd_write") : "",
 			evt->stall ? " stall" : "", evt->stag);
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
maintainer Applied
#2 lore raw
In reply to Pranjal Shrivastava
Quoted 5 lines · Pranjal Shrivastava

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

Applied to iommu (arm/smmu/updates), thanks!

[1/1] iommu/arm-smmu-v3: Use str_read_write helper w/ logs

      https://git.kernel.org/iommu/c/f2c77f6e41e6

Cheers,

Signature · 5 lines
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
#3 lore raw
In reply to Pranjal Shrivastava
Quoted 5 lines · Pranjal Shrivastava

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

This change landed in today's linux-next as commit f2c77f6e41e6 ("iommu/arm-smmu-v3: Use str_read_write helper w/ logs"). It fails to build here with arm64/defconfig on my setup. It looks that it misses to add the following include:

(quoted diff) +0 -0

b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c
index 0e4cbb2c64d7..a0e395da8a88 100644

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -0
@@ -26,6 +26,7 @@
  #include <linux/pci.h>
  #include <linux/pci-ats.h>
  #include <linux/platform_device.h>
+#include <linux/string_choices.h>
  #include <kunit/visibility.h>
  #include <uapi/linux/iommufd.h>
 
Quoted 9 lines
---
  drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +0 -0
index 34b424c87be0..0e4cbb2c64d7 100644

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c static void arm_smmu_dump_event(struct arm_smmu_device *smmu, u64 *raw, · line 1913

Quoted 8 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -1
@@ -1907,7 +1907,7 @@ static void arm_smmu_dump_event(struct arm_smmu_device *smmu, u64 *raw,
  		dev_err(smmu->dev, "%s %s %s %s \"%s\"%s%s stag: %#x",
  			evt->privileged ? "priv" : "unpriv",
  			evt->instruction ? "inst" : "data",
-			evt->read ? "read" : "write",
+			str_read_write(evt->read),
  			evt->s2 ? "s2" : "s1", event_class_str[evt->class],
  			evt->class_tt ? (evt->ttrnw ? " ttd_read" : " ttd_write") : "",
  			evt->stall ? " stall" : "", evt->stag);

Best regards

Signature · 2 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland
maintainer
#4 lore raw
Quoted 18 lines · Marek Szyprowski
Quoted 5 lines · Pranjal Shrivastava

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

This change landed in today's linux-next as commit f2c77f6e41e6 ("iommu/arm-smmu-v3: Use str_read_write helper w/ logs"). It fails to build here with arm64/defconfig on my setup. It looks that it misses to add the following include:

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +0 -0
index 0e4cbb2c64d7..a0e395da8a88 100644

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c line 31

Quoted 6 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -0
@@ -26,6 +26,7 @@
  #include <linux/pci.h>
  #include <linux/pci-ats.h>
  #include <linux/platform_device.h>
+#include <linux/string_choices.h>
  #include <kunit/visibility.h>
  #include <uapi/linux/iommufd.h>

Hmm, I build and test my branches before I push them so this is a bit surprising. I just confirmed that it's building with arm64/defconfig for me, so lemme dig into this some more...

Will

maintainer
#5 lore raw
Quoted 13 lines · Will Deacon
Quoted 12 lines · Marek Szyprowski
Quoted 5 lines · Pranjal Shrivastava

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

This change landed in today's linux-next as commit f2c77f6e41e6 ("iommu/arm-smmu-v3: Use str_read_write helper w/ logs"). It fails to build here with arm64/defconfig on my setup. It looks that it misses to add the following include:

Quoted 16 lines

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c line 31

Quoted 12 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -0
index 0e4cbb2c64d7..a0e395da8a88 100644
@@ -26,6 +26,7 @@
  #include <linux/pci.h>
  #include <linux/pci-ats.h>
  #include <linux/platform_device.h>
+#include <linux/string_choices.h>
  #include <kunit/visibility.h>
  #include <uapi/linux/iommufd.h>

Hmm, I build and test my branches before I push them so this is a bit surprising. I just confirmed that it's building with arm64/defconfig for me, so lemme dig into this some more...

Aha, there seems to be a transitive include of string_choices.h via linux/acpi.h. So while I still think the arm64 defconfig should build, if I go in and disable CONFIG_ACPI then I see the failure.

So for my test builds:
allnoconfig: Builds as there isn't an SMMU driver
defconfig: Builds because CONFIG_ACPI=y
allmodconfig: Same as above

I'll add the missing #include.

Will

maintainer
#6 lore raw
Quoted 35 lines · Will Deacon
Quoted 13 lines · Will Deacon
Quoted 12 lines · Marek Szyprowski
Quoted 5 lines · Pranjal Shrivastava

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

This change landed in today's linux-next as commit f2c77f6e41e6 ("iommu/arm-smmu-v3: Use str_read_write helper w/ logs"). It fails to build here with arm64/defconfig on my setup. It looks that it misses to add the following include:

Quoted 16 lines

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c line 31

Quoted 12 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -0
index 0e4cbb2c64d7..a0e395da8a88 100644
@@ -26,6 +26,7 @@
  #include <linux/pci.h>
  #include <linux/pci-ats.h>
  #include <linux/platform_device.h>
+#include <linux/string_choices.h>
  #include <kunit/visibility.h>
  #include <uapi/linux/iommufd.h>

Hmm, I build and test my branches before I push them so this is a bit surprising. I just confirmed that it's building with arm64/defconfig for me, so lemme dig into this some more...

Aha, there seems to be a transitive include of string_choices.h via linux/acpi.h. So while I still think the arm64 defconfig should build, if I go in and disable CONFIG_ACPI then I see the failure.

Quoted 6 lines

So for my test builds:
allnoconfig: Builds as there isn't an SMMU driver
defconfig: Builds because CONFIG_ACPI=y
allmodconfig: Same as above

I'll add the missing #include.

I pushed the fix to arm/smmu/updates [1] which should appear in -next when Joerg next rebuilds the branch.

Cheers,

Will

[1] https://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git/commit/?h=arm/smmu/updates

#7 lore raw
Quoted 34 lines
Quoted 34 lines
Quoted 13 lines · Marek Szyprowski
Quoted 12 lines · Pranjal Shrivastava
Quoted 5 lines

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

This change landed in today's linux-next as commit f2c77f6e41e6 ("iommu/arm-smmu-v3: Use str_read_write helper w/ logs"). It fails to build here with arm64/defconfig on my setup. It looks that it misses to add the following include:

Quoted 16 lines

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c line 31

Quoted 12 lines
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -0
index 0e4cbb2c64d7..a0e395da8a88 100644
@@ -26,6 +26,7 @@
  #include <linux/pci.h>
  #include <linux/pci-ats.h>
  #include <linux/platform_device.h>
+#include <linux/string_choices.h>
  #include <kunit/visibility.h>
  #include <uapi/linux/iommufd.h>

Hmm, I build and test my branches before I push them so this is a bit surprising. I just confirmed that it's building with arm64/defconfig for me, so lemme dig into this some more...

Aha, there seems to be a transitive include of string_choices.h via linux/acpi.h. So while I still think the arm64 defconfig should build, if I go in and disable CONFIG_ACPI then I see the failure.

Quoted 5 lines
Quoted 5 lines

So for my test builds:
allnoconfig: Builds as there isn't an SMMU driver
defconfig: Builds because CONFIG_ACPI=y
allmodconfig: Same as above

Ahh, apologies for not building with CONFIG_ACPI=n, I'll be more careful next time!

Quoted 4 lines
Quoted 1 line

I'll add the missing #include.

I pushed the fix to arm/smmu/updates [1] which should appear in -next when Joerg next rebuilds the branch.

Thanks for fixing this!
Regards,
Praan

#8 lore raw
In reply to Pranjal Shrivastava
Quoted 5 lines · Pranjal Shrivastava

Adopt the str_read_write helper in event logging as highlighted [1].

[1] https://lore.kernel.org/all/20250107130053.GC6991@willie-the-truck/

This may result in build errors such as:

Error log:
In file included from include/linux/device.h:15,

                 from include/linux/acpi.h:14,
                 from drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:12:

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c: In function 'arm_smmu_dump_event':
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c:1910:25: error: implicit declaration of function 'str_read_write'; did you mean 'sb_end_write'?

since the necessary include file is not included directly.

Guenter

Quoted 20 lines
---
 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +1 -1
index 34b424c87be0..0e4cbb2c64d7 100644
@@ -1907,7 +1907,7 @@ static void arm_smmu_dump_event(struct arm_smmu_device *smmu, u64 *raw,
 		dev_err(smmu->dev, "%s %s %s %s \"%s\"%s%s stag: %#x",
 			evt->privileged ? "priv" : "unpriv",
 			evt->instruction ? "inst" : "data",
-			evt->read ? "read" : "write",
+			str_read_write(evt->read),
 			evt->s2 ? "s2" : "s1", event_class_str[evt->class],
 			evt->class_tt ? (evt->ttrnw ? " ttd_read" : " ttd_write") : "",
 			evt->stall ? " stall" : "", evt->stag);
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog