[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0/2] Drop support for qdev taddr properties
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 0/2] Drop support for qdev taddr properties |
Date: |
Tue, 2 Apr 2013 16:39:37 -0400 (EDT) |
----- Messaggio originale -----
> Da: "Peter Maydell" <address@hidden>
> A: "Paolo Bonzini" <address@hidden>
> Cc: "Anthony Liguori" <address@hidden>, address@hidden, address@hidden,
> "David Gibson"
> <address@hidden>
> Inviato: Martedì, 2 aprile 2013 22:33:48
> Oggetto: Re: [PATCH 0/2] Drop support for qdev taddr properties
>
> On 2 April 2013 20:09, Paolo Bonzini <address@hidden> 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.
>
> 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
master",
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_enable_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.
>
> 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