diff mbox series

[23/36] xen/console: introduce console_owner_domid()

Message ID 20241126-vuart-ns8250-v1-v1-23-87b9a8375b7a@ford.com (mailing list archive)
State New
Headers show
Series Introduce NS8250 UART emulator | expand

Commit Message

Denis Mukhin via B4 Relay Nov. 26, 2024, 11:22 p.m. UTC
From: Denis Mukhin <dmukhin@ford.com>

console_owner_domid() is introduced to obtain the "console owner" domain ID.

The call is used in NS8250 emulator to identify the case when physical xen
console focus is owned by the domain w/ NS8250 emulator, in which case,
messages from guest OS are formatted w/o '(XEN)' prefix.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/drivers/char/console.c | 5 +++++
 xen/include/xen/console.h  | 1 +
 2 files changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 52cf64dbf6fd18d599cb88835d03501a23b3e3c4..a8ab5c2bcb98e4cadf9ad2c9ad28d297977d0557 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -498,6 +498,11 @@  struct domain *rcu_lock_domain_console_owner(void)
     return rcu_lock_domain_console_by_id(console_owner);
 }
 
+domid_t console_owner_domid(void)
+{
+    return console_owner;
+}
+
 static bool console_owner_possible(domid_t domid)
 {
     struct domain *d;
diff --git a/xen/include/xen/console.h b/xen/include/xen/console.h
index 57c482cfbf2da15b011e64841ea086e779f4588d..83be5794aff6630beaad46f910fcc0fc6d833808 100644
--- a/xen/include/xen/console.h
+++ b/xen/include/xen/console.h
@@ -33,6 +33,7 @@  void console_end_log_everything(void);
 
 struct domain *rcu_lock_domain_console_owner(void);
 int console_set_owner(domid_t);
+domid_t console_owner_domid(void);
 
 /*
  * Steal output from the console. Returns +ve identifier, else -ve error.