Skip to contentSkip to conversation

linux-next: build failure after merge of the kvm-arm tree

DISCUSSION Stephen Rothwell 4 participants 4 messages Mar 6, 2025 – Mar 7, 2025

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

Hi all,

After merging the kvm-arm tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/firmware/smccc/kvm_guest.c:58:14: warning: no previous prototype for 'kvm_arm_target_impl_cpu_init' [-Wmissing-prototypes]
58 | void __init kvm_arm_target_impl_cpu_init(void)

      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c: In function 'kvm_arm_target_impl_cpu_init':
drivers/firmware/smccc/kvm_guest.c:89:39: error: invalid application of 'sizeof' to incomplete type 'struct target_impl_cpu'
89 | target = memblock_alloc(sizeof(*target) * max_cpus, __alignof__(*target));
| ^
drivers/firmware/smccc/kvm_guest.c:89:62: error: invalid application of '__alignof__' to incomplete type 'struct target_impl_cpu'

   89 |         target = memblock_alloc(sizeof(*target) * max_cpus,  __alignof__(*target));
      |                                                              ^~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c:102:23: error: invalid use of undefined type 'struct target_impl_cpu'
102 | target[i].midr = res.a1;
| ^
drivers/firmware/smccc/kvm_guest.c:102:26: error: invalid use of undefined type 'struct target_impl_cpu'
102 | target[i].midr = res.a1;
| ^
drivers/firmware/smccc/kvm_guest.c:103:23: error: invalid use of undefined type 'struct target_impl_cpu'
103 | target[i].revidr = res.a2;
| ^
drivers/firmware/smccc/kvm_guest.c:103:26: error: invalid use of undefined type 'struct target_impl_cpu'
103 | target[i].revidr = res.a2;
| ^
drivers/firmware/smccc/kvm_guest.c:104:23: error: invalid use of undefined type 'struct target_impl_cpu'
104 | target[i].aidr = res.a3;
| ^
drivers/firmware/smccc/kvm_guest.c:104:26: error: invalid use of undefined type 'struct target_impl_cpu'
104 | target[i].aidr = res.a3;
| ^
drivers/firmware/smccc/kvm_guest.c:107:14: error: implicit declaration of function 'cpu_errata_set_target_impl' [-Wimplicit-function-declaration]

  107 |         if (!cpu_errata_set_target_impl(max_cpus, target)) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c:116:37: error: invalid application of 'sizeof' to incomplete type 'struct target_impl_cpu'
116 | memblock_free(target, sizeof(*target) * max_cpus);
| ^

Caused by commit

86edf6bdcf05 ("smccc/kvm_guest: Enable errata based on implementation CPUs")

I have used the kvm-arm tree from next-20250305 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 67 lines

-----Original Message-----
From: Stephen Rothwell <[email protected]>
Sent: Thursday, March 6, 2025 5:46 AM
To: Christoffer Dall <[email protected]>; Marc Zyngier <[email protected]>
Cc: Oliver Upton <[email protected]>; Shameerali Kolothum Thodi <[email protected]>; Linux Kernel Mailing List <[email protected]>; Linux Next Mailing List <linux- [email protected]>
Subject: linux-next: build failure after merge of the kvm-arm tree

Hi all,

After merging the kvm-arm tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/firmware/smccc/kvm_guest.c:58:14: warning: no previous prototype for 'kvm_arm_target_impl_cpu_init' [-Wmissing-prototypes]
58 | void __init kvm_arm_target_impl_cpu_init(void)

      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c: In function 'kvm_arm_target_impl_cpu_init':
