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

Re: [PATCH v4 1/3] xen/arm: Move some of the functions to common file


  • To: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Mon, 7 Apr 2025 14:34:11 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=fail (sender ip is 4.158.2.129) smtp.rcpttodomain=amd.com 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=Vl6U9nejvTrnW9MbDHbtgqaWqhGxsOdtGYGJxwofSJ8=; b=txlsPjoLwmUD+nBbWOjolrGiFL3cdQd+asowkRT6ByIjqG5GeCjWFWh1BuBoEpEKrYbLaIMSHzsF3HN6y5K4GOurfTlsKU8iPlZjY/QQ+EvGYUwFvoCqU+ac6Z7lgHuGZ2+V58oGGHrAdJOpS/wwd0ID+AN3IaBWnAezwGHpRRaTQn7lzJISWcXBa1z0sQhBlolferFY752NjkDWmzxf+/VopVgpsUfxUAl1nat87UOvAS9AG8qKVmIT+LDM9bnEwvrlBJgkn1vrdbMn1KL9EtRAfotn4c5RILa555jT0W1U0RConPx8vu6H/WsJPnWTA8rZkHZf70qzKEcDn8yDPg==
  • 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=Vl6U9nejvTrnW9MbDHbtgqaWqhGxsOdtGYGJxwofSJ8=; b=di8nk8+400a6iKbE8KuNCKlYRRp6JeZbKApyMWR2ivX3N5wXSHZ6jzv5Deo1vJ95b3TbMp8ExG6Ap3fJJ4cr7OMV1L8SlgpV0V98BAmtfTFve0F4LnWO6ID3olaEvXKTcQ17JQS21VQG1YAjrmH46pBT+e4oq3BUgKmvIv5Im+biCdOiQ2BNXzX3BwPhtj60tmwnRilCaewhoyF5lGyCNy41uqAyQ/5GhrIh21JdupGPX4RH5BgYxOflVFinKAVYvjvsex4N1xeeZG/rGCMVJsWkSWkSgOCynLXLo6HelTsTS9LAEZTtO7083XzFvFn+1rg8NHUdobnTGah5aE5JrA==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=b/yXmOpVw0qHiLgj/d+tqXVQ2pGOh+FniIg1rSGI4dpNh8vWRSCf8Z20XxU2lEOig9Y8QXRxudEWvdTvrowpcP74I/Q2G7v15xlQG//Zv9AbOSVpazLNHPMMfjtzjeP2/6RjYct0B64XY8WAT0WdPLqkg7hdHT9SHVBYzR3us7ZvNhCepW8s1KelOYe/NOWB4Ry5Z+CfPwgha3FYaFrCE2XXrtHZsAd/zY3jsPN+m6Oz7ciV5b86HJVvXcO7ZJ9zOqO57/ccn8IqajWEMsAC13Egd95nAKo1CA9JMnY07LCyrpKV+DBCY2sVBkMFJ7wkTuSBSQ9xmvoFON8fJ1tFxQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NWGgiDYM+gAqIBp67RR57C9EkdPSa07JrzsgFFhL53CYPeJmVunshVcS+6MzELjWPgEEPOa98DFaNFixtqXpoB/++TBk4uMQh45sOKkPsehYIEPSaEBLQ97FB4R0llxIaPKnAnUjIsL25oV1FObPvIWL4DW/wUZTY6taZF+LQdgYs+Ye/Bju4UI0mSF48sZgoHzMVqL4PACA/b9/dKGQqZUpzc113TEkqpaC/vM0uNrFbILn3O+8f1Ezb8lREuKafakPVfo6GEoadNtSSy3RPTWIpdXCROKvnkOG327swVydgGkqdM/bMlST8G7JywuQWglicW1fyLmaHsKr89IOZQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, "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: Mon, 07 Apr 2025 14:35:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHbpLu5pa88e8EeQkugLRqmrl+P07OTN/eAgAURkgCAAAEbAA==
  • Thread-topic: [PATCH v4 1/3] xen/arm: Move some of the functions to common file

Hi Ayan,


