Message ID | 20240126085444.324918-9-xiong.y.zhang@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: x86/pmu: Introduce passthrough vPM | expand |
On Fri, Jan 26, 2024, Xiong Zhang wrote: > From: Xiong Zhang <xiong.y.zhang@intel.com> > > On PMU passthrough mode, guest virtual LVTPC_MASK bit must be reflected > onto HW, especially when guest clear it, the HW bit should be cleared also. > Otherwise processor can't generate PMI until the HW mask bit is cleared. > > This commit add a function to get virtual LVTPC_MASK bit, so that No "This commit", "This patch", or any other variation. Please read through: Documentation/process/maintainer-tip.rst Documentation/process/maintainer-kvm-x86.rst > it can be set onto HW later. > > Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com> > --- > arch/x86/kvm/lapic.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h > index e30641d5ac90..dafae44325d1 100644 > --- a/arch/x86/kvm/lapic.h > +++ b/arch/x86/kvm/lapic.h > @@ -277,4 +277,10 @@ static inline u8 kvm_xapic_id(struct kvm_lapic *apic) > { > return kvm_lapic_get_reg(apic, APIC_ID) >> 24; > } > + > +static inline bool kvm_lapic_get_lvtpc_mask(struct kvm_vcpu *vcpu) > +{ > + return lapic_in_kernel(vcpu) && > + (kvm_lapic_get_reg(vcpu->arch.apic, APIC_LVTPC) & APIC_LVT_MASKED); > +} As suggested in the previous patch, I'm pretty sure we can safely omit this helper. > #endif > -- > 2.34.1 >
diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h index e30641d5ac90..dafae44325d1 100644 --- a/arch/x86/kvm/lapic.h +++ b/arch/x86/kvm/lapic.h @@ -277,4 +277,10 @@ static inline u8 kvm_xapic_id(struct kvm_lapic *apic) { return kvm_lapic_get_reg(apic, APIC_ID) >> 24; } + +static inline bool kvm_lapic_get_lvtpc_mask(struct kvm_vcpu *vcpu) +{ + return lapic_in_kernel(vcpu) && + (kvm_lapic_get_reg(vcpu->arch.apic, APIC_LVTPC) & APIC_LVT_MASKED); +} #endif