Re: [Xen-devel] [PATCH] x86: add a user configurable Kconfig option for the VGA

2016-09-20 Thread Derek Straka
On Tue, Sep 20, 2016 at 9:12 AM, Jan Beulich  wrote:

> >>> On 20.09.16 at 14:35,  wrote:
> > On Wed, Sep 14, 2016 at 6:47 AM, Jan Beulich  wrote:
> >
> >> >>> On 13.09.16 at 21:40,  wrote:
> >> > Allows for the conditional inclusion of VGA driver on the x86 platform
> >> > rather than having it always enabled.
> >>
> >> So I guess with all three of these patches an overview mail is missing.
> >> What are you trying to accomplish? Solely reducing the binary size of
> >> Xen doesn't seem like a very important goal to me, and eliminating
> >> these drivers from the build doesn't appear to help make Xen more
> >> stable of secure.
> >>
> > I agree with your assessment on the stability and security standpoint.
> Our
> > customer has asked us to remove
> > unused drivers based on functionality of a set of boards.  Each of the
> > boards has a subset of the available hardware functionality
> > brought out to accessible headers.
>
> Well, does that mean that's just to reduce the size of the hypervisor?
> If so, I'm honestly not sure we want to set a precedent here, since
> if we do, people could come and suggest to make all sorts of code
> build conditionally, and I don't think our plans with Kconfig so far were
> going in that direction (but others may disagree with me here).
>
> For the most part: yes.  At the end of the day, my customer wants to
reduce the size of hypervisor.  I disagree a bit that these specific
changes
would set a poor precedent of for configuration.  The reason I proposed it
in the first place was the mechanisms for conditional compilation
were already implicitly available via HAS_*.  I thought adding the ability
for the user to explicitly define the configuration option
would be a permissible extension of the capability already present.  That
said, I do see your point about limiting the scope of conditional
code to avoid an eventual mess.  Thanks.

-Derek

> Jan
>
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH] x86: add a user configurable Kconfig option for the VGA

2016-09-20 Thread Derek Straka
On Wed, Sep 14, 2016 at 6:47 AM, Jan Beulich  wrote:

> >>> On 13.09.16 at 21:40,  wrote:
> > Allows for the conditional inclusion of VGA driver on the x86 platform
> > rather than having it always enabled.
>
> So I guess with all three of these patches an overview mail is missing.
> What are you trying to accomplish? Solely reducing the binary size of
> Xen doesn't seem like a very important goal to me, and eliminating
> these drivers from the build doesn't appear to help make Xen more
> stable of secure.
>
I agree with your assessment on the stability and security standpoint.  Our
customer has asked us to remove
unused drivers based on functionality of a set of boards.  Each of the
boards has a subset of the available hardware functionality
brought out to accessible headers.  I decided to try to make these items
optional via the Kconfig mechanisms already
in place in Xen and contribute the modifications upstream.  I appreciate
all of the feedback on the patches, but if they won't
get accepted upstream because they aren't useful, I don't want to continue
to waste people's time reviewing these changes.

-Derek

>
> > @@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
> >
> >  printk("Command line: %s\n", cmdline);
> >
> > +#ifdef CONFIG_VGA
> >  printk("Video information:\n");
>
> Some of the other conditionals you add may be affected too, but
> here it is most prominent at the first glance - considering that we also
> have CONFIG_VIDEO, wouldn't it rather be that one to be used in a
> place like this one?
>
> > --- a/xen/include/xen/console.h
> > +++ b/xen/include/xen/console.h
> > @@ -19,7 +19,15 @@ void console_init_postirq(void);
> >  void console_endboot(void);
> >  int console_has(const char *device);
> >
> > +#ifdef CONFIG_VGA
> >  int fill_console_start_info(struct dom0_vga_console_info *);
> > +#else
> > +#include 
> > +static inline int fill_console_start_info(struct dom0_vga_console_info
> *ci)
> > {
> > +(void) memset(ci, 0, sizeof(*ci));
>
> What is this cast to void goo for?
>
> Jan
>
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v2 2/2] x86: add a user configurable Kconfig option for the EHCI debug port

