Re: [PATCH v2] xtensa/mm/highmem: Make generic kmap_atomic() work correctly

From: Thomas Gleixner
Date: Mon Nov 16 2020 - 15:18:55 EST


On Mon, Nov 16 2020 at 11:32, Max Filippov wrote:
> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>
> The conversion to the generic kmap_atomic() implementation missed the fact
> that xtensa's fixmap works bottom up while all other implementations work
> top down. There is no real reason why xtensa needs to work that way.
>
> Cure it by:
>
> - Using the generic fix_to_virt()/virt_to_fix() functions which work top
> down
> - Adjusting the mapping defines
> - Using the generic index calculation for the non cache aliasing case
> - Making the cache colour offset reverse so the effective index is correct
>
> While at it, remove the outdated and misleading comment above the fixmap
> enum which originates from the initial copy&pasta of this code from i386.
>
> Reported-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
> Fixes: 629ed3f7dad2 ("xtensa/mm/highmem: Switch to generic kmap atomic")
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Signed-off-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
> Tested-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
> ---
> Changes v1->v2:
> - fix off-by-one error in kmap_idx calculation

Duh. Indeed.

Thanks for following up and helping with this. Much appreciated!

tglx