All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 0/2] Drop support for qdev taddr properties
Date: Tue, 2 Apr 2013 16:39:37 -0400 (EDT)	[thread overview]
Message-ID: <2091258395.898706.1364935177718.JavaMail.root@redhat.com> (raw)
In-Reply-To: <CAFEAcA9aoDp03r8yx-3y_obi0xCpFpxYm1URNxMO95uSi_pkCw@mail.gmail.com>



----- Messaggio originale -----
> Da: "Peter Maydell" <peter.maydell@linaro.org>
> A: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: "Anthony Liguori" <aliguori@us.ibm.com>, patches@linaro.org, qemu-devel@nongnu.org, "David Gibson"
> <david@gibson.dropbear.id.au>
> 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 <pbonzini@redhat.com> 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

  reply	other threads:[~2013-04-02 20:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 16:10 [Qemu-devel] [PATCH 0/2] Drop support for qdev taddr properties Peter Maydell
2013-04-02 16:10 ` [Qemu-devel] [PATCH 1/2] hw/sm501: Use correct setter for sysbus-ohci dma-address property Peter Maydell
2013-04-02 16:10 ` [Qemu-devel] [PATCH 2/2] qdev: Drop taddr properties Peter Maydell
2013-04-02 16:42 ` [Qemu-devel] [PATCH 0/2] Drop support for qdev " Paolo Bonzini
2013-04-02 17:07   ` Peter Maydell
2013-04-02 19:09     ` Paolo Bonzini
2013-04-02 20:33       ` Peter Maydell
2013-04-02 20:39         ` Paolo Bonzini [this message]
2013-04-02 20:43           ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2091258395.898706.1364935177718.JavaMail.root@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.