[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 2/2] drivers/ns16550: remove use of run_in_exception_handler()



From: Denis Mukhin <dmukhin@xxxxxxxx> 

Polling is relevant for early boot only where facilities requiring
run_in_exception_handler() are not used (e.g. 'd' keyhandler).

Rework ns16550_poll() by droppping use of run_in_exception_handler().

The ground work for run_in_exception_handler() removal was done under XSA-453:
https://xenbits.xen.org/xsa/advisory-453.html

Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 xen/drivers/char/ns16550.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 0bbbafb49f6d..c10bff596b3b 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -214,21 +214,14 @@ static void cf_check ns16550_interrupt(int irq, void 
*dev_id)
     }
 }
 
-/* Safe: ns16550_poll() runs as softirq so not reentrant on a given CPU. */
-static DEFINE_PER_CPU(struct serial_port *, poll_port);
-
-static void cf_check __ns16550_poll(const struct cpu_user_regs *regs)
+static void cf_check ns16550_poll(void *data)
 {
-    struct serial_port *port = this_cpu(poll_port);
+    struct serial_port *port = data;
     struct ns16550 *uart = port->uart;
-    const struct cpu_user_regs *old_regs;
 
     if ( uart->intr_works )
         return; /* Interrupts work - no more polling */
 
-    /* Mimic interrupt context. */
-    old_regs = set_irq_regs(regs);
-
     while ( ns_read_reg(uart, UART_LSR) & UART_LSR_DR )
     {
         if ( ns16550_ioport_invalid(uart) )
@@ -241,16 +234,9 @@ static void cf_check __ns16550_poll(const struct 
cpu_user_regs *regs)
         serial_tx_interrupt(port);
 
 out:
-    set_irq_regs(old_regs);
     set_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms));
 }
 
-static void cf_check ns16550_poll(void *data)
-{
-    this_cpu(poll_port) = data;
-    run_in_exception_handler(__ns16550_poll);
-}
-
 static int cf_check ns16550_tx_ready(struct serial_port *port)
 {
     struct ns16550 *uart = port->uart;
-- 
2.34.1





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.