linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: add the ability to hook the fault code
@ 2014-06-19 10:54 Neil Zhang
  2014-06-20  8:25 ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Zhang @ 2014-06-19 10:54 UTC (permalink / raw)
  To: linux-arm-kernel

Add the ability to hook the fault code for future use.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 arch/arm64/include/asm/system_misc.h |    4 ++++
 arch/arm64/mm/fault.c                |   12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/arch/arm64/include/asm/system_misc.h b/arch/arm64/include/asm/system_misc.h
index 7a18fab..a8c19dd 100644
--- a/arch/arm64/include/asm/system_misc.h
+++ b/arch/arm64/include/asm/system_misc.h
@@ -37,6 +37,10 @@ void hook_debug_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
 					     struct pt_regs *),
 			   int sig, int code, const char *name);
 
+void hook_fault_code(int nr,
+		int (*fn)(unsigned long, unsigned int, struct pt_regs *),
+		int sig, int code, const char *name);
+
 struct mm_struct;
 extern void show_pte(struct mm_struct *mm, unsigned long addr);
 extern void __show_regs(struct pt_regs *);
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index bcc965e..7902fb6 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -447,6 +447,18 @@ static const char *fault_name(unsigned int esr)
 	return inf->name;
 }
 
+void __init hook_fault_code(int nr,
+		int (*fn)(unsigned long, unsigned int, struct pt_regs *),
+		int sig, int code, const char *name)
+{
+	BUG_ON(nr < 0 || nr >= ARRAY_SIZE(fault_info));
+
+	fault_info[nr].fn   = fn;
+	fault_info[nr].sig  = sig;
+	fault_info[nr].code = code;
+	fault_info[nr].name = name;
+}
+
 /*
  * Dispatch a data abort to the relevant handler.
  */
-- 
1.7.9.5

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

* [PATCH] arm64: add the ability to hook the fault code
  2014-06-19 10:54 [PATCH] arm64: add the ability to hook the fault code Neil Zhang
@ 2014-06-20  8:25 ` Will Deacon
  2014-06-20  8:33   ` Neil Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2014-06-20  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 19, 2014 at 11:54:56AM +0100, Neil Zhang wrote:
> Add the ability to hook the fault code for future use.

Do you have a user for this in the kernel tree? I'd rather add the hook with
the first user, if it doesn't exist already.

Will

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

* [PATCH] arm64: add the ability to hook the fault code
  2014-06-20  8:25 ` Will Deacon
@ 2014-06-20  8:33   ` Neil Zhang
  2014-06-20  8:39     ` Will Deacon
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Zhang @ 2014-06-20  8:33 UTC (permalink / raw)
  To: linux-arm-kernel


> -----Original Message-----
> From: Will Deacon [mailto:will.deacon at arm.com]
> Sent: 2014?6?20? 16:26
> To: Neil Zhang
> Cc: Catalin Marinas; linux-arm-kernel at lists.infradead.org;
> linux-kernel at vger.kernel.org
> Subject: Re: [PATCH] arm64: add the ability to hook the fault code
> 
> On Thu, Jun 19, 2014 at 11:54:56AM +0100, Neil Zhang wrote:
> > Add the ability to hook the fault code for future use.
> 
> Do you have a user for this in the kernel tree? I'd rather add the hook with
> the first user, if it doesn't exist already.
> 

Marvell Soc has a feature to use the external abort.
I didn't submit it since it's a private feature.

> Will

Best Regards,
Neil Zhang

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

* [PATCH] arm64: add the ability to hook the fault code
  2014-06-20  8:33   ` Neil Zhang
@ 2014-06-20  8:39     ` Will Deacon
  2014-06-20  9:02       ` Neil Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: Will Deacon @ 2014-06-20  8:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 20, 2014 at 09:33:59AM +0100, Neil Zhang wrote:
> 
> > -----Original Message-----
> > From: Will Deacon [mailto:will.deacon at arm.com]
> > Sent: 2014?6?20? 16:26
> > To: Neil Zhang
> > Cc: Catalin Marinas; linux-arm-kernel at lists.infradead.org;
> > linux-kernel at vger.kernel.org
> > Subject: Re: [PATCH] arm64: add the ability to hook the fault code
> > 
> > On Thu, Jun 19, 2014 at 11:54:56AM +0100, Neil Zhang wrote:
> > > Add the ability to hook the fault code for future use.
> > 
> > Do you have a user for this in the kernel tree? I'd rather add the hook with
> > the first user, if it doesn't exist already.
> > 
> 
> Marvell Soc has a feature to use the external abort.
> I didn't submit it since it's a private feature.

In which case, let's wait until we have a user of this in the mainline tree.

Will

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

* [PATCH] arm64: add the ability to hook the fault code
  2014-06-20  8:39     ` Will Deacon
@ 2014-06-20  9:02       ` Neil Zhang
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Zhang @ 2014-06-20  9:02 UTC (permalink / raw)
  To: linux-arm-kernel


> -----Original Message-----
> From: Will Deacon [mailto:will.deacon at arm.com]
> Sent: 2014?6?20? 16:40
> To: Neil Zhang
> Cc: Catalin Marinas; linux-kernel at vger.kernel.org;
> linux-arm-kernel at lists.infradead.org
> Subject: Re: [PATCH] arm64: add the ability to hook the fault code
> 
> On Fri, Jun 20, 2014 at 09:33:59AM +0100, Neil Zhang wrote:
> >
> > > -----Original Message-----
> > > From: Will Deacon [mailto:will.deacon at arm.com]
> > > Sent: 2014?6?20? 16:26
> > > To: Neil Zhang
> > > Cc: Catalin Marinas; linux-arm-kernel at lists.infradead.org;
> > > linux-kernel at vger.kernel.org
> > > Subject: Re: [PATCH] arm64: add the ability to hook the fault code
> > >
> > > On Thu, Jun 19, 2014 at 11:54:56AM +0100, Neil Zhang wrote:
> > > > Add the ability to hook the fault code for future use.
> > >
> > > Do you have a user for this in the kernel tree? I'd rather add the
> > > hook with the first user, if it doesn't exist already.
> > >
> >
> > Marvell Soc has a feature to use the external abort.
> > I didn't submit it since it's a private feature.
> 
> In which case, let's wait until we have a user of this in the mainline tree.
> 

OK?

> Will

Best Regards,
Neil Zhang

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

end of thread, other threads:[~2014-06-20  9:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-19 10:54 [PATCH] arm64: add the ability to hook the fault code Neil Zhang
2014-06-20  8:25 ` Will Deacon
2014-06-20  8:33   ` Neil Zhang
2014-06-20  8:39     ` Will Deacon
2014-06-20  9:02       ` Neil Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).