drivers/firmware/smccc/kvm_guest.c:89:39: error: invalid application of 'sizeof' to incomplete type 'struct target_impl_cpu'
89 | target = memblock_alloc(sizeof(*target) * max_cpus,
__alignof__(*target));
| ^
drivers/firmware/smccc/kvm_guest.c:89:62: error: invalid application of '__alignof__' to incomplete type 'struct target_impl_cpu'
89 | target = memblock_alloc(sizeof(*target) * max_cpus,
__alignof__(*target));
| ^~~~~~~~~~~
drivers/firmware/smccc/kvm_guest.c:102:23: error: invalid use of undefined type 'struct target_impl_cpu'
102 | target[i].midr = res.a1;
| ^
drivers/firmware/smccc/kvm_guest.c:102:26: error: invalid use of undefined type 'struct target_impl_cpu'
102 | target[i].midr = res.a1;
| ^
drivers/firmware/smccc/kvm_guest.c:103:23: error: invalid use of undefined type 'struct target_impl_cpu'
103 | target[i].revidr = res.a2;
| ^
drivers/firmware/smccc/kvm_guest.c:103:26: error: invalid use of undefined type 'struct target_impl_cpu'
103 | target[i].revidr = res.a2;
| ^
drivers/firmware/smccc/kvm_guest.c:104:23: error: invalid use of undefined type 'struct target_impl_cpu'
104 | target[i].aidr = res.a3;
| ^
drivers/firmware/smccc/kvm_guest.c:104:26: error: invalid use of undefined type 'struct target_impl_cpu'
104 | target[i].aidr = res.a3;
| ^
drivers/firmware/smccc/kvm_guest.c:107:14: error: implicit declaration of function 'cpu_errata_set_target_impl' [-Wimplicit-function-declaration]

  107 |         if (!cpu_errata_set_target_impl(max_cpus, target)) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c:116:37: error: invalid application of 'sizeof' to incomplete type 'struct target_impl_cpu'
116 | memblock_free(target, sizeof(*target) * max_cpus);
| ^

Quoted 6 lines

Caused by commit

86edf6bdcf05 ("smccc/kvm_guest: Enable errata based on implementation
CPUs")

I have used the kvm-arm tree from next-20250305 for today.

Thanks for reporting this.

Hmm..kvm_guest.c gets build through HAVE_ARM_SMCCC_DISCOVERY which is selected by ARM_GIC_V3.

We could limit the kvm_arm_target_impl_cpu_init() to ARM64 to fix this like below as these hypercall is only supported for KVM/ARM64.

Or is there a better way to handle this?

Thanks,
Shameer

---8---

(quoted diff) +0 -0

b/drivers/firmware/smccc/kvm_guest.c
index 2f03b582c298..5767aed25cdc 100644

drivers/firmware/smccc/kvm_guest.c +2 -0
@@ -55,6 +55,7 @@ bool kvm_arm_hyp_service_available(u32 func_id)
 }
 EXPORT_SYMBOL_GPL(kvm_arm_hyp_service_available);
 
+#ifdef CONFIG_ARM64
 void  __init kvm_arm_target_impl_cpu_init(void)
 {
        int i;
@@ -115,3 +116,4 @@ void  __init kvm_arm_target_impl_cpu_init(void)
 mem_free:
        memblock_free(target, sizeof(*target) * max_cpus);
 }
+#endif
#2 lore raw
Quoted 103 lines · Shameerali Kolothum Thodi
Quoted 68 lines

-----Original Message-----
From: Stephen Rothwell <[email protected]>
Sent: Thursday, March 6, 2025 5:46 AM
To: Christoffer Dall <[email protected]>; Marc Zyngier <[email protected]>
Cc: Oliver Upton <[email protected]>; Shameerali Kolothum Thodi <[email protected]>; Linux Kernel Mailing List <[email protected]>; Linux Next Mailing List <linux- [email protected]>
Subject: linux-next: build failure after merge of the kvm-arm tree

Hi all,

After merging the kvm-arm tree, today's linux-next build (arm multi_v7_defconfig) failed like this:

drivers/firmware/smccc/kvm_guest.c:58:14: warning: no previous prototype for 'kvm_arm_target_impl_cpu_init' [-Wmissing-prototypes]
58 | void __init kvm_arm_target_impl_cpu_init(void)

      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c: In function 'kvm_arm_target_impl_cpu_init':