2016-09-19 Thread Derek Straka
Julien,

On Mon, Sep 19, 2016 at 10:56 AM, Julien Grall <julien.gr...@arm.com> wrote:

> Hello,
>
> On 19/09/2016 16:51, Derek Straka wrote:
>
>> Allows for the conditional inclusion of EHCI debug port driver on the x86
>> platform rather than having it always enabled.
>>
>> The default configuration for the CONFIG_EHCI option remains 'y' on x86,
>> so the
>> behavior out of the box remains unchanged.  The addition of the option
>> allows
>> advanced users to enable/disable the inclusion of the EHCI debug port
>> driver.
>>
>> Signed-off-by: Derek Straka <de...@asterius.io>
>> ---
>>  xen/drivers/char/Kconfig  |  5 +
>>  xen/drivers/char/Makefile |  2 +-
>>  xen/include/xen/serial.h  | 12 +---
>>  3 files changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
>> index 1d894a7..1c5400f 100644
>> --- a/xen/drivers/char/Kconfig
>> +++ b/xen/drivers/char/Kconfig
>> @@ -51,6 +51,11 @@ config HAS_SCIF
>>
>>  config HAS_EHCI
>> bool
>> +
>> +config EHCI
>> +   bool "EHCI debug port" if EXPERT = "y"
>> +   default y
>> +   depends on HAS_EHCI
>> help
>>   This selects the USB based EHCI debug port to be used as a
>> UART. If
>>   you have an x86 based system with USB, say Y.
>> diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
>> index 0afadaf..40c193b 100644
>> --- a/xen/drivers/char/Makefile
>> +++ b/xen/drivers/char/Makefile
>> @@ -5,6 +5,6 @@ obj-$(CONFIG_HAS_PL011) += pl011.o
>>  obj-$(CONFIG_HAS_EXYNOS4210) += exynos4210-uart.o
>>  obj-$(CONFIG_HAS_OMAP) += omap-uart.o
>>  obj-$(CONFIG_HAS_SCIF) += scif-uart.o
>> -obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
>> +obj-$(CONFIG_EHCI) += ehci-dbgp.o
>>  obj-$(CONFIG_ARM) += arm-uart.o
>>  obj-y += serial.o
>> diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
>> index 46edff8..5c6cbe9 100644
>> --- a/xen/include/xen/serial.h
>> +++ b/xen/include/xen/serial.h
>> @@ -174,11 +174,17 @@ void ns16550_init(int index, struct
>> ns16550_defaults *defaults);
>>  static inline void ns16550_init(int index, struct ns16550_defaults
>> *defaults) {}
>>  #endif
>>
>> -void ehci_dbgp_init(void);
>> -void arm_uart_init(void);
>>
>
> Why did you move arm_uart_init? It does not seem related to this patch...
>
I moved the EHCI code above the arm_uart_init since ehci_dbgp_init preceded
the arm code originally, but I can certainly move the ECHI declarations
after if you'd prefer.

>
> -
>>  struct physdev_dbgp_op;
>> +
>> +#ifdef CONFIG_EHCI
>>  int dbgp_op(const struct physdev_dbgp_op *);
>> +void ehci_dbgp_init(void);
>> +#else
>> +static inline void ehci_dbgp_init(void) {}
>> +static inline int dbgp_op(const struct physdev_dbgp_op *op) { return 0; }
>> +#endif
>> +
>> +void arm_uart_init(void);
>>
>>  /* Baud rate was pre-configured before invoking the UART driver. */
>>  #define BAUD_AUTO (-1)
>>
>>
> Regards,
>
> --
> Julien Grall
___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 2/2] x86: add a user configurable Kconfig option for the EHCI debug port

2016-09-19 Thread Derek Straka
Allows for the conditional inclusion of EHCI debug port driver on the x86
platform rather than having it always enabled.

