* [PATCH] serial: 8250_lpss: Switch over to MSI interrupts
@ 2019-10-01 8:16 Felipe Balbi
2019-10-01 8:59 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2019-10-01 8:16 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby
Cc: Andy Shevchenko, linux-serial, Felipe Balbi
Some devices support MSI interrupts. Let's at least try to use them in
platforms that provide MSI capability.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
---
drivers/tty/serial/8250/8250_lpss.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
index 5f72ef3ea574..f0f7a2777557 100644
--- a/drivers/tty/serial/8250/8250_lpss.c
+++ b/drivers/tty/serial/8250/8250_lpss.c
@@ -293,16 +293,22 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (ret)
return ret;
+ pci_set_master(pdev);
+
lpss = devm_kzalloc(&pdev->dev, sizeof(*lpss), GFP_KERNEL);
if (!lpss)
return -ENOMEM;
+ ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
+ if (ret < 0)
+ return ret;
+
lpss->board = (struct lpss8250_board *)id->driver_data;
memset(&uart, 0, sizeof(struct uart_8250_port));
uart.port.dev = &pdev->dev;
- uart.port.irq = pdev->irq;
+ uart.port.irq = pci_irq_vector(pdev, 0);
uart.port.private_data = &lpss->data;
uart.port.type = PORT_16550A;
uart.port.iotype = UPIO_MEM;
@@ -337,6 +343,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_exit:
if (lpss->board->exit)
lpss->board->exit(lpss);
+ pci_free_irq_vectors(pdev);
return ret;
}
@@ -348,6 +355,7 @@ static void lpss8250_remove(struct pci_dev *pdev)
if (lpss->board->exit)
lpss->board->exit(lpss);
+ pci_free_irq_vectors(pdev);
}
static const struct lpss8250_board byt_board = {
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: 8250_lpss: Switch over to MSI interrupts
2019-10-01 8:16 [PATCH] serial: 8250_lpss: Switch over to MSI interrupts Felipe Balbi
@ 2019-10-01 8:59 ` Andy Shevchenko
2019-10-01 9:35 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2019-10-01 8:59 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial
On Tue, Oct 01, 2019 at 11:16:17AM +0300, Felipe Balbi wrote:
> Some devices support MSI interrupts. Let's at least try to use them in
> platforms that provide MSI capability.
Thanks for the patch!
I think you may clean up qrk_serial_setup() as well.
> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> ---
> drivers/tty/serial/8250/8250_lpss.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
> index 5f72ef3ea574..f0f7a2777557 100644
> --- a/drivers/tty/serial/8250/8250_lpss.c
> +++ b/drivers/tty/serial/8250/8250_lpss.c
> @@ -293,16 +293,22 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> if (ret)
> return ret;
>
> + pci_set_master(pdev);
> +
> lpss = devm_kzalloc(&pdev->dev, sizeof(*lpss), GFP_KERNEL);
> if (!lpss)
> return -ENOMEM;
>
> + ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> + if (ret < 0)
> + return ret;
> +
> lpss->board = (struct lpss8250_board *)id->driver_data;
>
> memset(&uart, 0, sizeof(struct uart_8250_port));
>
> uart.port.dev = &pdev->dev;
> - uart.port.irq = pdev->irq;
> + uart.port.irq = pci_irq_vector(pdev, 0);
> uart.port.private_data = &lpss->data;
> uart.port.type = PORT_16550A;
> uart.port.iotype = UPIO_MEM;
> @@ -337,6 +343,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> err_exit:
> if (lpss->board->exit)
> lpss->board->exit(lpss);
> + pci_free_irq_vectors(pdev);
> return ret;
> }
>
> @@ -348,6 +355,7 @@ static void lpss8250_remove(struct pci_dev *pdev)
>
> if (lpss->board->exit)
> lpss->board->exit(lpss);
> + pci_free_irq_vectors(pdev);
> }
>
> static const struct lpss8250_board byt_board = {
> --
> 2.23.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: 8250_lpss: Switch over to MSI interrupts
2019-10-01 8:59 ` Andy Shevchenko
@ 2019-10-01 9:35 ` Felipe Balbi
2019-10-01 11:09 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Balbi @ 2019-10-01 9:35 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial
[-- Attachment #1: Type: text/plain, Size: 408 bytes --]
Hi,
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> On Tue, Oct 01, 2019 at 11:16:17AM +0300, Felipe Balbi wrote:
>> Some devices support MSI interrupts. Let's at least try to use them in
>> platforms that provide MSI capability.
>
> Thanks for the patch!
>
> I think you may clean up qrk_serial_setup() as well.
That would break qrk_serial_setup_dma(), though.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] serial: 8250_lpss: Switch over to MSI interrupts
2019-10-01 9:35 ` Felipe Balbi
@ 2019-10-01 11:09 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2019-10-01 11:09 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial
On Tue, Oct 01, 2019 at 12:35:36PM +0300, Felipe Balbi wrote:
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> > On Tue, Oct 01, 2019 at 11:16:17AM +0300, Felipe Balbi wrote:
> >> Some devices support MSI interrupts. Let's at least try to use them in
> >> platforms that provide MSI capability.
> >
> > Thanks for the patch!
> >
> > I think you may clean up qrk_serial_setup() as well.
>
> That would break qrk_serial_setup_dma(), though.
Hmm... I don't see how.
The DMA setup is called after allocation of IRQ vector and the device in use is
the same, i.e. PCI device.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-01 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-01 8:16 [PATCH] serial: 8250_lpss: Switch over to MSI interrupts Felipe Balbi
2019-10-01 8:59 ` Andy Shevchenko
2019-10-01 9:35 ` Felipe Balbi
2019-10-01 11:09 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.