diff options
author | Jordan Niethe <jniethe5@gmail.com> | 2023-12-01 16:26:15 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-12-07 15:33:08 +0300 |
commit | db1dcfae1dae3c042f348175ac0394e2fc14b1b3 (patch) | |
tree | 3c06618993bb67d475199bbd59ba54f36c31edca /arch/powerpc/kvm/book3s_hv_nestedv2.c | |
parent | 4bc8ff6f170c78f64446c5d5f9ef6771eefd3416 (diff) | |
download | linux-db1dcfae1dae3c042f348175ac0394e2fc14b1b3.tar.xz |
KVM: PPC: Book3S HV nestedv2: Register the VPA with the L0
In the nestedv2 case, the L1 may register the L2's VPA with the L0. This
allows the L0 to manage the L2's dispatch count, as well as enable
possible performance optimisations by seeing if certain resources are
not being used by the L2 (such as the PMCs).
Use the H_GUEST_SET_STATE call to inform the L0 of the L2's VPA
address. This can not be done in the H_GUEST_VCPU_RUN input buffer.
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231201132618.555031-11-vaibhav@linux.ibm.com
Diffstat (limited to 'arch/powerpc/kvm/book3s_hv_nestedv2.c')
-rw-r--r-- | arch/powerpc/kvm/book3s_hv_nestedv2.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/book3s_hv_nestedv2.c b/arch/powerpc/kvm/book3s_hv_nestedv2.c index fd3c4f2d9480..5378eb40b162 100644 --- a/arch/powerpc/kvm/book3s_hv_nestedv2.c +++ b/arch/powerpc/kvm/book3s_hv_nestedv2.c @@ -856,6 +856,35 @@ free_gsb: EXPORT_SYMBOL_GPL(kvmhv_nestedv2_set_ptbl_entry); /** + * kvmhv_nestedv2_set_vpa() - register L2 VPA with L0 + * @vcpu: vcpu + * @vpa: L1 logical real address + */ +int kvmhv_nestedv2_set_vpa(struct kvm_vcpu *vcpu, unsigned long vpa) +{ + struct kvmhv_nestedv2_io *io; + struct kvmppc_gs_buff *gsb; + int rc = 0; + + io = &vcpu->arch.nestedv2_io; + gsb = io->vcpu_run_input; + + kvmppc_gsb_reset(gsb); + rc = kvmppc_gse_put_u64(gsb, KVMPPC_GSID_VPA, vpa); + if (rc < 0) + goto out; + + rc = kvmppc_gsb_send(gsb, 0); + if (rc < 0) + pr_err("KVM-NESTEDv2: couldn't register the L2 VPA (rc=%d)\n", rc); + +out: + kvmppc_gsb_reset(gsb); + return rc; +} +EXPORT_SYMBOL_GPL(kvmhv_nestedv2_set_vpa); + +/** * kvmhv_nestedv2_parse_output() - receive values from H_GUEST_RUN_VCPU output * @vcpu: vcpu * |