All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, Alexander Graf <agraf@suse.de>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in hypervisor mode
Date: Thu, 12 May 2011 12:07:17 +0300	[thread overview]
Message-ID: <4DCBA345.6090006@redhat.com> (raw)
In-Reply-To: <20110511104456.GK2837@brick.ozlabs.ibm.com>

On 05/11/2011 01:44 PM, Paul Mackerras wrote:
> This adds support for KVM running on 64-bit Book 3S processors,
> specifically POWER7, in hypervisor mode.  Using hypervisor mode means
> that the guest can use the processor's supervisor mode.  That means
> that the guest can execute privileged instructions and access privileged
> registers itself without trapping to the host.  This gives excellent
> performance, but does mean that KVM cannot emulate a processor
> architecture other than the one that the hardware implements.
>
> This code assumes that the guest is running paravirtualized using the
> PAPR (Power Architecture Platform Requirements) interface, which is the
> interface that IBM's PowerVM hypervisor uses.  That means that existing
> Linux distributions that run on IBM pSeries machines will also run
> under KVM without modification.  In order to communicate the PAPR
> hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
> to include/linux/kvm.h.
>
> Currently the choice between book3s_hv support and book3s_pr support
> (i.e. the existing code, which runs the guest in user mode) has to be
> made at kernel configuration time, so a given kernel binary can only
> do one or the other.
>
> This new book3s_hv code doesn't support MMIO emulation at present.
> Since we are running paravirtualized guests, this isn't a serious
> restriction.
>
> With the guest running in supervisor mode, most exceptions go straight
> to the guest.  We will never get data or instruction storage or segment
> interrupts, alignment interrupts, decrementer interrupts, program
> interrupts, single-step interrupts, etc., coming to the hypervisor from
> the guest.  Therefore this introduces a new KVMTEST_NONHV macro for the
> exception entry path so that we don't have to do the KVM test on entry
> to those exception handlers.
>
> We do however get hypervisor decrementer, hypervisor data storage,
> hypervisor instruction storage, and hypervisor emulation assist
> interrupts, so we have to handle those.
>
> In hypervisor mode, real-mode accesses can access all of RAM, not just
> a limited amount.  Therefore we put all the guest state in the vcpu.arch
> and use the shadow_vcpu in the PACA only for temporary scratch space.
> We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
> anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
>
> The POWER7 processor has a restriction that all threads in a core have
> to be in the same partition.  MMU-on kernel code counts as a partition
> (partition 0), so we have to do a partition switch on every entry to and
> exit from the guest.  At present we require the host and guest to run
> in single-thread mode because of this hardware restriction.
>
> This code allocates a hashed page table for the guest and initializes
> it with HPTEs for the guest's Virtual Real Memory Area (VRMA).  We
> require that the guest memory is allocated using 16MB huge pages, in
> order to simplify the low-level memory management.  This also means that
> we can get away without tracking paging activity in the host for now,
> since huge pages can't be paged or swapped.
>
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index ea2dc1a..a4447ce 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -161,6 +161,7 @@ struct kvm_pit_config {
>   #define KVM_EXIT_NMI              16
>   #define KVM_EXIT_INTERNAL_ERROR   17
>   #define KVM_EXIT_OSI              18
> +#define KVM_EXIT_PAPR_HCALL	  19
>
>   /* For KVM_EXIT_INTERNAL_ERROR */
>   #define KVM_INTERNAL_ERROR_EMULATION 1
> @@ -264,6 +265,11 @@ struct kvm_run {
>   		struct {
>   			__u64 gprs[32];
>   		} osi;
> +		struct {
> +			__u64 nr;
> +			__u64 ret;
> +			__u64 args[9];
> +		} papr_hcall;
>   		/* Fix the size of the union. */
>   		char padding[256];
>   	};

Please document this in Documentation/kvm/api.txt.

-- 
error compiling committee.c: too many arguments to function

WARNING: multiple messages have this Message-ID (diff)
From: Avi Kivity <avi@redhat.com>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, kvm@vger.kernel.org,
	Alexander Graf <agraf@suse.de>
Subject: Re: [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in hypervisor mode
Date: Thu, 12 May 2011 12:07:17 +0300	[thread overview]
Message-ID: <4DCBA345.6090006@redhat.com> (raw)
In-Reply-To: <20110511104456.GK2837@brick.ozlabs.ibm.com>

On 05/11/2011 01:44 PM, Paul Mackerras wrote:
> This adds support for KVM running on 64-bit Book 3S processors,
> specifically POWER7, in hypervisor mode.  Using hypervisor mode means
> that the guest can use the processor's supervisor mode.  That means
> that the guest can execute privileged instructions and access privileged
> registers itself without trapping to the host.  This gives excellent
> performance, but does mean that KVM cannot emulate a processor
> architecture other than the one that the hardware implements.
>
> This code assumes that the guest is running paravirtualized using the
> PAPR (Power Architecture Platform Requirements) interface, which is the
> interface that IBM's PowerVM hypervisor uses.  That means that existing
> Linux distributions that run on IBM pSeries machines will also run
> under KVM without modification.  In order to communicate the PAPR
> hypercalls to qemu, this adds a new KVM_EXIT_PAPR_HCALL exit code
> to include/linux/kvm.h.
>
> Currently the choice between book3s_hv support and book3s_pr support
> (i.e. the existing code, which runs the guest in user mode) has to be
> made at kernel configuration time, so a given kernel binary can only
> do one or the other.
>
> This new book3s_hv code doesn't support MMIO emulation at present.
> Since we are running paravirtualized guests, this isn't a serious
> restriction.
>
> With the guest running in supervisor mode, most exceptions go straight
> to the guest.  We will never get data or instruction storage or segment
> interrupts, alignment interrupts, decrementer interrupts, program
> interrupts, single-step interrupts, etc., coming to the hypervisor from
> the guest.  Therefore this introduces a new KVMTEST_NONHV macro for the
> exception entry path so that we don't have to do the KVM test on entry
> to those exception handlers.
>
> We do however get hypervisor decrementer, hypervisor data storage,
> hypervisor instruction storage, and hypervisor emulation assist
> interrupts, so we have to handle those.
>
> In hypervisor mode, real-mode accesses can access all of RAM, not just
> a limited amount.  Therefore we put all the guest state in the vcpu.arch
> and use the shadow_vcpu in the PACA only for temporary scratch space.
> We allocate the vcpu with kzalloc rather than vzalloc, and we don't use
> anything in the kvmppc_vcpu_book3s struct, so we don't allocate it.
>
> The POWER7 processor has a restriction that all threads in a core have
> to be in the same partition.  MMU-on kernel code counts as a partition
> (partition 0), so we have to do a partition switch on every entry to and
> exit from the guest.  At present we require the host and guest to run
> in single-thread mode because of this hardware restriction.
>
> This code allocates a hashed page table for the guest and initializes
> it with HPTEs for the guest's Virtual Real Memory Area (VRMA).  We
> require that the guest memory is allocated using 16MB huge pages, in
> order to simplify the low-level memory management.  This also means that
> we can get away without tracking paging activity in the host for now,
> since huge pages can't be paged or swapped.
>
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index ea2dc1a..a4447ce 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -161,6 +161,7 @@ struct kvm_pit_config {
>   #define KVM_EXIT_NMI              16
>   #define KVM_EXIT_INTERNAL_ERROR   17
>   #define KVM_EXIT_OSI              18
> +#define KVM_EXIT_PAPR_HCALL	  19
>
>   /* For KVM_EXIT_INTERNAL_ERROR */
>   #define KVM_INTERNAL_ERROR_EMULATION 1
> @@ -264,6 +265,11 @@ struct kvm_run {
>   		struct {
>   			__u64 gprs[32];
>   		} osi;
> +		struct {
> +			__u64 nr;
> +			__u64 ret;
> +			__u64 args[9];
> +		} papr_hcall;
>   		/* Fix the size of the union. */
>   		char padding[256];
>   	};

Please document this in Documentation/kvm/api.txt.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-05-12  9:07 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11 10:34 [PATCH 0/13] Hypervisor-mode KVM on POWER7 Paul Mackerras
2011-05-11 10:36 ` [PATCH 01/13] kvm/powerpc: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s Paul Mackerras
2011-05-11 10:38 ` [PATCH 02/13] kvm/powerpc: Fix kvmppc_core_pending_dec Paul Mackerras
2011-05-11 10:39 ` [PATCH 03/13] kvm/powerpc: Fix the build for 32-bit Book 3S (classic) processors Paul Mackerras
2011-05-12  9:33   ` Alexander Graf
2011-05-12  9:33     ` Alexander Graf
2011-05-12 11:15     ` Paul Mackerras
2011-05-12 11:15       ` Paul Mackerras
2011-05-12 11:16     ` Benjamin Herrenschmidt
2011-05-12 11:16       ` Benjamin Herrenschmidt
2011-05-12 11:57       ` Alexander Graf
2011-05-12 11:57         ` Alexander Graf
2011-05-11 10:40 ` [PATCH 04/13] kvm/powerpc: Split out code from book3s.c into book3s_pr.c Paul Mackerras
2011-05-11 10:41 ` [PATCH 05/13] powerpc, kvm: Rework KVM checks in first-level interrupt handlers Paul Mackerras
2011-05-11 10:42 ` [PATCH 06/13] kvm/powerpc: Deliver program interrupts right away instead of queueing them Paul Mackerras
2011-05-11 10:42 ` [PATCH 07/13] kvm/powerpc: Pass init/destroy vm and prepare/commit memory region ops down Paul Mackerras
2011-05-11 10:43 ` [PATCH 08/13] kvm/powerpc: Move guest enter/exit down into subarch-specific code Paul Mackerras
2011-05-17 18:05   ` Marcelo Tosatti
2011-05-17 18:05     ` Marcelo Tosatti
2011-05-17 18:10     ` Marcelo Tosatti
2011-05-17 18:10       ` Marcelo Tosatti
2011-05-11 10:44 ` [PATCH 09/13] powerpc: Set up LPCR for running guest partitions Paul Mackerras
2011-05-11 10:44 ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in hypervisor mode Paul Mackerras
2011-05-12  9:07   ` Avi Kivity [this message]
2011-05-12  9:07     ` Avi Kivity
2011-05-16  1:07     ` Paul Mackerras
2011-05-16  1:07       ` Paul Mackerras
2011-05-15 21:58   ` Alexander Graf
2011-05-15 21:58     ` Alexander Graf
2011-05-15 21:58     ` Alexander Graf
2011-05-16  5:58     ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in Paul Mackerras
2011-05-16  5:58       ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in hypervisor mode Paul Mackerras
2011-05-16  5:58       ` Paul Mackerras
2011-05-17 10:17       ` Alexander Graf
2011-05-17 10:17         ` Alexander Graf
2011-05-17 10:17         ` Alexander Graf
2011-05-27 10:33         ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in Paul Mackerras
2011-05-27 10:33           ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in hypervisor mode Paul Mackerras
2011-05-27 10:33           ` Paul Mackerras
2011-05-27 10:43           ` Alexander Graf
2011-05-27 10:43             ` Alexander Graf
2011-05-27 10:43             ` Alexander Graf
2011-05-27 20:59           ` Segher Boessenkool
2011-05-27 20:59             ` Segher Boessenkool
2011-05-27 20:59             ` Segher Boessenkool
2011-05-27 23:19             ` Alexander Graf
2011-05-27 23:19               ` Alexander Graf
2011-05-27 23:19               ` Alexander Graf
2011-05-28  1:07               ` Segher Boessenkool
2011-05-28  1:07                 ` Segher Boessenkool
2011-05-28  1:07                 ` Segher Boessenkool
2011-05-31 20:26                 ` Jimi Xenidis
2011-05-31 20:26                   ` Jimi Xenidis
2011-05-31 20:26                   ` Jimi Xenidis
2011-05-31 22:34                   ` Segher Boessenkool
2011-05-31 22:34                     ` Segher Boessenkool
2011-05-31 22:34                     ` Segher Boessenkool
2011-06-01  5:11                     ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in Paul Mackerras
2011-06-01  5:11                       ` [PATCH 10/13] kvm/powerpc: Add support for Book3S processors in hypervisor mode Paul Mackerras
2011-06-01  5:11                       ` Paul Mackerras
2011-05-11 10:45 ` [PATCH 11/13] kvm/powerpc: Handle some PAPR hcalls in the kernel Paul Mackerras
2011-05-17  7:54   ` Alexander Graf
2011-05-17  7:54     ` Alexander Graf
2011-05-17 10:28     ` Paul Mackerras
2011-05-11 10:46 ` [PATCH 12/13] kvm/powerpc: Accelerate H_PUT_TCE by implementing it in real mode Paul Mackerras
2011-05-17  8:01   ` Alexander Graf
2011-05-17  8:01     ` Alexander Graf
2011-05-17  9:11     ` Benjamin Herrenschmidt
2011-05-17  9:11       ` Benjamin Herrenschmidt
2011-05-17  9:31       ` Alexander Graf
2011-05-17  9:31         ` Alexander Graf
2011-05-17  9:35         ` Benjamin Herrenschmidt
2011-05-17  9:35           ` Benjamin Herrenschmidt
2011-05-17  9:39           ` Alexander Graf
2011-05-17  9:39             ` Alexander Graf
2011-05-11 10:46 ` [PATCH 13/13] kvm/powerpc: Allow book3s_hv guests to use SMT processor modes Paul Mackerras
2011-05-11 13:44   ` Christoph Hellwig
2011-05-11 21:17     ` Paul Mackerras
2011-05-11 21:17       ` Paul Mackerras
2011-05-17  8:21   ` Alexander Graf
2011-05-17  8:21     ` Alexander Graf
2011-05-17 10:44     ` Paul Mackerras
2011-05-17 11:36       ` Alexander Graf
2011-05-17 11:36         ` Alexander Graf
2011-05-19  6:06         ` Paul Mackerras
2011-05-17  9:46 ` [PATCH 0/13] Hypervisor-mode KVM on POWER7 Alexander Graf
2011-05-17  9:46   ` Alexander Graf
2011-05-17 11:15   ` Paul Mackerras
2011-05-17 11:38     ` Alexander Graf
2011-05-17 11:38       ` Alexander Graf
2011-05-17 11:42       ` Avi Kivity
2011-05-17 11:42         ` Avi Kivity
2011-05-19  5:22         ` Paul Mackerras
2011-05-19  5:22           ` Paul Mackerras
2011-05-19  6:01           ` Alexander Graf
2011-05-19  6:01             ` Alexander Graf
2011-05-19  6:01             ` Alexander Graf
2011-05-21 16:41           ` Alexander Graf
2011-05-21 16:41             ` Alexander Graf
2011-05-21 17:00             ` Alexander Graf
2011-05-21 17:00               ` Alexander Graf
2011-05-21 18:15               ` Alexander Graf
2011-05-21 18:15                 ` Alexander Graf

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=4DCBA345.6090006@redhat.com \
    --to=avi@redhat.com \
    --cc=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.