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

Re: [PATCH] xen/arm: Make hwdom vUART optional feature


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Fri, 16 Feb 2024 09:33:07 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org 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=arcselector9901; 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=UCc/sDE6mMSW7mn4yBfAaAU+QC0ySQvwfs6JiD2mR3A=; b=TpIKT0+1vd4m/ui780e8Cfns+ztBbjklus7Ph/Wjzk95Jupsg88xvqX9rachm7+c2gUwqh0teRFMRXbFMEZifO7uEJ/vcCqUdRLzPgNfgQr24C4Z7kU+tLLZW79p2up0UzBD2yej48PcBf/JuG7/ki6WlHCFeAyQSG8lUri7pGmsryM8XWMf5z9Z4BNHHGw2P3RRacjz3MqHaWTvb25VABpuR9HXaaiXotzwGVveFy7P+PLuNE/X9L47ZdIK6p3CRyOcugR9YltBEvLZNxTlwIlq4JRKD68w0DEuyp4x17y2wwEBBDTdqXt8x26UsNMhEoT/o3GOoPTBo4ynES/2aw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=adyCmYYO+RE9FOZSduN54ZuPWa506ZMwlEu2QZgo9UvCgHir5MY5e150zpSihfyFTnJzL+cbJk56N6sFNU5gElRXh/3sLfnxGIsNHY1V5AW65+PPbkqqCok12CZRp2XRH5P93uXg2IMVoENRdOQ2mPOdHAxzoNeHq2+S4Yy0CC4RZeeeiCAHAYYFIxO5gMYDFiqhEd/Hy0Ny5V+1csLSAsewdwWF80OksWvfyjrpnz0bqoIxzy/RRQmC+qbhDo04u57FCNedPmCek1EemV7cwbhN2a96iClwmMrXN2RMADpp/XSsoJ9jvnlA3rB+u6/WhTGQGHHmJXbqzwxe8BeIag==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 16 Feb 2024 08:33:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien,

On 15/02/2024 17:05, Julien Grall wrote:
> 
> 
> Hi Michal,
> 
> On 15/02/2024 14:39, Michal Orzel wrote:
>> At the moment, the hardware domain vUART is always compiled in. In the
>> spirit of fine granular configuration, make it optional so that the
>> feature can be disabled if not needed. This UART is not exposed (e.g.
>> via device tree) to a domain and is mostly used to support special use
>> cases like Linux early printk, prints from the decompressor code, etc.
>>
>> Introduce Kconfig option CONFIG_HWDOM_VUART, enabled by default (to keep
>> the current behavior) and use it to protect the vUART related code.
>> Provide stubs for domain_vuart_{init,free}() in case the feature is
>> disabled. Take the opportunity to add a struct domain forward declaration
>> to vuart.h, so that the header is self contained.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>> ---
>>   xen/arch/arm/Kconfig              |  8 ++++++++
>>   xen/arch/arm/Makefile             |  2 +-
>>   xen/arch/arm/include/asm/domain.h |  2 ++
>>   xen/arch/arm/vuart.h              | 15 +++++++++++++++
>>   4 files changed, 26 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
>> index 50e9bfae1ac8..72af329564b7 100644
>> --- a/xen/arch/arm/Kconfig
>> +++ b/xen/arch/arm/Kconfig
>> @@ -150,6 +150,14 @@ config SBSA_VUART_CONSOLE
>>         Allows a guest to use SBSA Generic UART as a console. The
>>         SBSA Generic UART implements a subset of ARM PL011 UART.
>>
>> +config HWDOM_VUART
>> +     bool "Emulated UART for hardware domain"
>> +     default y
>> +     help
>> +       Allows a hardware domain to use a minimalistic UART (single transmit
>> +       and status register) which takes information from dtuart. Note that 
>> this
>> +       UART is not intended to be exposed (e.g. via device-tree) to a 
>> domain.
>> +
>>   config ARM_SSBD
>>       bool "Speculative Store Bypass Disable" if EXPERT
>>       depends on HAS_ALTERNATIVE
>> diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
>> index 33c677672fe6..7b1350e2ef0a 100644
>> --- a/xen/arch/arm/Makefile
>> +++ b/xen/arch/arm/Makefile
>> @@ -71,7 +71,7 @@ obj-y += vtimer.o
>>   obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o
>>   obj-y += vsmc.o
>>   obj-y += vpsci.o
>> -obj-y += vuart.o
>> +obj-$(CONFIG_HWDOM_VUART) += vuart.o
>>
>>   extra-y += xen.lds
>>
>> diff --git a/xen/arch/arm/include/asm/domain.h 
>> b/xen/arch/arm/include/asm/domain.h
>> index 5fb8cd79c01a..8218afb8626a 100644
>> --- a/xen/arch/arm/include/asm/domain.h
>> +++ b/xen/arch/arm/include/asm/domain.h
>> @@ -91,6 +91,7 @@ struct arch_domain
>>
>>       struct vgic_dist vgic;
>>
>> +#ifdef CONFIG_HWDOM_VUART
>>       struct vuart {
>>   #define VUART_BUF_SIZE 128
>>           char                        *buf;
>> @@ -98,6 +99,7 @@ struct arch_domain
>>           const struct vuart_info     *info;
>>           spinlock_t                  lock;
>>       } vuart;
>> +#endif
>>
>>       unsigned int evtchn_irq;
>>   #ifdef CONFIG_ACPI
>> diff --git a/xen/arch/arm/vuart.h b/xen/arch/arm/vuart.h
>> index bd23bd92f631..36658b4a8c7f 100644
>> --- a/xen/arch/arm/vuart.h
>> +++ b/xen/arch/arm/vuart.h
>> @@ -20,9 +20,24 @@
>>   #ifndef __ARCH_ARM_VUART_H__
>>   #define __ARCH_ARM_VUART_H__
>>
>> +struct domain;
>> +
>> +#ifdef CONFIG_HWDOM_VUART
>> +
>>   int domain_vuart_init(struct domain *d);
>>   void domain_vuart_free(struct domain *d);
>>
>> +#else
>> +
>> +static inline int domain_vuart_init(struct domain *d)
>> +{
>> +    return 0;
> 
> NIT: I was going to query why we return 0 rather than -EOPNOSUPP. But it
> looks like this is because domain_vuart_init() is unconditionally called
> for the hardware domain. This is unusual and would be worth adding a
> comment.
> 
> In any case,
> 
> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
Thanks. If you want to add a comment, feel free to do in on commit.

~Michal



 


Rackspace

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