KVM
Macros | Functions
fixed_config.h File Reference
#include <asm/sysreg.h>
Include dependency graph for fixed_config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PVM_ID_AA64PFR0_ALLOW
 
#define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED
 
#define PVM_ID_AA64PFR1_ALLOW
 
#define PVM_ID_AA64PFR2_ALLOW   0ULL
 
#define PVM_ID_AA64MMFR0_ALLOW
 
#define PVM_ID_AA64MMFR0_RESTRICT_UNSIGNED
 
#define PVM_ID_AA64MMFR1_ALLOW
 
#define PVM_ID_AA64MMFR2_ALLOW
 
#define PVM_ID_AA64MMFR3_ALLOW   (0ULL)
 
#define PVM_ID_AA64ZFR0_ALLOW   (0ULL)
 
#define PVM_ID_AA64DFR0_ALLOW   (0ULL)
 
#define PVM_ID_AA64DFR1_ALLOW   (0ULL)
 
#define PVM_ID_AA64AFR0_ALLOW   (0ULL)
 
#define PVM_ID_AA64AFR1_ALLOW   (0ULL)
 
#define PVM_ID_AA64ISAR0_ALLOW
 
#define PVM_ID_AA64ISAR1_RESTRICT_UNSIGNED
 
#define PVM_ID_AA64ISAR2_RESTRICT_UNSIGNED
 
#define PVM_ID_AA64ISAR1_ALLOW
 
#define PVM_ID_AA64ISAR2_ALLOW
 

Functions

u64 pvm_read_id_reg (const struct kvm_vcpu *vcpu, u32 id)
 
bool kvm_handle_pvm_sysreg (struct kvm_vcpu *vcpu, u64 *exit_code)
 
bool kvm_handle_pvm_restricted (struct kvm_vcpu *vcpu, u64 *exit_code)
 
int kvm_check_pvm_sysreg_table (void)
 

Macro Definition Documentation

◆ PVM_ID_AA64AFR0_ALLOW

#define PVM_ID_AA64AFR0_ALLOW   (0ULL)

Definition at line 164 of file fixed_config.h.

◆ PVM_ID_AA64AFR1_ALLOW

#define PVM_ID_AA64AFR1_ALLOW   (0ULL)

Definition at line 165 of file fixed_config.h.

◆ PVM_ID_AA64DFR0_ALLOW

#define PVM_ID_AA64DFR0_ALLOW   (0ULL)

Definition at line 158 of file fixed_config.h.

◆ PVM_ID_AA64DFR1_ALLOW

#define PVM_ID_AA64DFR1_ALLOW   (0ULL)

Definition at line 159 of file fixed_config.h.

◆ PVM_ID_AA64ISAR0_ALLOW

#define PVM_ID_AA64ISAR0_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_AES) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_SHA1) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_SHA2) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_CRC32) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_ATOMIC) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_RDM) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_SHA3) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_SM3) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_SM4) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_DP) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_FHM) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_TS) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_TLB) | \
ARM64_FEATURE_MASK(ID_AA64ISAR0_EL1_RNDR) \
)

Definition at line 170 of file fixed_config.h.

◆ PVM_ID_AA64ISAR1_ALLOW

#define PVM_ID_AA64ISAR1_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_DPB) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_JSCVT) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_FCMA) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_LRCPC) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_GPA) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_GPI) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_FRINTTS) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_SB) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_SPECRES) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_BF16) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_DGH) | \
ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_I8MM) \
)

Definition at line 197 of file fixed_config.h.

◆ PVM_ID_AA64ISAR1_RESTRICT_UNSIGNED

#define PVM_ID_AA64ISAR1_RESTRICT_UNSIGNED
Value:
(\
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_APA), ID_AA64ISAR1_EL1_APA_PAuth) | \
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64ISAR1_EL1_API), ID_AA64ISAR1_EL1_API_PAuth) \
)

Definition at line 188 of file fixed_config.h.

◆ PVM_ID_AA64ISAR2_ALLOW

#define PVM_ID_AA64ISAR2_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64ISAR2_EL1_ATS1A)| \
ARM64_FEATURE_MASK(ID_AA64ISAR2_EL1_GPA3) | \
ARM64_FEATURE_MASK(ID_AA64ISAR2_EL1_MOPS) \
)

Definition at line 212 of file fixed_config.h.

◆ PVM_ID_AA64ISAR2_RESTRICT_UNSIGNED

#define PVM_ID_AA64ISAR2_RESTRICT_UNSIGNED
Value:
(\
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64ISAR2_EL1_APA3), ID_AA64ISAR2_EL1_APA3_PAuth) \
)

