Re: [PATCH v2 08/10] ARM: mmu: use reserve mem entries to modify maps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch breaks NAND support on my Phytec i.MX6 board. There are some
problems with this patch, so I ended up reverting it for now.

On Wed, Aug 17, 2022 at 01:42:42PM +0200, Ahmad Fatoum wrote:
> @@ -468,11 +469,28 @@ void __mmu_init(bool mmu_on)
>  	vectors_init();
>  
>  	for_each_memory_bank(bank) {
> +		struct resource *rsv;
> +
>  		create_sections(ttb, bank->start, bank->start + bank->size - 1,
>  				PMD_SECT_DEF_CACHED);
> -		__mmu_cache_flush();
> +
> +		for_each_reserved_region(bank, rsv) {
> +			create_sections(ttb, resource_first_page(rsv),
> +					resource_count_pages(rsv),
> +					attrs_uncached_mem());
> +		}

This operates on 1MiB sections, so everything requiring a finer
granularity will fail here. Not sure if we currently need that, but not
even issuing a warning is not good.

>  	}
>  
> +	/*
> +	 * We could set_ttbr(ttb) here instead and save on the copy, but
> +	 * for now we play it safe, so we don't mess with the older ARMs.
> +	 */
> +	if (oldttb) {
> +		memcpy(oldttb, ttb, ARM_TTB_SIZE);
> +		free(ttb);
> +	}

in the early MMU case the MMU still uses 'oldttb' as ttb whereas 'ttb'
now points to invalid memory. Still functions like arm_create_pte()
still operate on 'ttb'. It looks like a ttb = oldttb is missing here.

Also I wonder when we have to map the reserved regions as execute never,
then the early MMU setup seems broken as well, as that creates a flat
mapping without honoring the reserved regions. Shouldn't that be fixed?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux