From: Paolo Bonzini <pbonzini@redhat.com>
To: Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org, x86@kernel.org,
kvm@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
boris.ostrovsky@oracle.com, rkrcmar@redhat.com,
rjw@rjwysocki.net, len.brown@intel.com, pavel@ucw.cz
Subject: Re: [PATCH 2/3] x86: add guest_late_init hook to hypervisor_x86 structure
Date: Wed, 8 Nov 2017 10:53:46 +0100 [thread overview]
Message-ID: <cb98a786-50db-71ce-8238-388d6c86d7b0@redhat.com> (raw)
In-Reply-To: <20171108090739.26491-3-jgross@suse.com>
On 08/11/2017 10:07, Juergen Gross wrote:
> Add a new guest_late_init hook to the hypervisor_x86 structure. It
> will replace the current kvm_guest_init() call which is changed to
> make use of the new hook.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
The trivial KVM changes are of course
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
> ---
> arch/x86/include/asm/hypervisor.h | 11 +++++++++++
> arch/x86/include/asm/kvm_para.h | 2 --
> arch/x86/kernel/kvm.c | 3 ++-
> arch/x86/kernel/setup.c | 2 +-
> 4 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
> index 0ead9dbb9130..37320687b8cb 100644
> --- a/arch/x86/include/asm/hypervisor.h
> +++ b/arch/x86/include/asm/hypervisor.h
> @@ -38,6 +38,9 @@ struct hypervisor_x86 {
> /* Platform setup (run once per boot) */
> void (*init_platform)(void);
>
> + /* Guest late init */
> + void (*guest_late_init)(void);
> +
> /* X2APIC detection (run once per boot) */
> bool (*x2apic_available)(void);
>
> @@ -66,9 +69,17 @@ static inline void hypervisor_init_mem_mapping(void)
> if (x86_hyper && x86_hyper->init_mem_mapping)
> x86_hyper->init_mem_mapping();
> }
> +
> +static inline void hypervisor_guest_late_init(void)
> +{
> + if (x86_hyper && x86_hyper->guest_late_init)
> + x86_hyper->guest_late_init();
> +}
> +
> #else
> static inline void init_hypervisor_platform(void) { }
> static inline bool hypervisor_x2apic_available(void) { return false; }
> static inline void hypervisor_init_mem_mapping(void) { }
> +static inline void hypervisor_guest_late_init(void) { }
> #endif /* CONFIG_HYPERVISOR_GUEST */
> #endif /* _ASM_X86_HYPERVISOR_H */
> diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h
> index c373e44049b1..7b407dda2bd7 100644
> --- a/arch/x86/include/asm/kvm_para.h
> +++ b/arch/x86/include/asm/kvm_para.h
> @@ -88,7 +88,6 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
> #ifdef CONFIG_KVM_GUEST
> bool kvm_para_available(void);
> unsigned int kvm_arch_para_features(void);
> -void __init kvm_guest_init(void);
> void kvm_async_pf_task_wait(u32 token, int interrupt_kernel);
> void kvm_async_pf_task_wake(u32 token);
> u32 kvm_read_and_reset_pf_reason(void);
> @@ -103,7 +102,6 @@ static inline void kvm_spinlock_init(void)
> #endif /* CONFIG_PARAVIRT_SPINLOCKS */
>
> #else /* CONFIG_KVM_GUEST */
> -#define kvm_guest_init() do {} while (0)
> #define kvm_async_pf_task_wait(T, I) do {} while(0)
> #define kvm_async_pf_task_wake(T) do {} while(0)
>
> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
> index 8bb9594d0761..d331b5060aa9 100644
> --- a/arch/x86/kernel/kvm.c
> +++ b/arch/x86/kernel/kvm.c
> @@ -465,7 +465,7 @@ static void __init kvm_apf_trap_init(void)
> update_intr_gate(X86_TRAP_PF, async_page_fault);
> }
>
> -void __init kvm_guest_init(void)
> +static void __init kvm_guest_init(void)
> {
> int i;
>
> @@ -548,6 +548,7 @@ const struct hypervisor_x86 x86_hyper_kvm __refconst = {
> .name = "KVM",
> .detect = kvm_detect,
> .x2apic_available = kvm_para_available,
> + .guest_late_init = kvm_guest_init,
> };
> EXPORT_SYMBOL_GPL(x86_hyper_kvm);
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 0957dd73d127..578569481d87 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1294,7 +1294,7 @@ void __init setup_arch(char **cmdline_p)
>
> io_apic_init_mappings();
>
> - kvm_guest_init();
> + hypervisor_guest_late_init();
>
> e820__reserve_resources();
> e820__register_nosave_regions(max_low_pfn);
>
next prev parent reply other threads:[~2017-11-08 9:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 9:07 [PATCH 0/3] x86/xen: support booting PVH guest via standard boot path Juergen Gross
2017-11-08 9:07 ` [PATCH 1/3] x86/acpi: add test for ACPI_FADT_NO_VGA Juergen Gross
2017-11-08 9:07 ` [PATCH 2/3] x86: add guest_late_init hook to hypervisor_x86 structure Juergen Gross
2017-11-08 9:13 ` Ingo Molnar
2017-11-08 9:27 ` Juergen Gross
2017-11-08 9:40 ` Ingo Molnar
2017-11-08 9:49 ` Juergen Gross
2017-11-08 9:58 ` Ingo Molnar
2017-11-08 9:53 ` Paolo Bonzini [this message]
2017-11-08 9:07 ` [PATCH 3/3] x86/xen: use guest_late_init to detect Xen PVH guest Juergen Gross
2017-11-08 11:18 ` [Xen-devel] " Jan Beulich
[not found] ` <5A02F633020000780018D26A@suse.com>
2017-11-08 11:55 ` Juergen Gross
2017-11-08 12:03 ` Paolo Bonzini
2017-11-08 12:24 ` Juergen Gross
2017-11-08 12:26 ` Paolo Bonzini
2017-11-08 12:40 ` Juergen Gross
2017-11-08 12:31 ` Jan Beulich
2017-11-08 12:45 ` Juergen Gross
2017-11-08 12:58 ` Jan Beulich
[not found] ` <5A030D78020000780018D37B@suse.com>
2017-11-08 13:36 ` Juergen Gross
2017-11-08 14:10 ` Boris Ostrovsky
2017-11-08 14:17 ` Juergen Gross
2017-11-08 14:24 ` Boris Ostrovsky
2017-11-08 13:37 ` [PATCH 0/3] x86/xen: support booting PVH guest via standard boot path Boris Ostrovsky
2017-11-08 13:40 ` Juergen Gross
2017-11-08 13:47 ` Boris Ostrovsky
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=cb98a786-50db-71ce-8238-388d6c86d7b0@redhat.com \
--to=pbonzini@redhat.com \
--cc=boris.ostrovsky@oracle.com \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=kvm@vger.kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=rkrcmar@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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
all inboxes | Powered by JetHome®