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

Re: [PATCH] xen/arm: debug-pl011.inc: Use macros instead of hardcoded values


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 16 Nov 2022 19:05:27 +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
  • 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=YVPexwz1Mws6BNPqUDPpquCfnmsJJUMECnX7rTydxYs=; b=eH9ePeUxolmOQ0rjedG82mYWOZlCbLAybAT8tYSwMVKakTwnPFrOcF/jdd26bm0HcJYPzjWg8+UyVollB+16jZT0ppSOZcN5U+bzKg7LQ77xrmpbkWGMH9057+kVDlOHABuwAs3Flt/H495pwfTeQgoDc9M2Hm7icawTnzqBOmo6ySyaUekj692nhvyRVmqXbUK9hATx4oQpelpJ2MCPU+7M9YlAl0VznZJW0/7RY8wQG5/yFftRDJMBT4k712A/ak0+BjjBI3Rq6oom6Ts4na6tDFwduQR6jyC8y+k6mR3bjbIUrotrapfJOz6Br9/AI9wxxrnCgA2uTOo16GOIAA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fl5IrFFJTRxzoyjkoMtZjHt3+wDmXnY1aP+fuOM62RwlUYHIQ4hZN/aPFRkDBgYWLnJ8quP88uOCynAQNLo3usU7eC1UhvKkf+ZzMN7JipeBedJWxYvwMzZDN/Ws1NyRZNB1NgXhc9jNjTKSlrASJuFe+Iql6VcfoMayJtg4xopclCslfwt89uwt7WTVWPWL2TC9s4MKakiWE64RGXGdMvmINbVhqkqvzK3NA6BFI+ZRlnvFc7RkKKfNUFQzffRrsu1G1y1jNjaoXZv79fFv1YerzhOSHGdJCzeB7cGmqOQ8e1yKJRYa+bO1jKabiC3yMXfF1rY5Fxc9HPRfT59/0g==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 16 Nov 2022 18:05:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Julien,

On 16/11/2022 16:56, Julien Grall wrote:
> 
> 
> On 16/11/2022 14:45, Michal Orzel wrote:
>> Hi Julien,
> 
> Hi Michal,
> 
>>>
>>>> and use it in the pl011-debug files (+ there is a question whether we 
>>>> should define WLEN_7-5 for completeness).
>>>
>>> I would not define WLEN_7-5. That said, I wonder if we really need to
>>> set the baud rate & co here?
>>>
>>> AFAICT the runtime driver never touch them. The reasoning is the
>>> firmware is responsible to configure the serial. Therefore, I would
>>> consider to drop the code (setting UARTCR might still be necessary).
>> I do not really agree because the current behavior was done on purpose.
> 
> EARLY_UART_PL011_BAUD_RATE is only used for very early debugging (this
> is protected by CONFIG_DEBUG and CONFIG_EXPERT). This is not a
> production ready code.
I am fully aware of it. I just found it useful but I understand the global 
reasoning.

> 
>> At the moment early_uart_init is called only if EARLY_UART_PL011_BAUD_RATE 
>> is set to a value != 0.
>> This is done in order to have flexibility to either stick to what 
>> firmware/bootloader configured or to change this
>> configuration by specifying the EARLY_UART_PL011_BAUD_RATE (useful when you 
>> do not know what
>> the firmware configured).
> The chances are that you want to use the baud rate that was configured
> by the firmware. Otherwise, you would need to change the configuration
> of minicom (or whatever you used) to get proper output for the firmware
> and then Xen.
> 
> Furthermore, as I wrote before, the runtime driver doesn't configure the
> baud rate. This was removed in Xen 4.7 (see commit 2048e17ca9df
> "drivers/pl011: Don't configure baudrate") because it was buggy and this
> code is not simple.
> 
> So it makes no sense to configure the baud rate when using early printk
> but not the runtime driver.
Ok, so we will get rid of EARLY_UART_PL011_BAUD_RATE config and setting the bd
in the early uart code. Now, what about setting "8n1"? The runtime driver sets 
them
as well as the early code. It can also be set to a different value from the 
firmware
(unlikely but it can happen I think). In any case, if we decide to do what the 
runtime driver
does, I reckon setting LCR_H should be kept in early code.

> 
> So we have two choices:
>   1) Remove the baud rate setting in the early uart code
>   2) Support the baud rate in the runtime driver
> 
> I strongly prefer 1 so far because there are not any practical use to
> have a different baud rate for Xen and the firmware.
> 
> Cheers,
> 
> --
> Julien Grall

~Michal



 


Rackspace

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