linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry
@ 2022-04-25 14:21 Fabiano Rosas
  2022-04-28  4:12 ` Nicholas Piggin
  2022-05-24 10:51 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: Fabiano Rosas @ 2022-04-25 14:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: npiggin, kvm-ppc

The hypervisor always sets AMOR to ~0, but let's ensure we're not
passing stale values around.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
 arch/powerpc/kvm/book3s_hv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 6fa518f6501d..b5f504576765 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3967,6 +3967,7 @@ static int kvmhv_vcpu_entry_p9_nested(struct kvm_vcpu *vcpu, u64 time_limit, uns
 
 	kvmhv_save_hv_regs(vcpu, &hvregs);
 	hvregs.lpcr = lpcr;
+	hvregs.amor = ~0;
 	vcpu->arch.regs.msr = vcpu->arch.shregs.msr;
 	hvregs.version = HV_GUEST_STATE_VERSION;
 	if (vcpu->arch.nested) {
-- 
2.35.1


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

* Re: [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry
  2022-04-25 14:21 [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry Fabiano Rosas
@ 2022-04-28  4:12 ` Nicholas Piggin
  2022-04-28 16:37   ` Fabiano Rosas
  2022-05-24 10:51 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Nicholas Piggin @ 2022-04-28  4:12 UTC (permalink / raw)
  To: Fabiano Rosas, linuxppc-dev; +Cc: kvm-ppc

Excerpts from Fabiano Rosas's message of April 26, 2022 12:21 am:
> The hypervisor always sets AMOR to ~0, but let's ensure we're not
> passing stale values around.
> 

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>

Looks like our L0 doesn't do anything with hvregs.amor ?

Thanks,
Nick

> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
>  arch/powerpc/kvm/book3s_hv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 6fa518f6501d..b5f504576765 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -3967,6 +3967,7 @@ static int kvmhv_vcpu_entry_p9_nested(struct kvm_vcpu *vcpu, u64 time_limit, uns
>  
>  	kvmhv_save_hv_regs(vcpu, &hvregs);
>  	hvregs.lpcr = lpcr;
> +	hvregs.amor = ~0;
>  	vcpu->arch.regs.msr = vcpu->arch.shregs.msr;
>  	hvregs.version = HV_GUEST_STATE_VERSION;
>  	if (vcpu->arch.nested) {
> -- 
> 2.35.1
> 
> 

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

* Re: [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry
  2022-04-28  4:12 ` Nicholas Piggin
@ 2022-04-28 16:37   ` Fabiano Rosas
  0 siblings, 0 replies; 4+ messages in thread
From: Fabiano Rosas @ 2022-04-28 16:37 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: kvm-ppc

Nicholas Piggin <npiggin@gmail.com> writes:

> Excerpts from Fabiano Rosas's message of April 26, 2022 12:21 am:
>> The hypervisor always sets AMOR to ~0, but let's ensure we're not
>> passing stale values around.
>> 
>
> Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
>
> Looks like our L0 doesn't do anything with hvregs.amor ?

It doesn't. And if the HV ever starts clearing bits from AMOR, then we
would need to change any kernel code that writes and reads from AMR (
such as the KUAP) to take into consideration that we might read a
different value from what we wrote.

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

* Re: [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry
  2022-04-25 14:21 [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry Fabiano Rosas
  2022-04-28  4:12 ` Nicholas Piggin
@ 2022-05-24 10:51 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2022-05-24 10:51 UTC (permalink / raw)
  To: Fabiano Rosas, linuxppc-dev; +Cc: kvm-ppc, npiggin

On Mon, 25 Apr 2022 11:21:51 -0300, Fabiano Rosas wrote:
> The hypervisor always sets AMOR to ~0, but let's ensure we're not
> passing stale values around.
> 
> 

Applied to powerpc/topic/ppc-kvm.

[1/1] KVM: PPC: Book3S HV: Initialize AMOR in nested entry
      https://git.kernel.org/powerpc/c/1d1cd0f12a3ab5d7f79ae6cca28e7d23dd351ce3

cheers

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

end of thread, other threads:[~2022-05-24 10:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-25 14:21 [PATCH] KVM: PPC: Book3S HV: Initialize AMOR in nested entry Fabiano Rosas
2022-04-28  4:12 ` Nicholas Piggin
2022-04-28 16:37   ` Fabiano Rosas
2022-05-24 10:51 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).