* [PATCH v2] KVM: SVM: Fix implicit declaration for __default_cpu_present_to_apicid()
@ 2016-06-15 22:23 Suravee Suthikulpanit
2016-06-15 22:28 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Suravee Suthikulpanit @ 2016-06-15 22:23 UTC (permalink / raw)
To: linux-kernel, kvm, pbonzini
Cc: rkrcmar, fengguang.wu, kbuild-all, Suravee Suthikulpanit,
Suravee Suthikulpanit
The commit 8221c1370056 ("svm: Manage vcpu load/unload when enable AVIC")
introduces a build error due to implicit function declaration
when #ifdef CONFIG_X86_32 and #ifndef CONFIG_X86_LOCAL_APIC
(as reported by Kbuild test robot i386-randconfig-x0-06121009).
So, this patch introduces kvm_cpu_get_apicid() wrapper
around __default_cpu_present_to_apicid() with additional
handling if CONFIG_X86_LOCAL_APIC is not defined.
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/kvm_host.h | 11 +++++++++++
arch/x86/kvm/svm.c | 6 +++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index a714cc2..fe1c5c3 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -27,6 +27,7 @@
#include <linux/irqbypass.h>
#include <linux/hyperv.h>
+#include <asm/apic.h>
#include <asm/pvclock-abi.h>
#include <asm/desc.h>
#include <asm/mtrr.h>
@@ -1370,4 +1371,14 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu)
static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}
+static inline int kvm_cpu_get_apicid(int mps_cpu)
+{
+#ifdef CONFIG_X86_LOCAL_APIC
+ return __default_cpu_present_to_apicid(mps_cpu);
+#else
+ WARN_ON_ONCE(1);
+ return BAD_APICID;
+#endif
+}
+
#endif /* _ASM_X86_KVM_HOST_H */
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 5b12438..0d2aa13 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 = kvm_cpu_get_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 = kvm_cpu_get_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));
+ kvm_cpu_get_apicid(vcpu->cpu));
else
kvm_vcpu_wake_up(vcpu);
}
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] KVM: SVM: Fix implicit declaration for __default_cpu_present_to_apicid()
2016-06-15 22:23 [PATCH v2] KVM: SVM: Fix implicit declaration for __default_cpu_present_to_apicid() Suravee Suthikulpanit
@ 2016-06-15 22:28 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-06-15 22:28 UTC (permalink / raw)
To: Suravee Suthikulpanit, linux-kernel, kvm
Cc: rkrcmar, fengguang.wu, kbuild-all
Thanks, queuing both patches for 4.7-rc.
Paolo
On 16/06/2016 00:23, Suravee Suthikulpanit wrote:
> The commit 8221c1370056 ("svm: Manage vcpu load/unload when enable AVIC")
> introduces a build error due to implicit function declaration
> when #ifdef CONFIG_X86_32 and #ifndef CONFIG_X86_LOCAL_APIC
> (as reported by Kbuild test robot i386-randconfig-x0-06121009).
>
> So, this patch introduces kvm_cpu_get_apicid() wrapper
> around __default_cpu_present_to_apicid() with additional
> handling if CONFIG_X86_LOCAL_APIC is not defined.
>
> 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/kvm_host.h | 11 +++++++++++
> arch/x86/kvm/svm.c | 6 +++---
> 2 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index a714cc2..fe1c5c3 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -27,6 +27,7 @@
> #include <linux/irqbypass.h>
> #include <linux/hyperv.h>
>
> +#include <asm/apic.h>
> #include <asm/pvclock-abi.h>
> #include <asm/desc.h>
> #include <asm/mtrr.h>
> @@ -1370,4 +1371,14 @@ static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu)
>
> static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}
>
> +static inline int kvm_cpu_get_apicid(int mps_cpu)
> +{
> +#ifdef CONFIG_X86_LOCAL_APIC
> + return __default_cpu_present_to_apicid(mps_cpu);
> +#else
> + WARN_ON_ONCE(1);
> + return BAD_APICID;
> +#endif
> +}
> +
> #endif /* _ASM_X86_KVM_HOST_H */
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 5b12438..0d2aa13 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 = kvm_cpu_get_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 = kvm_cpu_get_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));
> + kvm_cpu_get_apicid(vcpu->cpu));
> else
> kvm_vcpu_wake_up(vcpu);
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-15 22:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 22:23 [PATCH v2] KVM: SVM: Fix implicit declaration for __default_cpu_present_to_apicid() Suravee Suthikulpanit
2016-06-15 22:28 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®