drivers/firmware/smccc/kvm_guest.c:89:39: error: invalid application of 'sizeof' to incomplete type 'struct target_impl_cpu'
89 | target = memblock_alloc(sizeof(*target) * max_cpus,
__alignof__(*target));
| ^
drivers/firmware/smccc/kvm_guest.c:89:62: error: invalid application of '__alignof__' to incomplete type 'struct target_impl_cpu'
89 | target = memblock_alloc(sizeof(*target) * max_cpus,
__alignof__(*target));
| ^~~~~~~~~~~
drivers/firmware/smccc/kvm_guest.c:102:23: error: invalid use of undefined type 'struct target_impl_cpu'
102 | target[i].midr = res.a1;
| ^
drivers/firmware/smccc/kvm_guest.c:102:26: error: invalid use of undefined type 'struct target_impl_cpu'
102 | target[i].midr = res.a1;
| ^
drivers/firmware/smccc/kvm_guest.c:103:23: error: invalid use of undefined type 'struct target_impl_cpu'
103 | target[i].revidr = res.a2;
| ^
drivers/firmware/smccc/kvm_guest.c:103:26: error: invalid use of undefined type 'struct target_impl_cpu'
103 | target[i].revidr = res.a2;
| ^
drivers/firmware/smccc/kvm_guest.c:104:23: error: invalid use of undefined type 'struct target_impl_cpu'
104 | target[i].aidr = res.a3;
| ^
drivers/firmware/smccc/kvm_guest.c:104:26: error: invalid use of undefined type 'struct target_impl_cpu'
104 | target[i].aidr = res.a3;
| ^
drivers/firmware/smccc/kvm_guest.c:107:14: error: implicit declaration of function 'cpu_errata_set_target_impl' [-Wimplicit-function-declaration]

  107 |         if (!cpu_errata_set_target_impl(max_cpus, target)) {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/firmware/smccc/kvm_guest.c:116:37: error: invalid application of 'sizeof' to incomplete type 'struct target_impl_cpu'
116 | memblock_free(target, sizeof(*target) * max_cpus);
| ^

Quoted 6 lines

Caused by commit

86edf6bdcf05 ("smccc/kvm_guest: Enable errata based on implementation
CPUs")

I have used the kvm-arm tree from next-20250305 for today.

Thanks for reporting this.

Hmm..kvm_guest.c gets build through HAVE_ARM_SMCCC_DISCOVERY which is selected by ARM_GIC_V3.

We could limit the kvm_arm_target_impl_cpu_init() to ARM64 to fix this like below as these hypercall is only supported for KVM/ARM64.

Or is there a better way to handle this?

Thanks,
Shameer

---8---

drivers/firmware/smccc/kvm_guest.c +1 -0
index 2f03b582c298..5767aed25cdc 100644
@@ -55,6 +55,7 @@ bool kvm_arm_hyp_service_available(u32 func_id)
 }
 EXPORT_SYMBOL_GPL(kvm_arm_hyp_service_available);
 
+#ifdef CONFIG_ARM64
 void  __init kvm_arm_target_impl_cpu_init(void)
 {
        int i;

drivers/firmware/smccc/kvm_guest.c void __init kvm_arm_target_impl_cpu_init(void) · line 119

Quoted 4 lines
drivers/firmware/smccc/kvm_guest.c +1 -0
@@ -115,3 +116,4 @@ void  __init kvm_arm_target_impl_cpu_init(void)
 mem_free:
        memblock_free(target, sizeof(*target) * max_cpus);
 }
+#endif

Yeah, that's probably best for now.

Oliver, do you mind stashing this on top so that -next can build again? We can revisit this and have a better solution down the line.

Thanks,

	M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
#3 lore raw
Quoted 2 lines · Marc Zyngier

Oliver, do you mind stashing this on top so that -next can build again? We can revisit this and have a better solution down the line.

Done -- finally caught a break to open my laptop today.

Thanks,
Oliver