Re: [PATCH] drm/panfrost: Don't try to map on error faults
From: Steven Price
Date: Wed Feb 05 2020 - 09:01:50 EST
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@xxxxxxx>
>
>> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx>
>> ---
>> Â 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@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel