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

Re: [PATCH] arch: arm64: always set EL=1 when injecting undefined exception


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 13 Feb 2025 09:29:51 +0100
  • 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=CRKpY864gjYFL/AXMKeWq2T4EwqlPfhHtxFA6kUTHoU=; b=rNbjH92vLaEOAtv3uhEULK/pQHv4iEelmxdd1ZwnhF9VIueNN9hoyjs1hsE50vxjUh6/m37FnK6OEGauinaqz/DcagmFatFQ/4jjiU/rhwGeW6fI3e5LMZFkDZUPkvXavWuisbKO9j3qFIbifXDXphVXIFTw2xFjY7Vhk0EH+/Lb6JabESGOdkzf4aCieI5jEYcJNYRWWHEIpyAiJmm7Y5Ck8bSpDQe4y2zS1UZEnkz6D5Vuw5/piAyevqDtxC9LgrlczbVRq9QFBTjNIa9yZgoIKP63tQWr7iK1GgGZ8h/t5jgvCQLWcYdYcc6JLu6io3xhfHNsOUbIpQamhVeIYA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Zs5pOjkEDb22UfsW0Gq5K5+kdv134OVZ0fi4+L5Naq80iftufc607NbS45b38iRwOQudFnM052BcEZI2cl14qcColsXepStanqM1uOqBYDnCqNeKOx9AJ7YjQslszCkIY7D9Q1x2G6CdQ2XemYt4uKZQ94GKLdegamU9kVm4ZEKvWUSgtJVsY8/9P0EDmeAPLgKGUuicu2pBU+zJxpMZLhX7ifMRWlct1ZFj8Z4MHoJN9IoJceewf2vkaPJD444sGemMJyFa4Tv0hH2FplhgUtKwKLyAq3xEQ6R9JXYz0441P5VIHnOMeWYd5oO03nPMQ5PFRH+oC9moYDSuzSNJWg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Thu, 13 Feb 2025 08:30:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Volodymyr,

NIT: s/EL/IL/ in commit title

One remark below.

