Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A98AEB64D9 for ; Fri, 30 Jun 2023 02:40:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.557243.870411 (Exim 4.92) (envelope-from ) id 1qF43h-0000vB-3o; Fri, 30 Jun 2023 02:40:29 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 557243.870411; Fri, 30 Jun 2023 02:40:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qF43h-0000v4-0r; Fri, 30 Jun 2023 02:40:29 +0000 Received: by outflank-mailman (input) for mailman id 557243; Fri, 30 Jun 2023 02:40:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qF43f-0000uu-PH for xen-devel@lists.xenproject.org; Fri, 30 Jun 2023 02:40:27 +0000 Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2062c.outbound.protection.outlook.com [2a01:111:f400:fe12::62c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7707c23b-16ef-11ee-b237-6b7b168915f2; Fri, 30 Jun 2023 04:40:25 +0200 (CEST) Received: from DU2PR04CA0082.eurprd04.prod.outlook.com (2603:10a6:10:232::27) by GV2PR08MB8051.eurprd08.prod.outlook.com (2603:10a6:150:79::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 02:40:21 +0000 Received: from DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:232:cafe::b1) by DU2PR04CA0082.outlook.office365.com (2603:10a6:10:232::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 02:40:21 +0000 Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT061.mail.protection.outlook.com (100.127.143.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.10 via Frontend Transport; Fri, 30 Jun 2023 02:40:20 +0000 Received: ("Tessian outbound 52217515e112:v142"); Fri, 30 Jun 2023 02:40:20 +0000 Received: from 4d1d69782a04.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 90C38A05-6E4D-41A2-99F1-F342D9301284.1; Fri, 30 Jun 2023 02:40:14 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 4d1d69782a04.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 30 Jun 2023 02:40:14 +0000 Received: from DU2PR04CA0164.eurprd04.prod.outlook.com (2603:10a6:10:2b0::19) by AS8PR08MB7888.eurprd08.prod.outlook.com (2603:10a6:20b:52f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 02:40:12 +0000 Received: from DBAEUR03FT064.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b0:cafe::af) by DU2PR04CA0164.outlook.office365.com (2603:10a6:10:2b0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 02:40:12 +0000 Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT064.mail.protection.outlook.com (100.127.143.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 02:40:11 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 30 Jun 2023 02:40:11 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 30 Jun 2023 02:40:11 +0000 Received: from [10.169.188.49] (10.169.188.49) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Fri, 30 Jun 2023 02:40:08 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7707c23b-16ef-11ee-b237-6b7b168915f2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2YrygJb6IOptJjQ6c2+oTKLOXDU6DZyk0uzvVtZLK6g=; b=g9ccMpXgrFBuWt0upqZrNckt2MSVQwtLrdXGSxuQTNYxSJ5DQjsk5+AGj7dsprjUiU4A+xErV5310SakypXDI/3rthXDRjib+j3aqvb754EgFNLFzr3yMo1gdKsmGfXQu7qQqcUxrGAfffPnqwHA0W0DWakXuIX2WIz0i+1susw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-CheckRecipientChecked: true X-CR-MTA-CID: fcc3b87ef85e39e1 X-CR-MTA-TID: 64aa7808 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=njES2J6R1r+G7vso5A5PfOh/MJj1Mq1ECM0c9b9Hlx07tXIe0Q+ZkLsZMyevOhnwVp0rtTLpTHPsDv46M0VMiuLy1F9edQfeJ3+PyO2TEAXSxp9rsJgHwF7cLJKQOp8VSy3sA4eQyQ0grqFzMOGug2I4bP7Mg/ctk+TcPdw0qC8m090HPHVWmPwBALDBO2rspFsnuuhsgWAE6YYla1pPp7LYOp/psOQoIK1myEY6+nB7QJC6F1SrM/Ic18OEF4NMmryH/PdZegMdol6HmJ8wsxeW2Zy+X6LXJz3JvlN0BnWJ+7C050g3ISEppfNaJMRr2pREACTEbgYB5mp1lhpBEQ== 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=2YrygJb6IOptJjQ6c2+oTKLOXDU6DZyk0uzvVtZLK6g=; b=DNgmpL8Eye7CWdT6kAmEgiY32+MOvDia9w9wpM0UNE15FpMuOVSw2PQfcKFUYZTUkjTQ1lcGNhBhCIDY0xJTFhMYKUhFhW+6YwHC+1e7MWr5zzllwQIe4knOtWYhhCT/65Bs89czLX9nlFYkMDMhiOLK3n3G3njefEYkTRwGCatnM8+nm5+D088/06DzUh3sW/iJp8MqSGqNv9WLl/IcZ6vl/MsIIkZv6VkngpxCXigkXGbYPuIb4hVVoBeMCtNA1FRIP8tqo3Ih66gHollaNDHi6vfJDE/9GiuRMGBd8hE95cV5VeVKKrAsKV8i0PqVrt/3FblAY2RMFhXe2xHbzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=xen.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2YrygJb6IOptJjQ6c2+oTKLOXDU6DZyk0uzvVtZLK6g=; b=g9ccMpXgrFBuWt0upqZrNckt2MSVQwtLrdXGSxuQTNYxSJ5DQjsk5+AGj7dsprjUiU4A+xErV5310SakypXDI/3rthXDRjib+j3aqvb754EgFNLFzr3yMo1gdKsmGfXQu7qQqcUxrGAfffPnqwHA0W0DWakXuIX2WIz0i+1susw= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Message-ID: <8ea56cfd-7ed2-8770-95b7-dcc2bc7081e6@arm.com> Date: Fri, 30 Jun 2023 10:40:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v3 28/52] xen/mpu: plump virt/maddr conversion in MPU system Content-Language: en-US To: Julien Grall , Ayan Kumar Halder , Andrew Cooper , CC: Stefano Stabellini , Bertrand Marquis , Volodymyr Babchuk , Wei Chen References: <20230626033443.2943270-1-Penny.Zheng@arm.com> <20230626033443.2943270-29-Penny.Zheng@arm.com> <674011bb-b8df-d11e-a322-1827096c1b74@amd.com> <2c8387ab-547d-5bdf-5d62-e7a950e5c1de@citrix.com> <9ae972a7-d229-4eb5-0f11-2a73f12d5ef8@xen.org> From: Penny Zheng In-Reply-To: <9ae972a7-d229-4eb5-0f11-2a73f12d5ef8@xen.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT064:EE_|AS8PR08MB7888:EE_|DBAEUR03FT061:EE_|GV2PR08MB8051:EE_ X-MS-Office365-Filtering-Correlation-Id: 4187e369-221e-4738-6ef6-08db7913591f x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 2YFPLZ341x8ENWouGghrqiaRq05lI6sO7705NlXNNGySz7AGFXdmsPlgPxN0iG+ILhdVnGakE1Dj6ueOns0igjdKv7nTdS7+ntFKTR4JurJ5lyrrFXdbmsxAFY0MpTTC9m9sADBBl89hrjzbnlUsiu9NGZQHvtAM0jf2GpN1C+8EnLvCQl1TgOPYSVS/dkpAijFCKpz51UnrLyZQzLGgnflryqMEH66Pgv2MbXdK8Sovpj1LHa1BIplkYdJrlIyCiUl2FvX4L8tlDeQiLPpJxzK0RubghpYSQA4oalPEOk5656m7K9wnZw6cLtybx5IDD4kfvT3dNAUYGjYBNm6BpF71oZB//kPgDDooljkIqDsB+io64xpWY4b0Xcj+Wpc3uH5YsrEakLJqLKxK5x44V/W9xYW3n5MOlBZanlEWZlBpblTc1viRWzKNDEIzucJQo1MV6pBWQtT6mGFs0+J+HRtI7dIgvs4UC1Eg5hzHrdIDT1fpCjsaFJBAH5qUxnnmLYZLtAmmu1PY/rI8JL7xCbYaDvG+puCBNgczyTCzdTDTC50U+JRNpNdnqbBaX9Jpr5MeQETx6kimRm5/inKh4pz1xaGdRa9SnO+6YmMtEpK9dv/tzUY8+YbKdM5IkprCMzr5wmQRkRMJ9tmeXw+bTO772qEWuWPG0KYTok2rfgTAW8lsg8mxYO9I/pz3Ob/y7bG6wt2vAthJm6Xyytl6xJqV2jDB1n8Xz61c9DnEHJphDUNXrzfh5y3hzBbPVb9ywvOg5Eb/5jeMXnO4KzdkSVnHfLALxVrLqKyLKwJZptTKOlJzS6d/kheF+7hruxjF X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(39860400002)(136003)(396003)(451199021)(46966006)(36840700001)(40470700004)(86362001)(82310400005)(2906002)(26005)(186003)(356005)(81166007)(47076005)(2616005)(426003)(336012)(40480700001)(36860700001)(53546011)(70586007)(40460700003)(5660300002)(70206006)(41300700001)(316002)(8936002)(8676002)(36756003)(31696002)(82740400003)(966005)(54906003)(16576012)(4326008)(478600001)(110136005)(44832011)(31686004)(3940600001)(36900700001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB7888 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 33e5f87e-9322-4118-d0f1-08db791353be X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lbdghWUuprQBPYwqy6mt1WzHmW0QMlDlHhxvDznsRaf6yXXx6TZxYtexd+Yh5CUjFTsQepTjluJHGlHo/x8ZFLgn5L29wr2RZhocx5o7CkcEzHCo92rqYUwNfOwEgAHyFFYkZ/qlFzwnoKnp8EkaeDb3+a7XyidaxShb2fn2FCmeTkcjy9eOhlIzD5LCX96n4AMr9yOORoiN8POwPYavLeH7BdhzcoJsiL7jbv0QBSzf7IVghcSTv8zbgrJCRa6WmWfufontScYzo8HaiBEf9m/QpRMPIabRihrlFXsjK/PPAQEtnk/cB89UdJpNoxmswKSR9hi+NRJc2L0D3ndEZdekX9XVNu7N+55ZY4Ma4DhQSTSFEnwVLTbsvOyvmKcTqlDXxrY98J1fVMeCvBjOOJXbG+NLvHjg6x0TkEz+kyG6j7lN0bO5CzuoGhPUpcCi7j8+tW1jO0T/K7NXA9TdMkXtGzuDP9lpNJ7BWUEWswHJ2NVANA18QNqEVC8RRUWvJNW7ZBctyaoz7vlyIQnmdIHxKfj+p1S+KmcAC+KrOlqXWnh7rNBr7+Ok5lnnMo0qh0FIyki3gzvjAD9LVEfAekaBtwrgF+r5p+SHzbA9bI0APquU2F9TUPAZaaEliVZA6MDtP2VYBN6xvCfHgkv3v/dZiCcSsNwjcFrP5SX4Ntitok/T6eEvymBv0Teo16QAzS5MhDUWfgIBynshTesxT9PHKQrGPU/CkluCrbUx7phMjn94VNlvMCBURUqMk4Qc1yj/Bm4wQoFOoQuwLz9pC+4Ljqht1TDOZfghiMHu6yU= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199021)(40470700004)(46966006)(36840700001)(31686004)(8676002)(8936002)(5660300002)(36756003)(110136005)(54906003)(16576012)(478600001)(70206006)(70586007)(4326008)(316002)(966005)(41300700001)(40460700003)(40480700001)(81166007)(47076005)(186003)(44832011)(2616005)(26005)(31696002)(86362001)(336012)(82310400005)(426003)(36860700001)(53546011)(82740400003)(2906002)(3940600001)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 02:40:20.9472 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4187e369-221e-4738-6ef6-08db7913591f X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT061.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8051 Hi, On 2023/6/29 23:14, Julien Grall wrote: > Hi, > > On 29/06/2023 15:44, Ayan Kumar Halder wrote: >> >> On 29/06/2023 15:23, Andrew Cooper wrote: >>> On 29/06/2023 3:20 pm, Ayan Kumar Halder wrote: >>>> On 26/06/2023 04:34, Penny Zheng wrote: >>>>> diff --git a/xen/arch/arm/include/asm/mm.h >>>>> b/xen/arch/arm/include/asm/mm.h >>>>> index eb520b49e3..ea4847c12b 100644 >>>>> --- a/xen/arch/arm/include/asm/mm.h >>>>> +++ b/xen/arch/arm/include/asm/mm.h >>>>> @@ -292,6 +301,12 @@ static inline void *maddr_to_virt(paddr_t ma) >>>>>                         ((ma & ma_top_mask) >> pfn_pdx_hole_shift))); >>>>>    } >>>>>    #endif >>>>> +#else /* CONFIG_HAS_MPU */ >>>>> +static inline void *maddr_to_virt(paddr_t ma) >>>>> +{ >>>>> +    return (void *)(unsigned long)ma; >>>> Why do you need "(unsigned long)ma" ? Both "unsigned long" and >>>> "paddr_t" are u64. >>> For when paddr_t really isn't u64. >> >> Sorry, I am missing something >> >>  From >> https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/include/asm/types.h;h=fb6618ef247fe8e3abe472e50b4877e11cc8a96c;hb=refs/heads/staging >> >> In CONFIG_ARM_64 >> >> typedef unsigned long u64; >> >> typedef u64 paddr_t; >> >> So, why do we need to typecast "paddr_t" to "unsigned long" as they >> are the same ? > We may decide to restrict paddr_t to 32-bit in the future on Arm64. > > Also, when CONFIG_PHYS_ADDR_T_32=n, paddr_t is 64-bit on 32-bit Xen. So > casting directly to (void *) is not possible. Although, this is not a > problem here because for the MPU on 32-bit, you would select > CONFIG_PHYS_ADDR_T_32. > > On a side note, I agree with Andrew that we should switch to _p(). Sure. I'll switch to _p(). > > Cheers, >