All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: mm: Add is_el1_data_abort() helper
@ 2021-06-03 12:02 Kefeng Wang
  2021-06-03 12:30 ` Catalin Marinas
  2021-06-03 18:14 ` Will Deacon
  0 siblings, 2 replies; 3+ messages in thread
From: Kefeng Wang @ 2021-06-03 12:02 UTC (permalink / raw)
  To: Will Deacon, linux-arm-kernel; +Cc: Catalin Marinas, Kefeng Wang

We alread have is_el1_instruction_abort(), add is_el1_data_abort()
helper and use it.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 arch/arm64/mm/fault.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 871c82ab0a30..5c855b2ab93b 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -232,13 +232,17 @@ static bool is_el1_instruction_abort(unsigned int esr)
 	return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_CUR;
 }
 
+static bool is_el1_data_abort(unsigned int esr)
+{
+	return ESR_ELx_EC(esr) == ESR_ELx_EC_DABT_CUR;
+}
+
 static inline bool is_el1_permission_fault(unsigned long addr, unsigned int esr,
 					   struct pt_regs *regs)
 {
-	unsigned int ec       = ESR_ELx_EC(esr);
 	unsigned int fsc_type = esr & ESR_ELx_FSC_TYPE;
 
-	if (ec != ESR_ELx_EC_DABT_CUR && ec != ESR_ELx_EC_IABT_CUR)
+	if (!is_el1_data_abort(esr) && !is_el1_instruction_abort(esr))
 		return false;
 
 	if (fsc_type == ESR_ELx_FSC_PERM)
@@ -258,7 +262,7 @@ static bool __kprobes is_spurious_el1_translation_fault(unsigned long addr,
 	unsigned long flags;
 	u64 par, dfsc;
 
-	if (ESR_ELx_EC(esr) != ESR_ELx_EC_DABT_CUR ||
+	if (!is_el1_data_abort(esr) ||
 	    (esr & ESR_ELx_FSC_TYPE) != ESR_ELx_FSC_FAULT)
 		return false;
 
@@ -346,10 +350,9 @@ static void do_tag_recovery(unsigned long addr, unsigned int esr,
 
 static bool is_el1_mte_sync_tag_check_fault(unsigned int esr)
 {
-	unsigned int ec = ESR_ELx_EC(esr);
 	unsigned int fsc = esr & ESR_ELx_FSC;
 
-	if (ec != ESR_ELx_EC_DABT_CUR)
+	if (!is_el1_data_abort(esr))
 		return false;
 
 	if (fsc == ESR_ELx_FSC_MTE)
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: mm: Add is_el1_data_abort() helper
  2021-06-03 12:02 [PATCH] arm64: mm: Add is_el1_data_abort() helper Kefeng Wang
@ 2021-06-03 12:30 ` Catalin Marinas
  2021-06-03 18:14 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Catalin Marinas @ 2021-06-03 12:30 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: Will Deacon, linux-arm-kernel

On Thu, Jun 03, 2021 at 08:02:39PM +0800, Kefeng Wang wrote:
> We alread have is_el1_instruction_abort(), add is_el1_data_abort()
> helper and use it.
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

It's better for consistency, so:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: mm: Add is_el1_data_abort() helper
  2021-06-03 12:02 [PATCH] arm64: mm: Add is_el1_data_abort() helper Kefeng Wang
  2021-06-03 12:30 ` Catalin Marinas
@ 2021-06-03 18:14 ` Will Deacon
  1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2021-06-03 18:14 UTC (permalink / raw)
  To: Kefeng Wang, linux-arm-kernel; +Cc: catalin.marinas, kernel-team, Will Deacon

On Thu, 3 Jun 2021 20:02:39 +0800, Kefeng Wang wrote:
> We alread have is_el1_instruction_abort(), add is_el1_data_abort()
> helper and use it.

Applied to arm64 (for-next/mm), thanks!

[1/1] arm64: mm: Add is_el1_data_abort() helper
      https://git.kernel.org/arm64/c/fcf9dc02f839

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-03 18:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 12:02 [PATCH] arm64: mm: Add is_el1_data_abort() helper Kefeng Wang
2021-06-03 12:30 ` Catalin Marinas
2021-06-03 18:14 ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.