From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Thu, 29 Mar 2012 07:53:04 +0000 Subject: [PATCH V2 5/7] ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture In-Reply-To: <4F740386.2080509@st.com> References: <201203281227.32299.arnd@arndb.de> <4F740386.2080509@st.com> Message-ID: <201203290753.04758.arnd@arndb.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thursday 29 March 2012, Viresh Kumar wrote: > But there are few concerns. > Firstly, i wasn't aware that ioremap will reuse these mappings. > I believed that it will create new mappings and this is what i > saw till 2-6.37. What will happen if iounmap is called? Yes, it was a fairly recent change. iounmap on one of these areas will do nothing. > Over that, board would not be using all the devices present in SoC. So, > we don't really need to map everything. And so above wouldn't be valid > there. That should not really be a concern, you only waste a little bit of the vmalloc space that you gained recently when ioremap was changed. Nothing should ever be able to get to those pointers other than by calling ioremap, so it doesn't hurt to have them mapped, except for the very unlikely scenario that you get a wild pointer dereference in the kernel that would otherwise result in an oops. > To avoid holes, that were created in my original mappings, i can pick your > idea of dropping IO_ADDRESS() in .virtual field and use tightly aligned > virtual address for all peripherals. > > Like: UART - 4K - 0xf0000000 - 0xf0001000 > SPI - 4K - 0xf0001000 - 0xf0002000 Well, if you use the 4k mappings here, you won't benefit from reduced TLB pressure through section maps, although you still get rid of IO_ADDRESS. I would not put any devices into the static mapping, other than those you need to access before mm_init() or when you can actually use the section mapping. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH V2 5/7] ARM: SPEAr3xx: Add device-tree support to SPEAr3xx architecture Date: Thu, 29 Mar 2012 07:53:04 +0000 Message-ID: <201203290753.04758.arnd@arndb.de> References: <201203281227.32299.arnd@arndb.de> <4F740386.2080509@st.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F740386.2080509-qxv4g6HH51o@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Viresh Kumar Cc: "devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org" , spear-devel , "viresh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" , "sr-ynQEQJNshbs@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org On Thursday 29 March 2012, Viresh Kumar wrote: > But there are few concerns. > Firstly, i wasn't aware that ioremap will reuse these mappings. > I believed that it will create new mappings and this is what i > saw till 2-6.37. What will happen if iounmap is called? Yes, it was a fairly recent change. iounmap on one of these areas will do nothing. > Over that, board would not be using all the devices present in SoC. So, > we don't really need to map everything. And so above wouldn't be valid > there. That should not really be a concern, you only waste a little bit of the vmalloc space that you gained recently when ioremap was changed. Nothing should ever be able to get to those pointers other than by calling ioremap, so it doesn't hurt to have them mapped, except for the very unlikely scenario that you get a wild pointer dereference in the kernel that would otherwise result in an oops. > To avoid holes, that were created in my original mappings, i can pick your > idea of dropping IO_ADDRESS() in .virtual field and use tightly aligned > virtual address for all peripherals. > > Like: UART - 4K - 0xf0000000 - 0xf0001000 > SPI - 4K - 0xf0001000 - 0xf0002000 Well, if you use the 4k mappings here, you won't benefit from reduced TLB pressure through section maps, although you still get rid of IO_ADDRESS. I would not put any devices into the static mapping, other than those you need to access before mm_init() or when you can actually use the section mapping. Arnd