[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 3/4] arm: Add PCIe host bridge in virt machin
From: |
Alexander Graf |
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 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
On 29.01.15 15:34, Peter Maydell wrote:
> On 29 January 2015 at 14:31, Alexander Graf <address@hidden> wrote:
>>
>>
>> On 27.01.15 17:52, Peter Maydell wrote:
>>> On 21 January 2015 at 16:18, Alexander Graf <address@hidden> 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
- [Qemu-devel] [PATCH v2 4/4] pci: Move PCI VGA to pci.mak, (continued)
Re: [Qemu-devel] [PATCH v2 3/4] arm: Add PCIe host bridge in virt machine, Peter Maydell, 2015/01/27
[Qemu-devel] [PATCH v2 2/4] pci: Add generic PCIe host bridge, Alexander Graf, 2015/01/21