[PATCH 2/2] KVM: PPC: sparse: prototypes for functions called from assembler

Daniel Axtens dja at axtens.net
Mon Oct 10 13:52:41 AEDT 2016


Paul Mackerras <paulus at ozlabs.org> writes:

> On Mon, Oct 10, 2016 at 11:31:20AM +1100, Daniel Axtens wrote:
>> A bunch of KVM functions are only called from assembler.
>> Give them prototypes in asm-prototypes.h
>> This reduces sparse warnings.
>> 
>> Signed-off-by: Daniel Axtens <dja at axtens.net>
>> ---
>>  arch/powerpc/include/asm/asm-prototypes.h | 44 +++++++++++++++++++++++++++++++
>>  arch/powerpc/kvm/book3s_64_vio_hv.c       |  1 +
>>  arch/powerpc/kvm/book3s_hv_builtin.c      |  1 +
>>  arch/powerpc/kvm/book3s_hv_ras.c          |  1 +
>>  arch/powerpc/kvm/book3s_hv_rm_mmu.c       |  1 +
>>  arch/powerpc/kvm/book3s_hv_rm_xics.c      |  1 +
>>  6 files changed, 49 insertions(+)
>> 
>> diff --git a/arch/powerpc/include/asm/asm-prototypes.h b/arch/powerpc/include/asm/asm-prototypes.h
>> index d1492736d852..6c853bcd11fa 100644
>> --- a/arch/powerpc/include/asm/asm-prototypes.h
>> +++ b/arch/powerpc/include/asm/asm-prototypes.h
>> @@ -14,6 +14,9 @@
>>  
>>  #include <linux/threads.h>
>>  #include <linux/kprobes.h>
>> +#ifdef CONFIG_KVM
>> +#include <linux/kvm_host.h>
>> +#endif
>>  
>>  #include <uapi/asm/ucontext.h>
>>  
>> @@ -109,4 +112,45 @@ void early_setup_secondary(void);
>>  /* time */
>>  void accumulate_stolen_time(void);
>>  
>> +/* kvm */
>> +#ifdef CONFIG_KVM
>
> Why do we need this ifdef?  Does the compilation break without it when
> CONFIG_KVM = n?

Yes it does - the 0day build bot picked it up when I did v1 without the
ifdef.

See: https://lists.01.org/pipermail/kbuild-all/2016-September/024742.html

For example:

   arch/powerpc/include/asm/asm-prototypes.h:82:7: error: 'struct kvm_vcpu' declared inside parameter list [-Werror]
          unsigned long tce_list, unsigned long npages);
          ^
   arch/powerpc/include/asm/asm-prototypes.h:85:7: error: 'struct kvm_vcpu' declared inside parameter list [-Werror]
          unsigned long tce_value, unsigned long npages);
          ^
   arch/powerpc/include/asm/asm-prototypes.h:87:29: error: 'struct kvm_vcpu' declared inside parameter list [-Werror]
                                unsigned int yield_count);
                                ^
   arch/powerpc/include/asm/asm-prototypes.h:88:29: error: 'struct kvm_vcpu' declared inside parameter list [-Werror]
    long kvmppc_h_random(struct kvm_vcpu *vcpu);


Regards,
Daniel


More information about the Linuxppc-dev mailing list