[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] console: make input work again for pv-shim
commit 698b0f5031c6083401234a9b9415175cc5855a0a Author: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx> AuthorDate: Thu Oct 19 09:54:50 2023 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Oct 19 09:54:50 2023 +0200 console: make input work again for pv-shim The use of rcu_lock_domain_by_id() right in switch_serial_input() makes assumptions about domain IDs which don't hold when in shim mode: The sole (initial) domain there has a non-zero ID. Obtain the real domain ID in that case (generalized as get_initial_domain_id() returns zero when not in shim mode). Note that console_input_domain() isn't altered, for not being used when in shim mode (or more generally on x86). Fixes: c2581c58bec9 ("xen/console: skip switching serial input to non existing domains") Signed-off-by: Manuel Bouyer <bouyer@xxxxxxxxxxxxxxx> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx> Release-acked-by: Henry Wang <Henry.Wang@xxxxxxx> --- xen/drivers/char/console.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index f81b8b6b47..6b679c5eac 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -468,7 +468,7 @@ static void cf_check dump_console_ring_key(unsigned char key) #define switch_code (opt_conswitch[0]-'a'+1) /* * console_rx=0 => input to xen - * console_rx=1 => input to dom0 + * console_rx=1 => input to dom0 (or the sole shim domain) * console_rx=N => input to dom(N-1) */ static unsigned int __read_mostly console_rx = 0; @@ -493,6 +493,7 @@ static void switch_serial_input(void) */ for ( ; ; ) { + domid_t domid; struct domain *d; if ( next_rx++ >= max_console_rx ) @@ -502,12 +503,18 @@ static void switch_serial_input(void) break; } - d = rcu_lock_domain_by_id(next_rx - 1); +#ifdef CONFIG_PV_SHIM + if ( next_rx == 1 ) + domid = get_initial_domain_id(); + else +#endif + domid = next_rx - 1; + d = rcu_lock_domain_by_id(domid); if ( d ) { rcu_unlock_domain(d); console_rx = next_rx; - printk("*** Serial input to DOM%u", next_rx - 1); + printk("*** Serial input to DOM%u", domid); break; } } -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |