All of lore.kernel.org
 help / color / mirror / Atom feed
From: m-karicheri2@ti.com (Murali Karicheri)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: keystone: add a work around to handle asynchronous external abort
Date: Mon, 17 Aug 2015 10:11:11 -0400	[thread overview]
Message-ID: <55D1EB7F.4030905@ti.com> (raw)
In-Reply-To: <1439561519.13210.55.camel@pengutronix.de>

On 08/14/2015 10:11 AM, Lucas Stach wrote:
> Am Freitag, den 14.08.2015, 10:04 -0400 schrieb Murali Karicheri:
>> On 08/11/2015 03:13 PM, Murali Karicheri wrote:
>>> Currently on some devices, an asynchronous external abort exception
>>> happens during boot up when exception handlers are enabled in kernel
>>> before switching to user space. This patch adds a workaround to handle
>>> this once during boot. Many customers are already using this
>>> with out any issues and is required to workaround the above issue.
>>>
>>> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
>>> ---
>>>    arch/arm/mach-keystone/keystone.c | 26 ++++++++++++++++++++++++++
>>>    1 file changed, 26 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
>>> index e2880105..c1d0fe5 100644
>>> --- a/arch/arm/mach-keystone/keystone.c
>>> +++ b/arch/arm/mach-keystone/keystone.c
>>> @@ -15,6 +15,7 @@
>>>    #include <linux/of_platform.h>
>>>    #include <linux/of_address.h>
>>>    #include <linux/memblock.h>
>>> +#include <linux/signal.h>
>>>
>>>    #include <asm/setup.h>
>>>    #include <asm/mach/map.h>
>>> @@ -52,6 +53,24 @@ static struct notifier_block platform_nb = {
>>>    	.notifier_call = keystone_platform_notifier,
>>>    };
>>>
>>> +static bool ignore_first = true;
>>> +static int keystone_async_ext_abort_fault(unsigned long addr, unsigned int fsr,
>>> +					  struct pt_regs *regs)
>>> +{
>>> +	/*
>>> +	 * if first time, ignore this as this is a asynchronous external abort
>>> +	 * happening only some devices that couldn't be root caused and we add
>>> +	 * this work around to handle this first time.
>>> +	 */
>>> +	if (ignore_first) {
>>> +		ignore_first = false;
>>> +		return 0;
>>> +	}
>>> +
>>> +	/* Subsequent ones should be handled as fault */
>>> +	return 1;
>>> +}
>>> +
>>>    static void __init keystone_init(void)
>>>    {
>>>    	if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START) {
>>> @@ -61,6 +80,13 @@ static void __init keystone_init(void)
>>>    	}
>>>    	keystone_pm_runtime_init();
>>>    	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
>>> +
>>> +	/*
>>> +	 * Add a one time exception handler to catch asynchronous external
>>> +	 * abort
>>> +	 */
>>> +	hook_fault_code(17, keystone_async_ext_abort_fault, SIGBUS, 0,
>>> +			"async external abort handler");
>>>    }
>>>
>>>    static phys_addr_t keystone_virt_to_idmap(unsigned long x)
>>>
>> Can this be applied if it looks good?
>>
> The keystone PCIe host driver already hooks the same fault code. Those
> hooks are no chain, but a simple pointer, so one of those handlers is
> going to loose out.
>
> This likely isn't what you intended.
You are right. I will try to debug this further based on your patch and 
as per RMK's suggestion.

Thanks and regards,

Murali
>
> Regards,
> Lucas
>


-- 
Murali Karicheri
Linux Kernel, Keystone

WARNING: multiple messages have this Message-ID (diff)
From: Murali Karicheri <m-karicheri2@ti.com>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: <ssantosh@kernel.org>, <linux@arm.linux.org.uk>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ARM: keystone: add a work around to handle asynchronous external abort
Date: Mon, 17 Aug 2015 10:11:11 -0400	[thread overview]
Message-ID: <55D1EB7F.4030905@ti.com> (raw)
In-Reply-To: <1439561519.13210.55.camel@pengutronix.de>

