Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Oliver Upton <oliver.upton@linux.dev>,
	Cornelia Huck <cohuck@redhat.com>,
	Sebastian Ott <sebott@redhat.com>
Subject: [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'
Date: Sat, 8 Mar 2025 15:42:57 +0800	[thread overview]
Message-ID: <202503081522.IB63qRPZ-lkp@intel.com> (raw)

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

                 reply	other threads:[~2025-03-08  7:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202503081522.IB63qRPZ-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cohuck@redhat.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oliver.upton@linux.dev \
    --cc=sebott@redhat.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox