[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region owner
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership |
Date: |
Mon, 3 Jun 2013 10:22:41 +0100 |
On 3 June 2013 07:47, Paolo Bonzini <address@hidden> wrote:
> Il 02/06/2013 18:12, Peter Maydell ha scritto:
>> What happens if I take a MemoryRegion* that another device
>> has exposed to me as a sysbus mmio region (and so claimed
>> ownership of) and pass it to pci_register_bar()?
>
> You get an assertion failure.
>
>> Who owns it at that point? [That's a legitimate thing to do, I think,
>> though I don't suppose anybody does it at the moment.
>> Sysbus MMIOs aren't only for mapping in the system address
>> space, they're a general way for one device to expose a
>> MemoryRegion * for use by another device.]
>
> I don't think it is legitimate, MMIO regions are just for use via
> sysbus_map_mmio.
This is definitely not true. We already make extensive use
of MMIO regions other than simply directly via sysbus_map_mmio.
Exposing a MemoryRegion* is just saying "here is something I
have which is some kind of memory mapped IO, do whatever you
need to with it" (which might be mapping it directly to the
system address space, or might be passing it to some other
device that wants a MemoryRegion*, or might be putting it in
a container MR or otherwise managing it). For example,
arm11mpcore.c does this:
sysbus_init_mmio(dev, sysbus_mmio_get_region(s->priv, 0));
which I suspect will assert with your patches.
(In general sysbus_mmio_get_region() callers are a good
place to look for uses of sysbus MMIOs other than simple
mapping.)
> The right thing to do is to use a container or alias region, and put the
> 1st region inside it. Then the 1st region keeps its owner, and the
> container/alias gets a new one.
I think the actual right fix is to make the creator of
the MR specify its owner. Anything else is just going to
have holes in it.
thanks
-- PMM
- [Qemu-devel] [PATCH 11/15] pci-assign: add memory_region_set_owner calls, (continued)
- [Qemu-devel] [PATCH 15/15] memory: ref/unref memory across address_space_map/unmap, Paolo Bonzini, 2013/06/02
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Peter Maydell, 2013/06/02
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Paolo Bonzini, 2013/06/03
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership,
Peter Maydell <=
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Paolo Bonzini, 2013/06/03
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Peter Maydell, 2013/06/03
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Paolo Bonzini, 2013/06/03
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Peter Maydell, 2013/06/03
- Re: [Qemu-devel] [PATCH 00/15] Memory/IOMMU patches part 4: region ownership, Paolo Bonzini, 2013/06/03