On 08/14/2015 10:11 AM, Lucas Stach wrote:
> Am Freitag, den 14.08.2015, 10:04 -0400 schrieb Murali Karicheri:
>> On 08/11/2015 03:13 PM, Murali Karicheri wrote:
>>> Currently on some devices, an asynchronous external abort exception
>>> happens during boot up when exception handlers are enabled in kernel
>>> before switching to user space. This patch adds a workaround to handle
>>> this once during boot. Many customers are already using this
>>> with out any issues and is required to workaround the above issue.
>>>
>>> Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
>>> ---
>>>    arch/arm/mach-keystone/keystone.c | 26 ++++++++++++++++++++++++++
>>>    1 file changed, 26 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
>>> index e2880105..c1d0fe5 100644
>>> --- a/arch/arm/mach-keystone/keystone.c
>>> +++ b/arch/arm/mach-keystone/keystone.c
>>> @@ -15,6 +15,7 @@
>>>    #include <linux/of_platform.h>
>>>    #include <linux/of_address.h>
>>>    #include <linux/memblock.h>
>>> +#include <linux/signal.h>
>>>
>>>    #include <asm/setup.h>
>>>    #include <asm/mach/map.h>
>>> @@ -52,6 +53,24 @@ static struct notifier_block platform_nb = {
>>>    	.notifier_call = keystone_platform_notifier,
>>>    };
>>>
>>> +static bool ignore_first = true;
>>> +static int keystone_async_ext_abort_fault(unsigned long addr, unsigned int fsr,
>>> +					  struct pt_regs *regs)
>>> +{
>>> +	/*
>>> +	 * if first time, ignore this as this is a asynchronous external abort
>>> +	 * happening only some devices that couldn't be root caused and we add
>>> +	 * this work around to handle this first time.
>>> +	 */
>>> +	if (ignore_first) {
>>> +		ignore_first = false;
>>> +		return 0;
>>> +	}
>>> +
>>> +	/* Subsequent ones should be handled as fault */
>>> +	return 1;
>>> +}
>>> +
>>>    static void __init keystone_init(void)
>>>    {
>>>    	if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START) {
>>> @@ -61,6 +80,13 @@ static void __init keystone_init(void)
>>>    	}
>>>    	keystone_pm_runtime_init();
>>>    	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
>>> +
>>> +	/*
>>> +	 * Add a one time exception handler to catch asynchronous external
>>> +	 * abort
>>> +	 */
>>> +	hook_fault_code(17, keystone_async_ext_abort_fault, SIGBUS, 0,
>>> +			"async external abort handler");
>>>    }
>>>
>>>    static phys_addr_t keystone_virt_to_idmap(unsigned long x)
>>>
>> Can this be applied if it looks good?
>>
> The keystone PCIe host driver already hooks the same fault code. Those
> hooks are no chain, but a simple pointer, so one of those handlers is
> going to loose out.
>
> This likely isn't what you intended.
You are right. I will try to debug this further based on your patch and 
as per RMK's suggestion.

Thanks and regards,

Murali
>
> Regards,
> Lucas
>


-- 
Murali Karicheri
Linux Kernel, Keystone

  reply	other threads:[~2015-08-17 14:11 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-11 19:13 [PATCH] ARM: keystone: add a work around to handle asynchronous external abort Murali Karicheri
2015-08-11 19:13 ` Murali Karicheri
2015-08-14 14:04 ` Murali Karicheri
2015-08-14 14:04   ` Murali Karicheri
2015-08-14 14:09   ` Russell King - ARM Linux
2015-08-14 14:09     ` Russell King - ARM Linux
2015-08-14 14:20     ` Lucas Stach
2015-08-14 14:20       ` Lucas Stach
2015-08-14 21:55       ` Murali Karicheri
2015-08-14 21:55         ` Murali Karicheri
2015-08-14 21:56         ` Russell King - ARM Linux
2015-08-14 21:56           ` Russell King - ARM Linux
2015-08-17 14:09           ` Murali Karicheri
2015-08-17 14:09             ` Murali Karicheri
2015-08-14 15:14     ` santosh shilimkar
2015-08-14 15:14       ` santosh shilimkar
2015-08-14 21:53       ` Murali Karicheri
2015-08-14 21:53         ` Murali Karicheri
2015-08-14 21:56         ` Russell King - ARM Linux
2015-08-14 21:56           ` Russell King - ARM Linux
2015-08-17 22:12           ` Murali Karicheri
2015-08-17 22:12             ` Murali Karicheri
2015-08-17 22:47             ` Russell King - ARM Linux
2015-08-17 22:47               ` Russell King - ARM Linux
2015-08-18  3:09             ` santosh.shilimkar at oracle.com
2015-08-18  3:09               ` santosh.shilimkar
2015-08-18  8:13               ` Russell King - ARM Linux
2015-08-18  8:13                 ` Russell King - ARM Linux
2015-08-18  8:28                 ` Lucas Stach
2015-08-18  8:28                   ` Lucas Stach
2015-08-18 12:06                   ` Afzal Mohammed
2015-08-18 12:06                     ` Afzal Mohammed
2015-08-18  8:28                 ` Jisheng Zhang
2015-08-18  8:28                   ` Jisheng Zhang
2015-08-18 14:49                   ` Murali Karicheri
2015-08-18 14:49                     ` Murali Karicheri
2015-08-18 20:25                 ` Murali Karicheri
2015-08-18 20:25                   ` Murali Karicheri
2015-08-15  0:01         ` santosh.shilimkar at oracle.com
2015-08-15  0:01           ` santosh.shilimkar
2015-08-14 14:11   ` Lucas Stach
2015-08-14 14:11     ` Lucas Stach
2015-08-17 14:11     ` Murali Karicheri [this message]
2015-08-17 14:11       ` Murali Karicheri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D1EB7F.4030905@ti.com \
    --to=m-karicheri2@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.