From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH 1/3] KVM: PPC: Book3S: Controls for in-kernel PAPR hypercall handling Date: Sun, 01 Jun 2014 11:55:21 +0200 Message-ID: <538AF889.4070700@suse.de> References: <1401520869-29364-1-git-send-email-paulus@samba.org> <1401520869-29364-2-git-send-email-paulus@samba.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, Cornelia Huck To: Paul Mackerras Return-path: In-Reply-To: <1401520869-29364-2-git-send-email-paulus@samba.org> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 31.05.14 09:21, Paul Mackerras wrote: > This provides a way for userspace controls which PAPR hcalls get > handled in the kernel. Each hcall can be individually enabled or > disabled for in-kernel handling, except for H_RTAS. The exception > for H_RTAS is because userspace can already control whether > individual RTAS functions are handled in-kernel or not via the > KVM_PPC_RTAS_DEFINE_TOKEN ioctl, and because the numeric value for > H_RTAS is out of the normal sequence of hcall numbers. > > Hcalls are enabled or disabled using the KVM_ENABLE_CAP ioctl for the > KVM_CAP_PPC_ENABLE_HCALL capability on the file descriptor for the VM. > The args field of the struct kvm_enable_cap specifies the hcall number > in args[0] and the enable/disable flag in args[1]; 0 means disable > in-kernel handling (so that the hcall will always cause an exit to > userspace) and 1 means enable. Enabling or disabling in-kernel > handling of an hcall is effective across the whole VM. > > The ability for KVM_ENABLE_CAP to be used on a VM file descriptor > on PowerPC is new, added by this commit. The KVM_CAP_ENABLE_CAP_VM > capability advertises that this ability exists. > > When a VM is created, an initial set of hcalls are enabled for > in-kernel handling. The set that is enabled is the set that have > an in-kernel implementation at this point. Any new hcall > implementations from this point onwards should not be added to the > default set without a good reason. > > No distinction is made between real-mode and virtual-mode hcall > implementations; the one setting controls them both. > > Signed-off-by: Paul Mackerras > --- > Documentation/virtual/kvm/api.txt | 19 ++++++++++++ > arch/powerpc/include/asm/kvm_book3s.h | 1 + > arch/powerpc/include/asm/kvm_host.h | 2 ++ > arch/powerpc/kernel/asm-offsets.c | 1 + > arch/powerpc/kvm/book3s_hv.c | 51 +++++++++++++++++++++++++++++++++ > arch/powerpc/kvm/book3s_hv_rmhandlers.S | 11 +++++++ > arch/powerpc/kvm/book3s_pr.c | 5 ++++ > arch/powerpc/kvm/book3s_pr_papr.c | 37 ++++++++++++++++++++++++ > arch/powerpc/kvm/powerpc.c | 45 +++++++++++++++++++++++++++++ > include/uapi/linux/kvm.h | 1 + > 10 files changed, 173 insertions(+) > > diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt > index 6ff3a77..73c614f 100644 > --- a/Documentation/virtual/kvm/api.txt > +++ b/Documentation/virtual/kvm/api.txt > @@ -3002,3 +3002,22 @@ Parameters: args[0] is the XICS device fd > args[1] is the XICS CPU number (server ID) for this vcpu > > This capability connects the vcpu to an in-kernel XICS device. > + > +6.8 KVM_CAP_PPC_ENABLE_HCALL > + > +Architectures: ppc (VM capability) Hrm. Just create a new section for VM scope ENABLE_CAP caps. Putting them into the same bucket as CPU ones will end up confusing :). > +Parameters: args[0] is the PAPR hcall number > + args[1] is 0 to disable, 1 to enable in-kernel handling > + > +This capability controls whether individual PAPR hypercalls (hcalls) Sorry for not seeing this earlier. We support both ePAPR and sPAPR compliant hypercalls on PPC. I think it makes sense to document which ones we're talking about here. Alex