mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
KVM: arm64: Introduce data structure tracking both RES0 and RES1 bits
We have so far mostly tracked RES0 bits, but only made a few attempts at being just as strict for RES1 bits (probably because they are both rarer and harder to handle). Start scratching the surface by introducing a data structure tracking RES0 and RES1 bits at the same time. Note that contrary to the usual idiom, this structure is mostly passed around by value -- the ABI handles it nicely, and the resulting code is much nicer. Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> Link: https://patch.msgid.link/20260202184329.2724080-5-maz@kernel.org Signed-off-by: Marc Zyngier <maz@kernel.org>
This commit is contained in:
@@ -626,13 +626,24 @@ enum vcpu_sysreg {
|
||||
NR_SYS_REGS /* Nothing after this line! */
|
||||
};
|
||||
|
||||
struct kvm_sysreg_masks {
|
||||
struct {
|
||||
u64 res0;
|
||||
u64 res1;
|
||||
} mask[NR_SYS_REGS - __SANITISED_REG_START__];
|
||||
struct resx {
|
||||
u64 res0;
|
||||
u64 res1;
|
||||
};
|
||||
|
||||
struct kvm_sysreg_masks {
|
||||
struct resx mask[NR_SYS_REGS - __SANITISED_REG_START__];
|
||||
};
|
||||
|
||||
static inline void __kvm_set_sysreg_resx(struct kvm_arch *arch,
|
||||
enum vcpu_sysreg sr, struct resx resx)
|
||||
{
|
||||
arch->sysreg_masks->mask[sr - __SANITISED_REG_START__] = resx;
|
||||
}
|
||||
|
||||
#define kvm_set_sysreg_resx(k, sr, resx) \
|
||||
__kvm_set_sysreg_resx(&(k)->arch, (sr), (resx))
|
||||
|
||||
struct fgt_masks {
|
||||
const char *str;
|
||||
u64 mask;
|
||||
@@ -1607,7 +1618,7 @@ static inline bool kvm_arch_has_irq_bypass(void)
|
||||
}
|
||||
|
||||
void compute_fgu(struct kvm *kvm, enum fgt_group_id fgt);
|
||||
void get_reg_fixed_bits(struct kvm *kvm, enum vcpu_sysreg reg, u64 *res0, u64 *res1);
|
||||
struct resx get_reg_fixed_bits(struct kvm *kvm, enum vcpu_sysreg reg);
|
||||
void check_feature_map(void);
|
||||
void kvm_vcpu_load_fgt(struct kvm_vcpu *vcpu);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user