Skip to content

Commit 311ba55

Browse files
author
Marc Zyngier
committed
KVM: arm64: Propagate FGT masks to the nVHE hypervisor
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 <[email protected]>
1 parent ea266c7 commit 311ba55

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,13 @@ extern struct fgt_masks hdfgrtr_masks;
621621
extern struct fgt_masks hdfgwtr_masks;
622622
extern struct fgt_masks hafgrtr_masks;
623623

624+
extern struct fgt_masks kvm_nvhe_sym(hfgrtr_masks);
625+
extern struct fgt_masks kvm_nvhe_sym(hfgwtr_masks);
626+
extern struct fgt_masks kvm_nvhe_sym(hfgitr_masks);
627+
extern struct fgt_masks kvm_nvhe_sym(hdfgrtr_masks);
628+
extern struct fgt_masks kvm_nvhe_sym(hdfgwtr_masks);
629+
extern struct fgt_masks kvm_nvhe_sym(hafgrtr_masks);
630+
624631
struct kvm_cpu_context {
625632
struct user_pt_regs regs; /* sp = sp_el0 */
626633

arch/arm64/kvm/arm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,14 @@ static void kvm_hyp_init_symbols(void)
24502450
kvm_nvhe_sym(__icache_flags) = __icache_flags;
24512451
kvm_nvhe_sym(kvm_arm_vmid_bits) = kvm_arm_vmid_bits;
24522452

2453+
/* Propagate the FGT state to the the nVHE side */
2454+
kvm_nvhe_sym(hfgrtr_masks) = hfgrtr_masks;
2455+
kvm_nvhe_sym(hfgwtr_masks) = hfgwtr_masks;
2456+
kvm_nvhe_sym(hfgitr_masks) = hfgitr_masks;
2457+
kvm_nvhe_sym(hdfgrtr_masks) = hdfgrtr_masks;
2458+
kvm_nvhe_sym(hdfgwtr_masks) = hdfgwtr_masks;
2459+
kvm_nvhe_sym(hafgrtr_masks) = hafgrtr_masks;
2460+
24532461
/*
24542462
* Flush entire BSS since part of its data containing init symbols is read
24552463
* while the MMU is off.

arch/arm64/kvm/hyp/nvhe/switch.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ DEFINE_PER_CPU(struct kvm_host_data, kvm_host_data);
3333
DEFINE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);
3434
DEFINE_PER_CPU(unsigned long, kvm_hyp_vector);
3535

36+
struct fgt_masks hfgrtr_masks;
37+
struct fgt_masks hfgwtr_masks;
38+
struct fgt_masks hfgitr_masks;
39+
struct fgt_masks hdfgrtr_masks;
40+
struct fgt_masks hdfgwtr_masks;
41+
struct fgt_masks hafgrtr_masks;
42+
3643
extern void kvm_nvhe_prepare_backtrace(unsigned long fp, unsigned long pc);
3744

3845
static void __activate_cptr_traps(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)