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

Re: [PATCH v4 1/8] xen/arm: Use READ_SYSREG instead of 32/64 versions


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Fri, 18 Dec 2020 10:23:11 +0000
  • Accept-language: en-GB, en-US
  • 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=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-SenderADCheck; bh=ULsjm2pC5sW6JaNnxQ+RHklJd8Myk/6dIbweNZw0Lro=; b=jkyi0VgeUFn9IBz8eJW8QAqmT4rbWvYeX2g6FXhryA9rV9HAYgTjHJMKOD672RZDe1693zR1Cdo/ShBgfhaOvzt/WyWm5dLKyUTxMUZeyWLebb84jIXG1B78EJYJtOV+aO+lCiZOmMbTjV0OR0tzpXFibEbhRW/bQWqA6JUpq8lPdZaEJuyAKRa3h/b4r2P5PZd13aNmE2cqVc2bM34PtZ7w6BRJhlOY9m1ipTFCklHFFx635ZhipmdfjUx4mCUk+scH3NP5gx7QwWggpumMyZrNKphuIGyJ8FpLyW3b17fMZHe8X9B7DYx03CVYeBaWjbkmWnUtCpZKXpdP+9TYQQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XMgMQt67atPQ52K+N/QyqNDlTQrWKikU0GPVyx8ttQ6LRUeva0LVLQNI+HnH39jqezqCzzcVmGMqTBAwVOEq5Vk+iziNG+6VSh1o4HhC24ixHQhbN4tAEmagivnkO29KAvvh3A3/AX44jPHGlzR3nC/d+pbaqYY+ZSxh69t59zpTOkJXJFSeaTc/haAfXpiSDPkjQ6BaIPrMgBnUborJ34HrjtiBU7pXOIE+cHu9Dp0La+qwyxrbVk3861gZWvaMqU/XRYsRLUd2w357zLO+ijYLvMVOUdLh5A2Zvs2vHAMLYbisi89gLY5unxcT2Sbqn49LTeLctIQmfk5X7sst+w==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Fri, 18 Dec 2020 10:23:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHW1ItQykO1RG0fj0mzlL7TviPUeqn77F6AgAC6HAA=
  • Thread-topic: [PATCH v4 1/8] xen/arm: Use READ_SYSREG instead of 32/64 versions

Hi Stefano,

> On 17 Dec 2020, at 23:17, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Thu, 17 Dec 2020, Bertrand Marquis wrote:
>> Modify identify_cpu function to use READ_SYSREG instead of READ_SYSREG32
>> or READ_SYSREG64.
>> The aarch32 versions of the registers are 64bit on an aarch64 processor
>> so it was wrong to access them as 32bit registers.
> 
> This sentence is a bit confusing because, as an example, MIDR_EL1 is
> also an aarch64 register, not only an aarch32 register. Maybe we should
> clarify.

You are right the sentence is not very clear.

Maybe the following would be better:

All aarch32 specific registers (for example ID_PFR0_EL1) are 64bit when
accessed from aarch64 with upper bits read as 0, so it is right to access them
as 64bit registers on a 64bit platform.

> 
> Aside from that:
> 
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> 

Thanks

Cheers
Bertrand

> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
>> 
>> ---
>> Change in V4:
>>  This patch was introduced in v4.
>> 
>> ---
>> xen/arch/arm/cpufeature.c | 50 +++++++++++++++++++--------------------
>> 1 file changed, 25 insertions(+), 25 deletions(-)
>> 
>> diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
>> index 44126dbf07..115e1b164d 100644
>> --- a/xen/arch/arm/cpufeature.c
>> +++ b/xen/arch/arm/cpufeature.c
>> @@ -99,44 +99,44 @@ int enable_nonboot_cpu_caps(const struct 
>> arm_cpu_capabilities *caps)
>> 
>> void identify_cpu(struct cpuinfo_arm *c)
>> {
>> -        c->midr.bits = READ_SYSREG32(MIDR_EL1);
>> +        c->midr.bits = READ_SYSREG(MIDR_EL1);
>>         c->mpidr.bits = READ_SYSREG(MPIDR_EL1);
>> 
>> #ifdef CONFIG_ARM_64
>> -        c->pfr64.bits[0] = READ_SYSREG64(ID_AA64PFR0_EL1);
>> -        c->pfr64.bits[1] = READ_SYSREG64(ID_AA64PFR1_EL1);
>> +        c->pfr64.bits[0] = READ_SYSREG(ID_AA64PFR0_EL1);
>> +        c->pfr64.bits[1] = READ_SYSREG(ID_AA64PFR1_EL1);
>> 
>> -        c->dbg64.bits[0] = READ_SYSREG64(ID_AA64DFR0_EL1);
>> -        c->dbg64.bits[1] = READ_SYSREG64(ID_AA64DFR1_EL1);
>> +        c->dbg64.bits[0] = READ_SYSREG(ID_AA64DFR0_EL1);
>> +        c->dbg64.bits[1] = READ_SYSREG(ID_AA64DFR1_EL1);
>> 
>> -        c->aux64.bits[0] = READ_SYSREG64(ID_AA64AFR0_EL1);
>> -        c->aux64.bits[1] = READ_SYSREG64(ID_AA64AFR1_EL1);
>> +        c->aux64.bits[0] = READ_SYSREG(ID_AA64AFR0_EL1);
>> +        c->aux64.bits[1] = READ_SYSREG(ID_AA64AFR1_EL1);
>> 
>> -        c->mm64.bits[0]  = READ_SYSREG64(ID_AA64MMFR0_EL1);
>> -        c->mm64.bits[1]  = READ_SYSREG64(ID_AA64MMFR1_EL1);
>> +        c->mm64.bits[0]  = READ_SYSREG(ID_AA64MMFR0_EL1);
>> +        c->mm64.bits[1]  = READ_SYSREG(ID_AA64MMFR1_EL1);
>> 
>> -        c->isa64.bits[0] = READ_SYSREG64(ID_AA64ISAR0_EL1);
>> -        c->isa64.bits[1] = READ_SYSREG64(ID_AA64ISAR1_EL1);
>> +        c->isa64.bits[0] = READ_SYSREG(ID_AA64ISAR0_EL1);
>> +        c->isa64.bits[1] = READ_SYSREG(ID_AA64ISAR1_EL1);
>> #endif
>> 
>> -        c->pfr32.bits[0] = READ_SYSREG32(ID_PFR0_EL1);
>> -        c->pfr32.bits[1] = READ_SYSREG32(ID_PFR1_EL1);
>> +        c->pfr32.bits[0] = READ_SYSREG(ID_PFR0_EL1);
>> +        c->pfr32.bits[1] = READ_SYSREG(ID_PFR1_EL1);
>> 
>> -        c->dbg32.bits[0] = READ_SYSREG32(ID_DFR0_EL1);
>> +        c->dbg32.bits[0] = READ_SYSREG(ID_DFR0_EL1);
>> 
>> -        c->aux32.bits[0] = READ_SYSREG32(ID_AFR0_EL1);
>> +        c->aux32.bits[0] = READ_SYSREG(ID_AFR0_EL1);
>> 
>> -        c->mm32.bits[0]  = READ_SYSREG32(ID_MMFR0_EL1);
>> -        c->mm32.bits[1]  = READ_SYSREG32(ID_MMFR1_EL1);
>> -        c->mm32.bits[2]  = READ_SYSREG32(ID_MMFR2_EL1);
>> -        c->mm32.bits[3]  = READ_SYSREG32(ID_MMFR3_EL1);
>> +        c->mm32.bits[0]  = READ_SYSREG(ID_MMFR0_EL1);
>> +        c->mm32.bits[1]  = READ_SYSREG(ID_MMFR1_EL1);
>> +        c->mm32.bits[2]  = READ_SYSREG(ID_MMFR2_EL1);
>> +        c->mm32.bits[3]  = READ_SYSREG(ID_MMFR3_EL1);
>> 
>> -        c->isa32.bits[0] = READ_SYSREG32(ID_ISAR0_EL1);
>> -        c->isa32.bits[1] = READ_SYSREG32(ID_ISAR1_EL1);
>> -        c->isa32.bits[2] = READ_SYSREG32(ID_ISAR2_EL1);
>> -        c->isa32.bits[3] = READ_SYSREG32(ID_ISAR3_EL1);
>> -        c->isa32.bits[4] = READ_SYSREG32(ID_ISAR4_EL1);
>> -        c->isa32.bits[5] = READ_SYSREG32(ID_ISAR5_EL1);
>> +        c->isa32.bits[0] = READ_SYSREG(ID_ISAR0_EL1);
>> +        c->isa32.bits[1] = READ_SYSREG(ID_ISAR1_EL1);
>> +        c->isa32.bits[2] = READ_SYSREG(ID_ISAR2_EL1);
>> +        c->isa32.bits[3] = READ_SYSREG(ID_ISAR3_EL1);
>> +        c->isa32.bits[4] = READ_SYSREG(ID_ISAR4_EL1);
>> +        c->isa32.bits[5] = READ_SYSREG(ID_ISAR5_EL1);
>> }
>> 
>> /*
>> -- 
>> 2.17.1
>> 




 


Rackspace

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