From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AK8-0003j6-0n for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:11:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0AK6-0002Ks-1f for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:11:19 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:38565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0AK5-0002KY-Ss for qemu-devel@nongnu.org; Wed, 03 Jun 2015 11:11:17 -0400 Date: Wed, 3 Jun 2015 17:11:13 +0200 From: Aurelien Jarno Message-ID: <20150603151113.GA10311@aurel32.net> References: <1433244411-9693-1-git-send-email-aurelien@aurel32.net> <1433244411-9693-4-git-send-email-aurelien@aurel32.net> <556E17F6.2060306@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <556E17F6.2060306@twiddle.net> Subject: Re: [Qemu-devel] [PATCH RFC 3/5] softmmu: add a tlb_vaddr_to_host_fill function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Peter Maydell , qemu-devel@nongnu.org, Alexander Graf , Yongbok Kim , Paolo Bonzini , Leon Alrae , Andreas =?iso-8859-15?Q?F=E4rber?= On 2015-06-02 13:54, Richard Henderson wrote: > On 06/02/2015 04:26 AM, Aurelien Jarno wrote: > > int index = (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); > > - CPUTLBEntry *tlbentry = &env->tlb_table[mmu_idx][index]; > > + CPUTLBEntry *tlbentry; > > target_ulong tlb_addr; > > uintptr_t haddr; > > > > +again: > > + tlbentry = &env->tlb_table[mmu_idx][index]; > > + > > switch (access_type) { > > - case 0: > > + case MMU_DATA_LOAD: > > tlb_addr = tlbentry->addr_read; > > break; > > - case 1: > > + case MMU_DATA_STORE: > > tlb_addr = tlbentry->addr_write; > > break; > > - case 2: > > + case MMU_INST_FETCH: > > tlb_addr = tlbentry->addr_code; > > break; > > default: > > @@ -347,10 +350,14 @@ static inline void *tlb_vaddr_to_host(CPUArchState *env, target_ulong addr, > > if ((addr & TARGET_PAGE_MASK) > > != (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) { > > /* TLB entry is for a different page */ > > + if (fill) { > > + tlb_fill(ENV_GET_CPU(env), addr, access_type, mmu_idx, retaddr); > > + goto again; > > + } > > return NULL; > > } > > To properly perform a fill, you also ought to check the victim cache. > There's a macro to do that in softmmu_template.h, which is why I > placed probe_write there. It's not so convenient to use with a > variable type though. > Unfortunately that means we can't cleanly provide a probe_write function doing nothing for the user-mode case. That would allow to avoid to many #ifdef in the helper code. For me the softmmu_template.h is supposed to only contain the code called by the helpers or by the glue in cpu_ldst*.h That also means the current tlb_vaddr_to_host code doesn't look in the victim cache and that there is no easy way to fix that, though that's less problematic. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net