All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/5] KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode
@ 2019-05-20  0:56 Nicholas Piggin
  2019-06-17  5:58 ` Paul Mackerras
  2019-06-19  3:09 ` Nicholas Piggin
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2019-05-20  0:56 UTC (permalink / raw)
  To: kvm-ppc

AIL=2 mode has no known users, so is not well tested or supported.
Disallow guests from selecting this mode because it may become
deprecated in future versions of the architecture.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kvm/book3s_hv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 36d16740748a..4295ccdbee26 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -784,6 +784,11 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
 		vcpu->arch.dawr  = value1;
 		vcpu->arch.dawrx = value2;
 		return H_SUCCESS;
+	case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
+		/* KVM does not support mflags=2 (AIL=2) */
+		if (mflags != 0 && mflags != 3)
+			return H_UNSUPPORTED_FLAG_START;
+		return H_TOO_HARD;
 	default:
 		return H_TOO_HARD;
 	}
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/5] KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode
  2019-05-20  0:56 [PATCH 5/5] KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode Nicholas Piggin
@ 2019-06-17  5:58 ` Paul Mackerras
  2019-06-19  3:09 ` Nicholas Piggin
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Mackerras @ 2019-06-17  5:58 UTC (permalink / raw)
  To: kvm-ppc

On Mon, May 20, 2019 at 10:56:59AM +1000, Nicholas Piggin wrote:
> AIL=2 mode has no known users, so is not well tested or supported.
> Disallow guests from selecting this mode because it may become
> deprecated in future versions of the architecture.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Given that H_SET_MODE_RESOURCE_ADDR_TRANS_MODE gets punted to
userspace (QEMU), why are we enforcing this here rather than in QEMU?

If there is a reason to do this here rather than in QEMU, then the
patch description should really comment on why we're rejecting AIL=1
as well as AIL=2.

> ---
>  arch/powerpc/kvm/book3s_hv.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 36d16740748a..4295ccdbee26 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -784,6 +784,11 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
>  		vcpu->arch.dawr  = value1;
>  		vcpu->arch.dawrx = value2;
>  		return H_SUCCESS;
> +	case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
> +		/* KVM does not support mflags=2 (AIL=2) */
> +		if (mflags != 0 && mflags != 3)
> +			return H_UNSUPPORTED_FLAG_START;
> +		return H_TOO_HARD;
>  	default:
>  		return H_TOO_HARD;
>  	}
> -- 
> 2.20.1

Paul.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/5] KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode
  2019-05-20  0:56 [PATCH 5/5] KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode Nicholas Piggin
  2019-06-17  5:58 ` Paul Mackerras
@ 2019-06-19  3:09 ` Nicholas Piggin
  1 sibling, 0 replies; 3+ messages in thread
From: Nicholas Piggin @ 2019-06-19  3:09 UTC (permalink / raw)
  To: kvm-ppc

Paul Mackerras's on June 17, 2019 3:58 pm:
> On Mon, May 20, 2019 at 10:56:59AM +1000, Nicholas Piggin wrote:
>> AIL=2 mode has no known users, so is not well tested or supported.
>> Disallow guests from selecting this mode because it may become
>> deprecated in future versions of the architecture.
>> 
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> 
> Given that H_SET_MODE_RESOURCE_ADDR_TRANS_MODE gets punted to
> userspace (QEMU), why are we enforcing this here rather than in QEMU?

QEMU (appears to) support AIL=2. I don't propose to remove that
support (which could in theory be a regression for users). It
can't have ever worked properly for KVM guests though AFAIKS. Is
that reasonable?

> If there is a reason to do this here rather than in QEMU, then the
> patch description should really comment on why we're rejecting AIL=1
> as well as AIL=2.

Sure.

Thanks for review of the other patches as well, I think all your
points were valid so I'll fix them up before reposting.

Thanks,
Nick

> 
>> ---
>>  arch/powerpc/kvm/book3s_hv.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>> index 36d16740748a..4295ccdbee26 100644
>> --- a/arch/powerpc/kvm/book3s_hv.c
>> +++ b/arch/powerpc/kvm/book3s_hv.c
>> @@ -784,6 +784,11 @@ static int kvmppc_h_set_mode(struct kvm_vcpu *vcpu, unsigned long mflags,
>>  		vcpu->arch.dawr  = value1;
>>  		vcpu->arch.dawrx = value2;
>>  		return H_SUCCESS;
>> +	case H_SET_MODE_RESOURCE_ADDR_TRANS_MODE:
>> +		/* KVM does not support mflags=2 (AIL=2) */
>> +		if (mflags != 0 && mflags != 3)
>> +			return H_UNSUPPORTED_FLAG_START;
>> +		return H_TOO_HARD;
>>  	default:
>>  		return H_TOO_HARD;
>>  	}
>> -- 
>> 2.20.1
> 
> Paul.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-19  3:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-20  0:56 [PATCH 5/5] KVM: PPC: Book3S HV: Reject mflags=2 (LPCR[AIL]=2) ADDR_TRANS_MODE mode Nicholas Piggin
2019-06-17  5:58 ` Paul Mackerras
2019-06-19  3:09 ` Nicholas Piggin

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.