Commit f5c847ea authored by Fabiano Rosas's avatar Fabiano Rosas Committed by Michael Ellerman

KVM: PPC: Align pt_regs in kvm_vcpu_arch structure

The H_ENTER_NESTED hypercall receives as second parameter the address
of a region of memory containing the values for the nested guest
privileged registers. We currently use the pt_regs structure contained
within kvm_vcpu_arch for that end.

Most hypercalls that receive a memory address expect that region to
not cross a 4K page boundary. We would want H_ENTER_NESTED to follow
the same pattern so this patch ensures the pt_regs structure sits
within a page.

Note: the pt_regs structure is currently 384 bytes in size, so
aligning to 512 is sufficient to ensure it will not cross a 4K page
and avoids punching too big a hole in struct kvm_vcpu_arch.
Signed-off-by: default avatarFabiano Rosas <farosas@linux.ibm.com>
Signed-off-by: default avatarMurilo Opsfelder Araújo <muriloo@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220624142712.790491-1-farosas@linux.ibm.com
parent 0df01238
......@@ -523,7 +523,11 @@ struct kvm_vcpu_arch {
struct kvmppc_book3s_shadow_vcpu *shadow_vcpu;
#endif
struct pt_regs regs;
/*
* This is passed along to the HV via H_ENTER_NESTED. Align to
* prevent it crossing a real 4K page.
*/
struct pt_regs regs __aligned(512);
struct thread_fp_state fp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment