diff mbox series

[v2,15/35] xen/console: rename console_rx to console_owner

Message ID 20241205-vuart-ns8250-v1-15-e9aa923127eb@ford.com (mailing list archive)
State New
Headers show
Series Introduce NS8250 UART emulator | expand

Commit Message

Denis Mukhin via B4 Relay Dec. 6, 2024, 4:41 a.m. UTC
From: Denis Mukhin <dmukhin@ford.com>

Preparation for the follow on change to switch console_owner to
domid_t address space.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/drivers/char/console.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

Comments

Jan Beulich Dec. 10, 2024, 2:23 p.m. UTC | #1
On 06.12.2024 05:41, Denis Mukhin via B4 Relay wrote:
> Preparation for the follow on change to switch console_owner to
> domid_t address space.

As with the earlier change - it's one thing to (plan to) change the
number space, and another to go from input only to general console.

Jan
Roger Pau Monné Dec. 12, 2024, 8:58 a.m. UTC | #2
On Thu, Dec 05, 2024 at 08:41:45PM -0800, Denis Mukhin via B4 Relay wrote:
> From: Denis Mukhin <dmukhin@ford.com>
> 
> Preparation for the follow on change to switch console_owner to
> domid_t address space.

I'm a bit confused, is the plan to assign the console (so both RX and
TX) exclusively to a domain?

Otherwise this would better be named console_input_target or similar,
if you think console_rx is not clear enough (FWIW, I'm OK with the
name given the current usage).

Thanks, Roger.
diff mbox series

Patch

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index f8a7db385c9525cabc69ceb1a84d73f57863aa45..86bf899ada8f8221ffc77bcffb1f58777a22198e 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -467,11 +467,11 @@  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 (or the sole shim domain)
- * console_rx=N => input to dom(N-1)
+ * console_owner=0 => input to xen
+ * console_owner=1 => input to dom0 (or the sole shim domain)
+ * console_owner=N => input to dom(N-1)
  */
-static unsigned int __read_mostly console_rx = 0;
+static unsigned int __read_mostly console_owner = 0;
 
 #define max_console_rx (max_init_domid + 1)
 
@@ -479,15 +479,15 @@  static unsigned int __read_mostly console_rx = 0;
 /* Make sure to rcu_unlock_domain after use */
 struct domain *rcu_lock_domain_console_owner(void)
 {
-    if ( console_rx == 0 )
+    if ( console_owner == 0 )
             return NULL;
-    return rcu_lock_domain_by_id(console_rx - 1);
+    return rcu_lock_domain_by_id(console_owner - 1);
 }
 #endif
 
 static void console_find_owner(void)
 {
-    unsigned int next_rx = console_rx;
+    unsigned int next_rx = console_owner;
 
     /*
      * Rotate among Xen, dom0 and boot-time created domUs while skipping
@@ -500,7 +500,7 @@  static void console_find_owner(void)
 
         if ( next_rx++ >= max_console_rx )
         {
-            console_rx = 0;
+            console_owner = 0;
             printk("*** Serial input to Xen");
             break;
         }
@@ -515,7 +515,7 @@  static void console_find_owner(void)
         if ( d )
         {
             rcu_unlock_domain(d);
-            console_rx = next_rx;
+            console_owner = next_rx;
             printk("*** Serial input to DOM%u", domid);
             break;
         }
@@ -529,7 +529,7 @@  static void console_find_owner(void)
 
 static void __serial_rx(char c)
 {
-    switch ( console_rx )
+    switch ( console_owner )
     {
     case 0:
         return handle_keypress(c, false);
@@ -552,7 +552,7 @@  static void __serial_rx(char c)
 #ifdef CONFIG_SBSA_VUART_CONSOLE
     default:
     {
-        struct domain *d = rcu_lock_domain_by_id(console_rx - 1);
+        struct domain *d = rcu_lock_domain_by_id(console_owner - 1);
 
         /*
          * If we have a properly initialized vpl011 console for the
@@ -563,7 +563,7 @@  static void __serial_rx(char c)
             vpl011_rx_char_xen(d, c);
         else
             printk("Cannot send chars to Dom%d: no UART available\n",
-                   console_rx - 1);
+                   console_owner - 1);
 
         if ( d != NULL )
             rcu_unlock_domain(d);
@@ -1116,7 +1116,7 @@  void __init console_endboot(void)
      * a useful 'how to switch' message.
      */
     if ( opt_conswitch[1] == 'x' )
-        console_rx = max_console_rx;
+        console_owner = max_console_rx;
 
     register_keyhandler('w', dump_console_ring_key,
                         "synchronously dump console ring buffer (dmesg)", 0);