diff mbox

x86/SVM: Fix implicit declaration issue for __default_cpu_present_to_apicid()

Message ID 1465849686-2586-1-git-send-email-Suravee.Suthikulpanit@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Suthikulpanit, Suravee June 13, 2016, 8:28 p.m. UTC
The commit 8221c1370056 ("svm: Manage vcpu load/unload when enable AVIC")
introduces a build error due to implicit function declaration
with#ifdef CONFIG_X86_32 and #ifndef CONFIG_X86_LOCAL_APIC.
with Kbuild test robot config file (i386-randconfig-x0-06121009).

This patch fixes the issue by using the default_cpu_present_to_apicid(),
adding necessary function declaration, and exporting the symbol.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: commit 8221c1370056 ("svm: Manage vcpu load/unload when enable AVIC")
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
---
 arch/x86/include/asm/apic.h | 5 +++++
 arch/x86/kernel/setup.c     | 1 +
 arch/x86/kvm/svm.c          | 6 +++---
 3 files changed, 9 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini June 14, 2016, 2:09 p.m. UTC | #1
On 13/06/2016 22:28, Suravee Suthikulpanit wrote:
> The commit 8221c1370056 ("svm: Manage vcpu load/unload when enable AVIC")
> introduces a build error due to implicit function declaration
> with#ifdef CONFIG_X86_32 and #ifndef CONFIG_X86_LOCAL_APIC.
> with Kbuild test robot config file (i386-randconfig-x0-06121009).
> 
> This patch fixes the issue by using the default_cpu_present_to_apicid(),
> adding necessary function declaration, and exporting the symbol.
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Fixes: commit 8221c1370056 ("svm: Manage vcpu load/unload when enable AVIC")
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
>  arch/x86/include/asm/apic.h | 5 +++++
>  arch/x86/kernel/setup.c     | 1 +
>  arch/x86/kvm/svm.c          | 6 +++---
>  3 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
> index bc27611..beb1d4a 100644
> --- a/arch/x86/include/asm/apic.h
> +++ b/arch/x86/include/asm/apic.h
> @@ -631,6 +631,11 @@ extern int default_cpu_present_to_apicid(int mps_cpu);
>  extern int default_check_phys_apicid_present(int phys_apicid);
>  #endif
>  
> +#else /* CONFIG_X86_LOCAL_APIC */
> +static inline int default_cpu_present_to_apicid(int mps_cpu)
> +{
> +	return BAD_APICID;
> +}
>  #endif /* CONFIG_X86_LOCAL_APIC */
>  extern void irq_enter(void);
>  extern void irq_exit(void);
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index c4e7b39..90168be 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -137,6 +137,7 @@ int default_cpu_present_to_apicid(int mps_cpu)
>  {
>  	return __default_cpu_present_to_apicid(mps_cpu);
>  }
> +EXPORT_SYMBOL_GPL(default_cpu_present_to_apicid);
>  
>  int default_check_phys_apicid_present(int phys_apicid)
>  {
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 5b12438..803351a 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -1402,7 +1402,7 @@ avic_update_iommu(struct kvm_vcpu *vcpu, int cpu, phys_addr_t pa, bool r)
>  static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)
>  {
>  	u64 entry;
> -	int h_physical_id = __default_cpu_present_to_apicid(vcpu->cpu);
> +	int h_physical_id = default_cpu_present_to_apicid(vcpu->cpu);
>  	struct vcpu_svm *svm = to_svm(vcpu);
>  
>  	if (!kvm_vcpu_apicv_active(vcpu))
> @@ -1434,7 +1434,7 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  {
>  	u64 entry;
>  	/* ID = 0xff (broadcast), ID > 0xff (reserved) */
> -	int h_physical_id = __default_cpu_present_to_apicid(cpu);
> +	int h_physical_id = default_cpu_present_to_apicid(cpu);
>  	struct vcpu_svm *svm = to_svm(vcpu);
>  
>  	if (!kvm_vcpu_apicv_active(vcpu))
> @@ -4328,7 +4328,7 @@ static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
>  
>  	if (avic_vcpu_is_running(vcpu))
>  		wrmsrl(SVM_AVIC_DOORBELL,
> -		       __default_cpu_present_to_apicid(vcpu->cpu));
> +		       default_cpu_present_to_apicid(vcpu->cpu));
>  	else
>  		kvm_vcpu_wake_up(vcpu);
>  }
> 

I think AVIC should be compiled out in this case.  I'll send a patch as
soon as I get closer to a compiler.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index bc27611..beb1d4a 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -631,6 +631,11 @@  extern int default_cpu_present_to_apicid(int mps_cpu);
 extern int default_check_phys_apicid_present(int phys_apicid);
 #endif
 
+#else /* CONFIG_X86_LOCAL_APIC */
+static inline int default_cpu_present_to_apicid(int mps_cpu)
+{
+	return BAD_APICID;
+}
 #endif /* CONFIG_X86_LOCAL_APIC */
 extern void irq_enter(void);
 extern void irq_exit(void);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c4e7b39..90168be 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -137,6 +137,7 @@  int default_cpu_present_to_apicid(int mps_cpu)
 {
 	return __default_cpu_present_to_apicid(mps_cpu);
 }
+EXPORT_SYMBOL_GPL(default_cpu_present_to_apicid);
 
 int default_check_phys_apicid_present(int phys_apicid)
 {
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 5b12438..803351a 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1402,7 +1402,7 @@  avic_update_iommu(struct kvm_vcpu *vcpu, int cpu, phys_addr_t pa, bool r)
 static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)
 {
 	u64 entry;
-	int h_physical_id = __default_cpu_present_to_apicid(vcpu->cpu);
+	int h_physical_id = default_cpu_present_to_apicid(vcpu->cpu);
 	struct vcpu_svm *svm = to_svm(vcpu);
 
 	if (!kvm_vcpu_apicv_active(vcpu))
@@ -1434,7 +1434,7 @@  static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 {
 	u64 entry;
 	/* ID = 0xff (broadcast), ID > 0xff (reserved) */
-	int h_physical_id = __default_cpu_present_to_apicid(cpu);
+	int h_physical_id = default_cpu_present_to_apicid(cpu);
 	struct vcpu_svm *svm = to_svm(vcpu);
 
 	if (!kvm_vcpu_apicv_active(vcpu))
@@ -4328,7 +4328,7 @@  static void svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
 
 	if (avic_vcpu_is_running(vcpu))
 		wrmsrl(SVM_AVIC_DOORBELL,
-		       __default_cpu_present_to_apicid(vcpu->cpu));
+		       default_cpu_present_to_apicid(vcpu->cpu));
 	else
 		kvm_vcpu_wake_up(vcpu);
 }