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

[PATCH v8 14/26] emul/vuart: add global UART emulator configuration knob


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Wed, 11 Nov 2026 11:47:48 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 205.220.161.53) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; 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=QTL0Gq7NGlThw4MrMreZB972O4g5p08C5Lc0JymCAq8=; b=dq/gsQieqIpWtWVs+f/zpnjBVwRVbR39+zgkgSwdjt8fvd2sDy22Ue8ziDgHnrV/wYZeeE7UxXzBlHScE8KSIMi6kA2va4MwFU/nb63CAxs9XSBpK8ZaGbSFlM9ipPjxr4/Lk0QuZ4l4k6J2MDUhbR/CnYf/AJ3EvBua4H9+fw5LHnfw95MABcEO2sVTPUKThlWfaEXehe6UxN0oDsMSkFljGG6eDBM/85UspNIVrdhmxYfDchFwCDAXxO7LYYQsxxFkYwpeGhsDjuBFxfnk8TVnmMB9oEECfv5UF9YSt6bj7BzFPdp1PO+yPUMKpAn/FiUlXmFr47Xl4sDgO5gWrQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U7iF1ks2PWe/YX0ZPgW3yCv3GXnDzQjHvuYqR07/4lFv8XpEeZ1VxBg7+EkhurlHzlcf1VrUJTaxF1xuB6S7lnpVxAuPnm3WYeC5b28yDJQ5qstj0AgmvRoVqfd9AcNph1tF3K8QIE6KGOH+IW0ZcOFs7Hmyga53JD2+5cYW2MnUxSOcY1vNsKVK1fdrI5B8hptnoh1gSYrAhZUP2GttgI4VDw5+qdoXmanE5iUR7cMb5eh1mceh8XDceBQVQqasCSAlvDeZX2929sTklHFSMd/tB3r7voMVZZ6p8Xo6EdC/OEtwstsl5QsvMHnpnzUxr8nOBg80NndctKOU4k4fbA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger@xxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, xakep.amatop@xxxxxxxxx, dmukhin@xxxxxxx, Denis Mukhin <dmukhin@xxxxxxxx>
  • Delivery-date: Wed, 11 Nov 2026 19:48:57 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx>

Introduce new command line setting `vuart=domid[:compatible,name]` for
configuring UART emulator per given domain.

Only one domain is supported for now.

Format:
  domid      - vUART owner domain ID
  compatible - vUART compatible string, must match with one of the
               registered emulators
  name       - vUART user-friendly name used for searching for one of
               the pre-defined guest I/O resources

compatible string and name are optional, if skipped, platform default
values will be chosen.

Note, documentation update is not covered in this patch.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
 xen/common/emul/vuart/vuart.c | 85 +++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/xen/common/emul/vuart/vuart.c b/xen/common/emul/vuart/vuart.c
index bd3b756fb4d6..0df29540b1b6 100644
--- a/xen/common/emul/vuart/vuart.c
+++ b/xen/common/emul/vuart/vuart.c
@@ -6,8 +6,10 @@
 
 #include <asm/types.h>
 
+#include <xen/ctype.h>
 #include <xen/err.h>
 #include <xen/resource.h>
+#include <xen/param.h>
 #include <xen/sched.h>
 #include <xen/vuart.h>
 #include <xen/xvmalloc.h>
@@ -18,6 +20,89 @@
 extern const struct vuart_emulator vuart_array_start[];
 extern const struct vuart_emulator vuart_array_end[];
 
+static domid_t __read_mostly opt_vuart_domid = DOMID_INVALID;
+static const struct vuart_info * __read_mostly opt_vuart_info;
+
+static const struct vuart_info vuart_supported[] = {
+#define VUART(c,n,t,a,s,i) { \
+    .compatible = c, \
+    .name = n, \
+    .flags = VUART_CONSOLE_INPUT, \
+    .base_type = t, \
+    .base_addr = a, \
+    .size = s, \
+    .irq = i, \
+}
+#ifdef CONFIG_VUART_NS16X50
+        VUART("ns16550", "com1", IORESOURCE_IO, 0x3f8u, 8u, 4u),
+        VUART("ns16550", "com2", IORESOURCE_IO, 0x2f8u, 8u, 3u),
+        VUART("ns16550", "com3", IORESOURCE_IO, 0x3feu, 8u, 4u),
+        VUART("ns16550", "com4", IORESOURCE_IO, 0x2feu, 8u, 3u),
+#endif /* CONFIG_VUART_NS16X50 */
+#undef VUART
+};
+
+static int __init cf_check vuart_parse_cmdline(const char *s)
+{
+    const char *compat = "ns16550";
+    size_t compat_len = strlen(compat);
+    const char *name = "com1";
+    size_t name_len = strlen(name);
+    const char *end;
+    domid_t domid;
+    unsigned int i;
+
+    /* vuart=domid:compatible,name */
+    if ( !isdigit(*s) )
+        return -EINVAL;
+
+    domid = simple_strtoul(s, &end, 0);
+    if ( domid >= DOMID_FIRST_RESERVED )
+        return -EINVAL;
+
+    if ( *end == '\0' )
+        goto match_defaults;
+
+    if ( *end != ':' )
+        return -EINVAL;
+
+    compat = end + 1;
+
+    while ( *end && *end != ',' )
+        end++;
+    if ( *end != ',' )
+        return -EINVAL;
+
+    compat_len = end - compat;
+    if ( !compat_len )
+        return -EINVAL;
+
+    name = end + 1;
+    name_len = strlen(name);
+    if ( !name_len )
+        return -EINVAL;
+
+ match_defaults:
+    for ( i = 0; i < ARRAY_SIZE(vuart_supported); i++ )
+    {
+        if ( compat_len != strlen(vuart_supported[i].compatible) ||
+             strncmp(compat, vuart_supported[i].compatible, compat_len) )
+            continue;
+
+        if ( name_len != strlen(vuart_supported[i].name) ||
+             strncmp(name, vuart_supported[i].name, name_len) )
+            continue;
+
+        opt_vuart_info = &vuart_supported[i];
+        opt_vuart_domid = domid;
+
+        return 0;
+    }
+
+    return -EINVAL;
+}
+custom_param("vuart", vuart_parse_cmdline);
+
 static const struct vuart_emulator *
 vuart_match_by_compatible(const struct domain *d, const char *compat)
 {
-- 
2.56.0




 


Rackspace

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