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

Re: [PATCH v3 2/5] xen/arm: Move some of the functions to common file


  • To: Julien Grall <julien@xxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Mon, 31 Mar 2025 10:28:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • 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=QX9+efKPmyD3YQxBSvmQTKpZUjSLqGSzjbUAT2SCvYA=; b=Ezii3YuF3ivqIVKKstfSYMql/lo0aCFFMNC4OAfVT7CI7YxbEzVMS3XTYB7JVBPXKdHF74+BHUHCCmbvznyKZtZquuZSKvCq6tdfsH3f/Nu/ZJAzzf1IPc0NBfAQaHjjXejJ5Gk6dfj7CABv3BS2iT07A1N401o798pGanhswLEUv71aUIhtMS6fzU9I/U2AmKc+SRdMDlqtn2fpQ4pWPc4jHYMZHUYL1lB8FdrHdnGY/q/TJ605JHOmAu3VygXOcN8BmMXlwfwvjSymBXOgyYXYLP3/213ynhxr7f/Ux4j+dVwy+TebNVCNH29LSV/X01MptFLrRxKn47gG1J8E/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iPyB0N/v5na1bRdd8v8MM8s5xwjdQRM5FlYMWc9BjqLjm1PyCcX/dPbMPS6rnJeNlq9EX739XrUxguu+7GIiunyBwgmMGEgG1LwIesczIqxeF5ouUZedecQYKHWFbQGEOm2tqBQpX8gkKtCNcKgTh9tEBxiw2ByyrQfRhwVHkQxZC0cUOFpI1BXhzgcqVqf61cnyVke80+PKMiVUpHE6+mvnPQ9M1zt75x5jwq1d7ihC3kr2SU7KRQprl+OmHAKxdWmPs8gz5BOzK098N7nXFhNvF2Eo/ybvxV3qSVaSaLZGOG7hU2tPzlPBmLFR25HOL+sJCOG3x014SOTcyItCaQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 31 Mar 2025 08:28:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 30/03/2025 23:06, Julien Grall wrote:
> 
> 
> Hi Ayan,
> 
> On 30/03/2025 19:03, Ayan Kumar Halder wrote:
>> Added a new file prepare_xen_region.inc to hold the common earlyboot MPU 
>> regions
>> configurations across arm64 and arm32.
> 
> While I understand the desire to consolidate the code, I am quite
> unconvinced this should be done for assembly code. A few examples below why.
> 
> I would be interested to hear the view of the other Arm maintainers.
I think consolidating the code is ok as long as we don't go to extremes.
Consolidation should be done for things only where it makes really sense
(macros, helpers). For example, in places where we don't predict that given
implementation might be different due to certain arch optimizations, etc. (like
you mentioned for mov_w). If we worry that it'll be difficult to asses what to
make common, I might suggest to consolidate only common macros.

In case of this patch, I think we could have a single implementation for
prepare_xen_region and fail_insufficient_regions, whereas enable_boot_cpu should
be implementation specific. I also think that a common .inc file is a good place
for storing stubs such as enable_secondary_cpu_mm(). One day, if let's say arm64
decide to add support for SMP, it will add it's own implementation, leaving the
stub only for arm32.

> 
>>
>> prepare_xen_region, enable_boot_cpu, fail_insufficient_regions() will be 
>> used by
>> both arm32 and arm64. Thus, they have been moved to prepare_xen_region.inc.
>>
>> REGION_* are moved to arm64/sysregs.h. Introduced LOAD_SYSREG and 
>> STORE_SYSREG
That's not a good name as it makes me think it's ldr/str.

>> to read/write to the system registers from the common asm file. One could not
>> reuse READ_SYSREG and WRITE_SYSREG as they have been defined to be invoked 
>> from
>> C files.
Therefore {READ/WRTIE}_SYSREG_ASM() could be used to denote ASM only usage.

~Michal




 


Rackspace

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