The default configuration for the CONFIG_EHCI option remains 'y' on x86, so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to enable/disable the inclusion of the EHCI debug port driver.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/drivers/char/Kconfig  |  5 +
 xen/drivers/char/Makefile |  2 +-
 xen/include/xen/serial.h  | 12 +---
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index 1d894a7..1c5400f 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -51,6 +51,11 @@ config HAS_SCIF
 
 config HAS_EHCI
bool
+
+config EHCI
+   bool "EHCI debug port" if EXPERT = "y"
+   default y
+   depends on HAS_EHCI
help
  This selects the USB based EHCI debug port to be used as a UART. If
  you have an x86 based system with USB, say Y.
diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
index 0afadaf..40c193b 100644
--- a/xen/drivers/char/Makefile
+++ b/xen/drivers/char/Makefile
@@ -5,6 +5,6 @@ obj-$(CONFIG_HAS_PL011) += pl011.o
 obj-$(CONFIG_HAS_EXYNOS4210) += exynos4210-uart.o
 obj-$(CONFIG_HAS_OMAP) += omap-uart.o
 obj-$(CONFIG_HAS_SCIF) += scif-uart.o
-obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
+obj-$(CONFIG_EHCI) += ehci-dbgp.o
 obj-$(CONFIG_ARM) += arm-uart.o
 obj-y += serial.o
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 46edff8..5c6cbe9 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -174,11 +174,17 @@ void ns16550_init(int index, struct ns16550_defaults 
*defaults);
 static inline void ns16550_init(int index, struct ns16550_defaults *defaults) 
{}
 #endif
 
-void ehci_dbgp_init(void);
-void arm_uart_init(void);
-
 struct physdev_dbgp_op;
+
+#ifdef CONFIG_EHCI
 int dbgp_op(const struct physdev_dbgp_op *);
+void ehci_dbgp_init(void);
+#else
+static inline void ehci_dbgp_init(void) {}
+static inline int dbgp_op(const struct physdev_dbgp_op *op) { return 0; }
+#endif
+
+void arm_uart_init(void);
 
 /* Baud rate was pre-configured before invoking the UART driver. */
 #define BAUD_AUTO (-1)
-- 
2.7.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 1/2] x86: add a user configurable Kconfig option for the NS16550 UART

2016-09-19 Thread Derek Straka
Allows for the conditional inclusion of NS16550 UART driver rather than having
it always enabled.

The default configuration for the CONFIG_NS16550 option remains 'y', so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to enable/disable the inclusion of the NS16550 UART driver.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/drivers/char/Kconfig  | 5 +
 xen/drivers/char/Makefile | 2 +-
 xen/include/xen/serial.h  | 7 ++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index 51343d0..1d894a7 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -1,6 +1,11 @@
 config HAS_NS16550
bool
default y
+
+config NS16550
+   bool "NS16550 UART" if EXPERT = "y"
+   default y
+   depends on HAS_NS16550
help
  This selects the 16550-series UART support. For most systems, say Y.
 
diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
index aa169d7..0afadaf 100644
--- a/xen/drivers/char/Makefile
+++ b/xen/drivers/char/Makefile
@@ -1,5 +1,5 @@
 obj-y += console.o
-obj-$(CONFIG_HAS_NS16550) += ns16550.o
+obj-$(CONFIG_NS16550) += ns16550.o
 obj-$(CONFIG_HAS_CADENCE_UART) += cadence-uart.o
 obj-$(CONFIG_HAS_PL011) += pl011.o
 obj-$(CONFIG_HAS_EXYNOS4210) += exynos4210-uart.o
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 1212a12..46edff8 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -167,9 +167,14 @@ struct ns16550_defaults {
 int irq;   /* default irq */
 unsigned long io_base; /* default io_base address */
 };
+
+#ifdef CONFIG_NS16550
 void ns16550_init(int index, struct ns16550_defaults *defaults);
-void ehci_dbgp_init(void);
+#else
+static inline void ns16550_init(int index, struct ns16550_defaults *defaults) 
{}
+#endif
 
+void ehci_dbgp_init(void);
 void arm_uart_init(void);
 
 struct physdev_dbgp_op;
