Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [linux-next:master 5819/9634] drivers/firmware/smccc/kvm_guest.c:89:32: error: invalid application of 'sizeof' to an incomplete type 'struct target_impl_cpu'
@ 2025-03-08  7:42 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-03-08  7:42 UTC (permalink / raw)
  To: Shameer Kolothum
  Cc: llvm, oe-kbuild-all, Oliver Upton, Cornelia Huck, Sebastian Ott

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   0a2f889128969dab41861b6e40111aa03dc57014
commit: 86edf6bdcf0571c07103b8751e9d792a4b808e97 [5819/9634] smccc/kvm_guest: Enable errata based on implementation CPUs
config: arm-defconfig (https://download.01.org/0day-ci/archive/20250308/202503081522.IB63qRPZ-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project e15545cad8297ec7555f26e5ae74a9f0511203e7)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250308/202503081522.IB63qRPZ-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503081522.IB63qRPZ-lkp@intel.com/

Note: the linux-next/master HEAD 0a2f889128969dab41861b6e40111aa03dc57014 builds fine.
      It may have been fixed somewhere.

All errors (new ones prefixed by >>):

>> drivers/firmware/smccc/kvm_guest.c:89:32: error: invalid application of 'sizeof' to an incomplete type 'struct target_impl_cpu'
      89 |         target = memblock_alloc(sizeof(*target) * max_cpus,  __alignof__(*target));
         |                                       ^~~~~~~~~
   drivers/firmware/smccc/kvm_guest.c:64:9: note: forward declaration of 'struct target_impl_cpu'
      64 |         struct target_impl_cpu *target;
         |                ^
>> drivers/firmware/smccc/kvm_guest.c:89:66: error: invalid application of '__alignof' to an incomplete type 'struct target_impl_cpu'
      89 |         target = memblock_alloc(sizeof(*target) * max_cpus,  __alignof__(*target));
         |                                                                         ^~~~~~~~~
   drivers/firmware/smccc/kvm_guest.c:64:9: note: forward declaration of 'struct target_impl_cpu'
      64 |         struct target_impl_cpu *target;
         |                ^
>> drivers/firmware/smccc/kvm_guest.c:102:9: error: subscript of pointer to incomplete type 'struct target_impl_cpu'
     102 |                 target[i].midr = res.a1;
         |                 ~~~~~~^
   drivers/firmware/smccc/kvm_guest.c:64:9: note: forward declaration of 'struct target_impl_cpu'
      64 |         struct target_impl_cpu *target;
         |                ^
   drivers/firmware/smccc/kvm_guest.c:103:9: error: subscript of pointer to incomplete type 'struct target_impl_cpu'
     103 |                 target[i].revidr = res.a2;
         |                 ~~~~~~^
   drivers/firmware/smccc/kvm_guest.c:64:9: note: forward declaration of 'struct target_impl_cpu'
      64 |         struct target_impl_cpu *target;
         |                ^
   drivers/firmware/smccc/kvm_guest.c:104:9: error: subscript of pointer to incomplete type 'struct target_impl_cpu'
     104 |                 target[i].aidr = res.a3;
         |                 ~~~~~~^
   drivers/firmware/smccc/kvm_guest.c:64:9: note: forward declaration of 'struct target_impl_cpu'
      64 |         struct target_impl_cpu *target;
         |                ^
>> drivers/firmware/smccc/kvm_guest.c:107:7: error: call to undeclared function 'cpu_errata_set_target_impl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     107 |         if (!cpu_errata_set_target_impl(max_cpus, target)) {
         |              ^
   drivers/firmware/smccc/kvm_guest.c:116:30: error: invalid application of 'sizeof' to an incomplete type 'struct target_impl_cpu'
     116 |         memblock_free(target, sizeof(*target) * max_cpus);
         |                                     ^~~~~~~~~
   drivers/firmware/smccc/kvm_guest.c:64:9: note: forward declaration of 'struct target_impl_cpu'
      64 |         struct target_impl_cpu *target;
         |                ^
   drivers/firmware/smccc/kvm_guest.c:58:14: warning: no previous prototype for function 'kvm_arm_target_impl_cpu_init' [-Wmissing-prototypes]
      58 | void  __init kvm_arm_target_impl_cpu_init(void)
         |              ^
   drivers/firmware/smccc/kvm_guest.c:58:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
      58 | void  __init kvm_arm_target_impl_cpu_init(void)
         | ^
         | static 
   1 warning and 7 errors generated.


vim +89 drivers/firmware/smccc/kvm_guest.c

    57	
    58	void  __init kvm_arm_target_impl_cpu_init(void)
    59	{
    60		int i;
    61		u32 ver;
    62		u64 max_cpus;
    63		struct arm_smccc_res res;
    64		struct target_impl_cpu *target;
    65	
    66		if (!kvm_arm_hyp_service_available(ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_VER) ||
    67		    !kvm_arm_hyp_service_available(ARM_SMCCC_KVM_FUNC_DISCOVER_IMPL_CPUS))
    68			return;
    69	
    70		arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_VER_FUNC_ID,
    71				     0, &res);
    72		if (res.a0 != SMCCC_RET_SUCCESS)
    73			return;
    74	
    75		/* Version info is in lower 32 bits and is in SMMCCC_VERSION format */
    76		ver = lower_32_bits(res.a1);
    77		if (PSCI_VERSION_MAJOR(ver) != 1) {
    78			pr_warn("Unsupported target CPU implementation version v%d.%d\n",
    79				PSCI_VERSION_MAJOR(ver), PSCI_VERSION_MINOR(ver));
    80			return;
    81		}
    82	
    83		if (!res.a2) {
    84			pr_warn("No target implementation CPUs specified\n");
    85			return;
    86		}
    87	
    88		max_cpus = res.a2;
  > 89		target = memblock_alloc(sizeof(*target) * max_cpus,  __alignof__(*target));
    90		if (!target) {
    91			pr_warn("Not enough memory for struct target_impl_cpu\n");
    92			return;
    93		}
    94	
    95		for (i = 0; i < max_cpus; i++) {
    96			arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_KVM_DISCOVER_IMPL_CPUS_FUNC_ID,
    97					     i, &res);
    98			if (res.a0 != SMCCC_RET_SUCCESS) {
    99				pr_warn("Discovering target implementation CPUs failed\n");
   100				goto mem_free;
   101			}
 > 102			target[i].midr = res.a1;
   103			target[i].revidr = res.a2;
   104			target[i].aidr = res.a3;
   105		};
   106	
 > 107		if (!cpu_errata_set_target_impl(max_cpus, target)) {

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-08  7:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-08  7:42 [linux-next:master 5819/9634] drivers/firmware/smccc/kvm_guest.c:89:32: error: invalid application of 'sizeof' to an incomplete type 'struct target_impl_cpu' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox