|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v8 14/26] emul/vuart: add global UART emulator configuration knob
On 11/11/26 8:47 PM, dmukhin@xxxxxxxx wrote: From: Denis Mukhin <dmukhin@xxxxxxxx> Introduce new command line setting `vuart=domid[:compatible,name]` for configuring UART emulator per given domain. A new command line option needs an entry in docs/misc/xen-command-line.pandoc; I don't see one in the series. Is `name` really optional? Look my reply below ([A]). 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> Inclusion of headers should be sorted in alphabetical order so please put xen/param.h before xen/resouce.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; Only a single domain can be given a vUART, and a later vuart= silently replaces an earlier one. If that's the intended scope, the documentation should say so. COM3 and COM4 are at 0x3e8 and 0x2e8 (e.g. Linux's arch/x86/include/asm/serial.h). 0x3fe and 0x2fe fall inside the COM1 and COM2 ranges (0x3fe is COM1's MSR), so a guest wouldn't find com3/com4 where it looks for them, and the emulated range would overlap the neighbouring ports. Also, this table describes legacy PC COM ports, i.e. it's x86-specific, but it lives in the arch-independent framework. For the RISC-V port Ihad to limit it to CONFIG_X86. Could it move to x86 code, or into ns16x50.c, with the framework only parsing the option?
The value is truncated to domid_t before the range check, so e.g.
vuart=65537 is accepted as domain 1. Also, base 0 makes vuart=010 mean
domain 8. I'd parse into an unsigned long with base 10 and check that
before assigning:
unsigned long val = simple_strtoul(s, &end, 10);
if ( end == s || val >= DOMID_FIRST_RESERVED )
return -EINVAL;
domid = val;
+ + if ( *end == '\0' ) + goto match_defaults; + + if ( *end != ':' ) + return -EINVAL; + + compat = end + 1; + + while ( *end && *end != ',' ) + end++; + if ( *end != ',' ) + return -EINVAL; [A] So once ":compatible" is given, ",name" is mandatory: vuart=1:ns16550 is rejected. The Kconfig help in 16/26 documents 'vuart=<domid>:<compatible>[,com[1-4]]', i.e. the name as optional; one of the two needs adjusting. Also, the comment then should be adjusted too. Nit: this matches the compatible exactly, while vuart_match_by_compatible() (01/26) matches a prefix; it would be good to use one rule for both. ~ Oleksii
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |