Skip to contentSkip to conversation

<linux/mod_devicetable.h> deprecation continues

PATCH In review Uwe Kleine-König (The Capable Hub) 4 participants 13 messages Oct 16 – Nov 13

Subsystems (7)
KVM Kbuild MIPS s390 +3 more subsystems
lore
Share & tools
lore
#0 lore raw

v2 cover <linux/mod_devicetable.h> deprecation continues

Hello,

v1 of this series is available from
https://lore.kernel.org/lkml/[email protected]/

Changes since then are:

- rebase to v7.3-rc7
- Add a header guard and a comment about why it's necessary
- Add Acked-by: for Armin Wolf

Nathan identified two merge conflicts for v1 with commits in next. These still happen and are easy to resolve as soon as the respective branches are merged into a common tree.

Nathan already proposed to take this series via the Kbuild tree after letting it cook in next after the upcomming merge window closes.

Uwe Kleine-König (The Capable Hub) (3):
Move struct cpu_feature to <linux/cpufeature.h>
devicetable-offsets: Include the needed device-id headers instead of
the catch-all
file2alias: Include the needed device-id headers instead of the
catch-all

Best regards
Uwe

 arch/loongarch/kvm/main.c         |  2 +-
 include/linux/cpufeature.h        | 19 ++++++++++-
 include/linux/mod_devicetable.h   | 13 -------
 scripts/mod/devicetable-offsets.c | 57 ++++++++++++++++++++++++++++++-
 scripts/mod/file2alias.c          | 56 +++++++++++++++++++++++++++++-
 5 files changed, 130 insertions(+), 17 deletions(-)

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907

Signature · 1 line
2.56.0.rc1
#1 lore raw

PATCH v2 1/3 Move struct cpu_feature to <linux/cpufeature.h>

struct cpu_feature used to be defined in <linux/mod_devicetable.h>. It's much better located in <linux/cpufeature.h>. The only downside is that modpost and devicetable-offsets.h need the definition and thus <linux/cpufeature.h> must be included explicitly there.

---
 arch/loongarch/kvm/main.c         |  2 +-
 include/linux/cpufeature.h        | 19 ++++++++++++++++++-
 include/linux/mod_devicetable.h   | 13 -------------
 scripts/mod/devicetable-offsets.c |  1 +
 scripts/mod/file2alias.c          |  1 +
 5 files changed, 21 insertions(+), 15 deletions(-)
arch/loongarch/kvm/main.c +1 -1
index 236523d2449d..d082dae61971 100644
@@ -5,7 +5,7 @@
 
 #include <linux/err.h>
 #include <linux/module.h>
-#include <linux/mod_devicetable.h>
+#include <linux/cpufeature.h>
 #include <linux/kvm_host.h>
 #include <asm/cacheflush.h>
 #include <asm/cpufeature.h>
include/linux/cpufeature.h +18 -1
index 6aff540ee9e5..7b22a536542d 100644
@@ -6,10 +6,27 @@
 #ifndef __LINUX_CPUFEATURE_H
 #define __LINUX_CPUFEATURE_H
 
+/*
+ * This file is included by scripts/mod/file2alias.c which is compiled
+ * using the host compiler which might not have <linux/types.h> but the
+ * __u{8,16,32} types are defined there locally.
+ */
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+/*
+ * Generic table type for matching CPU features.
+ * @feature:	the bit number of the feature (0 - 65535)
+ */
+
+struct cpu_feature {
+	__u16	feature;
+};
+
 #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
 
 #include <linux/init.h>
-#include <linux/mod_devicetable.h>
 #include <asm/cpufeature.h>
 
 /*
include/linux/mod_devicetable.h +0 -13
index a397213bedac..9ce2429b455f 100644
@@ -8,10 +8,6 @@
 #ifndef LINUX_MOD_DEVICETABLE_H
 #define LINUX_MOD_DEVICETABLE_H
 
-#ifdef __KERNEL__
-#include <linux/types.h>
-#endif
-
 #include "device-id/acpi.h"
 #include "device-id/amba.h"
 #include "device-id/ap.h"
@@ -69,13 +65,4 @@
 #include "device-id/x86_cpu.h"
 #include "device-id/zorro.h"
 
-/*
- * Generic table type for matching CPU features.
- * @feature:	the bit number of the feature (0 - 65535)
- */
-
-struct cpu_feature {
-	__u16	feature;
-};
-
 #endif /* LINUX_MOD_DEVICETABLE_H */
