qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Rob Herring <rob.herring@linaro.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Claudio Fontana <claudio.fontana@huawei.com>,
	Alvise Rigo <a.rigo@virtualopensystems.com>,
	Stuart Yoder <stuart.yoder@freescale.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/4] arm: Add PCIe host bridge in virt machine
Date: Thu, 29 Jan 2015 15:37:48 +0100	[thread overview]
Message-ID: <54CA45BC.8070709@suse.de> (raw)
In-Reply-To: <CAFEAcA8Eb4ZnoEQ_LL1nK3yTqACcaLAaevWNjWzTuVmVTiExEw@mail.gmail.com>



On 29.01.15 15:34, Peter Maydell wrote:
> On 29 January 2015 at 14:31, Alexander Graf <agraf@suse.de> wrote:
>>
>>
>> On 27.01.15 17:52, Peter Maydell wrote:
>>> On 21 January 2015 at 16:18, Alexander Graf <agraf@suse.de> wrote:
>>>> +    /* Map the MMIO window at the same spot in bus and cpu layouts */
>>>> +    mmio_alias = g_new0(MemoryRegion, 1);
>>>> +    mmio_reg = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 1);
>>>> +    memory_region_init_alias(mmio_alias, OBJECT(dev), "pcie-mmio",
>>>> +                             mmio_reg, base_mmio, size_mmio);
>>>> +    memory_region_add_subregion(get_system_memory(), base_mmio, mmio_alias);
>>>
>>> The comment claims to be mapping the MMIO window twice (in the
>>> system memory space and in the PCI mmio address space) but the
>>> code only seems to be mapping something into system memory space?
>>
>> The comment claims to map it at the same spot. It means the offset in
>> system memory is the same offset as the one in the mmio window that gets
>> exported by the PHB.
>>
>> The PHB exports a UINT64_MAX MMIO region as id 1. This is basically a
>> full window into the PCI address space. What we do here is to map a 1:1
>> window between CPU address space and PCI address space.
> 
> I kind of see, but isn't this just a window from CPU address
> space into PCI address space, not vice-versa?

Yup, exactly. But PCI devices need to map themselves somewhere into the
PCI address space. So if I configure a BAR to live at 0x10000000, it
should also show up at 0x10000000 when accessed from the CPU. That's
what the mapping above is about.

> DMA by PCI devices bus-mastering into system memory must be
> being set up elsewhere, I think.

Yes, that's a different mechanism that's not implemented yet for GPEX
:). On ARM this would happen via SMMU emulation.


Alex

  reply	other threads:[~2015-01-29 14:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 16:18 [Qemu-devel] [PATCH v2 0/4] ARM: Add support for a generic PCI Express host bridge Alexander Graf
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 1/4] pci: Split pcie_host_mmcfg_map() Alexander Graf
2015-01-27 13:55   ` Peter Maydell
2015-01-27 14:24     ` Michael S. Tsirkin
2015-01-27 14:40       ` Paolo Bonzini
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 2/4] pci: Add generic PCIe host bridge Alexander Graf
2015-01-22 16:32   ` B02008
2015-01-27 15:31   ` Peter Maydell
2015-01-29 13:59     ` Alexander Graf
2015-01-29 14:25       ` Peter Maydell
2015-01-30 10:25         ` Paolo Bonzini
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 3/4] arm: Add PCIe host bridge in virt machine Alexander Graf
2015-01-22 15:28   ` Claudio Fontana
2015-01-22 15:52     ` Alexander Graf
2015-01-27  9:24       ` Claudio Fontana
2015-01-27 10:09         ` Peter Maydell
2015-01-27 14:37           ` Claudio Fontana
2015-01-27 16:52   ` Peter Maydell
2015-01-29 14:31     ` Alexander Graf
2015-01-29 14:34       ` Peter Maydell
2015-01-29 14:37         ` Alexander Graf [this message]
2015-01-29 14:45           ` Peter Maydell
2015-01-29 14:49             ` Alexander Graf
2015-01-21 16:18 ` [Qemu-devel] [PATCH v2 4/4] pci: Move PCI VGA to pci.mak Alexander Graf

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=54CA45BC.8070709@suse.de \
    --to=agraf@suse.de \
    --cc=a.rigo@virtualopensystems.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=claudio.fontana@huawei.com \
    --cc=mst@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rob.herring@linaro.org \
    --cc=stuart.yoder@freescale.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).