* [PATCH] KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
@ 2019-05-30 2:17 ` Suraj Jitindar Singh
0 siblings, 0 replies; 4+ messages in thread
From: Suraj Jitindar Singh @ 2019-05-30 2:17 UTC (permalink / raw)
To: kvm-ppc; +Cc: paulus, kvm, Suraj Jitindar Singh
The sprgs are a set of 4 general purpose sprs provided for software use.
SPRG3 is special in that it can also be read from userspace. Thus it is
used on linux to store the cpu and numa id of the process to speed up
syscall access to this information.
This register is overwritten with the guest value on kvm guest entry,
and so needs to be restored on exit again. Thus restore the value on
the guest exit path in kvmhv_p9_guest_entry().
Fixes: 95a6432ce9038 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests")
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.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 ecbf66b3d2a4..4fdd7a7fe6a7 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3677,6 +3677,7 @@ out: kfree(hvregs);
vc->in_guest = 0;
mtspr(SPRN_DEC, local_paca->kvm_hstate.dec_expires - mftb());
+ mtspr(SPRN_SPRG_VDSO_WRITE, local_paca->sprg_vdso);
kvmhv_load_host_pmu();
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
@ 2019-05-30 2:17 ` Suraj Jitindar Singh
0 siblings, 0 replies; 4+ messages in thread
From: Suraj Jitindar Singh @ 2019-05-30 2:17 UTC (permalink / raw)
To: kvm-ppc; +Cc: paulus, kvm, Suraj Jitindar Singh
The sprgs are a set of 4 general purpose sprs provided for software use.
SPRG3 is special in that it can also be read from userspace. Thus it is
used on linux to store the cpu and numa id of the process to speed up
syscall access to this information.
This register is overwritten with the guest value on kvm guest entry,
and so needs to be restored on exit again. Thus restore the value on
the guest exit path in kvmhv_p9_guest_entry().
Fixes: 95a6432ce9038 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests")
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.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 ecbf66b3d2a4..4fdd7a7fe6a7 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -3677,6 +3677,7 @@ out: kfree(hvregs);
vc->in_guest = 0;
mtspr(SPRN_DEC, local_paca->kvm_hstate.dec_expires - mftb());
+ mtspr(SPRN_SPRG_VDSO_WRITE, local_paca->sprg_vdso);
kvmhv_load_host_pmu();
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
2019-05-30 2:17 ` Suraj Jitindar Singh
@ 2019-05-31 6:37 ` Paul Mackerras
-1 siblings, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2019-05-31 6:37 UTC (permalink / raw)
To: Suraj Jitindar Singh; +Cc: kvm-ppc, kvm
On Thu, May 30, 2019 at 12:17:18PM +1000, Suraj Jitindar Singh wrote:
> The sprgs are a set of 4 general purpose sprs provided for software use.
> SPRG3 is special in that it can also be read from userspace. Thus it is
> used on linux to store the cpu and numa id of the process to speed up
> syscall access to this information.
>
> This register is overwritten with the guest value on kvm guest entry,
> and so needs to be restored on exit again. Thus restore the value on
> the guest exit path in kvmhv_p9_guest_entry().
>
> Fixes: 95a6432ce9038 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests")
>
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Thanks, patch applied to my kvm-ppc-fixes branch.
Paul.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry()
@ 2019-05-31 6:37 ` Paul Mackerras
0 siblings, 0 replies; 4+ messages in thread
From: Paul Mackerras @ 2019-05-31 6:37 UTC (permalink / raw)
To: Suraj Jitindar Singh; +Cc: kvm-ppc, kvm
On Thu, May 30, 2019 at 12:17:18PM +1000, Suraj Jitindar Singh wrote:
> The sprgs are a set of 4 general purpose sprs provided for software use.
> SPRG3 is special in that it can also be read from userspace. Thus it is
> used on linux to store the cpu and numa id of the process to speed up
> syscall access to this information.
>
> This register is overwritten with the guest value on kvm guest entry,
> and so needs to be restored on exit again. Thus restore the value on
> the guest exit path in kvmhv_p9_guest_entry().
>
> Fixes: 95a6432ce9038 ("KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests")
>
> Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Thanks, patch applied to my kvm-ppc-fixes branch.
Paul.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-31 6:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-30 2:17 [PATCH] KVM: PPC: Book3S HV: Restore SPRG3 in kvmhv_p9_guest_entry() Suraj Jitindar Singh
2019-05-30 2:17 ` Suraj Jitindar Singh
2019-05-31 6:37 ` Paul Mackerras
2019-05-31 6:37 ` Paul Mackerras
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.