-- 
2.7.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86: add a user configurable Kconfig option for the VGA

2016-09-13 Thread Derek Straka
Allows for the conditional inclusion of VGA driver on the x86 platform
rather than having it always enabled.

The default configuration for the CONFIG_VGA option remains 'y' on x86, so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to enable/disable the inclusion of the VGA driver.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/arch/x86/Kconfig| 1 -
 xen/arch/x86/efi/efi-boot.h | 7 +++
 xen/arch/x86/setup.c| 5 +
 xen/drivers/video/Kconfig   | 3 ++-
 xen/include/asm-x86/setup.h | 5 +
 xen/include/xen/console.h   | 8 
 6 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 265fd79..9e10591 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -20,7 +20,6 @@ config X86
select HAS_PCI
select HAS_PDX
select NUMA
-   select VGA
 
 config ARCH_DEFCONFIG
string
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 10985721..911fdfd 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -476,6 +476,7 @@ static void __init efi_arch_edd(void)
 boot_edd_info_nr = EDD_INFO_MAX;
 }
 
+#ifdef CONFIG_VGA
 static void __init efi_arch_console_init(UINTN cols, UINTN rows)
 {
 vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3;
@@ -550,6 +551,12 @@ static void __init 
efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
 (gop->Mode->FrameBufferSize + 0x) >> 16;
 }
 }
+#else
+static inline void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL 
*gop,
+   UINTN info_size,
+   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION 
*mode_info) {}
+static inline void __init efi_arch_console_init(UINTN cols, UINTN rows) {}
+#endif
 
 static void __init efi_arch_memory_setup(void)
 {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ae897a..6358336 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -433,10 +433,12 @@ struct boot_video_info {
 u16 vesapm_off; /* 0x26 */
 u16 vesa_attrib;/* 0x28 */
 };
+
 extern struct boot_video_info boot_vid_info;
 
 static void __init parse_video_info(void)
 {
+#ifdef CONFIG_VGA
 struct boot_video_info *bvi = (boot_vid_info);
 
 /* The EFI loader fills vga_console_info directly. */
@@ -472,6 +474,7 @@ static void __init parse_video_info(void)
 vga_console_info.u.vesa_lfb.gbl_caps = bvi->capabilities;
 vga_console_info.u.vesa_lfb.mode_attrs = bvi->vesa_attrib;
 }
+#endif
 }
 
 static void __init kexec_reserve_area(struct e820map *e820)
@@ -672,6 +675,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
 printk("Command line: %s\n", cmdline);
 
+#ifdef CONFIG_VGA
 printk("Video information:\n");
 
 /* Print VGA display mode information. */
@@ -694,6 +698,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 printk(" No VGA detected\n");
 break;
 }
+#endif
 
 /* Print VBE/DDC EDID information. */
 if ( bootsym(boot_edid_caps) != 0x1313 )
diff --git a/xen/drivers/video/Kconfig b/xen/drivers/video/Kconfig
index 0ffbbd9..0f208fe 100644
--- a/xen/drivers/video/Kconfig
+++ b/xen/drivers/video/Kconfig
@@ -3,7 +3,8 @@ config VIDEO
bool
 
 config VGA
-   bool
+   bool "VGA"
+   default y if X86
select VIDEO
 
 config HAS_ARM_HDLCD
diff --git a/xen/include/asm-x86/setup.h b/xen/include/asm-x86/setup.h
index c65b79c..02e9b12 100644
--- a/xen/include/asm-x86/setup.h
+++ b/xen/include/asm-x86/setup.h
@@ -28,8 +28,13 @@ void arch_init_memory(void);
 void subarch_init_memory(void);
 
 void init_IRQ(void);
+#ifdef CONFIG_VGA
 void vesa_init(void);
 void vesa_mtrr_init(void);
