static DEFINE_PER_CPU(u64, current_tsc_ratio);
+#define X2APIC_MSR(x) (APIC_BASE_MSR + (x >> 4))
+
static const struct svm_direct_access_msrs {
u32 index; /* Index of the MSR */
bool always; /* True if intercept is initially cleared */
{ .index = MSR_IA32_CR_PAT, .always = false },
{ .index = MSR_AMD64_SEV_ES_GHCB, .always = true },
{ .index = MSR_TSC_AUX, .always = false },
- { .index = (APIC_BASE_MSR + APIC_ID), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_TASKPRI), .always = false },
- { .index = (APIC_BASE_MSR + APIC_ARBPRI), .always = false },
- { .index = (APIC_BASE_MSR + APIC_PROCPRI), .always = false },
- { .index = (APIC_BASE_MSR + APIC_EOI), .always = false },
- { .index = (APIC_BASE_MSR + APIC_RRR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LDR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_DFR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_SPIV), .always = false },
- { .index = (APIC_BASE_MSR + APIC_ISR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_TMR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_IRR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_ESR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_ICR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_ICR2), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVTT), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVTTHMR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVTPC), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVT0), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVT1), .always = false },
- { .index = (APIC_BASE_MSR + APIC_LVTERR), .always = false },
- { .index = (APIC_BASE_MSR + APIC_TMICT), .always = false },
- { .index = (APIC_BASE_MSR + APIC_TMCCT), .always = false },
- { .index = (APIC_BASE_MSR + APIC_TDCR), .always = false },
+ { .index = X2APIC_MSR(APIC_ID), .always = false },
+ { .index = X2APIC_MSR(APIC_LVR), .always = false },
+ { .index = X2APIC_MSR(APIC_TASKPRI), .always = false },
+ { .index = X2APIC_MSR(APIC_ARBPRI), .always = false },
+ { .index = X2APIC_MSR(APIC_PROCPRI), .always = false },
+ { .index = X2APIC_MSR(APIC_EOI), .always = false },
+ { .index = X2APIC_MSR(APIC_RRR), .always = false },
+ { .index = X2APIC_MSR(APIC_LDR), .always = false },
+ { .index = X2APIC_MSR(APIC_DFR), .always = false },
+ { .index = X2APIC_MSR(APIC_SPIV), .always = false },
+ { .index = X2APIC_MSR(APIC_ISR), .always = false },
+ { .index = X2APIC_MSR(APIC_TMR), .always = false },
+ { .index = X2APIC_MSR(APIC_IRR), .always = false },
+ { .index = X2APIC_MSR(APIC_ESR), .always = false },
+ { .index = X2APIC_MSR(APIC_ICR), .always = false },
+ { .index = X2APIC_MSR(APIC_ICR2), .always = false },
+ { .index = X2APIC_MSR(APIC_LVTT), .always = false },
+ { .index = X2APIC_MSR(APIC_LVTTHMR), .always = false },
+ { .index = X2APIC_MSR(APIC_LVTPC), .always = false },
+ { .index = X2APIC_MSR(APIC_LVT0), .always = false },
+ { .index = X2APIC_MSR(APIC_LVT1), .always = false },
+ { .index = X2APIC_MSR(APIC_LVTERR), .always = false },
+ { .index = X2APIC_MSR(APIC_TMICT), .always = false },
+ { .index = X2APIC_MSR(APIC_TMCCT), .always = false },
+ { .index = X2APIC_MSR(APIC_TDCR), .always = false },
{ .index = MSR_INVALID, .always = false },
};