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

Re: [PATCH 1/4] xen/arm: debug-pl011: Use correct accessors


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Thu, 15 Jun 2023 08:41:48 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=+ePZVHWiomxesV+rzw3eymIut3qjDdkJ+FrS4yGi+6o=; b=bDfMt82dNnW0PxQjJgvvZUT2VCSgeBcIJNlX/jr0NhmoO8FyH0DjR/46qxlhH5NpcBeE2dmIH25q4FzYcLIWnLIp0/9/wGsOdQ7FJZpPHC5bzJw2yP9cJeRM3pdCh/eeDwnDxpTn60y+LvLiME+EePFGnV97gDYJQloVv62BvDAX5DxEZtctBCe7oYraSSAzWqFRUOIaToX2Z/vojYXD8vNYcit0G5HggFi0lVv3M19pbvfuxbeMp0Ii7WIXvFrj6izB/bQufuxAULIOUC55xhM7CnOpgVTsJc8XMVjyI+z4kpMwKf1/LyIYOCWneh/LmNm4LZg8gZOKrVmTL/0nrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aqldfbLUHgg6JxzP5GnE2Aqr9+F5g4pUkbqmk5dHyaRoWwH5Arg14cxaQrt8bpzT5uAUQRzJfBFvNvs3aPqnvxYFl87LlHuZXlOyL1L/e0qZB5nnzERT1RIE2KFtFe4W8T96nX0CzWp9tb3zi5oiF4N6uI/5OU6gElaryu4GNPjz3WaPtBLkq5F0d7xlpYvM3towx4z7dFrq6Xv+J2xhbl0OvcQDeGX3RSBNCvlwXYXqcsPgw0SMcshqkditx3tmJyRK1c+8TAQYtj33L1FoHVx1BrVr8sDnKP0my4lZLV9N7MYeBFfGzuozP/e5XHQBjQZRdbVh67z88DVCtAGMKA==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 15 Jun 2023 06:42:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Stefano,

On 15/06/2023 03:36, Stefano Stabellini wrote:
> 
> 
> On Wed, 7 Jun 2023, Michal Orzel wrote:
>> Although most PL011 UARTs can cope with 32-bit accesses, some of the old
>> legacy ones might not. PL011 registers are 8/16-bit wide and this shall
>> be perceived as the normal behavior.
>>
>> Modify early printk pl011 code for arm32/arm64 to use the correct
>> accessors depending on the register size (refer ARM DDI 0183G, Table 3.1).
>>
>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
>> ---
>> Next patch will override strX,ldrX with macros but I prefer to keep the
>> history clean (+ possibiltity for a backport if needed).
>> ---
>>  xen/arch/arm/arm32/debug-pl011.inc | 12 ++++++------
>>  xen/arch/arm/arm64/debug-pl011.inc |  6 +++---
>>  2 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/xen/arch/arm/arm32/debug-pl011.inc 
>> b/xen/arch/arm/arm32/debug-pl011.inc
>> index c527f1d4424d..9fe0c2503831 100644
>> --- a/xen/arch/arm/arm32/debug-pl011.inc
>> +++ b/xen/arch/arm/arm32/debug-pl011.inc
>> @@ -26,13 +26,13 @@
>>   */
>>  .macro early_uart_init rb, rc, rd
>>          mov   \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE % 16)
>> -        str   \rc, [\rb, #FBRD]     /* -> UARTFBRD (Baud divisor fraction) 
>> */
>> +        strb  \rc, [\rb, #FBRD]     /* -> UARTFBRD (Baud divisor fraction) 
>> */
>>          mov   \rc, #(7372800 / CONFIG_EARLY_UART_PL011_BAUD_RATE / 16)
>> -        str   \rc, [\rb, #IBRD]     /* -> UARTIBRD (Baud divisor integer) */
>> +        strh  \rc, [\rb, #IBRD]     /* -> UARTIBRD (Baud divisor integer) */
>>          mov   \rc, #WLEN_8          /* 8n1 */
>> -        str   \rc, [\rb, #LCR_H]     /* -> UARTLCR_H (Line control) */
>> +        strb  \rc, [\rb, #LCR_H]     /* -> UARTLCR_H (Line control) */
>>          ldr   \rc, =(RXE | TXE | UARTEN)      /* RXE | TXE | UARTEN */
>> -        str   \rc, [\rb, #CR]     /* -> UARTCR (Control Register) */
>> +        strh  \rc, [\rb, #CR]     /* -> UARTCR (Control Register) */
>>  .endm
>>
>>  /*
>> @@ -42,7 +42,7 @@
>>   */
>>  .macro early_uart_ready rb, rc
>>  1:
>> -        ldr   \rc, [\rb, #FR]       /* <- UARTFR (Flag register) */
>> +        ldrh  \rc, [\rb, #FR]       /* <- UARTFR (Flag register) */
>>          tst   \rc, #BUSY             /* Check BUSY bit */
>>          bne   1b                    /* Wait for the UART to be ready */
>>  .endm
>> @@ -53,7 +53,7 @@
>>   * rt: register which contains the character to transmit
>>   */
>>  .macro early_uart_transmit rb, rt
>> -        str   \rt, [\rb, #DR]            /* -> UARTDR (Data Register) */
>> +        strb  \rt, [\rb, #DR]            /* -> UARTDR (Data Register) */
> 
> Isn't UARTDR potentially 12-bit? I am not sure if we should use strb or
> strh here...
UARTDR is 16-bit register where bits 15:12 are reserved and 11:8 are for 
indicating errors during READ.
Here, we perform WRITE meaning the actual register width is 8 bytes. This is 
also indicated by the PL011 TRM
which specifies width as "12/8" meaning 12 for READ and 8 for WRITE.

~Michal




 


Rackspace

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