[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 15:54:05 +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=xfdpysEpVYmCg3juruySqhZcoVCTgjl+WYsJi5jecUg=; b=HzRZDY+EKrekH28A5cb6io+E772meaZ2nIOGhYKfGLamFaWlj2r+16x5dwra1MdO9od8SSsyVeI7EmhUQhTArZki4Pd1WFsA39L1y3w7juEfcKKZEkeG51wr9IatpfbRKUUtKsLsTq0x4IAhUAjZd94BJhYfgAJLKptevSd5Y7vYlR06hkmYpEEB05/9U0F0oKywKs78KzRdMmQR9SjSQ/OWSSWOA9lC1+oOFJzwTtZv8ouBQUfqY7k9JhI/J/Qr9zoP45g1I2hKo40t2PVRSPCjTkTxDwp7tKxofXfMAn9+mPmBvftAYRltJfdb+5hYuyaAMoRGDgTC4knJjA0k/w==
  • 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=xfdpysEpVYmCg3juruySqhZcoVCTgjl+WYsJi5jecUg=; b=YY/67yh2EDx1I9TFdAOae4ZNGB+UxQsRWVj7F6VhgML88EPYATYzNV6jcmCTyu5zZiUN8iwdGojl3Qzpf24OdkbYVBKamwddm8mpOnBVw9d85dTfJTKEe+UUAJz18n70w9678mZgVRE8zTjRZwPadLUq6aTXGuDvECFUlBUAEVUNUAv/E4irtF1BUc+7Dc3+5DglrWORR9P4wtDzwTT+BYWmleinfNxgfnR8xHRBsSvvcAUhfhf6zNb9jDWF46M+BuJzrC+nihdEyZPYn95760pUDV90gXDZTxNSFLtylh3VNEI0gdYxU9uO3JXDpIQ8kdVZod7f62WIeEwdprXuaA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=KFtQIToY1zDwHyortKBHjgwumgt/OHYCxCuJaKuc/IbQDOO5K956NUpnrvCJpQnKEX/Ljet9ACsMVsmncYas7IcZRPKCRdwLd7/Y9XM7UQPd0bZ0kdxkGsfiIrRuwqJiIXAVUUGnKQFr7mdGm6AmRXVpF7Pqn/9V+BbBJ1vpDK1m75K6IM8bokiOHjeHhGelyBao/Y14HbqgnBPAtmvNRzYjPBS03O0jjMS1NHi/cu+5wx6Sq4UMqsEBmXkHwZ0DGoN4iPANpX3A5EUWAHcwPFHBQHLJl+0w/Ds0fdIW27K9gUzvjmCTxYu/9PZoWQwt80PYaSIPv5TFQp3WtxppyQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SwF++H1KyomAfmRWncMdqcMLUNDueEOwSAP5Gd5h6cLasRZPRCRSRyni4zbYcUuGzJoIkhUAIfwjicO2PujVc4THJkWeTH0LE/XI4TvzeHmQ+3K0Cb1yBrP4HB3/meHw4O63bHUmMJlJnfh2OnyV5nSghFbUYT6J1PwNaZWtq+yFSaWDxLDA1QWkTJCv1nlluYepFPS8hUOgGRUZXTNwpJNITQ6nCBaPPgOnDNIuKWUP6sFGUfE+UUwduyou9rmWZnPZD0gcLRtq/ogFVHxUcov6UlGH1vJV/V1ODofSe9NiQ6rWmlvUlboRKmJEmkxb4/xz68RYOWu2TnKPrD+Tew==
  • 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 15:54:42 +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/1eLLUrCiA
  • Thread-topic: [PATCH v2 1/2] xen/mpu: Map early uart when earlyprintk on

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.

Cheers,
Luca


 


Rackspace

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