]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
Merge branch kvm-arm64/pkvm-np-guest into kvmarm-master/next
authorMarc Zyngier <maz@kernel.org>
Sun, 12 Jan 2025 10:37:15 +0000 (10:37 +0000)
committerMarc Zyngier <maz@kernel.org>
Sun, 12 Jan 2025 10:37:15 +0000 (10:37 +0000)
* kvm-arm64/pkvm-np-guest:
  : .
  : pKVM support for non-protected guests using the standard MM
  : infrastructure, courtesy of Quentin Perret. From the cover letter:
  :
  : "This series moves the stage-2 page-table management of non-protected
  : guests to EL2 when pKVM is enabled. This is only intended as an
  : incremental step towards a 'feature-complete' pKVM, there is however a
  : lot more that needs to come on top.
  :
  : With that series applied, pKVM provides near-parity with standard KVM
  : from a functional perspective all while Linux no longer touches the
  : stage-2 page-tables itself at EL1. The majority of mm-related KVM
  : features work out of the box, including MMU notifiers, dirty logging,
  : RO memslots and things of that nature. There are however two gotchas:
  :
  :  - We don't support mapping devices into guests: this requires
  :    additional hypervisor support for tracking the 'state' of devices,
  :    which will come in a later series. No device assignment until then.
  :
  :  - Stage-2 mappings are forced to page-granularity even when backed by a
  :    huge page for the sake of simplicity of this series. I'm only aiming
  :    at functional parity-ish (from userspace's PoV) for now, support for
  :    HP can be added on top later as a perf improvement."
  : .
  KVM: arm64: Plumb the pKVM MMU in KVM
  KVM: arm64: Introduce the EL1 pKVM MMU
  KVM: arm64: Introduce __pkvm_tlb_flush_vmid()
  KVM: arm64: Introduce __pkvm_host_mkyoung_guest()
  KVM: arm64: Introduce __pkvm_host_test_clear_young_guest()
  KVM: arm64: Introduce __pkvm_host_wrprotect_guest()
  KVM: arm64: Introduce __pkvm_host_relax_guest_perms()
  KVM: arm64: Introduce __pkvm_host_unshare_guest()
  KVM: arm64: Introduce __pkvm_host_share_guest()
  KVM: arm64: Introduce __pkvm_vcpu_{load,put}()
  KVM: arm64: Add {get,put}_pkvm_hyp_vm() helpers
  KVM: arm64: Make kvm_pgtable_stage2_init() a static inline function
  KVM: arm64: Pass walk flags to kvm_pgtable_stage2_relax_perms
  KVM: arm64: Pass walk flags to kvm_pgtable_stage2_mkyoung
  KVM: arm64: Move host page ownership tracking to the hyp vmemmap
  KVM: arm64: Make hyp_page::order a u8
  KVM: arm64: Move enum pkvm_page_state to memory.h
  KVM: arm64: Change the layout of enum pkvm_page_state

Signed-off-by: Marc Zyngier <maz@kernel.org>
# Conflicts:
# arch/arm64/kvm/arm.c

1  2 
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/nvhe/hyp-main.c

Simple merge
Simple merge
index 563cd0b626b91d6008904eb829a331b2216e4e24,9bcbc7b8ed38ec24bde333da45956156a75a6a2d..51e4ba6eb5c2e181b8de38aab4d0eaad94d8c859
@@@ -616,13 -624,29 +623,27 @@@ nommu
  
        vcpu_set_pauth_traps(vcpu);
  
 -      kvm_arch_vcpu_load_debug_state_flags(vcpu);
 -
+       if (is_protected_kvm_enabled()) {
+               kvm_call_hyp_nvhe(__pkvm_vcpu_load,
+                                 vcpu->kvm->arch.pkvm.handle,
+                                 vcpu->vcpu_idx, vcpu->arch.hcr_el2);
+               kvm_call_hyp(__vgic_v3_restore_vmcr_aprs,
+                            &vcpu->arch.vgic_cpu.vgic_v3);
+       }
        if (!cpumask_test_cpu(cpu, vcpu->kvm->arch.supported_cpus))
                vcpu_set_on_unsupported_cpu(vcpu);
  }
  
  void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
  {
 -      kvm_arch_vcpu_put_debug_state_flags(vcpu);
+       if (is_protected_kvm_enabled()) {
+               kvm_call_hyp(__vgic_v3_save_vmcr_aprs,
+                            &vcpu->arch.vgic_cpu.vgic_v3);
+               kvm_call_hyp_nvhe(__pkvm_vcpu_put);
+       }
 +      kvm_vcpu_put_debug(vcpu);
        kvm_arch_vcpu_put_fp(vcpu);
        if (has_vhe())
                kvm_vcpu_put_vhe(vcpu);
Simple merge