diff mbox series

[XEN,v1,2/3] x86/hvm: introduce config option for stdvga emulation

Message ID 05a027b7021ce6deb5b48078034e560a38ca8d23.1728032664.git.Sergiy_Kibrik@epam.com (mailing list archive)
State New
Headers show
Series configurable stdvga & pmtimer emulation | expand

Commit Message

Sergiy Kibrik Oct. 4, 2024, 9:33 a.m. UTC
Introduce config option X86_STDVGA so that stdvga emulation driver can later be
made configurable and be disabled on systems that don't need it.

As a first step the option is hidden from user. No functional changes intended.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
CC: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig              | 3 +++
 xen/arch/x86/hvm/Makefile         | 2 +-
 xen/arch/x86/include/asm/domain.h | 3 ++-
 xen/arch/x86/include/asm/hvm/io.h | 4 ++++
 4 files changed, 10 insertions(+), 2 deletions(-)

Comments

Roger Pau Monné Oct. 4, 2024, 1:12 p.m. UTC | #1
On Fri, Oct 04, 2024 at 12:33:53PM +0300, Sergiy Kibrik wrote:
> Introduce config option X86_STDVGA so that stdvga emulation driver can later be
> made configurable and be disabled on systems that don't need it.
> 
> As a first step the option is hidden from user. No functional changes intended.
> 
> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
> CC: Jan Beulich <jbeulich@suse.com>
> ---
>  xen/arch/x86/Kconfig              | 3 +++
>  xen/arch/x86/hvm/Makefile         | 2 +-
>  xen/arch/x86/include/asm/domain.h | 3 ++-
>  xen/arch/x86/include/asm/hvm/io.h | 4 ++++
>  4 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
> index 95275dc17e..89c42ff6da 100644
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -147,6 +147,9 @@ config INTEL_VMX
>  config X86_PMTIMER
>  	def_bool HVM
>  
> +config X86_STDVGA
> +	def_bool HVM

Same as previous patch, the content of patch 3 needs to be moved here.

> +
>  config XEN_SHSTK
>  	bool "Supervisor Shadow Stacks"
>  	depends on HAS_AS_CET_SS
> diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
> index 321241f0bf..b7741b0f60 100644
> --- a/xen/arch/x86/hvm/Makefile
> +++ b/xen/arch/x86/hvm/Makefile
> @@ -22,7 +22,7 @@ obj-$(CONFIG_X86_PMTIMER) += 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
> diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
> index 3f65bfd190..675a13d917 100644
> --- a/xen/arch/x86/include/asm/domain.h
> +++ b/xen/arch/x86/include/asm/domain.h
> @@ -501,7 +501,8 @@ struct arch_domain
>  #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) && \

You don't need the IS_ENABLED() if emulation_flags_ok() is adjusted
accordingly.

Thanks, Roger.
Jan Beulich Oct. 4, 2024, 1:34 p.m. UTC | #2
On 04.10.2024 11:33, Sergiy Kibrik wrote:
> --- a/xen/arch/x86/Kconfig
> +++ b/xen/arch/x86/Kconfig
> @@ -147,6 +147,9 @@ config INTEL_VMX
>  config X86_PMTIMER
>  	def_bool HVM
>  
> +config X86_STDVGA
> +	def_bool HVM

For both if these I'd also question the naming: They way they're named now,
I for one would infer they're about Xen support for respective hardware. I
think they both want to be X86_HVM_... to indicate they're about support for
HVM guests. The same concern then applies to the menu title in patch 3.

Jan
Stefano Stabellini Oct. 4, 2024, 9:08 p.m. UTC | #3
On Fri, 4 Oct 2024, Roger Pau Monné wrote:
> On Fri, Oct 04, 2024 at 12:33:53PM +0300, Sergiy Kibrik wrote:
> > Introduce config option X86_STDVGA so that stdvga emulation driver can later be
> > made configurable and be disabled on systems that don't need it.
> > 
> > As a first step the option is hidden from user. No functional changes intended.
> > 
> > Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
> > CC: Jan Beulich <jbeulich@suse.com>
> > ---
> >  xen/arch/x86/Kconfig              | 3 +++
> >  xen/arch/x86/hvm/Makefile         | 2 +-
> >  xen/arch/x86/include/asm/domain.h | 3 ++-
> >  xen/arch/x86/include/asm/hvm/io.h | 4 ++++
> >  4 files changed, 10 insertions(+), 2 deletions(-)
> > 
> > diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
> > index 95275dc17e..89c42ff6da 100644
> > --- a/xen/arch/x86/Kconfig
> > +++ b/xen/arch/x86/Kconfig
> > @@ -147,6 +147,9 @@ config INTEL_VMX
> >  config X86_PMTIMER
> >  	def_bool HVM
> >  
> > +config X86_STDVGA
> > +	def_bool HVM
> 
> Same as previous patch, the content of patch 3 needs to be moved here.
> 
> > +
> >  config XEN_SHSTK
> >  	bool "Supervisor Shadow Stacks"
> >  	depends on HAS_AS_CET_SS
> > diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
> > index 321241f0bf..b7741b0f60 100644
> > --- a/xen/arch/x86/hvm/Makefile
> > +++ b/xen/arch/x86/hvm/Makefile
> > @@ -22,7 +22,7 @@ obj-$(CONFIG_X86_PMTIMER) += 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
> > diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
> > index 3f65bfd190..675a13d917 100644
> > --- a/xen/arch/x86/include/asm/domain.h
> > +++ b/xen/arch/x86/include/asm/domain.h
> > @@ -501,7 +501,8 @@ struct arch_domain
> >  #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) && \
> 
> You don't need the IS_ENABLED() if emulation_flags_ok() is adjusted
> accordingly.

Same as patch #1 regarding compiler DCE, we could either do this or
define X86_EMU_VGA to zero
diff mbox series

Patch

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 95275dc17e..89c42ff6da 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -147,6 +147,9 @@  config INTEL_VMX
 config X86_PMTIMER
 	def_bool HVM
 
+config X86_STDVGA
+	def_bool HVM
+
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
 	depends on HAS_AS_CET_SS
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 321241f0bf..b7741b0f60 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -22,7 +22,7 @@  obj-$(CONFIG_X86_PMTIMER) += 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
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 3f65bfd190..675a13d917 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -501,7 +501,8 @@  struct arch_domain
 #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))
diff --git a/xen/arch/x86/include/asm/hvm/io.h b/xen/arch/x86/include/asm/hvm/io.h
index f2b8431fac..32a2490fbc 100644
--- a/xen/arch/x86/include/asm/hvm/io.h
+++ b/xen/arch/x86/include/asm/hvm/io.h
@@ -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);