ns16550: use poll mode if INTERRUPT_LINE is 0xff
PATCH v4 1/2 ns16550: use poll mode if INTERRUPT_LINE is 0xff
Intel LPSS has INTERRUPT_LINE set to 0xff by default, that is declared by the PCI Local Bus Specification Revision 3.0 (from 2004) as "unknown"/"no connection". Fallback to poll mode in this case. The 0xff handling is x86-specific, the surrounding code is guarded with CONFIG_X86 anyway.
---
Changes in v4:
- adjust log message, change it from WARNING to INFO
- re-add x86 reference in the commit message
Changes in v3:
- change back to checking 0xff explicitly
- adjust commit message, include spec reference
- change warning to match the above
Changes in v2:
- add log message
- extend commit message
- code style fix
--- xen/drivers/char/ns16550.c | 7 +++++++ 1 file changed, 7 insertions(+)
xen/drivers/char/ns16550.c +7 -0
@@ -1238,6 +1238,13 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)pci_conf_read8 (PCI_SBDF (0 , b, d, f), PCI_INTERRUPT_LINE) : 0; +if ( uart->irq ==0xff ) + uart->irq =0 ; +if ( !uart->irq ) +printk (XENLOG_INFO +"ns16550: %pp no legacy IRQ %d, using poll mode\n" , + &PCI_SBDF (0 , b, d, f), uart->irq); +return 0 ; } }
Signature · 1 line
2.35.1
PATCH v4 2/2 ns16550: Add more device IDs for Intel LPSS UART
This is purely based on the spec:
- Intel 500 Series PCH: 635218-006
- Intel 600 Series PCH: 691222-001, 648364-003
This is tested only on TGL-LP added initially, but according to the spec, they should behave the same.
---
Changes in v2:
- new patch, adding more IDs to the patch that went in already
--- xen/drivers/char/ns16550.c | 80 +++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)
xen/drivers/char/ns16550.c +79 -1
@@ -1077,12 +1077,90 @@ static const struct ns16550_config __initconst uart_config[] = .dev_id = 0x0358, .param = param_exar_xr17v358 }, -/* Intel Corp. TGL-LP LPSS PCI */ +/* Intel Corp. TGL-LP LPSS PCI UART #0 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0xa0a8, + .param = param_intel_lpss + }, + /* Intel Corp. TGL-LP LPSS PCI UART #1 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0xa0a9, + .param = param_intel_lpss + }, + /* Intel Corp. TGL-LP LPSS PCI UART #2 */ { .vendor_id = PCI_VENDOR_ID_INTEL, .dev_id = 0xa0c7, .param = param_intel_lpss }, + /* Intel Corp. TGL-H LPSS PCI UART #0 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x43a8, + .param = param_intel_lpss + }, + /* Intel Corp. TGL-H LPSS PCI UART #1 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x43a9, + .param = param_intel_lpss + }, + /* Intel Corp. TGL-H LPSS PCI UART #2 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x43a7, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-P LPSS PCI UART #0 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x51a8, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-P LPSS PCI UART #1 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x51a9, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-P LPSS PCI UART #2 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x51c7, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-P LPSS PCI UART #3 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x51da, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-S LPSS PCI UART #0 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x7aa8, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-S LPSS PCI UART #1 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x7aa9, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-S LPSS PCI UART #2 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x7afe, + .param = param_intel_lpss + }, + /* Intel Corp. ADL-S LPSS PCI UART #3 */ + { + .vendor_id = PCI_VENDOR_ID_INTEL, + .dev_id = 0x7adc, + .param = param_intel_lpss + }, }; static int __init
Signature · 1 line
2.35.1
Quoted 28 lines · Marek Marczykowski-Górecki
Intel LPSS has
INTERRUPT_LINEset to0xffby default, that is declared by the PCI Local Bus Specification Revision 3.0 (from 2004) as "unknown"/"no connection". Fallback to poll mode in this case. The0xffhandling is x86-specific, the surrounding code is guarded withCONFIG_X86anyway.Signed-off-by Marek Marczykowski-Górecki <[email protected]>---
Changes in v4:
- adjust log message, change it from WARNING to INFO
- re-add x86 reference in the commit message
Changes in v3:
- change back to checking0xffexplicitly
- adjust commit message, include spec reference
- change warning to match the above
Changes in v2:
- add log message
- extend commit message
- code style fix--- xen/drivers/char/ns16550.c | 7 +++++++ 1 file changed, 7 insertions(+)xen/drivers/char/ns16550.c +0
-0
xen/drivers/char/ns16550.c pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx) · line 1246
Quoted 9 lines
xen/drivers/char/ns16550.c +6
-0@@ -1238,6 +1238,13 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)pci_conf_read8 (PCI_SBDF (0 , b, d, f), PCI_INTERRUPT_LINE) : 0; +if ( uart->irq ==0xff ) + uart->irq =0 ; +if ( !uart->irq ) +printk (XENLOG_INFO +"ns16550: %pp no legacy IRQ %d, using poll mode\n" , + &PCI_SBDF (0 , b, d, f), uart->irq);
There's no point in printing ->irq as it will be 0 or else the message won't be printed.
With that fixed:
Thanks.
Quoted 41 lines · Roger Pau Monné
Quoted 28 lines · Marek Marczykowski-Górecki
Intel LPSS has
INTERRUPT_LINEset to0xffby default, that is declared by the PCI Local Bus Specification Revision 3.0 (from 2004) as "unknown"/"no connection". Fallback to poll mode in this case. The0xffhandling is x86-specific, the surrounding code is guarded withCONFIG_X86anyway.Signed-off-by Marek Marczykowski-Górecki <[email protected]>---
Changes in v4:
- adjust log message, change it from WARNING to INFO
- re-add x86 reference in the commit message
Changes in v3:
- change back to checking0xffexplicitly
- adjust commit message, include spec reference
- change warning to match the above
Changes in v2:
- add log message
- extend commit message
- code style fix--- xen/drivers/char/ns16550.c | 7 +++++++ 1 file changed, 7 insertions(+)xen/drivers/char/ns16550.c +0
-0xen/drivers/char/ns16550.c pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx) · line 1246
Quoted 9 lines
xen/drivers/char/ns16550.c +6
-0@@ -1238,6 +1238,13 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)pci_conf_read8 (PCI_SBDF (0 , b, d, f), PCI_INTERRUPT_LINE) : 0; +if ( uart->irq ==0xff ) + uart->irq =0 ; +if ( !uart->irq ) +printk (XENLOG_INFO +"ns16550: %pp no legacy IRQ %d, using poll mode\n" , + &PCI_SBDF (0 , b, d, f), uart->irq);There's no point in printing ->irq as it will be 0 or else the message won't be printed.
Quoted 3 lines
With that fixed:
Reviewed-by Roger Pau Monné <[email protected]>
TBH, can be fixed on commit, save another round of patching.
~Andrew
Quoted 42 lines · Andrew Cooper
Quoted 41 lines · Roger Pau Monné
Quoted 28 lines · Marek Marczykowski-Górecki
Intel LPSS has
INTERRUPT_LINEset to0xffby default, that is declared by the PCI Local Bus Specification Revision 3.0 (from 2004) as "unknown"/"no connection". Fallback to poll mode in this case. The0xffhandling is x86-specific, the surrounding code is guarded withCONFIG_X86anyway.Signed-off-by Marek Marczykowski-Górecki <[email protected]>---
Changes in v4:
- adjust log message, change it from WARNING to INFO
- re-add x86 reference in the commit message
Changes in v3:
- change back to checking0xffexplicitly
- adjust commit message, include spec reference
- change warning to match the above
Changes in v2:
- add log message
- extend commit message
- code style fix--- xen/drivers/char/ns16550.c | 7 +++++++ 1 file changed, 7 insertions(+)xen/drivers/char/ns16550.c +0
-0xen/drivers/char/ns16550.c pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx) · line 1246
Quoted 9 lines
xen/drivers/char/ns16550.c +6
-0@@ -1238,6 +1238,13 @@ pci_uart_config(struct ns16550 *uart, bool_t skip_amt, unsigned int idx)pci_conf_read8 (PCI_SBDF (0 , b, d, f), PCI_INTERRUPT_LINE) : 0; +if ( uart->irq ==0xff ) + uart->irq =0 ; +if ( !uart->irq ) +printk (XENLOG_INFO +"ns16550: %pp no legacy IRQ %d, using poll mode\n" , + &PCI_SBDF (0 , b, d, f), uart->irq);There's no point in printing ->irq as it will be 0 or else the message won't be printed.
Quoted 5 lines
Quoted 3 lines
With that fixed:
Reviewed-by Roger Pau Monné <[email protected]>TBH, can be fixed on commit, save another round of patching.
Indeed, thanks for taking care of that.
Roger.