<linux/mod_devicetable.h> deprecation continues
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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
@@ -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
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
@@ -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
Nicolas Schier
maintainerQuoted 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
Kbuildtree 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
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.
--- 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
@@ -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
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header
Quoted 8 lines · Sasha Levin
Since commit
cdfdbc11552b("Move structcpu_featureto <linux/cpufeature.h>"),devicetable-offsets.cincludes <linux/cpufeature.h>, which includes <asm/cpufeature.h> on architectures that selectGENERIC_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.cis 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 directoryMove struct
cpu_featureto <linux/device-id/cpu_feature.h>, next to the other device id types, and include that from <linux/cpufeature.h>,devicetable-offsets.candfile2alias.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
Nicolas Schier
maintainerRe: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header
In reply to Sasha LevinQuoted 9 lines · Sasha Levin
Since commit
cdfdbc11552b("Move structcpu_featureto <linux/cpufeature.h>"),devicetable-offsets.cincludes <linux/cpufeature.h>, which includes <asm/cpufeature.h> on architectures that selectGENERIC_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.cis 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
Re: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header
Hi,
I have a question regarding best-practise:
Quoted 9 lines · Nicolas Schier
Quoted 8 lines · Sasha Levin
Since commit
cdfdbc11552b("Move structcpu_featureto <linux/cpufeature.h>"),devicetable-offsets.cincludes <linux/cpufeature.h>, which includes <asm/cpufeature.h> on architectures that selectGENERIC_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.cis built before that header is generated, so even defconfig fails on both:
Quoted 6 lines
Quoted 1 line
[...]
Applied to kbuild/linux.git (kbuild-next-unstable), thanks!
[2/2] devicetable-offsets: Get struct
cpu_featurefrom a device-id headerhttps://git.kernel.org/kbuild/c/50ccc340
I applied this fix on kbuild-next-unstable (and rebased today [1]), two commits after "Move struct cpu_feature to <linux/cpufeature.h>" [2], which is being "fixed" by this patch.
If we keep it this way, a bisect may hit the issue; folding does not look correct to me as that would mix-up related but different things.
So my questions:
* Shall we keep it the way it is to keep the original patch order (bisect might fail on the two commits before this patch)?
* Or shall the patch be moved before Uwe's (removing the 'Fixes' tag, and rewriting the commit msg)?
I am in favor of the latter. Are there any objections?
[1]: https://git.kernel.org/kbuild/c/f1dc66c38b7eb4b2fb946a2fd6929250ecd2d85a
[2]: https://patch.msgid.link/bc9fbf5784f6788e10c749a05d56c42bdb68f3d9.1792144769.git.u.kleine-koenig@baylibre.com
Signature · 1 line
Nicolas
Nathan Chancellor
maintainerRe: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header
Quoted 6 lines · Nicolas Schier
Quoted 4 lines · Nicolas Schier
Applied to kbuild/linux.git (kbuild-next-unstable), thanks!
[2/2] devicetable-offsets: Get struct
cpu_featurefrom a device-id headerhttps://git.kernel.org/kbuild/c/50ccc340
Quoted 6 lines
I applied this fix on kbuild-next-unstable (and rebased today [1]), two commits after "Move struct
cpu_featureto <linux/cpufeature.h>" [2], which is being "fixed" by this patch.If we keep it this way, a bisect may hit the issue; folding does not look correct to me as that would mix-up related but different things.
Yeah, good catch.
Quoted 5 lines
So my questions:
* Shall we keep it the way it is to keep the original patch order (bisect might fail on the two commits before this patch)?
Quoted 8 lines
* Or shall the patch be moved before Uwe's (removing the 'Fixes' tag, and rewriting the commit msg)?
I am in favor of the latter. Are there any objections?
[1]: https://git.kernel.org/kbuild/c/f1dc66c38b7eb4b2fb946a2fd6929250ecd2d85a
[2]: https://patch.msgid.link/bc9fbf5784f6788e10c749a05d56c42bdb68f3d9.1792144769.git.u.kleine-koenig@baylibre.com
If history is already being rewritten, I believe it is always good to fix potential bisection issues like this. Rewriting the commit message (and maybe some of the diff?) and placing it in an order such that the build cannot break sounds great to me (but others are free to disagree).
Signature · 2 lines
Cheers, Nathan
Re: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header
Hello,
Quoted 12 lines · Nathan Chancellor
Quoted 11 lines · Nicolas Schier
So my questions:
* Shall we keep it the way it is to keep the original patch order (bisect might fail on the two commits before this patch)?
* Or shall the patch be moved before Uwe's (removing the 'Fixes' tag, and rewriting the commit msg)?
I am in favor of the latter. Are there any objections?
Quoted 7 lines
Quoted 2 lines
[1]: https://git.kernel.org/kbuild/c/f1dc66c38b7eb4b2fb946a2fd6929250ecd2d85a
[2]: https://patch.msgid.link/bc9fbf5784f6788e10c749a05d56c42bdb68f3d9.1792144769.git.u.kleine-koenig@baylibre.comIf history is already being rewritten, I believe it is always good to fix potential bisection issues like this. Rewriting the commit message (and maybe some of the diff?) and placing it in an order such that the build cannot break sounds great to me (but others are free to disagree).
Full ack. I think the danger to hit that point during bisection is small, but I like the 2nd option as this reduces the small chance to 0 in that case that people yell at me :-)
So from my side: go!
Best regards
Uwe
Nicolas Schier
maintainerRe: [PATCH 2/2] devicetable-offsets: Get struct cpu_feature from a device-id header
Quoted 23 lines · Uwe Kleine-König
Hello,
Quoted 12 lines · Nathan Chancellor
Quoted 11 lines · Nicolas Schier
So my questions:
* Shall we keep it the way it is to keep the original patch order (bisect might fail on the two commits before this patch)?
* Or shall the patch be moved before Uwe's (removing the 'Fixes' tag, and rewriting the commit msg)?
I am in favor of the latter. Are there any objections?
Quoted 7 lines
Quoted 2 lines
[1]: https://git.kernel.org/kbuild/c/f1dc66c38b7eb4b2fb946a2fd6929250ecd2d85a
[2]: https://patch.msgid.link/bc9fbf5784f6788e10c749a05d56c42bdb68f3d9.1792144769.git.u.kleine-koenig@baylibre.comIf history is already being rewritten, I believe it is always good to fix potential bisection issues like this. Rewriting the commit message (and maybe some of the diff?) and placing it in an order such that the build cannot break sounds great to me (but others are free to disagree).
Quoted 5 lines
Full ack. I think the danger to hit that point during bisection is small, but I like the 2nd option as this reduces the small chance to 0 in that case that people yell at me :-)
So from my side: go!
Thanks!
I'll send a patch that combines both patches in a few minutes. I plan to replace
* Move struct cpu_feature to <linux/cpufeature.h>
https://patch.msgid.link/bc9fbf5784f6788e10c749a05d56c42bdb68f3d9.1792144769.git.u.kleine-koenig@baylibre.com
and
* devicetable-offsets: Get struct cpu_feature from a device-id header
https://patch.msgid.link/f610c07f39df15f3e7ebdc63bfcd759ca7a687a8.1794233316.git.sashal@kernel.org
with it. Please complain in case of objections or inappropriate tags.
Have a nice weekend!
Signature · 1 line
Nicolas
Nicolas Schier
maintainerPATCH 1/1 Move struct cpu_feature to a <linux/device-id/cpu_feature.h>
From: Nicolas Schier <[email protected]>
struct cpu_feature used to be defined in <linux/mod_devicetable.h>. Move it to <linux/device-id/cpu_feature.h> to let users of mod_devicetable.h that only need struct cpu_feature switch to the new include file, and to reduce the number of users of mod_devicetable.h.
While moving struct cpu_feature to <linux/cpufeature.h> instead sounds reasonable, it would break defconfig on loongarch and mips [1].
---
This patch is a combination of [1] and [2]; both patches have been merged to prevent failures during bisecting.
Acked-by, Reported-by and Closes tags have been dropped due to the rewrite.
Thanks to Uwe and Sasha!
--- arch/loongarch/kvm/main.c | 2 +- include/linux/cpufeature.h | 3 ++- include/linux/device-id/cpu_feature.h | 23 +++++++++++++++++++++++ include/linux/mod_devicetable.h | 14 +------------- 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 include/linux/device-id/cpu_feature.h
arch/loongarch/kvm/main.c +1 -1
@@ -5,7 +5,7 @@#include <linux/err.h> #include <linux/module.h> -#include <linux/mod_devicetable.h> +#include <linux/device-id/cpu_feature.h> #include <linux/kvm_host.h> #include <asm/cacheflush.h> #include <asm/cpufeature.h>
include/linux/cpufeature.h +2 -1
@@ -6,10 +6,11 @@#ifndef __LINUX_CPUFEATURE_H#define __LINUX_CPUFEATURE_H +#include <linux/device-id/cpu_feature.h> +#ifdef CONFIG_GENERIC_CPU_AUTOPROBE #include <linux/init.h> -#include <linux/mod_devicetable.h> #include <asm/cpufeature.h> /*
include/linux/device-id/cpu_feature.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef LINUX_DEVICE_ID_CPU_FEATURE_H +#define LINUX_DEVICE_ID_CPU_FEATURE_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; +}; + +#endif /* ifndef LINUX_DEVICE_ID_CPU_FEATURE_H */
include/linux/mod_devicetable.h +1 -13
@@ -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"
@@ -21,6 +17,7 @@#include "device-id/ccw.h" #include "device-id/cdx.h" #include "device-id/coreboot.h" +#include "device-id/cpu_feature.h" #include "device-id/css.h" #include "device-id/dfl.h" #include "device-id/dmi.h"
@@ -69,13 +66,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 */
Signature · 1 line
2.47.3
kernel test robot
build botRe: [PATCH] Move struct cpu_feature to a <linux/device-id/cpu_feature.h>
kernel test robot noticed the following build errors:
Hi Nicolas,
kernel test robot noticed the following build errors:
[auto build test ERROR on kvm/queue]
[also build test ERROR on kvm/next linus/master v7.4-rc3] [cannot apply to kvm/linux-next next-20261119]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Nicolas-Schier/Move-struct-cpu_feature-to-a-linux-device-id-cpu_feature-h/20261120-212711 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue patch link: https://lore.kernel.org/r/20261120202712.3377691-1-nsc%40kernel.org patch subject: [PATCH] Move struct cpu_feature to a <linux/device-id/cpu_feature.h> config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20261121/[email protected]/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 3b14d7c370558b46e5f0c6494a05c492e59bf32c) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/s390/crypto/pkey_cca.c:22:45: error: array has incomplete element type 'struct ap_device_id'
22 | static struct ap_device_id pkey_cca_card_ids[] = {
| ^
drivers/s390/crypto/ap_bus.h:158:9: note: forward declaration of 'struct ap_device_id'
158 | struct ap_device_id *ids;
| ^
1 error generated.
--
>> drivers/s390/crypto/pkey_ep11.c:23:46: error: array has incomplete element type 'struct ap_device_id'
23 | static struct ap_device_id pkey_ep11_card_ids[] = {
| ^
drivers/s390/crypto/ap_bus.h:158:9: note: forward declaration of 'struct ap_device_id'
158 | struct ap_device_id *ids;
| ^1 error generated.
vim +22 drivers/s390/crypto/pkey_cca.c
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 20
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 21 #if IS_MODULE(CONFIG_PKEY_CCA)
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 @22 static struct ap_device_id pkey_cca_card_ids[] = {
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 23 { .dev_type = AP_DEVICE_TYPE_CEX4 },
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 24 { .dev_type = AP_DEVICE_TYPE_CEX5 },
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 25 { .dev_type = AP_DEVICE_TYPE_CEX6 },
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 26 { .dev_type = AP_DEVICE_TYPE_CEX7 },
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 27 { .dev_type = AP_DEVICE_TYPE_CEX8 },
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 28 { /* end of list */ },
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 29 };
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 30 MODULE_DEVICE_TABLE(ap, pkey_cca_card_ids);
8fcc231ce3bea12 Harald Freudenberger 2024-08-22 31 #endif8fcc231ce3bea12 Harald Freudenberger 2024-08-22 32
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Nicolas Schier
maintainerRe: [PATCH] Move struct cpu_feature to a <linux/device-id/cpu_feature.h>
Quoted 34 lines · kernel test robot
Hi Nicolas,
kernel test robot noticed the following build errors:
[auto build test ERROR on kvm/queue]
[also build test ERROR on kvm/next linus/master v7.4-rc3] [cannot apply to kvm/linux-next next-20261119]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Nicolas-Schier/Move-struct-cpu_feature-to-a-linux-device-id-cpu_feature-h/20261120-212711 base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git queue patch link: https://lore.kernel.org/r/20261120202712.3377691-1-nsc%40kernel.org patch subject: [PATCH] Move struct cpu_feature to a <linux/device-id/cpu_feature.h> config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20261121/[email protected]/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 3b14d7c370558b46e5f0c6494a05c492e59bf32c) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261121/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
Quoted 1 line
Quoted 1 line
drivers/s390/crypto/pkey_cca.c:22:45: error: array has incomplete element type 'structap_device_id'22 | static struct ap_device_id pkey_cca_card_ids[] = { | ^ drivers/s390/crypto/ap_bus.h:158:9: note: forward declaration of 'struct ap_device_id' 158 | struct ap_device_id *ids; | ^1 error generated.
--
Quoted 7 lines
Quoted 1 line
Quoted 1 line
drivers/s390/crypto/pkey_ep11.c:23:46: error: array has incomplete element type 'structap_device_id'23 | static struct ap_device_id pkey_ep11_card_ids[] = { | ^ drivers/s390/crypto/ap_bus.h:158:9: note: forward declaration of 'struct ap_device_id' 158 | struct ap_device_id *ids; | ^1 error generated.
That is fixed by [1] which is to be applied before the patch referenced above.
Signature · 1 line
Nicolas
[email protected]
AI reviewRe: [PATCH] Move struct cpu_feature to a <linux/device-id/cpu_feature.h>
In reply to Nicolas SchierThank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] s390/pkey: build failure in pkey_cca.c and pkey_ep11.c due to missing ap.h --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] s390/pkey: build failure in pkey_cca.c and pkey_ep11.c due to missing ap.h
--
commit 543ef19435c07903669c00abccf0dfdd05854de2
Author: Nicolas Schier <[email protected]>
Move struct cpu_feature to a <linux/device-id/cpu_feature.h>
This commit moves the definition of struct cpu_feature from <linux/mod_devicetable.h> into a new <linux/device-id/cpu_feature.h> header and updates <linux/cpufeature.h> and arch/loongarch/kvm/main.c to include the new header directly.
Quoted 7 lines
include/linux/cpufeature.h +0
-0@@ -6,10 +6,11 @@#ifndef __LINUX_CPUFEATURE_H#define __LINUX_CPUFEATURE_H
include/linux/cpufeature.h line 16
Quoted 10 lines
include/linux/cpufeature.h +2
-1+#include <linux/device-id/cpu_feature.h> +#ifdef CONFIG_GENERIC_CPU_AUTOPROBE #include <linux/init.h> -#include <linux/mod_devicetable.h> #include <asm/cpufeature.h> /*
[Severity: High]
Does removing <linux/mod_devicetable.h> here break the s390 build when CONFIG_PKEY_CCA=m or CONFIG_PKEY_EP11=m?
drivers/s390/crypto/pkey_cca.c and drivers/s390/crypto/pkey_ep11.c define arrays of struct ap_device_id (pkey_cca_card_ids[] and pkey_ep11_card_ids[]) without directly including <linux/device-id/ap.h>. They previously got that definition transitively through <linux/cpufeature.h> -> <linux/mod_devicetable.h>, so struct ap_device_id is now an incomplete type in both files.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id
In reply to Sasha LevinQuoted 24 lines · Sasha Levin
pkey_cca.candpkey_ep11.cgot structap_device_idfrom <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commitcdfdbc11552b("Move structcpu_featureto <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 'structap_device_id'drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has incomplete element type 'structap_device_id'Include the header that defines it, as the other AP drivers do.
Reported-by kernelci.org bot <[email protected]>Fixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")Signed-off-by Sasha Levin <[email protected]>--- 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
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@@ -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
Harald Freudenberger
maintainerRe: [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.candpkey_ep11.cgot structap_device_idfrom <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commitcdfdbc11552b("Move structcpu_featureto <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 'structap_device_id'
drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has
incomplete element type 'structap_device_id'Include the header that defines it, as the other AP drivers do.
Reported-by kernelci.org bot <[email protected]>Fixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")Signed-off-by Sasha Levin <[email protected]>--- 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@@ -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_TABLEindrivers/s390/crypto/pkey_cca.cwhile 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@@ -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.
Acked-by Uwe Kleine-König <[email protected]>Thanks
Uwe
Nicolas Schier
maintainerRe: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id
In reply to Sasha LevinQuoted 9 lines · Sasha Levin
pkey_cca.candpkey_ep11.cgot structap_device_idfrom <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commitcdfdbc11552b("Move structcpu_featureto <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 'structap_device_id'drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has incomplete element type 'structap_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
Re: [PATCH 1/2] s390/pkey: Include <linux/device-id/ap.h> for struct ap_device_id
In reply to Sasha LevinQuoted 39 lines · Sasha Levin
pkey_cca.candpkey_ep11.cgot structap_device_idfrom <linux/mod_devicetable.h> by way of <linux/cpufeature.h>. Commitcdfdbc11552b("Move structcpu_featureto <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 'structap_device_id'
drivers/s390/crypto/pkey_ep11.c:23:28: error: array type has
incomplete element type 'structap_device_id'Include the header that defines it, as the other AP drivers do.
Reported-by kernelci.org bot <[email protected]>Closes:
https://d.kernelci.org/i/maestro:7baaa311bc9c30a8ad43f42c24225ab2fead866aFixes cdfdbc11552b ("Move struct cpu_feature to <linux/cpufeature.h>")Signed-off-by Sasha Levin <[email protected]>--- 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@@ -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
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"