--- drivers/char/console.c.orig 2023-10-18 12:24:57.221891748 +0200 +++ drivers/char/console.c 2023-10-18 12:30:26.072844802 +0200 @@ -478,14 +478,20 @@ /* Make sure to rcu_unlock_domain after use */ struct domain *console_input_domain(void) { + domid_t domid; if ( console_rx == 0 ) return NULL; - return rcu_lock_domain_by_id(console_rx - 1); + if (console_rx == 1 && pv_shim) + domid = get_initial_domain_id(); + else + domid = console_rx - 1; + return rcu_lock_domain_by_id(domid); } static void switch_serial_input(void) { unsigned int next_rx = console_rx; + domid_t domid; /* * Rotate among Xen, dom0 and boot-time created domUs while skipping @@ -502,7 +508,11 @@ break; } - d = rcu_lock_domain_by_id(next_rx - 1); + if (next_rx == 1 && pv_shim) + domid = get_initial_domain_id(); + else + domid = next_rx - 1; + d = rcu_lock_domain_by_id(domid); if ( d ) { rcu_unlock_domain(d);