public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [V4 PATCH 0/4] Execute hypercalls according to host cpu
@ 2022-12-28 19:24 Vishal Annapurve
  2022-12-28 19:24 ` [V4 PATCH 1/4] KVM: selftests: x86: use this_cpu_* helpers Vishal Annapurve
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Vishal Annapurve @ 2022-12-28 19:24 UTC (permalink / raw)
  To: x86, kvm, linux-kernel, linux-kselftest
  Cc: pbonzini, shuah, bgardon, seanjc, oupton, peterx, vkuznets,
	dmatlack, Vishal Annapurve

Confidential VMs(CVMs) need to execute hypercall instruction as per the CPU
type. Normally KVM emulates the vmcall/vmmcall instruction by patching
the guest code at runtime. Such a guest memory manipulation by KVM is
not allowed with CVMs and is also undesirable in general.

This series adds support of executing hypercall as per the host cpu
type queried using cpuid instruction. CPU vendor type is stored early
during selftest setup and guest setup to be reused later.

Changes in v4:
1) Incoporated suggestions from Sean -
  * Added APIs to query host cpu type
  * Shared the host cpu type with guests to avoid querying the cpu type
    again
  * Modified kvm_hypercall to execute vmcall/vmmcall according to host
    cpu type.
2) Dropped the separate API for kvm_hypercall.

v3:
https://lore.kernel.org/lkml/20221222230458.3828342-1-vannapurve@google.com/

Vishal Annapurve (4):
  KVM: selftests: x86: use this_cpu_* helpers
  KVM: selftests: x86: Add variables to store cpu type
  KVM: sefltests: x86: Replace is_*cpu with is_host_*cpu
  KVM: selftests: x86: Invoke kvm hypercall as per host cpu

 .../selftests/kvm/include/x86_64/processor.h  | 26 ++++++++++-
 .../selftests/kvm/lib/x86_64/processor.c      | 44 ++++++++++---------
 .../selftests/kvm/x86_64/fix_hypercall_test.c |  4 +-
 .../selftests/kvm/x86_64/mmio_warning_test.c  |  2 +-
 .../kvm/x86_64/pmu_event_filter_test.c        |  4 +-
 .../vmx_exception_with_invalid_guest_state.c  |  2 +-
 6 files changed, 54 insertions(+), 28 deletions(-)

-- 
2.39.0.314.g84b9a713c41-goog


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

end of thread, other threads:[~2023-01-11  0:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-28 19:24 [V4 PATCH 0/4] Execute hypercalls according to host cpu Vishal Annapurve
2022-12-28 19:24 ` [V4 PATCH 1/4] KVM: selftests: x86: use this_cpu_* helpers Vishal Annapurve
2023-01-09 18:07   ` Sean Christopherson
2023-01-10 23:56     ` Vishal Annapurve
2022-12-28 19:24 ` [V4 PATCH 2/4] KVM: selftests: x86: Add variables to store cpu type Vishal Annapurve
2023-01-09 18:13   ` Sean Christopherson
2023-01-11  0:13     ` Vishal Annapurve
2022-12-28 19:24 ` [V4 PATCH 3/4] KVM: sefltests: x86: Replace is_*cpu with is_host_*cpu Vishal Annapurve
2022-12-28 19:24 ` [V4 PATCH 4/4] KVM: selftests: x86: Invoke kvm hypercall as per host cpu Vishal Annapurve
2023-01-09 18:20   ` Sean Christopherson
2023-01-11  0:18     ` Vishal Annapurve
2023-01-04 19:32 ` [V4 PATCH 0/4] Execute hypercalls according to " David Matlack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox