[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/2] xen/mpu: Map early uart when earlyprintk on
- To: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Tue, 3 Dec 2024 16:49:01 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=GTYDWcqNwuIfZLvqdzy09qQIMnJ/Jd/lkFMevRKznCY=; b=sfE6veXKJp9zzGR2agG2Ojwwwm28l7qbPpyBAb5BXCxsOPoJjikUQ9J16bx02jaWJ9avNoTWupLZ+lHcFR7+5dIPW0q+CGrqMn9x+VBajzHxc7t3kp4JOpWx7LquRQKFdGrvOxEvoGHhhkmv0h9RqwPGW6ZOBDRAzjYX0JSx0ubonrAYM4xoD2SQhLmavUjztblpXwI0JH844NweHQNfYd97uCaNoMj801SWJc9tHjSQRJxbqqgO8B8w1MW5swtf4Pmd9IS7G4vjptbWeUigEX6nb+bmCjH76Hjos7mJWN0OXAoUifJYS/G3Ckw93LKJf2hVcoLtpQsge8hzSWGdkQ==
- 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=GTYDWcqNwuIfZLvqdzy09qQIMnJ/Jd/lkFMevRKznCY=; b=E8foPcEnVUAcLArSX8x8P5SQDG3EnR6r/qtoZeLzUllEAtEo2mE1GOREJLHxZA8GTqq8+TpnA4VvYo3hAwqWxceskQFb/VqduRJKL+4YUzURpWb83wbv1/o1yBLtQFnvR8cqQiaUDzaFNCOFYGk6WY6DPV3H9apF4YiuEQBlnl8t/mkAYuoPXSOk2ZdAPeLGzTPGYXjx2tZnulJSmsWYAG3+VeiS19EdWyhGgWIXo/DAMlvkYzOOVYN1K5TDTAwJ2vOjbBwr6SXIjreDrVNhVgJyD5WGIcQNvBsXvG6eSPBmjDNl110LFUL0l9N+T6LF9wPN1CP4vfOoqvNk011fpw==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=vdERTbylWYMJ/vD2oE1OaMD3/gkh3SNPCkRtgSRpdmZCgNgi2w3H4wllHsiJ8XX/0p2dXNGnLvmynsNnY24gs1a/mRH5d0AEYjPCpG93W8smB0pfq6SqnNXBtjeU7F3z48fr3+GhFJ36WDGTlF77vJbhf75Z4rC0bOptL0vDDqP1yvXiDf9gu5utV3Cz2iQVHLLnVyVMYFVB5HhO1CU8wUQ+H1JV/UPaQIwi48JFfHZZtXHdRLMJP4P27fGXyVapfAMiczv0KI9vTVGal7G2a9BCNZK4y7qQqO0EG8Ax4AotcbyxGcl0Pq6/Dtngc7Rmhu2aen0bQjhnoOrpZB/47w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YmUvcbT26rXZDw4gTkUx/bfzicwxXsAKex0Ct7hOTCyYXD7jFC2oWx2K72PXAqkbquBH4ca2vNeHQtHcB1ptk5A6TqCW63Ow3wYYEel4B/ns5wQvyTjQ+rUzZ4Qn/e3BgqjPdi87IQ8BsRZcfEyGK8ztLwNBDFtIyAkFrOObQyxXaNew8WG7CS5AusOtJHUO2fc6afbrllUpFx0R9/T01gw5B/vNFedx15/tC/76uGfMkuegMZIreU/l3M4FkYrVEdp3k0CSQLuIDzDO+3IGrLXiJ4/TvnAav4BeuuP0EiHw9wqTHdOm1Xie3MB5qfNA83Ipu/G++Sh7m2nIb+q3vw==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Tue, 03 Dec 2024 16:49:26 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHbRWz5mao3stJzR02TMW5lND/1eLLUrCiAgAAPXIA=
- Thread-topic: [PATCH v2 1/2] xen/mpu: Map early uart when earlyprintk on
> On 3 Dec 2024, at 15:54, Luca Fancellu <Luca.Fancellu@xxxxxxx> wrote:
>
> Hi Ayan,
>
> sorry for the separate message, I've spotted another thing where I’m in doubt
>
>> On 27 Nov 2024, at 18:39, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
>> wrote:
>>
>> CONFIG_EARLY_UART_SIZE is introduced to let user provide physical size of
>> early UART. Unlike MMU where we map a page in the virtual address space,
>> here we need to know the exact physical size to be mapped.
>> As VA == PA in case of MPU, the memory layout follows exactly the hardware
>> configuration. As a consequence, we set EARLY_UART_VIRTUAL_ADDRESS as
>> physical
>> address.
>>
>> EARLY_UART_BASE_ADDRESS and EARLY_UART_SIZE should be aligned to the minimum
>> size of MPU region (ie 64 bits) as per the hardware restrictions. Refer ARM
>> DDI 0600A.d ID120821 A1.3 "A minimum protection region size of 64 bytes.".
>>
>> UART is mapped as nGnRE region (as specified by ATTR=100 , refer G1.3.13,
>> MAIR_EL2, "---0100 Device memory nGnRE") and Doc ID - 102670_0101_02_en
>> Table 4-3, Armv8 architecture memory types (nGnRE - Corresponds to Device in
>> Armv7 architecture). Also, it is mapped as outer shareable, RW at EL2 only
>> and execution of instructions from the region is not permitted.
>>
>
> [...]
>
>
>> diff --git a/xen/arch/arm/arm64/mpu/head.S b/xen/arch/arm/arm64/mpu/head.S
>> index f692fc7443..86e4019a0c 100644
>> --- a/xen/arch/arm/arm64/mpu/head.S
>> +++ b/xen/arch/arm/arm64/mpu/head.S
>> @@ -11,8 +11,10 @@
>> #define REGION_TEXT_PRBAR 0x38 /* SH=11 AP=10 XN=00 */
>> #define REGION_RO_PRBAR 0x3A /* SH=11 AP=10 XN=10 */
>> #define REGION_DATA_PRBAR 0x32 /* SH=11 AP=00 XN=10 */
>> +#define REGION_DEVICE_PRBAR 0x22 /* SH=10 AP=00 XN=10 */
>>
>> #define REGION_NORMAL_PRLAR 0x0f /* NS=0 ATTR=111 EN=1 */
>> +#define REGION_DEVICE_PRLAR 0x09 /* NS=0 ATTR=100 EN=1 */
>
> Should this point to ATTR=0 instead? From what I see on Zephyr, the pl011 is
> mapped with nGnRnE, on R82 this works fine because it will treat all device
> memory as
> nGnRnE, but I’m not sure that this will work well on other Armv8-R aarch64
> platforms.
>
> I was trying to check how Linux maps pl011 but I’m kind of lost, so maybe if
> anyone has
> more experience is more than welcome to contribute to the discussion.
Anyway, changing that to 0x01 (ATTR=0 EN=1) is giving me a weird issue in my
branch:
"Error getting IRQ number for this serial port 0” from create_domUs(), so I’m
not sure now
if the right value was indeed 0x09
|