public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Paul Mackerras <paulus@samba.org>
Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: Get/set guest SPRs using the GET/SET_ONE_REG interface
Date: Tue, 18 Sep 2012 16:06:25 +0200	[thread overview]
Message-ID: <50587FE1.30504@suse.de> (raw)
In-Reply-To: <20120918071407.GB12437@bloggs.ozlabs.ibm.com>

On 09/18/2012 09:14 AM, Paul Mackerras wrote:
> This enables userspace to get and set various SPRs (special-purpose
> registers) using the KVM_[GS]ET_ONE_REG ioctls.  With this, userspace
> can get and set all the SPRs that are part of the guest state, either
> through the KVM_[GS]ET_REGS ioctls, the KVM_[GS]ET_SREGS ioctls, or
> the KVM_[GS]ET_ONE_REG ioctls.
>
> The SPRs that are added here are:
>
> - DABR:  Data address breakpoint register
> - DSCR:  Data stream control register
> - PURR:  Processor utilization of resources register
> - SPURR: Scaled PURR
> - DAR:   Data address register
> - DSISR: Data storage interrupt status register
> - AMR:   Authority mask register
> - UAMOR: User authority mask override register
> - MMCR0, MMCR1, MMCRA: Performance monitor unit control registers
> - PMC1..PMC8: Performance monitor unit counter registers
>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
> v2: use case a...b: notation for MMCR0/1/A and PMCs
>
>   Documentation/virtual/kvm/api.txt |   19 ++++++++
>   arch/powerpc/include/asm/kvm.h    |   21 +++++++++
>   arch/powerpc/kvm/book3s_hv.c      |   88 +++++++++++++++++++++++++++++++++++++
>   3 files changed, 128 insertions(+)
>
> diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
> index a12f4e4..407556f 100644
> --- a/Documentation/virtual/kvm/api.txt
> +++ b/Documentation/virtual/kvm/api.txt
> @@ -1740,6 +1740,25 @@ registers, find a list below:
>     PPC   | KVM_REG_PPC_IAC4      | 64
>     PPC   | KVM_REG_PPC_DAC1      | 64
>     PPC   | KVM_REG_PPC_DAC2      | 64
> +  PPC   | KVM_REG_PPC_DABR      | 64
> +  PPC   | KVM_REG_PPC_DSCR      | 64
> +  PPC   | KVM_REG_PPC_PURR      | 64
> +  PPC   | KVM_REG_PPC_SPURR     | 64
> +  PPC   | KVM_REG_PPC_DAR       | 64
> +  PPC   | KVM_REG_PPC_DSISR	| 32
> +  PPC   | KVM_REG_PPC_AMR       | 64
> +  PPC   | KVM_REG_PPC_UAMOR     | 64
> +  PPC   | KVM_REG_PPC_MMCR0     | 64
> +  PPC   | KVM_REG_PPC_MMCR1     | 64
> +  PPC   | KVM_REG_PPC_MMCRA     | 64
> +  PPC   | KVM_REG_PPC_PMC1      | 32
> +  PPC   | KVM_REG_PPC_PMC2      | 32
> +  PPC   | KVM_REG_PPC_PMC3      | 32
> +  PPC   | KVM_REG_PPC_PMC4      | 32
> +  PPC   | KVM_REG_PPC_PMC5      | 32
> +  PPC   | KVM_REG_PPC_PMC6      | 32
> +  PPC   | KVM_REG_PPC_PMC7      | 32
> +  PPC   | KVM_REG_PPC_PMC8      | 32
>   
>   4.69 KVM_GET_ONE_REG
>   
> diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
> index 3c14202..9557576 100644
> --- a/arch/powerpc/include/asm/kvm.h
> +++ b/arch/powerpc/include/asm/kvm.h
> @@ -338,5 +338,26 @@ struct kvm_book3e_206_tlb_params {
>   #define KVM_REG_PPC_IAC4	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5)
>   #define KVM_REG_PPC_DAC1	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6)
>   #define KVM_REG_PPC_DAC2	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7)
> +#define KVM_REG_PPC_DABR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8)
> +#define KVM_REG_PPC_DSCR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9)
> +#define KVM_REG_PPC_PURR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa)
> +#define KVM_REG_PPC_SPURR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb)
> +#define KVM_REG_PPC_DAR		(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc)
> +#define KVM_REG_PPC_DSISR	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd)
> +#define KVM_REG_PPC_AMR		(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe)
> +#define KVM_REG_PPC_UAMOR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf)
> +
> +#define KVM_REG_PPC_MMCR0	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10)
> +#define KVM_REG_PPC_MMCR1	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11)
> +#define KVM_REG_PPC_MMCRA	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)
> +
> +#define KVM_REG_PPC_PMC1	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18)
> +#define KVM_REG_PPC_PMC2	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19)
> +#define KVM_REG_PPC_PMC3	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a)
> +#define KVM_REG_PPC_PMC4	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b)
> +#define KVM_REG_PPC_PMC5	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c)
> +#define KVM_REG_PPC_PMC6	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d)
> +#define KVM_REG_PPC_PMC7	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e)
> +#define KVM_REG_PPC_PMC8	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f)
>   
>   #endif /* __LINUX_KVM_POWERPC_H */
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 38c7f1b..c4b5636 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -547,11 +547,44 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>   int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
>   {
>   	int r = -EINVAL;
> +	long int i;
>   
>   	switch (reg->id) {
>   	case KVM_REG_PPC_HIOR:
>   		r = put_user(0, (u64 __user *)reg->addr);
>   		break;
> +	case KVM_REG_PPC_DABR:
> +		r = put_user(vcpu->arch.dabr, (u64 __user *)reg->addr);
> +		break;
> +	case KVM_REG_PPC_DSCR:
> +		r = put_user(vcpu->arch.dscr, (u64 __user *)reg->addr);
> +		break;
> +	case KVM_REG_PPC_PURR:
> +		r = put_user(vcpu->arch.purr, (u64 __user *)reg->addr);
> +		break;
> +	case KVM_REG_PPC_SPURR:
> +		r = put_user(vcpu->arch.spurr, (u64 __user *)reg->addr);
> +		break;

Could you please merge the registers that you share with book3s pr into 
shared code?


Alex

  reply	other threads:[~2012-09-18 14:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  7:13 [PATCH v2 0/2] KVM: PPC: Save/restore complete Book3S HV guest register state Paul Mackerras
2012-09-18  7:14 ` [PATCH v2 1/2] KVM: PPC: Book3S HV: Get/set guest SPRs using the GET/SET_ONE_REG interface Paul Mackerras
2012-09-18 14:06   ` Alexander Graf [this message]
2012-09-19  0:02     ` Paul Mackerras
2012-09-19 11:10       ` Alexander Graf
2012-09-19 17:14       ` Scott Wood
2012-09-19 18:49         ` Alexander Graf
2012-09-18  7:14 ` [PATCH v2 2/2] KVM: PPC: Book3S HV: Get/set guest FP regs " Paul Mackerras

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=50587FE1.30504@suse.de \
    --to=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox