On Wed, Nov 27, 2024, Aaron Lewis wrote: > VMX MSR interception is done via three functions: > > vmx_disable_intercept_for_msr(vcpu, msr, type) > vmx_enable_intercept_for_msr(vcpu, msr, type) > vmx_set_intercept_for_msr(vcpu, msr, type, value) > > While SVM uses > > set_msr_interception(vcpu, msrpm, msr, read, write) > > The SVM code is not very intuitive (using 0 for enable and 1 for > disable), and forces both read and write changes with each call which > is not always required. > > Add helpers functions to SVM to match VMX: > > svm_disable_intercept_for_msr(vcpu, msr, type) > svm_enable_intercept_for_msr(vcpu, msr, type) > svm_set_intercept_for_msr(vcpu, msr, type, enable_intercept) > > Additionally, update calls to set_msr_interception() to use the new > functions. This update is only made to calls that toggle interception > for both read and write. > > Keep the old paths for now, they will be deleted once all code is > converted to the new helpers. > > Opportunistically, the function svm_get_msr_bitmap_entries() is added > to abstract the MSR bitmap from the intercept functions. This will be > needed later in the series when this code is hoisted to common code. > > No functional change. > > Suggested-by: Sean Christopherson <seanjc@xxxxxxxxxx> > Co-Developed-by: Anish Ghulati <aghulati@xxxxxxxxxx> Needs Anish's SoB. > Signed-off-by: Aaron Lewis <aaronlewis@xxxxxxxxxx>