Definition at line 193 of file fixed_config.h.

◆ PVM_ID_AA64MMFR0_ALLOW

#define PVM_ID_AA64MMFR0_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64MMFR0_EL1_BIGEND) | \
ARM64_FEATURE_MASK(ID_AA64MMFR0_EL1_SNSMEM) | \
ARM64_FEATURE_MASK(ID_AA64MMFR0_EL1_BIGENDEL0) | \
ARM64_FEATURE_MASK(ID_AA64MMFR0_EL1_EXS) \
)

Definition at line 81 of file fixed_config.h.

◆ PVM_ID_AA64MMFR0_RESTRICT_UNSIGNED

#define PVM_ID_AA64MMFR0_RESTRICT_UNSIGNED
Value:
(\
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64MMFR0_EL1_PARANGE), ID_AA64MMFR0_EL1_PARANGE_40) | \
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64MMFR0_EL1_ASIDBITS), ID_AA64MMFR0_EL1_ASIDBITS_16) \
)

Definition at line 93 of file fixed_config.h.

◆ PVM_ID_AA64MMFR1_ALLOW

#define PVM_ID_AA64MMFR1_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_HAFDBS) | \
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_VMIDBits) | \
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_HPDS) | \
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_PAN) | \
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_SpecSEI) | \
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_ETS) | \
ARM64_FEATURE_MASK(ID_AA64MMFR1_EL1_CMOW) \
)

Definition at line 108 of file fixed_config.h.

◆ PVM_ID_AA64MMFR2_ALLOW

#define PVM_ID_AA64MMFR2_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_CnP) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_UAO) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_IESB) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_AT) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_IDS) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_TTL) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_BBM) | \
ARM64_FEATURE_MASK(ID_AA64MMFR2_EL1_E0PD) \
)

Definition at line 129 of file fixed_config.h.

◆ PVM_ID_AA64MMFR3_ALLOW

#define PVM_ID_AA64MMFR3_ALLOW   (0ULL)

Definition at line 140 of file fixed_config.h.

◆ PVM_ID_AA64PFR0_ALLOW

#define PVM_ID_AA64PFR0_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_FP) | \
ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_AdvSIMD) | \
ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_DIT) | \
ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_CSV2) | \
ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_CSV3) \
)

Definition at line 38 of file fixed_config.h.

◆ PVM_ID_AA64PFR0_RESTRICT_UNSIGNED

#define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED
Value:
(\
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \
FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_RAS), ID_AA64PFR0_EL1_RAS_IMP) \
)

Definition at line 54 of file fixed_config.h.

◆ PVM_ID_AA64PFR1_ALLOW

#define PVM_ID_AA64PFR1_ALLOW
Value:
(\
ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_BT) | \
ARM64_FEATURE_MASK(ID_AA64PFR1_EL1_SSBS) \
)

Definition at line 67 of file fixed_config.h.

◆ PVM_ID_AA64PFR2_ALLOW

#define PVM_ID_AA64PFR2_ALLOW   0ULL

Definition at line 72 of file fixed_config.h.

◆ PVM_ID_AA64ZFR0_ALLOW

#define PVM_ID_AA64ZFR0_ALLOW   (0ULL)

Definition at line 147 of file fixed_config.h.

Function Documentation

◆ kvm_check_pvm_sysreg_table()

int kvm_check_pvm_sysreg_table ( void  )

Definition at line 456 of file sys_regs.c.

457 {
458  unsigned int i;
459 
460  for (i = 1; i < ARRAY_SIZE(pvm_sys_reg_descs); i++) {
461  if (cmp_sys_reg(&pvm_sys_reg_descs[i-1], &pvm_sys_reg_descs[i]) >= 0)
462  return 1;
463  }
464 
465  return 0;
466 }
static const struct sys_reg_desc pvm_sys_reg_descs[]
Definition: sys_regs.c:344
static int cmp_sys_reg(const struct sys_reg_desc *i1, const struct sys_reg_desc *i2)
Definition: sys_regs.h:189
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kvm_handle_pvm_restricted()

bool kvm_handle_pvm_restricted ( struct kvm_vcpu *  vcpu,
u64 *  exit_code 
)

Definition at line 512 of file sys_regs.c.

513 {
514  inject_undef64(vcpu);
515  return true;
516 }
static void inject_undef64(struct kvm_vcpu *vcpu)
Definition: sys_regs.c:35
Here is the call graph for this function:

◆ kvm_handle_pvm_sysreg()

