KVM: SEV: move set_dr_intercepts/clr_dr_intercepts from the header
Static functions set_dr_intercepts() and clr_dr_intercepts() are only called from SVM so move them to .c. No functional change intended. Signed-off-by: Alexey Kardashevskiy <aik@amd.com> Reviewed-by: Carlos Bilbao <carlos.bilbao@amd.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Santosh Shukla <santosh.shukla@amd.com> Link: https://lore.kernel.org/r/20230615063757.3039121-2-aik@amd.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
fdf0eaf114
commit
b265ee7bae
|
@ -677,6 +677,48 @@ free_save_area:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_dr_intercepts(struct vcpu_svm *svm)
|
||||||
|
{
|
||||||
|
struct vmcb *vmcb = svm->vmcb01.ptr;
|
||||||
|
|
||||||
|
if (!sev_es_guest(svm->vcpu.kvm)) {
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR0_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR1_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR2_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR3_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR4_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR5_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR6_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR0_WRITE);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR1_WRITE);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR2_WRITE);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR3_WRITE);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR4_WRITE);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR5_WRITE);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR6_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_WRITE);
|
||||||
|
|
||||||
|
recalc_intercepts(svm);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void clr_dr_intercepts(struct vcpu_svm *svm)
|
||||||
|
{
|
||||||
|
struct vmcb *vmcb = svm->vmcb01.ptr;
|
||||||
|
|
||||||
|
vmcb->control.intercepts[INTERCEPT_DR] = 0;
|
||||||
|
|
||||||
|
/* DR7 access must remain intercepted for an SEV-ES guest */
|
||||||
|
if (sev_es_guest(svm->vcpu.kvm)) {
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_READ);
|
||||||
|
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
recalc_intercepts(svm);
|
||||||
|
}
|
||||||
|
|
||||||
static int direct_access_msr_slot(u32 msr)
|
static int direct_access_msr_slot(u32 msr)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
|
@ -404,48 +404,6 @@ static inline bool vmcb12_is_intercept(struct vmcb_ctrl_area_cached *control, u3
|
||||||
return test_bit(bit, (unsigned long *)&control->intercepts);
|
return test_bit(bit, (unsigned long *)&control->intercepts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_dr_intercepts(struct vcpu_svm *svm)
|
|
||||||
{
|
|
||||||
struct vmcb *vmcb = svm->vmcb01.ptr;
|
|
||||||
|
|
||||||
if (!sev_es_guest(svm->vcpu.kvm)) {
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR0_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR1_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR2_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR3_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR4_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR5_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR6_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR0_WRITE);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR1_WRITE);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR2_WRITE);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR3_WRITE);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR4_WRITE);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR5_WRITE);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR6_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_WRITE);
|
|
||||||
|
|
||||||
recalc_intercepts(svm);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void clr_dr_intercepts(struct vcpu_svm *svm)
|
|
||||||
{
|
|
||||||
struct vmcb *vmcb = svm->vmcb01.ptr;
|
|
||||||
|
|
||||||
vmcb->control.intercepts[INTERCEPT_DR] = 0;
|
|
||||||
|
|
||||||
/* DR7 access must remain intercepted for an SEV-ES guest */
|
|
||||||
if (sev_es_guest(svm->vcpu.kvm)) {
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_READ);
|
|
||||||
vmcb_set_intercept(&vmcb->control, INTERCEPT_DR7_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
recalc_intercepts(svm);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void set_exception_intercept(struct vcpu_svm *svm, u32 bit)
|
static inline void set_exception_intercept(struct vcpu_svm *svm, u32 bit)
|
||||||
{
|
{
|
||||||
struct vmcb *vmcb = svm->vmcb01.ptr;
|
struct vmcb *vmcb = svm->vmcb01.ptr;
|
||||||
|
|
Loading…
Reference in New Issue