On 12/02/2025 23:03, Stefano Stabellini wrote:
> 
> 
> On Wed, 12 Feb 2025, Volodymyr Babchuk wrote:
>> ARM Architecture Reference Manual states that EL field of ESR_EL1
>> register should be 1 when EC is 0b000000 aka HSR_EC_UNKNOWN.
>>
>> Section D24.2.40, page D24-7337 of ARM DDI 0487L:
>>
>>   IL, bit [25]
>>   Instruction Length for synchronous exceptions. Possible values of this bit 
>> are:
>>
>>   [...]
>>
>>   0b1 - 32-bit instruction trapped.
>>   This value is also used when the exception is one of the following:
>>   [...]
>>    - An exception reported using EC value 0b000000.
>>
>> To align code with the specification, set .len field to 1 in
>> inject_undef64_exception() and remove unneeded second parameter.
>>
>> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> 
> 
>> ---
>>  xen/arch/arm/arm64/vsysreg.c           |  8 ++++----
>>  xen/arch/arm/include/asm/arm64/traps.h |  2 +-
>>  xen/arch/arm/include/asm/traps.h       |  2 +-
>>  xen/arch/arm/p2m.c                     |  2 +-
>>  xen/arch/arm/traps.c                   | 24 ++++++++++++------------
>>  xen/arch/arm/vcpreg.c                  | 24 ++++++++++++------------
>>  xen/arch/arm/vsmc.c                    |  6 ++----
>>  7 files changed, 33 insertions(+), 35 deletions(-)
>>
>> diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c
>> index c73b2c95ce..29622a8593 100644
>> --- a/xen/arch/arm/arm64/vsysreg.c
>> +++ b/xen/arch/arm/arm64/vsysreg.c
>> @@ -95,7 +95,7 @@ void do_sysreg(struct cpu_user_regs *regs,
>>       */
>>      case HSR_SYSREG_ACTLR_EL1:
>>          if ( regs_mode_is_user(regs) )
>> -            return inject_undef_exception(regs, hsr);
>> +            return inject_undef_exception(regs);
>>          if ( hsr.sysreg.read )
>>              set_user_reg(regs, regidx, v->arch.actlr);
>>          break;
>> @@ -267,7 +267,7 @@ void do_sysreg(struct cpu_user_regs *regs,
>>      case HSR_SYSREG_CNTP_TVAL_EL0:
>>      case HSR_SYSREG_CNTP_CVAL_EL0:
>>          if ( !vtimer_emulate(regs, hsr) )
>> -            return inject_undef_exception(regs, hsr);
>> +            return inject_undef_exception(regs);
>>          break;
>>
>>      /*
>> @@ -280,7 +280,7 @@ void do_sysreg(struct cpu_user_regs *regs,
>>      case HSR_SYSREG_ICC_SGI0R_EL1:
>>
>>          if ( !vgic_emulate(regs, hsr) )
>> -            return inject_undef64_exception(regs, hsr.len);
>> +            return inject_undef64_exception(regs);
>>          break;
>>
>>      /*
>> @@ -440,7 +440,7 @@ void do_sysreg(struct cpu_user_regs *regs,
>>      gdprintk(XENLOG_ERR,
>>               "unhandled 64-bit sysreg access %#"PRIregister"\n",
>>               hsr.bits & HSR_SYSREG_REGS_MASK);
>> -    inject_undef_exception(regs, hsr);
>> +    inject_undef_exception(regs);
>>  }
>>
>>  /*
>> diff --git a/xen/arch/arm/include/asm/arm64/traps.h 
>> b/xen/arch/arm/include/asm/arm64/traps.h
>> index a347cb13d6..3be2fa69ee 100644
>> --- a/xen/arch/arm/include/asm/arm64/traps.h
>> +++ b/xen/arch/arm/include/asm/arm64/traps.h
>> @@ -1,7 +1,7 @@
>>  #ifndef __ASM_ARM64_TRAPS__
>>  #define __ASM_ARM64_TRAPS__
>>
>> -void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len);
>> +void inject_undef64_exception(struct cpu_user_regs *regs);
>>
>>  void do_sysreg(struct cpu_user_regs *regs,
>>                 const union hsr hsr);
>> diff --git a/xen/arch/arm/include/asm/traps.h 
>> b/xen/arch/arm/include/asm/traps.h
>> index 9a60dbf70e..3b40afe262 100644
>> --- a/xen/arch/arm/include/asm/traps.h
>> +++ b/xen/arch/arm/include/asm/traps.h
>> @@ -44,7 +44,7 @@ int check_conditional_instr(struct cpu_user_regs *regs, 
>> const union hsr hsr);
>>
>>  void advance_pc(struct cpu_user_regs *regs, const union hsr hsr);
>>
>> -void inject_undef_exception(struct cpu_user_regs *regs, const union hsr 
>> hsr);
>> +void inject_undef_exception(struct cpu_user_regs *regs);
>>
>>  /* read as zero and write ignore */
>>  void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read,
>> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
>> index 65b70955e3..6196cad0d4 100644
>> --- a/xen/arch/arm/p2m.c
>> +++ b/xen/arch/arm/p2m.c
>> @@ -438,7 +438,7 @@ void p2m_set_way_flush(struct vcpu *v, struct 
>> cpu_user_regs *regs,
>>      {
>>          gprintk(XENLOG_ERR,
>>                  "The cache should be flushed by VA rather than by 
>> set/way.\n");
>> -        inject_undef_exception(regs, hsr);
>> +        inject_undef_exception(regs);
There's nothing using hsr anymore, so you should drop hsr parameter from
p2m_set_way_flush()

BTW. Are you going to also look at simplifying e.g. inject_iabt_exception() for
which IL is also 1?

~Michal




 


Rackspace

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