+#else
+static inline void vesa_init(void) {}
+static inline void vesa_mtrr_init(void) {}
+#endif
 
 int construct_dom0(
 struct domain *d,
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index ea06fd8..2e7c22c 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -19,7 +19,15 @@ void console_init_postirq(void);
 void console_endboot(void);
 int console_has(const char *device);
 
+#ifdef CONFIG_VGA
 int fill_console_start_info(struct dom0_vga_console_info *);
+#else
+#include 
+static inline int fill_console_start_info(struct dom0_vga_console_info *ci) {
+(void) memset(ci, 0, sizeof(*ci));
+return 1;
+}
+#endif
 
 unsigned long console_lock_recursive_irqsave(void);
 void console_unlock_recursive_irqrestore(unsigned long flags);
-- 
2.7.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 1/2] x86: add a user configurable Kconfig option for the NS16550 UART

2016-09-13 Thread Derek Straka
Allows for the conditional inclusion of NS16550 UART driver on the x86 platform
rather than having it always enabled.

The default configuration for the HAS_NS16550 option remains 'y' on x86, so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to enable/disable the inclusion of the NS16550 UART driver.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/arch/x86/Kconfig | 1 -
 xen/drivers/char/Kconfig | 4 ++--
 xen/include/xen/serial.h | 7 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 265fd79..8a122df 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -15,7 +15,6 @@ config X86
select HAS_MEM_ACCESS
select HAS_MEM_PAGING
select HAS_MEM_SHARING
-   select HAS_NS16550
select HAS_PASSTHROUGH
select HAS_PCI
select HAS_PDX
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index 51343d0..c87e018 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -1,6 +1,6 @@
 config HAS_NS16550
-   bool
-   default y
+   bool "NS16550 UART" if EXPERT = "y"
+   default y if X86
help
  This selects the 16550-series UART support. For most systems, say Y.
 
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 1212a12..343779c 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -167,9 +167,14 @@ struct ns16550_defaults {
 int irq;   /* default irq */
 unsigned long io_base; /* default io_base address */
 };
+
+#ifdef CONFIG_HAS_NS16550
 void ns16550_init(int index, struct ns16550_defaults *defaults);
-void ehci_dbgp_init(void);
+#else
+static inline void ns16550_init(int index, struct ns16550_defaults *defaults) 
{}
+#endif
 
+void ehci_dbgp_init(void);
 void arm_uart_init(void);
 
 struct physdev_dbgp_op;
-- 
2.7.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH 2/2] x86: add a user configurable Kconfig option for the EHCI UART

2016-09-13 Thread Derek Straka
Allows for the conditional inclusion of EHCI UART driver on the x86 platform
rather than having it always enabled.

The default configuration for the HAS_EHCI option remains 'y' on x86, so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to enable/disable the inclusion of the EHCI UART driver.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/arch/x86/Kconfig |  1 -
 xen/drivers/char/Kconfig |  3 ++-
 xen/include/xen/serial.h | 12 +++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 8a122df..2119c93 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -8,7 +8,6 @@ config X86
select COMPAT
select CORE_PARKING
select HAS_CPUFREQ
-   select HAS_EHCI
select HAS_GDBSX
select HAS_IOPORTS
select HAS_KEXEC
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index c87e018..08a60e0 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -45,7 +45,8 @@ config HAS_SCIF
  say Y.
 
 config HAS_EHCI
-   bool
+   bool "EHCI UART" if EXPERT = "y"
+   default y if X86
help
  This selects the USB based EHCI debug port to be used as a UART. If
  you have an x86 based system with USB, say Y.
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 343779c..8f87897 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -174,11 +174,21 @@ void ns16550_init(int index, struct ns16550_defaults 
*defaults);
 static inline void ns16550_init(int index, struct ns16550_defaults *defaults) 
{}
 #endif
 
+#ifdef CONFIG_HAS_EHCI
 void ehci_dbgp_init(void);
-void arm_uart_init(void);
+#else
+static inline void ehci_dbgp_init(void) {}
+#endif
 
+void arm_uart_init(void);
+ 
 struct physdev_dbgp_op;
+
+#ifdef CONFIG_HAS_EHCI
 int dbgp_op(const struct physdev_dbgp_op *);
