Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 275f344

Browse files
mrutland-armctmarinas
authored andcommittedJun 21, 2016
arm64: add macro to extract ESR_ELx.EC
Several places open-code extraction of the EC field from an ESR_ELx value, in subtly different ways. This is unfortunate duplication and variation, and the precise logic used to extract the field is a distraction. This patch adds a new macro, ESR_ELx_EC(), to extract the EC field from an ESR_ELx value in a consistent fashion. Existing open-coded extractions in core arm64 code are moved over to the new helper. KVM code is left as-is for the moment. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Tested-by: Huang Shijie <shijie.huang@arm.com> Cc: Dave P Martin <dave.martin@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent b67a8b2 commit 275f344

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed
 

‎arch/arm64/include/asm/esr.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474

7575
#define ESR_ELx_EC_SHIFT (26)
7676
#define ESR_ELx_EC_MASK (UL(0x3F) << ESR_ELx_EC_SHIFT)
77+
#define ESR_ELx_EC(esr) (((esr) & ESR_ELx_EC_MASK) >> ESR_ELx_EC_SHIFT)
7778

7879
#define ESR_ELx_IL (UL(1) << 25)
7980
#define ESR_ELx_ISS_MASK (ESR_ELx_IL - 1)

‎arch/arm64/kernel/traps.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ static const char *esr_class_str[] = {
456456

457457
const char *esr_get_class_string(u32 esr)
458458
{
459-
return esr_class_str[esr >> ESR_ELx_EC_SHIFT];
459+
return esr_class_str[ESR_ELx_EC(esr)];
460460
}
461461

462462
/*

‎arch/arm64/mm/fault.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static int __do_page_fault(struct mm_struct *mm, unsigned long addr,
244244

245245
static inline int permission_fault(unsigned int esr)
246246
{
247-
unsigned int ec = (esr & ESR_ELx_EC_MASK) >> ESR_ELx_EC_SHIFT;
247+
unsigned int ec = ESR_ELx_EC(esr);
248248
unsigned int fsc_type = esr & ESR_ELx_FSC_TYPE;
249249

250250
return (ec == ESR_ELx_EC_DABT_CUR && fsc_type == ESR_ELx_FSC_PERM);

0 commit comments

Comments
 (0)
Failed to load comments.