Re: [PATCH 1/5] powerpc: define ePAPR hcall exit interface

Alexander Graf
2013-07-15T11:21:01Z

On 15.07.2013, at 13:11, Bharat Bhushan wrote:

> This patch defines the ePAPR hcall exit interface to guest user space.

The subject line is misleading. This is a kvm patch. Same applies for most other patches.

>
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> ---
> Documentation/virtual/kvm/api.txt | 20 ++++++++++++++++++++
> include/uapi/linux/kvm.h | 7 +++++++
> 2 files changed, 27 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
> index 66dd2aa..054f2f4 100644
> --- a/Documentation/virtual/kvm/api.txt
> +++ b/Documentation/virtual/kvm/api.txt
> @@ -2597,6 +2597,26 @@ The possible hypercalls are defined in the Power Architecture Platform
> Requirements (PAPR) document available from www.power.org (free
> developer registration required to access it).
>
> + /* KVM_EXIT_EPAPR_HCALL */
> + struct {
> + __u64 nr;
> + __u64 ret;
> + __u64 args[8];
> + } epapr_hcall;
> +
> +This is used on PowerPC platforms that support ePAPR hcalls.
> +It occurs when a guest does a hypercall (as defined
> +in the ePAPR 1.1) and the hcall is not handled by the kernel.
> +
> +The 'nr' field contains the hypercall number (from the guest R11),
> +and 'args' contains the arguments (from the guest R3 - R10).
> +Userspace should put the return code in 'ret' and any extra returned
> +values in args[]. If the VM is not in 64-bit mode KVM zeros
> +the upper half of each field in the struct.
> +
> +As per the ePAPR hcall ABI, the return value is returned to
> +the guest in R3 and output return values in R4 - R10.
> +
> /* KVM_EXIT_S390_TSCH */
> struct {
> __u16 subchannel_id;
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index acccd08..01ee50e 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -171,6 +171,7 @@ struct kvm_pit_config {
> #define KVM_EXIT_WATCHDOG 21
> #define KVM_EXIT_S390_TSCH 22
> #define KVM_EXIT_EPR 23
> +#define KVM_EXIT_EPAPR_HCALL 24
>
> /* For KVM_EXIT_INTERNAL_ERROR */
> /* Emulate instruction failed. */
> @@ -288,6 +289,12 @@ struct kvm_run {
> __u64 ret;
> __u64 args[9];
> } papr_hcall;
> + /* KVM_EXIT_EPAPR_HCALL */
> + struct {
> + __u64 nr;
> + __u64 ret;
> + __u64 args[8];
> + } epapr_hcall;

This should be at the end of the union.

Alex

> /* KVM_EXIT_S390_TSCH */
> struct {
> __u16 subchannel_id;
> --
> 1.7.0.4
>
>