+#else
+static inline int dbgp_op(const struct physdev_dbgp_op *op) { return 0; }
+#endif
 
 /* Baud rate was pre-configured before invoking the UART driver. */
 #define BAUD_AUTO (-1)
-- 
2.7.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCHv2] x86: Add a tboot Kconfig option

2016-08-18 Thread Derek Straka
Allows for the conditional inclusion of tboot related functionality
via Kconfig

The default configuration for the new CONFIG_TBOOT option is 'y', so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to disable system behaviors associated with tboot at compile
time rather than relying on the run-time detection and configuration.

The CONFIG_CRYPTO option is 'n' by default and selected by the individual users
that require the functionality.  Currently, the only user is tboot.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/Rules.mk|  2 +-
 xen/arch/x86/Kconfig| 11 +++
 xen/arch/x86/Makefile   |  2 +-
 xen/common/Kconfig  |  4 
 xen/include/asm-x86/tboot.h | 16 
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index ebe1dc0..a190ff0 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -44,7 +44,7 @@ ALL_OBJS-y   += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y   += $(BASEDIR)/drivers/built_in.o
 ALL_OBJS-y   += $(BASEDIR)/xsm/built_in.o
 ALL_OBJS-y   += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
-ALL_OBJS-$(CONFIG_X86)   += $(BASEDIR)/crypto/built_in.o
+ALL_OBJS-$(CONFIG_CRYPTO)   += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -nostdinc -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index c1e9279..265fd79 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -76,6 +76,17 @@ config HVM_FEP
  for use in production.
 
  If unsure, say N.
+
+config TBOOT
+   def_bool y
+   prompt "Xen tboot support" if EXPERT = "y"
+   depends on X86
+   select CRYPTO
+   ---help---
+ Allows support for Trusted Boot using the Intel(R) Trusted Execution
+ Technology (TXT)
+
+ If unsure, say Y.
 endmenu
 
 source "common/Kconfig"
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b18f033..5b9e9da 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -62,7 +62,7 @@ obj-y += trace.o
 obj-y += traps.o
 obj-y += usercopy.o
 obj-y += x86_emulate.o
-obj-y += tboot.o
+obj-$(CONFIG_TBOOT) += tboot.o
 obj-y += hpet.o
 obj-y += vm_event.o
 obj-y += xstate.o
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 51afa24..e2dd89f 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -218,6 +218,10 @@ config SCHED_DEFAULT
 
 endmenu
 
+config CRYPTO
+   bool
+   default n
+
 # Enable/Disable live patching support
 config LIVEPATCH