> On 7 Apr 2025, at 15:29, Ayan Kumar Halder <ayankuma@xxxxxxx> wrote:
> 
> Hi Luca,
> 
> On 04/04/2025 10:06, Luca Fancellu wrote:
>> Hi Ayan,
>> 
>>> On 3 Apr 2025, at 18:12, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx> 
>>> wrote:
>>> 
>>> Added a new file prepare_xen_region.inc to hold the common earlyboot MPU 
>>> regions
>>> configurations across arm64 and arm32.
>>> 
>>> prepare_xen_region, fail_insufficient_regions() will be used by both arm32 
>>> and
>>> arm64. Thus, they have been moved to prepare_xen_region.inc.
>>> 
>>> enable_secondary_cpu_mm() is a stub which is moved to 
>>> prepare_xen_region.inc as
>>> SMP is currently not supported for MPU.
>>> 
>>> *_PRBAR are moved to arm64/sysregs.h.
>>> *_PRLAR are moved to prepare_xen_region.inc as they are common between arm32
>>> and arm64.
>>> 
>>> Introduce WRITE_SYSREG_ASM to write to the system registers from the common 
>>> asm
>>> file.
>>> 
>>> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
>>> ---
>> The split for the common code seems ok to me, but this patch is introducing 
>> an issue for the arm64 compilation,
> Sorry, I moved something at the last moment without testing. :(
>> I’ve done an experiment and with these changes I’m able to compile both, but 
>> feel free to ignore if it’s no what you
>> had in mind.
> The change looks good. However, ...
>> 
>> diff --git a/xen/arch/arm/include/asm/arm32/sysregs.h 
>> b/xen/arch/arm/include/asm/arm32/sysregs.h
>> index 22871999afb3..a90d1610a155 100644
>> --- a/xen/arch/arm/include/asm/arm32/sysregs.h
>> +++ b/xen/arch/arm/include/asm/arm32/sysregs.h
>> @@ -20,6 +20,13 @@
>>   * uses r0 as a placeholder register. */
>>  #define CMD_CP32(name...)      "mcr " __stringify(CP32(r0, name)) ";"
>>  +#define REGION_TEXT_PRBAR       0x18    /* SH=11 AP=10 XN=0 */
>> +#define REGION_RO_PRBAR         0x1D    /* SH=11 AP=10 XN=1 */
>> +#define REGION_DATA_PRBAR       0x19    /* SH=11 AP=00 XN=1 */
>> +#define REGION_DEVICE_PRBAR     0x11    /* SH=10 AP=00 XN=1 */
>> +
>> +#define WRITE_SYSREG_ASM(v, name) mcr CP32(v, name)
>> +
>>  #ifndef __ASSEMBLY__
>>    /* C wrappers */
>> diff --git a/xen/arch/arm/include/asm/cpregs.h 
>> b/xen/arch/arm/include/asm/cpregs.h
>> index 6019a2cbdd89..b909adc102a5 100644
>> --- a/xen/arch/arm/include/asm/cpregs.h
>> +++ b/xen/arch/arm/include/asm/cpregs.h
>> @@ -1,10 +1,6 @@
>>  #ifndef __ASM_ARM_CPREGS_H
>>  #define __ASM_ARM_CPREGS_H
>>  -#ifdef CONFIG_MPU
>> -#include <asm/mpu/cpregs.h>
>> -#endif
>> -
>>  /*
>>   * AArch32 Co-processor registers.
>>   *
>> @@ -502,6 +498,12 @@
>>  #define MVFR0_EL1               MVFR0
>>  #define MVFR1_EL1               MVFR1
>>  #define MVFR2_EL1               MVFR2
>> +#define HMPUIR                  p15,4,c0,c0,4
>> +#define HPRSELR                 p15,4,c6,c2,1
>> +#define PRBAR_EL2               p15,4,c6,c3,0
>> +#define PRLAR_EL2               p15,4,c6,c8,1
>> +#define MPUIR_EL2               HMPUIR
>> +#define PRSELR_EL2              HPRSELR
> 
> Considering that there will be lots of arm32 MPU specific registers, do you 
> want to move them to mpu/cpregs.h ?
> 
> That would be my style preference.

I don’t have any strong opinion so it’s fine if you want them in cpregs.h.

Cheers,
Luca


 


Rackspace

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