From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxISh-0007gt-GI for qemu-devel@nongnu.org; Tue, 26 May 2015 13:16:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxISc-0005Ry-8E for qemu-devel@nongnu.org; Tue, 26 May 2015 13:16:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44207) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxISc-0005Ru-3g for qemu-devel@nongnu.org; Tue, 26 May 2015 13:16:14 -0400 Message-ID: <5564AA58.1050508@redhat.com> Date: Tue, 26 May 2015 19:16:08 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1432658961-48553-1-git-send-email-yongbok.kim@imgtec.com> <1432658961-48553-3-git-send-email-yongbok.kim@imgtec.com> <5564A649.6070206@suse.de> In-Reply-To: <5564A649.6070206@suse.de> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 2/3] softmmu: Add probe_write() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= , Yongbok Kim , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Peter Crosthwaite , leon.alrae@imgtec.com, rth@twiddle.net On 26/05/2015 18:58, Andreas F=E4rber wrote: >> > +#if DATA_SIZE =3D=3D 1 >> > +/* >> > + * Force a tlb_fill if the specified guest virtual index isn't in t= he TCG >> > + * softmmu TLB. >> > + */ >> > +void probe_write(CPUArchState *env, target_ulong addr, int mmu_idx, >> > + uintptr_t retaddr) >> > +{ >> > + int index =3D (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); >> > + target_ulong tlb_addr =3D env->tlb_table[mmu_idx][index].addr_w= rite; >> > + >> > + if ((addr & TARGET_PAGE_MASK) >> > + !=3D (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) { >> > + /* TLB entry is for a different page */ >> > + if (!VICTIM_TLB_HIT(addr_write)) { >> > + tlb_fill(ENV_GET_CPU(env), addr, MMU_DATA_STORE, mmu_id= x, retaddr); > Isn't the use of ENV_GET_CPU() here contradicting Peter C.'s series? No, I don't think so. This function has a genuine need to access env's fields, so it is okay for it to accept CPUArchState*, especially because it is called from the TCG innards where everything is based on the CPUArchState* anyway. The functions touched by Peter's series (gdbserver_fork, tb_flush, tcg_cpu_exec, cpu_exec_init) don't, so they should accept CPUState*. In other words, it's okay to go from env to cpu, but you should do it as soon as possible. Paolo