]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
KVM: arm64: Propagate FGT masks to the nVHE hypervisor
authorMarc Zyngier <maz@kernel.org>
Fri, 24 Jan 2025 17:17:42 +0000 (17:17 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 6 May 2025 16:35:25 +0000 (17:35 +0100)
The nVHE hypervisor needs to have access to its own view of the FGT
masks, which unfortunately results in a bit of data duplication.

Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/nvhe/switch.c

index 95fedd27f4bb876526612406ecf09a2ef6e7698f..9e5164fad0dbc393f26a3b1d5af573934d29a7f7 100644 (file)
@@ -621,6 +621,13 @@ extern struct fgt_masks hdfgrtr_masks;
 extern struct fgt_masks hdfgwtr_masks;
 extern struct fgt_masks hafgrtr_masks;
 
+extern struct fgt_masks kvm_nvhe_sym(hfgrtr_masks);
+extern struct fgt_masks kvm_nvhe_sym(hfgwtr_masks);
+extern struct fgt_masks kvm_nvhe_sym(hfgitr_masks);
+extern struct fgt_masks kvm_nvhe_sym(hdfgrtr_masks);
+extern struct fgt_masks kvm_nvhe_sym(hdfgwtr_masks);
+extern struct fgt_masks kvm_nvhe_sym(hafgrtr_masks);
+
 struct kvm_cpu_context {
        struct user_pt_regs regs;       /* sp = sp_el0 */
 
index 68fec8c95feef96d6c73c4fdbc69729518c69b70..8951e8693ca7b21e54bd0dfa89631ec5d39cb90a 100644 (file)
@@ -2450,6 +2450,14 @@ static void kvm_hyp_init_symbols(void)
        kvm_nvhe_sym(__icache_flags) = __icache_flags;
        kvm_nvhe_sym(kvm_arm_vmid_bits) = kvm_arm_vmid_bits;
 
+       /* Propagate the FGT state to the the nVHE side */
+       kvm_nvhe_sym(hfgrtr_masks)  = hfgrtr_masks;
+       kvm_nvhe_sym(hfgwtr_masks)  = hfgwtr_masks;
+       kvm_nvhe_sym(hfgitr_masks)  = hfgitr_masks;
+       kvm_nvhe_sym(hdfgrtr_masks) = hdfgrtr_masks;
+       kvm_nvhe_sym(hdfgwtr_masks) = hdfgwtr_masks;
+       kvm_nvhe_sym(hafgrtr_masks) = hafgrtr_masks;
+
        /*
         * Flush entire BSS since part of its data containing init symbols is read
         * while the MMU is off.
index 7d2ba6ef026186e2e9f7eae48132c0ede4285c90..ae55d6d87e3d266a99648c2584ece32b27913e33 100644 (file)
@@ -33,6 +33,13 @@ DEFINE_PER_CPU(struct kvm_host_data, kvm_host_data);
 DEFINE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);
 DEFINE_PER_CPU(unsigned long, kvm_hyp_vector);
 
+struct fgt_masks hfgrtr_masks;
+struct fgt_masks hfgwtr_masks;
+struct fgt_masks hfgitr_masks;
+struct fgt_masks hdfgrtr_masks;
+struct fgt_masks hdfgwtr_masks;
+struct fgt_masks hafgrtr_masks;
+
 extern void kvm_nvhe_prepare_backtrace(unsigned long fp, unsigned long pc);
 
 static void __activate_cptr_traps(struct kvm_vcpu *vcpu)