@@ -1253,6 +1253,7 @@ static void cf_check _ehci_dbgp_poll(str
unsigned long flags;
unsigned int timeout = MICROSECS(DBGP_CHECK_INTERVAL);
bool empty = false;
+ struct cpu_user_regs *old_regs;
if ( !dbgp->ehci_debug )
return;
@@ -1268,12 +1269,17 @@ static void cf_check _ehci_dbgp_poll(str
spin_unlock_irqrestore(&port->tx_lock, flags);
}
+ /* Mimic interrupt context. */
+ old_regs = set_irq_regs(regs);
+
if ( dbgp->in.chunk )
serial_rx_interrupt(port, regs);
if ( empty )
serial_tx_interrupt(port, regs);
+ set_irq_regs(old_regs);
+
if ( spin_trylock_irqsave(&port->tx_lock, flags) )
{
if ( dbgp->state == dbgp_idle && !dbgp->in.chunk &&
@@ -211,10 +211,14 @@ static void cf_check __ns16550_poll(stru
{
struct serial_port *port = this_cpu(poll_port);
struct ns16550 *uart = port->uart;
+ 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) )
@@ -227,6 +231,7 @@ static void cf_check __ns16550_poll(stru
serial_tx_interrupt(port, regs);
out:
+ set_irq_regs(old_regs);
set_timer(&uart->timer, NOW() + MILLISECS(uart->timeout_ms));
}
In preparation of dropping the register parameters from serial_[rt]x_interrupt() and in turn from IRQ handler functions, register state needs making available another way for the few key handlers which need it. Fake IRQ-like state. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- The use of guest_cpu_user_regs() in dbc_uart_poll() is inconsistent with other console poll functions we have, and it's unclear whether that's actually generally correct. It is only for this reason that it doesn't need changing here. Andrew suggested to move set_irq_regs() to BUGFRAME_run_fn handling; it's not clear to me whether that would be (a) correct from an abstract pov (that's exception, not interrupt context after all) and (b) really beneficial. --- v4: Drop xhci-dbc.c change as unnecessary with dump_registers() falling back to using guest_cpu_user_regs() as of patch 2, i.e. ahead of serial_rx_interrupt() having its 2nd parameter dropped. v2: New.