[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 2/2] x86/hvm: make ACPI PM timer support optional
From: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx> Introduce config option X86_PMTIMER so that pmtimer driver can be disabled on systems that don't need it. Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx> Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx> --- Hi all, this is a rework for https://lore.kernel.org/xen-devel/20240916063757.990070-1-Sergiy_Kibrik@xxxxxxxx/T/#u. v1->v2 changes: * Moved definition of "config X86_PMTIMER" into Kconfig.emu. * Adjusted macro "has_vpm". Best regards, Jiqian Chen. --- xen/arch/x86/hvm/Kconfig.emu | 9 +++++++++ xen/arch/x86/hvm/Makefile | 2 +- xen/arch/x86/include/asm/acpi.h | 5 +++++ xen/arch/x86/include/asm/domain.h | 6 ++++-- xen/arch/x86/include/asm/hvm/vpt.h | 10 ++++++++++ 5 files changed, 29 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/Kconfig.emu b/xen/arch/x86/hvm/Kconfig.emu index aa60b6227036..e2d0f5db1d15 100644 --- a/xen/arch/x86/hvm/Kconfig.emu +++ b/xen/arch/x86/hvm/Kconfig.emu @@ -11,4 +11,13 @@ config X86_STDVGA If unsure, say Y. +config X86_PMTIMER + bool "ACPI PM timer emulation support" if EXPERT + default y + depends on HVM + help + Build pmtimer driver that emulates ACPI PM timer for HVM guests. + + If unsure, say Y. + endmenu diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile index 4d1f8e00eb68..b7741b0f607e 100644 --- a/xen/arch/x86/hvm/Makefile +++ b/xen/arch/x86/hvm/Makefile @@ -18,7 +18,7 @@ obj-y += irq.o obj-y += monitor.o obj-y += mtrr.o obj-y += nestedhvm.o -obj-y += pmtimer.o +obj-$(CONFIG_X86_PMTIMER) += pmtimer.o obj-y += quirks.o obj-y += rtc.o obj-y += save.o diff --git a/xen/arch/x86/include/asm/acpi.h b/xen/arch/x86/include/asm/acpi.h index 217819dd619c..8d92014ae93a 100644 --- a/xen/arch/x86/include/asm/acpi.h +++ b/xen/arch/x86/include/asm/acpi.h @@ -150,8 +150,13 @@ void acpi_mmcfg_init(void); /* Incremented whenever we transition through S3. Value is 1 during boot. */ extern uint32_t system_reset_counter; +#ifdef CONFIG_X86_PMTIMER void hvm_acpi_power_button(struct domain *d); void hvm_acpi_sleep_button(struct domain *d); +#else +static inline void hvm_acpi_power_button(struct domain *d) {} +static inline void hvm_acpi_sleep_button(struct domain *d) {} +#endif /* suspend/resume */ void save_rest_processor_state(void); diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index 68be23bf3bf4..1f3c02e3088f 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -495,11 +495,13 @@ struct arch_domain X86_EMU_VPCI) #define DISABLED_EMU_MASK \ - (!IS_ENABLED(CONFIG_X86_STDVGA) ? X86_EMU_VGA : 0) + ((!IS_ENABLED(CONFIG_X86_STDVGA) ? X86_EMU_VGA : 0) | \ + (!IS_ENABLED(CONFIG_X86_PMTIMER) ? X86_EMU_PM : 0)) #define has_vlapic(d) (!!((d)->arch.emulation_flags & X86_EMU_LAPIC)) #define has_vhpet(d) (!!((d)->arch.emulation_flags & X86_EMU_HPET)) -#define has_vpm(d) (!!((d)->arch.emulation_flags & X86_EMU_PM)) +#define has_vpm(d) (IS_ENABLED(CONFIG_X86_PMTIMER) && \ + !!((d)->arch.emulation_flags & X86_EMU_PM)) #define has_vrtc(d) (!!((d)->arch.emulation_flags & X86_EMU_RTC)) #define has_vioapic(d) (!!((d)->arch.emulation_flags & X86_EMU_IOAPIC)) #define has_vpic(d) (!!((d)->arch.emulation_flags & X86_EMU_PIC)) diff --git a/xen/arch/x86/include/asm/hvm/vpt.h b/xen/arch/x86/include/asm/hvm/vpt.h index 0b92b286252d..333b346068de 100644 --- a/xen/arch/x86/include/asm/hvm/vpt.h +++ b/xen/arch/x86/include/asm/hvm/vpt.h @@ -187,10 +187,20 @@ void rtc_deinit(struct domain *d); void rtc_reset(struct domain *d); void rtc_update_clock(struct domain *d); +#ifdef CONFIG_X86_PMTIMER void pmtimer_init(struct vcpu *v); void pmtimer_deinit(struct domain *d); void pmtimer_reset(struct domain *d); int pmtimer_change_ioport(struct domain *d, uint64_t version); +#else +static inline void pmtimer_init(struct vcpu *v) {} +static inline void pmtimer_deinit(struct domain *d) {} +static inline void pmtimer_reset(struct domain *d) {} +static inline int pmtimer_change_ioport(struct domain *d, uint64_t version) +{ + return -ENODEV; +} +#endif void hpet_init(struct domain *d); void hpet_deinit(struct domain *d); -- 2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |