From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuhOE-0001DR-Ju for qemu-devel@nongnu.org; Fri, 06 Nov 2015 08:49:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuhOB-0001uz-E5 for qemu-devel@nongnu.org; Fri, 06 Nov 2015 08:49:14 -0500 Date: Fri, 6 Nov 2015 14:49:05 +0100 From: "Edgar E. Iglesias" Message-ID: <20151106134905.GH13308@toto> References: <1446747358-18214-1-git-send-email-peter.maydell@linaro.org> <1446747358-18214-4-git-send-email-peter.maydell@linaro.org> <20151106132759.GC13308@toto> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 03/16] tlb_set_page_with_attrs: Take argument specifying AddressSpace to use List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Patch Tracking , QEMU Developers , qemu-arm@nongnu.org, Paolo Bonzini , Alex =?iso-8859-1?Q?Benn=E9e?= , Andreas =?iso-8859-1?Q?F=E4rber?= On Fri, Nov 06, 2015 at 01:41:54PM +0000, Peter Maydell wrote: > On 6 November 2015 at 13:27, Edgar E. Iglesias wrote: > > On Thu, Nov 05, 2015 at 06:15:45PM +0000, Peter Maydell wrote: > >> Add an argument to tlb_set_page_with_attrs which allows the target CPU code > >> to tell the core code which AddressSpace to use. > >> > >> The AddressSpace is specified by the index into the array of ASes which > >> were registered with cpu_address_space_init(). > > >> --- a/exec.c > >> +++ b/exec.c > >> @@ -445,12 +445,13 @@ MemoryRegion *address_space_translate(AddressSpace *as, hwaddr addr, > >> > >> /* Called from RCU critical section */ > >> MemoryRegionSection * > >> -address_space_translate_for_iotlb(CPUState *cpu, hwaddr addr, > >> +address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, > >> hwaddr *xlat, hwaddr *plen) > > > > Does it make sense to replace the CPUState argument with an AddressSpace * > > and have the callers do the cpu->cpu_ases[asidx]? > > It would be more consistent and eventually maybe eliminate the need for > > address_space_translate_for_iotlb in favor of calling address_space_translate > > directly? > > We can't accept an arbitrary AddressSpace, it has to be one which is > embedded in a CPUAddressSpace and which we can thus find the > memory_dispatch for. So you could pass a CPUAddressSpace*, but not > an AddressSpace*. But to pass a CPUAddressSpace we would have to > expose the currently-private-to-exec.c layout of the CPUAddressSpace > struct. I chose not to do that (and you can see the results elsewhere > in the patch series, like the function that's basically just "do > the cs_ases array lookup for me"); there's an argument for making > the structure more widely available to avoid some of that. Aha, I see.. Thanks for clarifying. Cheers, Edgar