[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 34/35] xen/console: enable console owners w/ emulated NS8250


  • To: <dmukhin@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 10 Dec 2024 17:46:15 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ford.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r79r4zDLpxcaMFheGyKd3Wb6ZfryLky/aY/0Wn0XtQc=; b=a+tvlKkNQu7Ax9L6+E4o8kzITXaa0kPX2hzHQAUtbvfyiOPPa25nzH2gRUwnzq7SeEgmBo3+g/F5mCNSfF6KP4X7h2E9/F78ldWglWyK5pwQ46Re3jqqpgjyVgW/fbQ5t+24Yr6r3sCZYiFd8iZaHnNNEmLkxHvr6WDwwz9nQu83s1/KJWengkt7hYyFh+fDN8e93stWf3WEFiYnS2rNoNx94qdE1xxQPQNfdI++QaeuMblqhuOh60nYWXaG5eTa7L96gwPctVwfU0ZKJg9uKL4GoLOfXLfU0QJ4aM8L3O5jdOaQOUE+bJdCVmmy3Yb/mV1MTvduPtu7hXVA7Xyt7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q/u33+/uEyTRcYjudWTLzoyngQyU5j9LHkMBa/qmrJTpXUOygrImDVVGaLWZu7KVLepPq3NN1nzlh2Q08xma5l4i84xQwxwL8KZl7flMu6tps+aKNctrmwwSl57Yg8e22onGlJX63aKnHCq3pa9C7gGXZ1qW23LGyKtz15ZbPRpeek5JTjBLciZmLuBgoaDHHfPbLZBX7vyYf44QQ/G2BrcLTh+4m8cG+8G/WHqVxn6fE7NrVsIEBXwpeKfanlbIJit2P0RZkXVsG6W34Qfwqxzfy9/aaQZz9BnQAVmlCzodlad0UOf36FhNNh3QFLc6xdKu6F9y1r81u8RUyHv+RQ==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Tue, 10 Dec 2024 22:46:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-12-05 23:42, Denis Mukhin via B4 Relay wrote:
From: Denis Mukhin <dmukhin@xxxxxxxx>

Enable console focus for domains w/ virtual NS8250.

Code change allows to capture the output from the guest OS now and send it to
the physical console device.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
  xen/drivers/char/console.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 
a26daee9c4c4b1134d0ae3d105ffdb656340b6df..798dfdf3412a2feef35e72946d6c59bee59a9251
 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -41,6 +41,9 @@
  #ifdef CONFIG_SBSA_VUART_CONSOLE
  #include <asm/vpl011.h>
  #endif
+#if defined(CONFIG_HAS_VUART_NS8250)
+#include <asm/hvm/vuart_ns8250.h>
+#endif
/* console: comma-separated list of console outputs. */
  static char __initdata opt_console[30] = OPT_CONSOLE_STR;
@@ -627,6 +630,8 @@ static void handle_keypress_in_domain(struct domain *d, 
char c)
      {
  #if defined(CONFIG_SBSA_VUART_CONSOLE)
          rc = vpl011_rx_char_xen(d, c);
+#elif defined(CONFIG_HAS_VUART_NS8250)
+        rc = vuart_putchar(&d->arch.hvm.vuart, c);
  #endif

I think it would be nicer to just use a single name and avoid ifdef-ery. vuart_putchar() is generic and matches domain_has_vuart(), so that seems good.

You can then have a default stub that returns -ENODEV for when an implementation is not built. (This goes along with Jan's suggestion of a common, default domain_has_vuart().) Something like:

#ifndef vuart_putchar
static inline int vuart_putchar(struct domain *d, char c) {
    return -ENODEV;
}
#define vuart_putchar vuart_putchar
#endif

and ARM can do:
#define vuart_putchar vpl011_rx_char_xen

x86 would need to change its arguments, but that should be straight forward.

What do you think?

Regards,
Jason




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.