x86/hvm: make stdvga support optional
PATCH v2 1/2 x86/hvm: make stdvga support optional
From: Sergiy Kibrik <[email protected]>
Introduce config option X86_STDVGA so that stdvga driver can be disabled on systems that don't need it.
What's more, in function emulation_flags_ok, to check if toolstack pass any emulation flag that disabled in building time.
---
Hi all,
this is a rework for https://lore.kernel.org/xen-devel/[email protected]/T/#u.
v1->v2 changes:
* For emulation flags, added a new file "arch/x86/hvm/Kconfig.emu" to be a separate seletion, and moved definition of "config X86_STDVGA" into it.
* Added a new macro "#define DISABLED_EMU_MASK (!IS_ENABLED(CONFIG_X86_STDVGA) ? X86_EMU_VGA : 0)", and checked it in function emulation_flags_ok.
* Adjusted macro "has_vvga".
Best regards,
Jiqian Chen.
--- xen/arch/x86/Kconfig | 2 ++ xen/arch/x86/domain.c | 2 ++ xen/arch/x86/hvm/Kconfig.emu | 14 ++++++++++++++ xen/arch/x86/hvm/Makefile | 2 +- xen/arch/x86/include/asm/domain.h | 6 +++++- xen/arch/x86/include/asm/hvm/io.h | 4 ++++ 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 xen/arch/x86/hvm/Kconfig.emu
xen/arch/x86/Kconfig +2 -0
@@ -123,6 +123,8 @@ config HVM If unsure, say Y. +source "arch/x86/hvm/Kconfig.emu" + config AMD_SVM bool "AMD-V" if EXPERT depends on HVM
xen/arch/x86/domain.c +2 -0
@@ -758,6 +758,8 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags) (X86_EMU_ALL & ~(X86_EMU_VPCI | X86_EMU_USE_PIRQ)) && emflags != X86_EMU_LAPIC )return false; +if ( emflags &DISABLED_EMU_MASK ) +return false; }else if ( emflags !=0 && emflags !=X86_EMU_PIT ) {
xen/arch/x86/hvm/Kconfig.emu new file +14 -0
@@ -0,0 +1,14 @@ +menu "Emulated device support" + visible if EXPERT + +config X86_STDVGA + bool "Standard VGA card emulation support" if EXPERT + default y + depends on HVM + help + Build stdvga driver that emulates standard VGA card with VESA BIOS + Extensions for HVM guests. + + If unsure, say Y. + +endmenu
xen/arch/x86/hvm/Makefile +1 -1
@@ -22,7 +22,7 @@ obj-y += pmtimer.o obj-y += quirks.o obj-y += rtc.o obj-y += save.o -obj-y += stdvga.o +obj-$(CONFIG_X86_STDVGA) += stdvga.o obj-y += vioapic.o obj-y += vlapic.o obj-y += vm_event.o
xen/arch/x86/include/asm/domain.h +5 -1
@@ -494,13 +494,17 @@ struct arch_domain X86_EMU_PIT | X86_EMU_USE_PIRQ | \ X86_EMU_VPCI) +#define DISABLED_EMU_MASK \ + (!IS_ENABLED(CONFIG_X86_STDVGA) ? X86_EMU_VGA : 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_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)) -#define has_vvga (d) (!!((d)->arch.emulation_flags & X86_EMU_VGA)) +#define has_vvga (d) (IS_ENABLED(CONFIG_X86_STDVGA) && \ + !!((d)->arch.emulation_flags & X86_EMU_VGA))#define has_viommu (d) (!!((d)->arch.emulation_flags & X86_EMU_IOMMU))#define has_vpit (d) (!!((d)->arch.emulation_flags & X86_EMU_PIT))#define has_pirq (d) (!!((d)->arch.emulation_flags & X86_EMU_USE_PIRQ))
xen/arch/x86/include/asm/hvm/io.h +4 -0
@@ -108,7 +108,11 @@ struct vpci_arch_msix_entry {int pirq; }; +#ifdef CONFIG_X86_STDVGA void stdvga_init (struct domain *d); +#else +static inline void stdvga_init (struct domain *d) {} +#endif extern void hvm_dpci_msi_eoi (struct domain *d,int vector);
Signature · 1 line
2.34.1
PATCH v2 2/2 x86/hvm: make ACPI PM timer support optional
From: Sergiy Kibrik <[email protected]>
Introduce config option X86_PMTIMER so that pmtimer driver can be disabled on systems that don't need it.
---
Hi all,
this is a rework for https://lore.kernel.org/xen-devel/[email protected]/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(-)
xen/arch/x86/hvm/Kconfig.emu +9 -0
@@ -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
xen/arch/x86/hvm/Makefile +1 -1
@@ -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
xen/arch/x86/include/asm/acpi.h +5 -0
@@ -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 );
xen/arch/x86/include/asm/domain.h +4 -2
@@ -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))
xen/arch/x86/include/asm/hvm/vpt.h +10 -0
@@ -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);
Signature · 1 line
2.34.1
Hi all,
Quoted 8 lines · Jiqian Chen
From: Sergiy Kibrik <[email protected]>
Introduce config option
X86_STDVGAso that stdvga driver can be disabled on systems that don't need it.What's more, in function
emulation_flags_ok, to check if toolstack pass any emulation flag that disabled in building time.
I am sorry.
After sending my series, I just found out that there are v3 for this work.
https://lore.kernel.org/xen-devel/[email protected]/
And it seems that the v3 has no other implementation-related comment, just waiting for x86 Maintainers' opinion.
Quoted 123 lines
Signed-off-by Sergiy Kibrik <[email protected]>Signed-off-by Jiqian Chen <[email protected]>---
Hi all,
this is a rework for https://lore.kernel.org/xen-devel/[email protected]/T/#u.
v1->v2changes:
* For emulation flags, added a new file "arch/x86/hvm/Kconfig.emu" to be a separate seletion, and moved definition of "configX86_STDVGA" into it.
* Added a new macro "#defineDISABLED_EMU_MASK(!IS_ENABLED(CONFIG_X86_STDVGA) ?X86_EMU_VGA: 0)", and checked it in functionemulation_flags_ok.
* Adjusted macro "has_vvga".Best regards,
Jiqian Chen.--- xen/arch/x86/Kconfig | 2 ++ xen/arch/x86/domain.c | 2 ++ xen/arch/x86/hvm/Kconfig.emu | 14 ++++++++++++++ xen/arch/x86/hvm/Makefile | 2 +- xen/arch/x86/include/asm/domain.h | 6 +++++- xen/arch/x86/include/asm/hvm/io.h | 4 ++++ 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 xen/arch/x86/hvm/Kconfig.emuxen/arch/x86/Kconfig +2
-0@@ -123,6 +123,8 @@ config HVM If unsure, say Y. +source "arch/x86/hvm/Kconfig.emu" + config AMD_SVM bool "AMD-V" if EXPERT depends on HVMxen/arch/x86/domain.c +2
-0@@ -758,6 +758,8 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags) (X86_EMU_ALL & ~(X86_EMU_VPCI | X86_EMU_USE_PIRQ)) && emflags != X86_EMU_LAPIC )return false; +if ( emflags &DISABLED_EMU_MASK ) +return false; }else if ( emflags !=0 && emflags !=X86_EMU_PIT ) {xen/arch/x86/hvm/Kconfig.emu new file +14
-0@@ -0,0 +1,14 @@ +menu "Emulated device support" + visible if EXPERT + +config X86_STDVGA + bool "Standard VGA card emulation support" if EXPERT + default y + depends on HVM + help + Build stdvga driver that emulates standard VGA card with VESA BIOS + Extensions for HVM guests. + + If unsure, say Y. + +endmenuxen/arch/x86/hvm/Makefile +1
-1@@ -22,7 +22,7 @@ obj-y += pmtimer.o obj-y += quirks.o obj-y += rtc.o obj-y += save.o -obj-y += stdvga.o +obj-$(CONFIG_X86_STDVGA) += stdvga.o obj-y += vioapic.o obj-y += vlapic.o obj-y += vm_event.oxen/arch/x86/include/asm/domain.h +5
-1@@ -494,13 +494,17 @@ struct arch_domain X86_EMU_PIT | X86_EMU_USE_PIRQ | \ X86_EMU_VPCI) +#define DISABLED_EMU_MASK \ + (!IS_ENABLED(CONFIG_X86_STDVGA) ? X86_EMU_VGA : 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_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)) -#define has_vvga (d) (!!((d)->arch.emulation_flags & X86_EMU_VGA)) +#define has_vvga (d) (IS_ENABLED(CONFIG_X86_STDVGA) && \ + !!((d)->arch.emulation_flags & X86_EMU_VGA))#define has_viommu (d) (!!((d)->arch.emulation_flags & X86_EMU_IOMMU))#define has_vpit (d) (!!((d)->arch.emulation_flags & X86_EMU_PIT))#define has_pirq (d) (!!((d)->arch.emulation_flags & X86_EMU_USE_PIRQ))xen/arch/x86/include/asm/hvm/io.h +4
-0@@ -108,7 +108,11 @@ struct vpci_arch_msix_entry {int pirq; }; +#ifdef CONFIG_X86_STDVGA void stdvga_init (struct domain *d); +#else +static inline void stdvga_init (struct domain *d) {} +#endif extern void hvm_dpci_msi_eoi (struct domain *d,int vector);
Signature · 2 lines
Best regards, Jiqian Chen.
Quoted 6 lines · Jiqian
Quoted 5 lines · Jiqian Chen
From: Sergiy Kibrik <[email protected]>
Introduce config option
X86_STDVGAso that stdvga driver can be disabled on systems that don't need it.
Quoted 7 lines
Quoted 3 lines
What's more, in function
emulation_flags_ok, to check if toolstack pass any emulation flag that disabled in building time.I am sorry.
After sending my series, I just found out that there are v3 for this work.
https://lore.kernel.org/xen-devel/[email protected]/
And it seems that the v3 has no other implementation-related comment, just waiting for x86 Maintainers' opinion.
I certainly voiced my take, in reply to the v3 cover letter.
Jan
Quoted 47 lines · Jiqian Chen
From: Sergiy Kibrik [email protected]
Introduce config option
X86_STDVGAso that stdvga driver can be disabled on systems that don't need it.What's more, in function
emulation_flags_ok, to check if toolstack pass any emulation flag that disabled in building time.Signed-off-by Sergiy Kibrik [email protected]Signed-off-by Jiqian Chen [email protected]---
Hi all,
this is a rework for https://lore.kernel.org/xen-devel/[email protected]/T/#u.
v1->v2changes:* For emulation flags, added a new file "
arch/x86/hvm/Kconfig.emu" to be a separate seletion, and moved definition of "configX86_STDVGA" into it.
* Added a new macro "#defineDISABLED_EMU_MASK(!IS_ENABLED(CONFIG_X86_STDVGA) ?X86_EMU_VGA: 0)", and checked it in functionemulation_flags_ok.
* Adjusted macro "has_vvga".Best regards,
Jiqian Chen.
---
xen/arch/x86/Kconfig | 2 ++xen/arch/x86/domain.c| 2 ++
xen/arch/x86/hvm/Kconfig.emu | 14 ++++++++++++++
xen/arch/x86/hvm/Makefile | 2 +-xen/arch/x86/include/asm/domain.h| 6 +++++-xen/arch/x86/include/asm/hvm/io.h| 4 ++++6 files changed, 28 insertions(+), 2 deletions(-)create mode 100644 xen/arch/x86/hvm/Kconfig.emu
xen/arch/x86/Kconfig +0
-0@@ -123,6 +123,8 @@ config HVMIf unsure, say Y.
Quoted 1 line
+source "
arch/x86/hvm/Kconfig.emu"
JFYI, there's this patch:
https://lore.kernel.org/xen-devel/[email protected]/
I think having one Kconfig under arch/x86/hvm is enough. Thoughts?
Quoted 102 lines
+
configAMD_SVM
bool "AMD-V" if EXPERT
depends on HVMxen/arch/x86/domain.c +0
-0@@ -758,6 +758,8 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)(
X86_EMU_ALL& ~(X86_EMU_VPCI |X86_EMU_USE_PIRQ)) && emflags !=X86_EMU_LAPIC)
return false;
+ if ( emflags &DISABLED_EMU_MASK)
+ return false;
}
else if ( emflags != 0 && emflags !=X86_EMU_PIT) {xen/arch/x86/hvm/Kconfig.emu new file +14
-0@@ -0,0 +1,14 @@ +menu "Emulated device support" + visible if EXPERT + +config X86_STDVGA + bool "Standard VGA card emulation support" if EXPERT + default y + depends on HVM + help + Build stdvga driver that emulates standard VGA card with VESA BIOS + Extensions for HVM guests. + + If unsure, say Y. + +endmenuxen/arch/x86/hvm/Makefile +0
-0@@ -22,7 +22,7 @@ obj-y += pmtimer.oobj-y += quirks.o
obj-y += rtc.o
obj-y += save.oxen/arch/x86/hvm/Makefile +1
-1-obj-y += stdvga.o +obj-$(CONFIG_X86_STDVGA) += stdvga.oobj-y += vioapic.o
obj-y += vlapic.o
obj-y += vm_event.oxen/arch/x86/include/asm/domain.h +3
-0@@ -494,13 +494,17 @@ struct arch_domain X86_EMU_PIT | X86_EMU_USE_PIRQ | \ X86_EMU_VPCI) +#define DISABLED_EMU_MASK \ + (!IS_ENABLED(CONFIG_X86_STDVGA) ? X86_EMU_VGA : 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_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))xen/arch/x86/include/asm/domain.h +2
-1-#define has_vvga (d) (!!((d)->arch.emulation_flags & X86_EMU_VGA)) +#define has_vvga (d) (IS_ENABLED(CONFIG_X86_STDVGA) && \ + !!((d)->arch.emulation_flags & X86_EMU_VGA))#define
has_viommu(d)(!!((d)->arch.emulation_flags &X86_EMU_IOMMU))#define
has_vpit(d)(!!((d)->arch.emulation_flags &X86_EMU_PIT))#define
has_pirq(d)(!!((d)->arch.emulation_flags &X86_EMU_USE_PIRQ))xen/arch/x86/include/asm/hvm/io.h +4
-1@@ -108,7 +108,11 @@ struct vpci_arch_msix_entry {int pirq; }; +#ifdef CONFIG_X86_STDVGA void stdvga_init (struct domain *d); +#else +static inline void stdvga_init (struct domain *d) {} +#endif extern void hvm_dpci_msi_eoi (struct domain *d,int vector); --2.34.1