Skip to contentSkip to conversation

x86: add a user configurable Kconfig option for the NS16550 UART

PATCH In review Derek Straka 4 participants 8 messages Sep 13, 2016 – Sep 14, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86: add a user configurable Kconfig option for the NS16550 UART

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.

---
 xen/arch/x86/Kconfig     | 1 -
 xen/drivers/char/Kconfig | 4 ++--
 xen/include/xen/serial.h | 7 ++++++-
 3 files changed, 8 insertions(+), 4 deletions(-)
xen/arch/x86/Kconfig +0 -1
index 265fd79..8a122df 100644
@@ -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
xen/drivers/char/Kconfig +2 -2
index 51343d0..c87e018 100644
@@ -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.
 
xen/include/xen/serial.h +6 -1
index 1212a12..343779c 100644
@@ -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;
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 2/2 x86: add a user configurable Kconfig option for the EHCI UART

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.

---
 xen/arch/x86/Kconfig     |  1 -
 xen/drivers/char/Kconfig |  3 ++-
 xen/include/xen/serial.h | 12 +++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)
xen/arch/x86/Kconfig +0 -1
index 8a122df..2119c93 100644
@@ -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
xen/drivers/char/Kconfig +2 -1
index c87e018..08a60e0 100644
@@ -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.
xen/include/xen/serial.h +11 -1
index 343779c..8f87897 100644
@@ -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)
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#2 lore raw

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

Quoted 45 lines · 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.

---
 xen/arch/x86/Kconfig     |  1 -
 xen/drivers/char/Kconfig |  3 ++-
 xen/include/xen/serial.h | 12 +++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)
xen/arch/x86/Kconfig +0 -1
index 8a122df..2119c93 100644
@@ -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
xen/drivers/char/Kconfig +2 -1
index c87e018..08a60e0 100644
@@ -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.
xen/include/xen/serial.h +0 -0
index 343779c..8f87897 100644

xen/include/xen/serial.h void ns16550_init(int index, struct ns16550_defaults *defaults); · line 181

Quoted 9 lines
xen/include/xen/serial.h +4 -1
@@ -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

It would be cleaner to have ehci_dbgp_init() and dbgp_op() beside each other in a single #ifdef CONFIG_HAS_EHCI

With this, Acked-by: Andrew Cooper <[email protected]>

xen/include/xen/serial.h void ns16550_init(int index, struct ns16550_defaults *defaults); · line 194

Quoted 13 lines
xen/include/xen/serial.h +7 -0
+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)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

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

In reply to Derek Straka

Hello Derek,

xen/drivers/char/Kconfig config HAS_SCIF · line 49

Quoted 11 lines · Derek Straka
xen/drivers/char/Kconfig +2 -1
index c87e018..08a60e0 100644
@@ -45,7 +45,8 @@ config HAS_SCIF
 	  say Y.
 
 config HAS_EHCI
-	bool
+	bool "EHCI UART" if EXPERT = "y"
+	default y if X86

HAS_EHCI should not be available for ARM. Otherwise you may break randomconfig build.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

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

In reply to Derek Straka

xen/drivers/char/Kconfig config HAS_SCIF · line 48

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 13.09.16 at 19:35, <[email protected]> wrote:
xen/drivers/char/Kconfig +1 -1
@@ -45,7 +45,8 @@ config HAS_SCIF
 	  say Y.
 
 config HAS_EHCI
-	bool
+	bool "EHCI UART" if EXPERT = "y"

Please make the prompt say e.g "EHCI debug port" - UART is not a term commonly used with this hardware. And the variable renaming comment from patch 1 applies here too, of course.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/2
#5 lore raw
In reply to Derek Straka
Quoted 8 lines · 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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Derek Straka

Hello Derek,

Quoted 31 lines · 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.

---
 xen/arch/x86/Kconfig     | 1 -
 xen/drivers/char/Kconfig | 4 ++--
 xen/include/xen/serial.h | 7 ++++++-
 3 files changed, 8 insertions(+), 4 deletions(-)
xen/arch/x86/Kconfig +0 -1
index 265fd79..8a122df 100644
@@ -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
xen/drivers/char/Kconfig +0 -0
index 51343d0..c87e018 100644

xen/drivers/char/Kconfig line 5

Quoted 7 lines
xen/drivers/char/Kconfig +2 -2
@@ -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.

With this change, NS166550 is now disabled by default on ARM. This was not the case before.

Please make sure to retain the previous behavior for ARM platforms.

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#7 lore raw
In reply to Derek Straka

xen/drivers/char/Kconfig line 2

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 13.09.16 at 19:35, <[email protected]> wrote:
xen/drivers/char/Kconfig +1 -2
@@ -1,6 +1,6 @@
 config HAS_NS16550
-	bool
-	default y
+	bool "NS16550 UART" if EXPERT = "y"

This need more adjustment: HAS_* options should never have prompts. I.e. you need to rename the config variable at once.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel