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

Re: [PATCH 1/2] xen/arm: traps: report level 0 faults in panic_PAR()


  • To: Oleksandr Tyshchenko <olekstysh@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Orzel, Michal" <michal.orzel@xxxxxxx>
  • Date: Thu, 27 Aug 2026 10:23:04 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=PjoiI3jA92lSsQgwZ4R8+YsMenuPk2Dm0CBsOMgBuBg=; b=rZp534xfMdqiDmtFSvvGJUMGb7PjERYYPauH6da0KaPUtGrqAq+EhwlaKI/t4yQ2JOM1wlTo9WZt4a/MuJeu++iDv+QQfxIh5GwN+eU3bTfPTgYTnn3idq9kAO4j+fhzpxVCxNpi1HNuST8nwLUju+fLx4TiNIXeZEBM9Bue7XV2RCKz9VEsSkKvA7lf42oK28pCqxRuLw9BwmU9lV4K5PTwUnCT+3X/LY4GaGXOa3M4inPYj/Tufq6DL1X2X3pIysPxDhOp/4nz6LVD3bRsMms6l8BYec3RO8gj/LODks8IIHfhyTSCgTPcESQ7FBcB7dBNjPbh3+smSB4vVU1Pbg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xVI5ZO19z8T2TDHj9V5yl6Cy7TCA7aTY0qHf8WdLOiqbVnUH/c9WzDt/U6XLhHI5UTw6TdZw4ukitLoT2k8RMgxSOOVhvlI1OBQ4I6nAk5W67w3ffJ4VGZoLKMABSbp6avbnAdQRTnM4DsS8K/W+gBXDHfhoW87POvaWukR5iH2nvBYGQDnwD7Efow+qMnfJVB0ozpznXwSKf1F0/FyIstB0zBAw+wMNwOuODUV1MH3EfK49SFQw3xxIS7OLblcBQmg+0/lwFDH0JXXc0Y2f5TWitmDlmlGMiujk2II9PqtDllLAdT5833eiSzncoTcnZ7c5dYfUsdwQMqR+KS38mA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 27 Aug 2026 08:23:28 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 26-Aug-26 17:47, Oleksandr Tyshchenko wrote:
> 
> 
> On 8/25/26 09:23, Michal Orzel wrote:
> 
> Hello Michal
> 
> 
>> decode_fsc() derives the fault level from the low two bits of the FSC, so
>> level 0 is a valid output: FSC_FLT_TRANS is 0x04, i.e. "translation fault,
>> level 0".
>>
>> This is reachable on arm64 because xen_pgtable is the zeroeth-level root,
>> but fsc_level_str() has no case for it and prints " (level invalid)"
>> instead. At the time the function was created Xen used only three levels.
>>
>> Add the missing case. On arm32 the zeroeth level does not exist, hence
>> guard the case by CONFIG_ARM_64.
>>
>> While at it, make decode_fsc() decode also address size faults.
>>
>> Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
> 
> 
> Patch looks ok to me, so:
> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
> 
> but I have a comment below:
> 
>> ---
>>   xen/arch/arm/include/asm/processor.h | 2 ++
>>   xen/arch/arm/traps.c                 | 8 ++++++++
>>   2 files changed, 10 insertions(+)
>>
>> diff --git a/xen/arch/arm/include/asm/processor.h 
>> b/xen/arch/arm/include/asm/processor.h
>> index a3753c317fff..509040a1cdc0 100644
>> --- a/xen/arch/arm/include/asm/processor.h
>> +++ b/xen/arch/arm/include/asm/processor.h
>> @@ -521,6 +521,7 @@ extern register_t __cpu_logical_map[];
>>   /*
>>    * 543210 BIT
>>    * 00XXLL -- XX Fault Level LL
>> + * ..00LL -- Address Size Fault LL
>>    * ..01LL -- Translation Fault LL
>>    * ..10LL -- Access Fault LL
>>    * ..11LL -- Permission Fault LL
>> @@ -534,6 +535,7 @@ extern register_t __cpu_logical_map[];
>>   #define FSC_TYPE_OTH   (_AC(0x02,U)<<4)
>>   #define FSC_TYPE_IMPL  (_AC(0x03,U)<<4)
>>   
>> +#define FSC_FLT_ADDR_SIZE (0x00)
>>   #define FSC_FLT_TRANS  (0x04)
>>   #define FSC_FLT_ACCESS (0x08)
>>   #define FSC_FLT_PERM   (0x0c)
>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>> index 0c01f37ad6b4..dc0ec8a345ed 100644
>> --- a/xen/arch/arm/traps.c
>> +++ b/xen/arch/arm/traps.c
>> @@ -307,6 +307,10 @@ static const char *decode_fsc(uint32_t fsc, int *level)
>>   
>>       switch ( fsc & 0x3f )
>>       {
>> +    case FSC_FLT_ADDR_SIZE ... FSC_FLT_ADDR_SIZE + 3:
>> +        msg = "Address size fault";
>> +        *level = fsc & FSC_LL_MASK;
>> +        break;
>>       case FSC_FLT_TRANS ... FSC_FLT_TRANS + 3:
>>           msg = "Translation fault";
>>           *level = fsc & FSC_LL_MASK;
>> @@ -363,6 +367,10 @@ static const char *fsc_level_str(int level)
>>       switch ( level )
>>       {
>>       case -1: return "";
>> +#ifdef CONFIG_ARM_64
>> +    /* On arm32 the zeroeth level does not exist */
>> +    case 0:  return " at level 0";
>> +#endif
> 
> 
> NIT: Before this patch fsc of 0x00 fell through to default, so it 
> printed "Unknown Failure" and level stayed -1. After the patch Arm32 
> decodes 0x00 as an address size fault and sets *level = 0, while case 0: 
> in fsc_level_str() is compiled out there, so the print becomes "Address 
> size fault (level invalid)". So I would either drop the #ifdef (to keep 
> the two hunks consistent), or not set the level on Arm32.
Actually, FSC 0 means address size fault at...:
 - on AArch64: level 0 OR translation table base register
 - on AArch32: translation table base register
so I will say: "at level 0 or TTBR" and drop the #ifdef.

~Michal




 


Rackspace

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