bool kvm_handle_pvm_sysreg ( struct kvm_vcpu *  vcpu,
u64 *  exit_code 
)

Definition at line 474 of file sys_regs.c.

475 {
476  const struct sys_reg_desc *r;
477  struct sys_reg_params params;
478  unsigned long esr = kvm_vcpu_get_esr(vcpu);
479  int Rt = kvm_vcpu_sys_get_rt(vcpu);
480 
481  params = esr_sys64_to_params(esr);
482  params.regval = vcpu_get_reg(vcpu, Rt);
483 
484  r = find_reg(&params, pvm_sys_reg_descs, ARRAY_SIZE(pvm_sys_reg_descs));
485 
486  /* Undefined (RESTRICTED). */
487  if (r == NULL) {
488  inject_undef64(vcpu);
489  return true;
490  }
491 
492  /* Handled by the host (HOST_HANDLED) */
493  if (r->access == NULL)
494  return false;
495 
496  /* Handled by hyp: skip instruction if instructed to do so. */
497  if (r->access(vcpu, &params, r))
498  __kvm_skip_instr(vcpu);
499 
500  if (!params.is_write)
501  vcpu_set_reg(vcpu, Rt, params.regval);
502 
503  return true;
504 }
static void __kvm_skip_instr(struct kvm_vcpu *vcpu)
Definition: adjust_pc.h:33
bool(* access)(struct kvm_vcpu *, struct sys_reg_params *, const struct sys_reg_desc *)
Definition: sys_regs.h:70
#define esr_sys64_to_params(esr)
Definition: sys_regs.h:37
static const struct sys_reg_desc * find_reg(const struct sys_reg_params *params, const struct sys_reg_desc table[], unsigned int num)
Definition: sys_regs.h:217
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pvm_read_id_reg()

u64 pvm_read_id_reg ( const struct kvm_vcpu *  vcpu,
u32  id 
)

Definition at line 208 of file sys_regs.c.

209 {
210  switch (id) {
211  case SYS_ID_AA64PFR0_EL1:
212  return get_pvm_id_aa64pfr0(vcpu);
213  case SYS_ID_AA64PFR1_EL1:
214  return get_pvm_id_aa64pfr1(vcpu);
215  case SYS_ID_AA64ZFR0_EL1:
216  return get_pvm_id_aa64zfr0(vcpu);
217  case SYS_ID_AA64DFR0_EL1:
218  return get_pvm_id_aa64dfr0(vcpu);
219  case SYS_ID_AA64DFR1_EL1:
220  return get_pvm_id_aa64dfr1(vcpu);
221  case SYS_ID_AA64AFR0_EL1:
222  return get_pvm_id_aa64afr0(vcpu);
223  case SYS_ID_AA64AFR1_EL1:
224  return get_pvm_id_aa64afr1(vcpu);
225  case SYS_ID_AA64ISAR0_EL1:
226  return get_pvm_id_aa64isar0(vcpu);
227  case SYS_ID_AA64ISAR1_EL1:
228  return get_pvm_id_aa64isar1(vcpu);
229  case SYS_ID_AA64ISAR2_EL1:
230  return get_pvm_id_aa64isar2(vcpu);
231  case SYS_ID_AA64MMFR0_EL1:
232  return get_pvm_id_aa64mmfr0(vcpu);
233  case SYS_ID_AA64MMFR1_EL1:
234  return get_pvm_id_aa64mmfr1(vcpu);
235  case SYS_ID_AA64MMFR2_EL1:
236  return get_pvm_id_aa64mmfr2(vcpu);
237  default:
238  /* Unhandled ID register, RAZ */
239  return 0;
240  }
241 }
static u64 get_pvm_id_aa64mmfr1(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:197
static u64 get_pvm_id_aa64afr0(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:138
static u64 get_pvm_id_aa64dfr1(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:128
static u64 get_pvm_id_aa64dfr0(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:118
static u64 get_pvm_id_aa64isar1(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:163
static u64 get_pvm_id_aa64afr1(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:148
static u64 get_pvm_id_aa64zfr0(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:108
static u64 get_pvm_id_aa64mmfr0(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:187
static u64 get_pvm_id_aa64isar0(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:158
static u64 get_pvm_id_aa64mmfr2(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:202
static u64 get_pvm_id_aa64pfr0(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:86
static u64 get_pvm_id_aa64isar2(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:176
static u64 get_pvm_id_aa64pfr1(const struct kvm_vcpu *vcpu)
Definition: sys_regs.c:97
Here is the call graph for this function:
Here is the caller graph for this function: