From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48564) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN7zg-0004u3-7e for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:39:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UN7za-0002ZJ-IM for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:39:48 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:33777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN7za-0002Z6-Al for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:39:42 -0400 Date: Tue, 2 Apr 2013 16:39:37 -0400 (EDT) From: Paolo Bonzini Message-ID: <2091258395.898706.1364935177718.JavaMail.root@redhat.com> In-Reply-To: References: <1364919044-18413-1-git-send-email-peter.maydell@linaro.org> <515B0A79.50906@redhat.com> <515B2CE6.3040703@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 0/2] Drop support for qdev taddr properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Anthony Liguori , David Gibson , qemu-devel@nongnu.org, patches@linaro.org ----- Messaggio originale ----- > Da: "Peter Maydell" > A: "Paolo Bonzini" > Cc: "Anthony Liguori" , patches@linaro.org, qemu-dev= el@nongnu.org, "David Gibson" > > Inviato: Marted=C3=AC, 2 aprile 2013 22:33:48 > Oggetto: Re: [PATCH 0/2] Drop support for qdev taddr properties >=20 > On 2 April 2013 20:09, Paolo Bonzini wrote: > > Il 02/04/2013 19:07, Peter Maydell ha scritto: > >> It's not a problem with sysbus, it's a problem with people > >> being lazy about implementing things that do DMA. For instance > >> PCI doesn't take a MemoryRegion* for DMA, it just assumes it > >> can DMA into the system address space. > > > > PCI does provide its own DMAContext*, which includes an AddressSpace. > > This address space ("view of the world") is different for each device. >=20 > Yes, but (unless you're using the legacy stuff spapr uses) > it generates it via get_system_memory(), which is always > wrong (though often close enough that Linux will work right). It also respects the bus master enable bit: memory_region_init_alias(&pci_dev->bus_master_enable_region, "bus m= aster", get_system_memory(), 0, memory_region_size(get_system_memory())); memory_region_set_enabled(&pci_dev->bus_master_enable_region, false= ); address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_en= able_region); > >> (it does let you pass > >> a DMAContext, but maybe that goes away with the patches you > >> mention above; it's only used for spapr.) > > > > It is extended so that it is also used for spapr with those patches. >=20 > I'm confused. Do you mean that it's changed so that spapr passes > a MemoryRegion* rather than a DMAContext*, or so that everything > uses a DMAContext* ? (The comments in pci.c suggest that the former > is the intended approach.) Yes, the former. More precisely, everything uses an AddressSpace*, in fact (that was the part that Avi didn't write) dma-helpers.c can use AddressSpace* instead of DMAContext*. spapr right now needs a special translate pointer embedded in the DMAContext. With the iommu MemoryRegion patches, it can put the translate function pointer into a translation MemoryRegion. Then the AddressSpace points to that MemoryRegion. Paolo