Received: from eggs.gnu.org ([208.118.235.92]:58014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWMvy-0007qZ-Vr for qemu-devel@nongnu.org; Mon, 21 May 2012 03:21:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWMvs-0000ap-GM for qemu-devel@nongnu.org; Mon, 21 May 2012 03:21:38 -0400 Received: from smtpout4.laposte.net ([193.253.67.229]:12250 helo=smtpout.laposte.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWMvs-0000aS-7Q for qemu-devel@nongnu.org; Mon, 21 May 2012 03:21:32 -0400 Date: Mon, 21 May 2012 09:21:29 +0200 From: "nicolas.sauzede" Message-ID: <842600711.2527751.1337584877321.JavaMail.www@wwinf8221> In-Reply-To: References: <1512121653.606644.1337094765947.JavaMail.www@wwinf8306> <4FB27400.3010908@suse.de> <27874590.608345.1337095907076.JavaMail.www@wwinf8306> <4FB28591.4090709@suse.de> <189253069.454583.1337155108168.JavaMail.www@wwinf8304> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] Get current env within io_handler ? Reply-To: "nicolas.sauzede" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , Blue Swirl Cc: qemu-devel@nongnu.org Hi Peter,=20 > Message du 19/05/12 11:39 > De : "Peter Maydell"=20 > A : "Blue Swirl"=20 > Copie =C3=A0 : "nicolas.sauzede" , qemu-devel@nongnu.org > Objet : Re: [Qemu-devel] Get current env within io_handler ? > > On 19 May 2012 08:13, Blue Swirl wrote: > > nicolas.sauzede wrote: > >> Well, for example, we have the issue where we need to know if > >> the cpu that performs a hardware io is in priviledged/secure mode, > >> because some HW devices implemented in TLM requires such special > >> flags on certain register accesses. >=20 > > How does real HW do it? I don't think there is a bus that indicates > > the CPU number to the device. >=20 > The AMBA AXI bus includes attributes for: > * secure/nonsecure world (used for TrustZone) > * privileged/nonprivileged > * instruction/data access > * a transaction ID >=20 > The transaction ID typically encodes "which core in the > CPU made this memory transaction?". It's not always > meaningful, eg when caching intervenes, but for device > access you can use it. I'd tend to expect to see that in > testbench setups rather than the real world, though. Looking > straightforwardly at the protection attributes as Nicolas > suggests is much more standard. Ok, so I guess that for now, we have to live with the lack of a way to actu= ally get those io transaction properties, right ? Do you think it would be feasible to allow it the future ? (for now, I've d= one some shortcuts and ugly hardcoding in my TLM prototype to make things work,= but still..) In fact, we encounter the same kind of issues regarding the "debug" propert= y when doing io transaction. When eg: the gdb stub accesses io, it uses the function : cpu_memory_rw_deb= ug() to fetch bytes from the memory for debugging purposes, and the issue is tha= t that "debug" property is lost when it eventually calls in turn the functi= on cpu_physical_memory_rw(), that gets propagated to io handlers, which don= 't know if it is a regular "software" transaction (ie: initiated by the CPU= executing the software), or if it is an artificial "debug" access by eg: t= he debugger. The impact is that if the io range matches some specific io hardware regist= er implemented in TLM that triggers side-effects (such as eg: an interrupt,= a DMA transfer, whatever, etc..) then the hardware wimulation will not be = accurate.. For the same, we currently employ a trick to propagate in a dirty way this = "debug" flag to the io handler, but again, it would be nice to get it legal= ly, like the secure/priviledged mode, etc.. Do you think this feature could be useful/legitimate in upstream qemu ? > >> Also, I think about some specific IPs such as local timers and > >> such, all seen at the same address by all the smp cpu, then how > >> can we know what cpu number originated the io transaction ? > > > > For each CPU, a different physical memory view should be constructed, > > with a different CPU specific device at this common address. I'm not > > sure if memory API can handle this yet, but it would be useful for x86 > > APIC as well which in theory could have similar arrangement. >=20 > This is conceptually the nicest way to handle these, yes, but > I don't think we have the infrastructure for it just at the > moment... >=20 > -- PMM Thanks for your support, NS. Une messagerie gratuite, garantie =C3=A0 vie et des services en plus, =C3= =A7a vous tente ? Je cr=C3=A9e ma bo=C3=AEte mail www.laposte.net