scripts/mod/devicetable-offsets.c +1 -0
index b4178c42d08f..b57dbbef8777 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #define COMPILE_OFFSETS
+#include <linux/cpufeature.h>
 #include <linux/kbuild.h>
 #include <linux/mod_devicetable.h>
 
scripts/mod/file2alias.c +1 -0
index 8d36c74dec2d..88bff3207277 100644
@@ -121,6 +121,7 @@ typedef struct {
 /* Big exception to the "don't include kernel headers into userspace, which
  * even potentially has different endianness and word sizes, since
  * we handle those differences explicitly below */
+#include "../../include/linux/cpufeature.h"
 #include "../../include/linux/mod_devicetable.h"
 
 struct devtable {
Signature · 1 line
2.56.0.rc1
#2 lore raw

PATCH v2 2/3 devicetable-offsets: Include the needed device-id headers instead of the catch-all

In reply to Uwe Kleine-König (The Capable Hub)

<linux/mod_devicetable.h> is planned to go away. Include just the needed bits in scripts/mod/devicetable-offsets.c which reduces dependencies as <linux/mod_devicetable.h> includes several headers not needed here.

---
 scripts/mod/devicetable-offsets.c | 56 ++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)
scripts/mod/devicetable-offsets.c +55 -1
index b57dbbef8777..1f4bbd014a3d 100644
@@ -2,7 +2,61 @@
 #define COMPILE_OFFSETS
 #include <linux/cpufeature.h>
 #include <linux/kbuild.h>
-#include <linux/mod_devicetable.h>
+
+#include <linux/device-id/acpi.h>
+#include <linux/device-id/amba.h>
+#include <linux/device-id/ap.h>
+#include <linux/device-id/auxiliary.h>
+#include <linux/device-id/bcma.h>
+#include <linux/device-id/ccw.h>
+#include <linux/device-id/cdx.h>
+#include <linux/device-id/coreboot.h>
+#include <linux/device-id/css.h>
+#include <linux/device-id/dfl.h>
+#include <linux/device-id/dmi.h>
+#include <linux/device-id/eisa.h>
+#include <linux/device-id/fsl_mc.h>
+#include <linux/device-id/hda.h>
+#include <linux/device-id/hid.h>
+#include <linux/device-id/hv_vmbus.h>
+#include <linux/device-id/i2c.h>
+#include <linux/device-id/i3c.h>
+#include <linux/device-id/ieee1394.h>
+#include <linux/device-id/input.h>
+#include <linux/device-id/ipack.h>
+#include <linux/device-id/isapnp.h>
+#include <linux/device-id/ishtp.h>
+#include <linux/device-id/mcb.h>
+#include <linux/device-id/mdio.h>
+#include <linux/device-id/mei_cl.h>
+#include <linux/device-id/mhi.h>
+#include <linux/device-id/mips_cdmm.h>
+#include <linux/device-id/of.h>
+#include <linux/device-id/parisc.h>
+#include <linux/device-id/pci.h>
+#include <linux/device-id/pcmcia.h>
+#include <linux/device-id/platform.h>
+#include <linux/device-id/pnp.h>
+#include <linux/device-id/rio.h>
+#include <linux/device-id/rpmsg.h>
+#include <linux/device-id/sdio.h>
+#include <linux/device-id/sdw.h>
+#include <linux/device-id/serio.h>
+#include <linux/device-id/slim.h>
+#include <linux/device-id/spi.h>
+#include <linux/device-id/ssam.h>
+#include <linux/device-id/ssb.h>
+#include <linux/device-id/tb.h>
+#include <linux/device-id/tee_client.h>
+#include <linux/device-id/typec.h>
+#include <linux/device-id/ulpi.h>
+#include <linux/device-id/usb.h>
+#include <linux/device-id/vchiq.h>
+#include <linux/device-id/vio.h>
+#include <linux/device-id/virtio.h>
+#include <linux/device-id/wmi.h>
+#include <linux/device-id/x86_cpu.h>
+#include <linux/device-id/zorro.h>
 
 #define DEVID(devid) DEFINE(SIZE_##devid, sizeof(struct devid))
 #define DEVID_FIELD(devid, field) \
Signature · 1 line
2.56.0.rc1
#3 lore raw

PATCH v2 3/3 file2alias: Include the needed device-id headers instead of the catch-all

In reply to Uwe Kleine-König (The Capable Hub)

<linux/mod_devicetable.h> is planned to go away. Include just the needed bits in scripts/mod/file2alias.c which reduces dependencies as <linux/mod_devicetable.h> includes several headers not needed here.

---
 scripts/mod/file2alias.c | 55 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 54 insertions(+), 1 deletion(-)
scripts/mod/file2alias.c +54 -1
index 88bff3207277..7d76233a8d5d 100644
@@ -122,7 +122,60 @@ typedef struct {
  * even potentially has different endianness and word sizes, since
  * we handle those differences explicitly below */
 #include "../../include/linux/cpufeature.h"
-#include "../../include/linux/mod_devicetable.h"
+#include "../../include/linux/device-id/acpi.h"
+#include "../../include/linux/device-id/amba.h"
+#include "../../include/linux/device-id/ap.h"
+#include "../../include/linux/device-id/auxiliary.h"
+#include "../../include/linux/device-id/bcma.h"
+#include "../../include/linux/device-id/ccw.h"
+#include "../../include/linux/device-id/cdx.h"
+#include "../../include/linux/device-id/coreboot.h"
+#include "../../include/linux/device-id/css.h"
+#include "../../include/linux/device-id/dfl.h"
+#include "../../include/linux/device-id/dmi.h"
+#include "../../include/linux/device-id/eisa.h"
+#include "../../include/linux/device-id/fsl_mc.h"
+#include "../../include/linux/device-id/hda.h"
+#include "../../include/linux/device-id/hid.h"
+#include "../../include/linux/device-id/hv_vmbus.h"
+#include "../../include/linux/device-id/i2c.h"
+#include "../../include/linux/device-id/i3c.h"
+#include "../../include/linux/device-id/ieee1394.h"
+#include "../../include/linux/device-id/input.h"
+#include "../../include/linux/device-id/ipack.h"
+#include "../../include/linux/device-id/isapnp.h"
+#include "../../include/linux/device-id/ishtp.h"
+#include "../../include/linux/device-id/mcb.h"
+#include "../../include/linux/device-id/mdio.h"
+#include "../../include/linux/device-id/mei_cl.h"
+#include "../../include/linux/device-id/mhi.h"
+#include "../../include/linux/device-id/mips_cdmm.h"
+#include "../../include/linux/device-id/of.h"
+#include "../../include/linux/device-id/parisc.h"
+#include "../../include/linux/device-id/pci.h"
+#include "../../include/linux/device-id/pcmcia.h"
+#include "../../include/linux/device-id/platform.h"
+#include "../../include/linux/device-id/pnp.h"
+#include "../../include/linux/device-id/rio.h"
+#include "../../include/linux/device-id/rpmsg.h"
+#include "../../include/linux/device-id/sdio.h"
+#include "../../include/linux/device-id/sdw.h"
+#include "../../include/linux/device-id/serio.h"
+#include "../../include/linux/device-id/slim.h"
+#include "../../include/linux/device-id/spi.h"
+#include "../../include/linux/device-id/ssam.h"
+#include "../../include/linux/device-id/ssb.h"
+#include "../../include/linux/device-id/tb.h"
+#include "../../include/linux/device-id/tee_client.h"
+#include "../../include/linux/device-id/typec.h"
+#include "../../include/linux/device-id/ulpi.h"
+#include "../../include/linux/device-id/usb.h"
+#include "../../include/linux/device-id/vchiq.h"
+#include "../../include/linux/device-id/vio.h"
+#include "../../include/linux/device-id/virtio.h"
+#include "../../include/linux/device-id/wmi.h"
+#include "../../include/linux/device-id/x86_cpu.h"
+#include "../../include/linux/device-id/zorro.h"
 
 struct devtable {
 	const char *device_id;
Signature · 1 line
2.56.0.rc1
maintainer
#4 lore raw
In reply to Uwe Kleine-König (The Capable Hub)
Quoted 11 lines

Hello,

v1 of this series is available from
https://lore.kernel.org/lkml/[email protected]/

Changes since then are:

- rebase to v7.3-rc7
- Add a header guard and a comment about why it's necessary
- Add Acked-by: for Armin Wolf

Quoted 6 lines

Nathan identified two merge conflicts for v1 with commits in next. These still happen and are easy to resolve as soon as the respective branches are merged into a common tree.

Nathan already proposed to take this series via the Kbuild tree after letting it cook in next after the upcomming merge window closes.

Ok, then let's go; I am going to put this on kbuild-next-unstable and kbuild-for-next.

Thanks.

Signature · 1 line
Nicolas
#5 lore raw

PATCH 1/2 s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id

pkey_cca.c and pkey_ep11.c got struct ap_device_id from <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>") dropped that include, so s390 defconfig no longer builds:

drivers/s390/crypto/pkey_cca.c:22:28: error: array type has incomplete element type 'struct ap_device_id' drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has incomplete element type 'struct ap_device_id'

Include the header that defines it, as the other AP drivers do.

Fixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")
---
 drivers/s390/crypto/pkey_cca.c  | 1 +
 drivers/s390/crypto/pkey_ep11.c | 1 +
 2 files changed, 2 insertions(+)
drivers/s390/crypto/pkey_cca.c +1 -0
index e8dc2f77c137b..f95d61fd5b090 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "pkey_base.h"
drivers/s390/crypto/pkey_ep11.c +1 -0
index f99c19323f3d7..f66fc97ad5adc 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "zcrypt_ep11misc.h"
Signature · 1 line
2.53.0
#6 lore raw

PATCH 2/2 devicetable-offsets: Get struct cpu_feature from a device-id header

Since commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>"), devicetable-offsets.c includes <linux/cpufeature.h>, which includes <asm/cpufeature.h> on architectures that select GENERIC_CPU_AUTOPROBE. On loongarch and mips that header pulls in <asm/elf.h>, and from there <linux/fs.h> and <linux/mmzone.h>, which need <generated/bounds.h>. devicetable-offsets.c is built before that header is generated, so even defconfig fails on both:

include/linux/page-flags-layout.h:6:10: fatal error: generated/bounds.h: No such file or directory

Move struct cpu_feature to <linux/device-id/cpu_feature.h>, next to the other device id types, and include that from <linux/cpufeature.h>, devicetable-offsets.c and file2alias.c.

---
 include/linux/cpufeature.h            | 18 +-----------------
 include/linux/device-id/cpu_feature.h | 18 ++++++++++++++++++
 scripts/mod/devicetable-offsets.c     |  2 +-
 scripts/mod/file2alias.c              |  2 +-
 4 files changed, 21 insertions(+), 19 deletions(-)
 create mode 100644 include/linux/device-id/cpu_feature.h
include/linux/cpufeature.h +1 -17
index 7b22a536542d5..cd470987777f3 100644
@@ -6,23 +6,7 @@
 #ifndef __LINUX_CPUFEATURE_H
 #define __LINUX_CPUFEATURE_H
 
-/*
- * This file is included by scripts/mod/file2alias.c which is compiled
- * using the host compiler which might not have <linux/types.h> but the
- * __u{8,16,32} types are defined there locally.
- */
-#ifdef __KERNEL__
-#include <linux/types.h>
-#endif
-
-/*
- * Generic table type for matching CPU features.
- * @feature:	the bit number of the feature (0 - 65535)
- */
-
-struct cpu_feature {
-	__u16	feature;
-};
+#include <linux/device-id/cpu_feature.h>
 
 #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
 
include/linux/device-id/cpu_feature.h new file +18 -0
new file mode 100644
index 0000000000000..937fbe00dcd55
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef LINUX_DEVICE_ID_CPU_FEATURE_H
+#define LINUX_DEVICE_ID_CPU_FEATURE_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+/*
+ * Generic table type for matching CPU features.
+ * @feature:	the bit number of the feature (0 - 65535)
+ */
+
+struct cpu_feature {
+	__u16	feature;
+};
+
+#endif /* ifndef LINUX_DEVICE_ID_CPU_FEATURE_H */
scripts/mod/devicetable-offsets.c +1 -1
index 875eafeb743de..2b5217edf6389 100644
@@ -1,6 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
 #define COMPILE_OFFSETS
-#include <linux/cpufeature.h>
 #include <linux/kbuild.h>
 
 #include <linux/device-id/acpi.h>
@@ -12,6 +11,7 @@
 #include <linux/device-id/ccw.h>
 #include <linux/device-id/cdx.h>
 #include <linux/device-id/coreboot.h>
+#include <linux/device-id/cpu_feature.h>
 #include <linux/device-id/css.h>
 #include <linux/device-id/dfl.h>
 #include <linux/device-id/dmi.h>
scripts/mod/file2alias.c +1 -1
index f848b39145d97..08b45e096c164 100644
@@ -121,7 +121,6 @@ typedef struct {
 /* Big exception to the "don't include kernel headers into userspace, which
  * even potentially has different endianness and word sizes, since
  * we handle those differences explicitly below */
-#include "../../include/linux/cpufeature.h"
 #include "../../include/linux/device-id/acpi.h"
 #include "../../include/linux/device-id/amba.h"
 #include "../../include/linux/device-id/ap.h"
@@ -131,6 +130,7 @@ typedef struct {
 #include "../../include/linux/device-id/ccw.h"
 #include "../../include/linux/device-id/cdx.h"
 #include "../../include/linux/device-id/coreboot.h"
+#include "../../include/linux/device-id/cpu_feature.h"
 #include "../../include/linux/device-id/css.h"
 #include "../../include/linux/device-id/dfl.h"
 #include "../../include/linux/device-id/dmi.h"
Signature · 1 line
2.53.0
author Acked-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header

Quoted 8 lines · Sasha Levin

Since commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>"), devicetable-offsets.c includes <linux/cpufeature.h>, which includes <asm/cpufeature.h> on architectures that select GENERIC_CPU_AUTOPROBE. On loongarch and mips that header pulls in <asm/elf.h>, and from there <linux/fs.h> and <linux/mmzone.h>, which need <generated/bounds.h>. devicetable-offsets.c is built before that header is generated, so even defconfig fails on both:

Quoted 5 lines

include/linux/page-flags-layout.h:6:10: fatal error: generated/bounds.h: No such file or directory

Move struct cpu_feature to <linux/device-id/cpu_feature.h>, next to the other device id types, and include that from <linux/cpufeature.h>, devicetable-offsets.c and file2alias.c.

I didn't do that before because I didn't have the impression that struct cpu_feature is a device id type. Seems a bit like a misuse to me, but 🤷.

Best regards
Uwe

maintainer
#8 lore raw

Re: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header

In reply to Sasha Levin
Quoted 9 lines · Sasha Levin

Since commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>"), devicetable-offsets.c includes <linux/cpufeature.h>, which includes <asm/cpufeature.h> on architectures that select GENERIC_CPU_AUTOPROBE. On loongarch and mips that header pulls in <asm/elf.h>, and from there <linux/fs.h> and <linux/mmzone.h>, which need <generated/bounds.h>. devicetable-offsets.c is built before that header is generated, so even defconfig fails on both:

[...]

Applied to kbuild/linux.git (kbuild-next-unstable), thanks!

[2/2] devicetable-offsets: Get struct cpu_feature from a device-id header

      https://git.kernel.org/kbuild/c/50ccc340

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped, reverted or modified (e.g. trailers).

Patches applied to the kbuild-next-unstable branch are accepted pending wider testing in linux-next and any post-commit review; they will generally be moved to the kbuild-next branch in about a week if no issues are found.

Best regards,

Signature · 1 line
Nicolas
author Acked-by on v1 1/2
#9 lore raw

Re: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id

In reply to Sasha Levin
Quoted 24 lines · Sasha Levin

pkey_cca.c and pkey_ep11.c got struct ap_device_id from <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>") dropped that include, so s390 defconfig no longer builds:

drivers/s390/crypto/pkey_cca.c:22:28: error: array type has incomplete element type 'struct ap_device_id' drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has incomplete element type 'struct ap_device_id'

Include the header that defines it, as the other AP drivers do.

Fixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")
---
 drivers/s390/crypto/pkey_cca.c  | 1 +
 drivers/s390/crypto/pkey_ep11.c | 1 +
 2 files changed, 2 insertions(+)
drivers/s390/crypto/pkey_cca.c +0 -0
index e8dc2f77c137b..f95d61fd5b090 100644

drivers/s390/crypto/pkey_cca.c line 16

Quoted 7 lines
drivers/s390/crypto/pkey_cca.c +1 -0
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "pkey_base.h"

that makes me wonder why there is an ap MODULE_DEVICE_TABLE in drivers/s390/crypto/pkey_cca.c while that file doesn't seem to contain a driver for these device IDs.

drivers/s390/crypto/pkey_ep11.c line 16

Quoted 12 lines
drivers/s390/crypto/pkey_ep11.c +1 -0
index f99c19323f3d7..f66fc97ad5adc 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "zcrypt_ep11misc.h"

Same here.

But anyhow, as a regression fix the change looks fine.

Thanks
Uwe

#10 lore raw

Re: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id

Quoted 32 lines · Uwe Kleine-König
Quoted 31 lines · Sasha Levin

pkey_cca.c and pkey_ep11.c got struct ap_device_id from <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>") dropped that include, so s390 defconfig no longer builds:

drivers/s390/crypto/pkey_cca.c:22:28: error: array type has
incomplete element type 'struct ap_device_id'
drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has
incomplete element type 'struct ap_device_id'

Include the header that defines it, as the other AP drivers do.

Fixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")
---
 drivers/s390/crypto/pkey_cca.c  | 1 +
 drivers/s390/crypto/pkey_ep11.c | 1 +
 2 files changed, 2 insertions(+)
drivers/s390/crypto/pkey_cca.c +1 -0
index e8dc2f77c137b..f95d61fd5b090 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
Quoted 7 lines

drivers/s390/crypto/pkey_cca.c line 16

Quoted 2 lines
drivers/s390/crypto/pkey_cca.c +0 -0
 #include "zcrypt_ccamisc.h"
 #include "pkey_base.h"

that makes me wonder why there is an ap MODULE_DEVICE_TABLE in drivers/s390/crypto/pkey_cca.c while that file doesn't seem to contain a driver for these device IDs.

This makes the pkey_cca kernel module automatically loaded when an AP device (CEX4...CEX8) is detected by the kernel. Similar the pkey_ep11 kernel module has a MODULE_DEVICE_TABLE entry.

Quoted 21 lines

drivers/s390/crypto/pkey_ep11.c line 16

Quoted 12 lines
drivers/s390/crypto/pkey_ep11.c +1 -0
index f99c19323f3d7..f66fc97ad5adc 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "zcrypt_ep11misc.h"

Same here.

But anyhow, as a regression fix the change looks fine.

Thanks
Uwe

maintainer
#11 lore raw

Re: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id

In reply to Sasha Levin
Quoted 9 lines · Sasha Levin

pkey_cca.c and pkey_ep11.c got struct ap_device_id from <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>") dropped that include, so s390 defconfig no longer builds:

drivers/s390/crypto/pkey_cca.c:22:28: error: array type has incomplete element type 'struct ap_device_id' drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has incomplete element type 'struct ap_device_id'

[...]

Applied to kbuild/linux.git (kbuild-next-unstable), thanks!

[1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id

      https://git.kernel.org/kbuild/c/b48d1c04

Please look out for regression or issue reports or other follow up comments, as they may result in the patch/series getting dropped, reverted or modified (e.g. trailers).

Patches applied to the kbuild-next-unstable branch are accepted pending wider testing in linux-next and any post-commit review; they will generally be moved to the kbuild-next branch in about a week if no issues are found.

Best regards,

Signature · 1 line
Nicolas
maintainer Acked-by on v1 1/2
#12 lore raw

Re: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id

In reply to Sasha Levin
Quoted 39 lines · Sasha Levin

pkey_cca.c and pkey_ep11.c got struct ap_device_id from <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commit cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>") dropped that include, so s390 defconfig no longer builds:

drivers/s390/crypto/pkey_cca.c:22:28: error: array type has
incomplete element type 'struct ap_device_id'
drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has
incomplete element type 'struct ap_device_id'

Include the header that defines it, as the other AP drivers do.

Closes:
https://d.kernelci.org/i/maestro:7baaa311bc9c30a8ad43f42c24225ab2fead866a

Fixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")
---
 drivers/s390/crypto/pkey_cca.c  | 1 +
 drivers/s390/crypto/pkey_ep11.c | 1 +
 2 files changed, 2 insertions(+)
drivers/s390/crypto/pkey_cca.c +1 -0
index e8dc2f77c137b..f95d61fd5b090 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "pkey_base.h"
drivers/s390/crypto/pkey_ep11.c +0 -0
index f99c19323f3d7..f66fc97ad5adc 100644

drivers/s390/crypto/pkey_ep11.c line 16

Quoted 7 lines
drivers/s390/crypto/pkey_ep11.c +1 -0
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/cpufeature.h>
+#include <linux/device-id/ap.h>
 
 #include "zcrypt_ccamisc.h"
 #include "zcrypt_ep11misc.h"