bool "Live patching support (TECH PREVIEW)"
diff --git a/xen/include/asm-x86/tboot.h b/xen/include/asm-x86/tboot.h
index d242862..59ed449 100644
--- a/xen/include/asm-x86/tboot.h
+++ b/xen/include/asm-x86/tboot.h
@@ -119,6 +119,7 @@ typedef struct __packed {
 
 extern tboot_shared_t *g_tboot_shared;
 
+#ifdef CONFIG_TBOOT
 void tboot_probe(void);
 void tboot_shutdown(uint32_t shutdown_type);
 int tboot_in_measured_env(void);
@@ -127,6 +128,21 @@ int tboot_parse_dmar_table(acpi_table_handler 
dmar_handler);
 int tboot_s3_resume(void);
 void tboot_s3_error(int error);
 int tboot_wake_ap(int apicid, unsigned long sipi_vec);
+#else
+static inline void tboot_probe(void) {}
+static inline void tboot_shutdown(uint32_t shutdown_type) {}
+static inline int tboot_in_measured_env(void) { return 0; }
+static inline int tboot_protect_mem_regions(void) { return 1; }
+
+static inline int tboot_parse_dmar_table(acpi_table_handler dmar_handler)
+{
+return acpi_table_parse(ACPI_SIG_DMAR, dmar_handler);
+}
+
+static inline int tboot_s3_resume(void) { return 0; }
+static inline void tboot_s3_error(int error) {}
+static inline int tboot_wake_ap(int apicid, unsigned long sipi_vec) { return 
1; }
+#endif /* CONFIG_TBOOT */
 
 #endif /* __TBOOT_H__ */
 
-- 
1.9.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86: Add a tboot Kconfig option

2016-08-17 Thread Derek Straka
Allows for the conditional inclusion of tboot related functionality via Kconfig

The default configuration for the new CONFIG_TBOOT option is 'y', so the
behavior out of the box remains unchanged.  The addition of the option allows
advanced users to disable system behaviors associated with tboot at compile
time rather than relying on the run-time detection and configuration.

Signed-off-by: Derek Straka <de...@asterius.io>
---
 xen/Rules.mk|  2 +-
 xen/arch/x86/Makefile   |  2 +-
 xen/common/Kconfig  | 11 +++
 xen/include/asm-x86/tboot.h | 12 
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/xen/Rules.mk b/xen/Rules.mk
index ebe1dc0..12d3184 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -44,7 +44,7 @@ ALL_OBJS-y   += $(BASEDIR)/common/built_in.o
 ALL_OBJS-y   += $(BASEDIR)/drivers/built_in.o
 ALL_OBJS-y   += $(BASEDIR)/xsm/built_in.o
 ALL_OBJS-y   += $(BASEDIR)/arch/$(TARGET_ARCH)/built_in.o
-ALL_OBJS-$(CONFIG_X86)   += $(BASEDIR)/crypto/built_in.o
+ALL_OBJS-$(CONFIG_TBOOT)   += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -nostdinc -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index b18f033..5b9e9da 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -62,7 +62,7 @@ obj-y += trace.o
 obj-y += traps.o
 obj-y += usercopy.o
 obj-y += x86_emulate.o
-obj-y += tboot.o
+obj-$(CONFIG_TBOOT) += tboot.o
 obj-y += hpet.o
 obj-y += vm_event.o
 obj-y += xstate.o
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 51afa24..cb9a92a 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -218,6 +218,17 @@ config SCHED_DEFAULT
 
 endmenu
 
+# Enable/Disable tboot support
+config TBOOT
+   bool "Xen tboot support"
+   default y
+   depends on X86
+   ---help---
+ Allows support for Trusted Boot using the Intel(R) Trusted Execution
+ Technology (TXT)
+
+ If unsure, say Y.
+
 # Enable/Disable live patching support
 config LIVEPATCH
bool "Live patching support (TECH PREVIEW)"
diff --git a/xen/include/asm-x86/tboot.h b/xen/include/asm-x86/tboot.h
index d242862..977e509 100644
--- a/xen/include/asm-x86/tboot.h
+++ b/xen/include/asm-x86/tboot.h
@@ -119,6 +119,7 @@ typedef struct __packed {
 
 extern tboot_shared_t *g_tboot_shared;
 
+#ifdef CONFIG_TBOOT
 void tboot_probe(void);
 void tboot_shutdown(uint32_t shutdown_type);
 int tboot_in_measured_env(void);
@@ -127,6 +128,17 @@ int tboot_parse_dmar_table(acpi_table_handler 
dmar_handler);
 int tboot_s3_resume(void);
 void tboot_s3_error(int error);
 int tboot_wake_ap(int apicid, unsigned long sipi_vec);
+#else
+static inline void tboot_probe(void) {}
+static inline void tboot_shutdown(uint32_t shutdown_type) {}
+static inline int tboot_in_measured_env(void) {return 0;}
+static inline int tboot_protect_mem_regions(void) {return 1;}
+static inline int tboot_parse_dmar_table(acpi_table_handler dmar_handler) 
{return acpi_table_parse(ACPI_SIG_DMAR, dmar_handler);}
+static inline int tboot_s3_resume(void) { return 0; }
+
+static inline void tboot_s3_error(int error) {}
+static inline int tboot_wake_ap(int apicid, unsigned long sipi_vec) {return 1;}
+#endif /* CONFIG_TBOOT */
 
 #endif /* __TBOOT_H__ */
 
-- 
1.9.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel