All of lore.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 3/3] KVM: PPC: Book3S HV: Add H_SET_MODE hcall handling
Date: Wed, 28 May 2014 13:35:28 +0000	[thread overview]
Message-ID: <5385E620.5090703@suse.de> (raw)
In-Reply-To: <1401106626-13130-4-git-send-email-paulus@samba.org>


On 26.05.14 14:17, Paul Mackerras wrote:
> From: Michael Neuling <mikey@neuling.org>
>
> This adds support for the H_SET_MODE hcall.  This hcall is a
> multiplexer that has several functions, some of which are called
> rarely, and some which are potentially called very frequently.
> Here we add support for the functions that set the debug registers
> CIABR (Completed Instruction Address Breakpoint Register) and
> DAWR/DAWRX (Data Address Watchpoint Register and eXtension),
> since they could be updated by the guest as often as every context
> switch.
>
> This also adds a kvmppc_power8_compatible() function to test to see
> if a guest is compatible with POWER8 or not.  The CIABR and DAWR/X
> only exist on POWER8.
>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
>   arch/powerpc/include/asm/hvcall.h |  6 +++++
>   arch/powerpc/kvm/book3s_hv.c      | 51 ++++++++++++++++++++++++++++++++++++++-
>   2 files changed, 56 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
> index 5dbbb29..85bc8c0 100644
> --- a/arch/powerpc/include/asm/hvcall.h
> +++ b/arch/powerpc/include/asm/hvcall.h
> @@ -279,6 +279,12 @@
>   #define H_GET_24X7_DATA		0xF07C
>   #define H_GET_PERF_COUNTER_INFO	0xF080
>   
> +/* Values for 2nd argument to H_SET_MODE */
> +#define H_SET_MODE_RESOURCE_SET_CIABR		1
> +#define H_SET_MODE_RESOURCE_SET_DAWR		2
> +#define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE	3
> +#define H_SET_MODE_RESOURCE_LE			4
> +
>   #ifndef __ASSEMBLY__
>   
>   /**
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 1f91130..53e2b63 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -557,6 +557,47 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
>   	vcpu->arch.dtl.dirty = true;
>   }
>   
> +static bool kvmppc_power8_compatible(struct kvm_vcpu *vcpu)
> +{
> +	if (vcpu->arch.vcore->arch_compat >= PVR_ARCH_207)
> +		return true;
> +	if ((!vcpu->arch.vcore->arch_compat) &&
> +	    cpu_has_feature(CPU_FTR_ARCH_207S))
> +		return true;
> +	return false;
> +}
> +
> +static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
> +			     unsigned long resource, unsigned long value1,
> +			     unsigned long value2)
> +{
> +	switch (resource) {
> +	case H_SET_MODE_RESOURCE_SET_CIABR:
> +		if (!kvmppc_power8_compatible(vcpu))
> +			return H_P2;
> +		if (value2)
> +			return H_P4;
> +		if (mflags)
> +			return H_UNSUPPORTED_FLAG_START;
> +		if ((value1 & 0x3) = 0x3)

What is this?

Alex

> +			return H_P3;
> +		vcpu->arch.ciabr  = value1;
> +		return H_SUCCESS;
> +	case H_SET_MODE_RESOURCE_SET_DAWR:
> +		if (!kvmppc_power8_compatible(vcpu))
> +			return H_P2;
> +		if (mflags)
> +			return H_UNSUPPORTED_FLAG_START;
> +		if (value2 & DABRX_HYP)
> +			return H_P4;
> +		vcpu->arch.dawr  = value1;
> +		vcpu->arch.dawrx = value2;
> +		return H_SUCCESS;
> +	default:
> +		return H_TOO_HARD;
> +	}
> +}
> +
>   int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
>   {
>   	unsigned long req = kvmppc_get_gpr(vcpu, 3);
> @@ -626,7 +667,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
>   
>   		/* Send the error out to userspace via KVM_RUN */
>   		return rc;
> -
> +	case H_SET_MODE:
> +		ret = kvmppc_h_set_mode(vcpu, kvmppc_get_gpr(vcpu, 4),
> +					kvmppc_get_gpr(vcpu, 5),
> +					kvmppc_get_gpr(vcpu, 6),
> +					kvmppc_get_gpr(vcpu, 7));
> +		if (ret = H_TOO_HARD)
> +			return RESUME_HOST;
> +		break;
>   	case H_XIRR:
>   	case H_CPPR:
>   	case H_EOI:
> @@ -652,6 +700,7 @@ static int kvmppc_hcall_impl_hv(struct kvm *kvm, unsigned long cmd)
>   	case H_PROD:
>   	case H_CONFER:
>   	case H_REGISTER_VPA:
> +	case H_SET_MODE:
>   #ifdef CONFIG_KVM_XICS
>   	case H_XIRR:
>   	case H_CPPR:


WARNING: multiple messages have this Message-ID (diff)
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 3/3] KVM: PPC: Book3S HV: Add H_SET_MODE hcall handling
Date: Wed, 28 May 2014 15:35:28 +0200	[thread overview]
Message-ID: <5385E620.5090703@suse.de> (raw)
In-Reply-To: <1401106626-13130-4-git-send-email-paulus@samba.org>


On 26.05.14 14:17, Paul Mackerras wrote:
> From: Michael Neuling <mikey@neuling.org>
>
> This adds support for the H_SET_MODE hcall.  This hcall is a
> multiplexer that has several functions, some of which are called
> rarely, and some which are potentially called very frequently.
> Here we add support for the functions that set the debug registers
> CIABR (Completed Instruction Address Breakpoint Register) and
> DAWR/DAWRX (Data Address Watchpoint Register and eXtension),
> since they could be updated by the guest as often as every context
> switch.
>
> This also adds a kvmppc_power8_compatible() function to test to see
> if a guest is compatible with POWER8 or not.  The CIABR and DAWR/X
> only exist on POWER8.
>
> Signed-off-by: Michael Neuling <mikey@neuling.org>
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
>   arch/powerpc/include/asm/hvcall.h |  6 +++++
>   arch/powerpc/kvm/book3s_hv.c      | 51 ++++++++++++++++++++++++++++++++++++++-
>   2 files changed, 56 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
> index 5dbbb29..85bc8c0 100644
> --- a/arch/powerpc/include/asm/hvcall.h
> +++ b/arch/powerpc/include/asm/hvcall.h
> @@ -279,6 +279,12 @@
>   #define H_GET_24X7_DATA		0xF07C
>   #define H_GET_PERF_COUNTER_INFO	0xF080
>   
> +/* Values for 2nd argument to H_SET_MODE */
> +#define H_SET_MODE_RESOURCE_SET_CIABR		1
> +#define H_SET_MODE_RESOURCE_SET_DAWR		2
> +#define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE	3
> +#define H_SET_MODE_RESOURCE_LE			4
> +
>   #ifndef __ASSEMBLY__
>   
>   /**
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 1f91130..53e2b63 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -557,6 +557,47 @@ static void kvmppc_create_dtl_entry(struct kvm_vcpu *vcpu,
>   	vcpu->arch.dtl.dirty = true;
>   }
>   
> +static bool kvmppc_power8_compatible(struct kvm_vcpu *vcpu)
> +{
> +	if (vcpu->arch.vcore->arch_compat >= PVR_ARCH_207)
> +		return true;
> +	if ((!vcpu->arch.vcore->arch_compat) &&
> +	    cpu_has_feature(CPU_FTR_ARCH_207S))
> +		return true;
> +	return false;
> +}
> +
> +static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
> +			     unsigned long resource, unsigned long value1,
> +			     unsigned long value2)
> +{
> +	switch (resource) {
> +	case H_SET_MODE_RESOURCE_SET_CIABR:
> +		if (!kvmppc_power8_compatible(vcpu))
> +			return H_P2;
> +		if (value2)
> +			return H_P4;
> +		if (mflags)
> +			return H_UNSUPPORTED_FLAG_START;
> +		if ((value1 & 0x3) == 0x3)

What is this?

Alex

> +			return H_P3;
> +		vcpu->arch.ciabr  = value1;
> +		return H_SUCCESS;
> +	case H_SET_MODE_RESOURCE_SET_DAWR:
> +		if (!kvmppc_power8_compatible(vcpu))
> +			return H_P2;
> +		if (mflags)
> +			return H_UNSUPPORTED_FLAG_START;
> +		if (value2 & DABRX_HYP)
> +			return H_P4;
> +		vcpu->arch.dawr  = value1;
> +		vcpu->arch.dawrx = value2;
> +		return H_SUCCESS;
> +	default:
> +		return H_TOO_HARD;
> +	}
> +}
> +
>   int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
>   {
>   	unsigned long req = kvmppc_get_gpr(vcpu, 3);
> @@ -626,7 +667,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
>   
>   		/* Send the error out to userspace via KVM_RUN */
>   		return rc;
> -
> +	case H_SET_MODE:
> +		ret = kvmppc_h_set_mode(vcpu, kvmppc_get_gpr(vcpu, 4),
> +					kvmppc_get_gpr(vcpu, 5),
> +					kvmppc_get_gpr(vcpu, 6),
> +					kvmppc_get_gpr(vcpu, 7));
> +		if (ret == H_TOO_HARD)
> +			return RESUME_HOST;
> +		break;
>   	case H_XIRR:
>   	case H_CPPR:
>   	case H_EOI:
> @@ -652,6 +700,7 @@ static int kvmppc_hcall_impl_hv(struct kvm *kvm, unsigned long cmd)
>   	case H_PROD:
>   	case H_CONFER:
>   	case H_REGISTER_VPA:
> +	case H_SET_MODE:
>   #ifdef CONFIG_KVM_XICS
>   	case H_XIRR:
>   	case H_CPPR:

  reply	other threads:[~2014-05-28 13:35 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 12:17 [PATCH 0/3] New PAPR hypercall plus individual hypercall enables Paul Mackerras
2014-05-26 12:17 ` Paul Mackerras
2014-05-26 12:17 ` [PATCH 1/3] KVM: PPC: Book3S: Controls for in-kernel PAPR hypercall handling Paul Mackerras
2014-05-26 12:17   ` Paul Mackerras
2014-05-28 13:27   ` Alexander Graf
2014-05-28 13:27     ` Alexander Graf
2014-05-29  5:27     ` Paul Mackerras
2014-05-29  5:27       ` Paul Mackerras
2014-05-29  6:35       ` Alexander Graf
2014-05-29  6:35         ` Alexander Graf
2014-05-26 12:17 ` [PATCH 2/3] KVM: PPC: Book3S: Allow only implemented hcalls to be enabled or disabled Paul Mackerras
2014-05-26 12:17   ` Paul Mackerras
2014-05-28 13:30   ` Alexander Graf
2014-05-28 13:30     ` Alexander Graf
2014-05-26 12:17 ` [PATCH 3/3] KVM: PPC: Book3S HV: Add H_SET_MODE hcall handling Paul Mackerras
2014-05-26 12:17   ` Paul Mackerras
2014-05-28 13:35   ` Alexander Graf [this message]
2014-05-28 13:35     ` Alexander Graf
2014-05-29  5:47     ` Michael Neuling
2014-05-29  5:47       ` Michael Neuling
2014-05-29  6:22       ` [PATCH v2 " Michael Neuling
2014-05-29  6:22         ` Michael Neuling
2014-05-29  7:18         ` Alexander Graf
2014-05-29  7:18           ` Alexander Graf
2014-05-29  7:45           ` powerpc/pseries: Use new defines when calling h_set_mode Michael Neuling
2014-05-29  7:45             ` Michael Neuling
2014-05-29  7:45             ` Michael Neuling
2014-05-29 21:27             ` Alexander Graf
2014-05-29 21:27               ` Alexander Graf
2014-05-29 21:27               ` Alexander Graf
2014-05-29 21:52               ` Benjamin Herrenschmidt
2014-05-29 21:52                 ` Benjamin Herrenschmidt
2014-05-29 21:52                 ` Benjamin Herrenschmidt
2014-05-30  7:44                 ` Alexander Graf
2014-05-30  7:44                   ` Alexander Graf
2014-05-30  7:44                   ` Alexander Graf
2014-05-30  8:56             ` Michael Ellerman
2014-05-30  8:56               ` Michael Ellerman
2014-05-30  8:56               ` Michael Ellerman
2014-05-30  9:10               ` Michael Neuling
2014-05-30  9:10                 ` Michael Neuling
2014-05-30  9:10                 ` Michael Neuling
2014-05-30  9:13                 ` Alexander Graf
2014-05-30  9:13                   ` Alexander Graf
2014-05-30  9:13                   ` Alexander Graf
2014-05-30  9:44                   ` Michael Neuling
2014-05-30  9:44                     ` Michael Neuling
2014-05-30  9:44                     ` Alexander Graf
2014-05-30  9:44                       ` Alexander Graf
2014-05-30  9:44                       ` Alexander Graf
2014-05-31  7:21 ` [PATCH 0/3] New PAPR hypercall plus individual hypercall enables, v2 Paul Mackerras
2014-05-31  7:21   ` Paul Mackerras
2014-05-31  7:21   ` [PATCH 1/3] KVM: PPC: Book3S: Controls for in-kernel PAPR hypercall handling Paul Mackerras
2014-05-31  7:21     ` Paul Mackerras
2014-06-01  9:55     ` Alexander Graf
2014-06-01  9:55       ` Alexander Graf
2014-05-31  7:21   ` [PATCH 2/3] KVM: PPC: Book3S: Allow only implemented hcalls to be enabled or disabled Paul Mackerras
2014-05-31  7:21     ` Paul Mackerras
2014-05-31  7:21   ` [PATCH 3/3] KVM: PPC: Book3S HV: Add H_SET_MODE hcall handling Paul Mackerras
2014-05-31  7:21     ` Paul Mackerras
2014-06-01 10:01   ` [PATCH 0/3] New PAPR hypercall plus individual hypercall enables, v2 Alexander Graf
2014-06-01 10:01     ` Alexander Graf
2014-06-02  1:02 ` [PATCH 0/3] New PAPR hypercall plus individual hypercall enables, v3 Paul Mackerras
2014-06-02  1:02   ` Paul Mackerras
2014-06-02  1:02   ` [PATCH 1/3] KVM: PPC: Book3S: Controls for in-kernel sPAPR hypercall handling Paul Mackerras
2014-06-02  1:02     ` Paul Mackerras
2014-06-02  1:03   ` [PATCH 2/3] KVM: PPC: Book3S: Allow only implemented hcalls to be enabled or disabled Paul Mackerras
2014-06-02  1:03     ` Paul Mackerras
2014-06-02  1:03   ` [PATCH 3/3] KVM: PPC: Book3S HV: Add H_SET_MODE hcall handling Paul Mackerras
2014-06-02  1:03     ` Paul Mackerras
2014-06-25 21:46   ` [PATCH 0/3] New PAPR hypercall plus individual hypercall enables, v3 Alexander Graf
2014-06-25 21:46     ` Alexander Graf
2014-06-25 23:08     ` Paul Mackerras
2014-06-25 23:08       ` 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=5385E620.5090703@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 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.