* [PATCH] drm/panfrost: Don't try to map on error faults
@ 2020-02-05 10:07 Tomeu Vizoso
2020-02-05 12:24 ` Alyssa Rosenzweig
2020-02-05 13:25 ` Robin Murphy
0 siblings, 2 replies; 4+ messages in thread
From: Tomeu Vizoso @ 2020-02-05 10:07 UTC (permalink / raw)
To: linux-kernel
Cc: Tomeu Vizoso, David Airlie, dri-devel, Steven Price, Alyssa Rosenzweig
If the exception type isn't one of the normal faults, don't try to map
and instead go straight to a terminal fault.
Otherwise, we can get flooded by kernel warnings and further faults.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 763cfca886a7..80abddb4544c 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -596,8 +596,9 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
source_id = (fault_status >> 16);
/* Page fault only */
- if ((status & mask) == BIT(i)) {
- WARN_ON(exception_type < 0xC1 || exception_type > 0xC4);
+ if ((status & mask) == BIT(i) &&
+ exception_type >= 0xC1 &&
+ exception_type <= 0xC4) {
ret = panfrost_mmu_map_fault_addr(pfdev, i, addr);
if (!ret) {
--
2.21.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/panfrost: Don't try to map on error faults
2020-02-05 10:07 [PATCH] drm/panfrost: Don't try to map on error faults Tomeu Vizoso
@ 2020-02-05 12:24 ` Alyssa Rosenzweig
2020-02-05 13:25 ` Robin Murphy
1 sibling, 0 replies; 4+ messages in thread
From: Alyssa Rosenzweig @ 2020-02-05 12:24 UTC (permalink / raw)
To: Tomeu Vizoso; +Cc: David Airlie, linux-kernel, dri-devel, Steven Price
[-- Attachment #1.1: Type: text/plain, Size: 1461 bytes --]
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Although it might be nice to
#define TRANSLATION_FAULT_LEVEL1 0xC1
...
#define TRANSLATION_FAULT_LEVEL4 0xC4
and then use semantic names instead of magic values. Minimally maybe add
a comment explaining that.
On Wed, Feb 05, 2020 at 11:07:16AM +0100, Tomeu Vizoso wrote:
> If the exception type isn't one of the normal faults, don't try to map
> and instead go straight to a terminal fault.
>
> Otherwise, we can get flooded by kernel warnings and further faults.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> index 763cfca886a7..80abddb4544c 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> @@ -596,8 +596,9 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
> source_id = (fault_status >> 16);
>
> /* Page fault only */
> - if ((status & mask) == BIT(i)) {
> - WARN_ON(exception_type < 0xC1 || exception_type > 0xC4);
> + if ((status & mask) == BIT(i) &&
> + exception_type >= 0xC1 &&
> + exception_type <= 0xC4) {
>
> ret = panfrost_mmu_map_fault_addr(pfdev, i, addr);
> if (!ret) {
> --
> 2.21.0
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/panfrost: Don't try to map on error faults
2020-02-05 10:07 [PATCH] drm/panfrost: Don't try to map on error faults Tomeu Vizoso
2020-02-05 12:24 ` Alyssa Rosenzweig
@ 2020-02-05 13:25 ` Robin Murphy
2020-02-05 14:01 ` Steven Price
1 sibling, 1 reply; 4+ messages in thread
From: Robin Murphy @ 2020-02-05 13:25 UTC (permalink / raw)
To: Tomeu Vizoso, linux-kernel
Cc: David Airlie, Alyssa Rosenzweig, dri-devel, Steven Price
On 05/02/2020 10:07 am, Tomeu Vizoso wrote:
> If the exception type isn't one of the normal faults, don't try to map
> and instead go straight to a terminal fault.
"One of the the normal faults" seems a rather vague way of saying "a
translation fault", which is what we're specifically handling here, and
logically the only fault reflecting something not yet mapped rather than
mapped inappropriately ;)
(Who knows how the level ended up as 1-4 rather than 0-3 as it really
should be - another Mali Mystery(TM)...)
> Otherwise, we can get flooded by kernel warnings and further faults.
Either way,
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> index 763cfca886a7..80abddb4544c 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
> @@ -596,8 +596,9 @@ static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data)
> source_id = (fault_status >> 16);
>
> /* Page fault only */
> - if ((status & mask) == BIT(i)) {
> - WARN_ON(exception_type < 0xC1 || exception_type > 0xC4);
> + if ((status & mask) == BIT(i) &&
> + exception_type >= 0xC1 &&
> + exception_type <= 0xC4) {
>
> ret = panfrost_mmu_map_fault_addr(pfdev, i, addr);
> if (!ret) {
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/panfrost: Don't try to map on error faults
2020-02-05 13:25 ` Robin Murphy
@ 2020-02-05 14:01 ` Steven Price
0 siblings, 0 replies; 4+ messages in thread
From: Steven Price @ 2020-02-05 14:01 UTC (permalink / raw)
To: Robin Murphy, Tomeu Vizoso, linux-kernel
Cc: David Airlie, Alyssa Rosenzweig, dri-devel
On 05/02/2020 13:25, Robin Murphy wrote:
> On 05/02/2020 10:07 am, Tomeu Vizoso wrote:
>> If the exception type isn't one of the normal faults, don't try to map
>> and instead go straight to a terminal fault.
>
> "One of the the normal faults" seems a rather vague way of saying "a
> translation fault", which is what we're specifically handling here, and
> logically the only fault reflecting something not yet mapped rather than
> mapped inappropriately ;)
>
> (Who knows how the level ended up as 1-4 rather than 0-3 as it really
> should be - another Mali Mystery(TM)...)
Ah, but you're thinking of LPAE not Mali Magic Page Tables ('inspired
by' LPAE but not actually compatible....) ;) However I do wonder what
will happen when we enable aarch64 page tables in Bifrost.
>> Otherwise, we can get flooded by kernel warnings and further faults.
>
> Either way,
>
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
>
>> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
>> ---
>> drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> b/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> index 763cfca886a7..80abddb4544c 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
>> @@ -596,8 +596,9 @@ static irqreturn_t
>> panfrost_mmu_irq_handler_thread(int irq, void *data)
>> source_id = (fault_status >> 16);
>> /* Page fault only */
>> - if ((status & mask) == BIT(i)) {
>> - WARN_ON(exception_type < 0xC1 || exception_type > 0xC4);
>> + if ((status & mask) == BIT(i) &&
>> + exception_type >= 0xC1 &&
>> + exception_type <= 0xC4) {
I would suggest the best option here is to copy mali_kbase and check
against a mask, in kbase[1] we have:
switch (fault_status & AS_FAULTSTATUS_EXCEPTION_CODE_MASK) {
case AS_FAULTSTATUS_EXCEPTION_CODE_TRANSLATION_FAULT:
[1]
https://gitlab.freedesktop.org/panfrost/linux-panfrost/blob/a864e6b9fbd093a033a90d5bbdd6dcc79a0667b2/mali_kbase_mmu.c#L108
Where:
#define AS_FAULTSTATUS_EXCEPTION_CODE_MASK (0x7<<3)
#define AS_FAULTSTATUS_EXCEPTION_CODE_TRANSLATION_FAULT (0x0<<3)
Steve
>> ret = panfrost_mmu_map_fault_addr(pfdev, i, addr);
>> if (!ret) {
>>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-06 8:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 10:07 [PATCH] drm/panfrost: Don't try to map on error faults Tomeu Vizoso
2020-02-05 12:24 ` Alyssa Rosenzweig
2020-02-05 13:25 ` Robin Murphy
2020-02-05 14:01 ` Steven Price
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).