Thread (23 messages) 23 messages, 3 authors, 2023-12-21

Re: [PATCH 09/12] KVM: PPC: Book3S HV nestedv2: Do not call H_COPY_TOFROM_GUEST

From: "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>
Date: 2023-12-11 04:02:21
Also in: kvm

On 12/11/23 9:26 AM, Vaibhav Jain wrote:
Hi Aneesh,

Thanks for looking into this patch. My responses inline:

"Aneesh Kumar K.V (IBM)" [off-list ref] writes:

<snip>
quoted
May be we should use 
firmware_has_feature(FW_FEATURE_H_COPY_TOFROM_GUEST))?

the nestedv2 can end up using the above hcall if it is supported by
the hypervisor right? In its absence we will have to translate the
guest ea using xlate and then use kvm_guest_read to read location
using the guest real address right? That xlate will also involves
multiple kvm_guest_read.
Yes, Agreed and thats a nice suggestion. However ATM the hypervisor 
supporting Nestedv2 doesnt have support for this hcall. In future
once we have support for this hcall for nestedv2 from the hypervisor
we can replace this branch with a firmware_has_feature() test.
What I am suggesting is we convert that conditional to firmware_has_feature so that
later when hypervisor supports this hcall all older kernel can make
use of the copy_tofrom_guest without any code change.
quoted
quoted
Signed-off-by: Jordan Niethe <redacted> --- 
arch/powerpc/kvm/book3s_64_mmu_radix.c | 3 +++ 1 file changed, 3
insertions(+)
diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c
b/arch/powerpc/kvm/book3s_64_mmu_radix.c index
916af6c153a5..4a1abb9f7c05 100644 ---
a/arch/powerpc/kvm/book3s_64_mmu_radix.c +++
b/arch/powerpc/kvm/book3s_64_mmu_radix.c @@ -40,6 +40,9 @@
unsigned long __kvmhv_copy_tofrom_guest_radix(int lpid, int pid, 
unsigned long quadrant, ret = n; bool is_load = !!to;

+	if (kvmhv_is_nestedv2()) +		return H_UNSUPPORTED; + /* Can't
access quadrants 1 or 2 in non-HV mode, call the HV to do it */ 
if (kvmhv_on_pseries()) return
plpar_hcall_norets(H_COPY_TOFROM_GUEST, lpid, pid, eaddr, -- 
2.42.0
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help