@@ -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
@@ -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
@@ -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);
@@ -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))
@@ -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);