On 10/07/2012 01:57 PM, Alexander Graf wrote: > > > On 07.10.2012, at 11:48, Avi Kivity <a...@redhat.com> wrote: > >> On 10/05/2012 01:59 PM, Alexander Graf wrote: >>>>>> Do you mean that we add the "MemoryRegion bar0" in PCIDevice struct. Do >>>>>> the >>>>> same thing that I was doing in e500_pcihost_initfn() in the k->init() >>>>> (will add >>>>> this) function of "e500-host-bridge" >>>>> >>>>> No, he means that you create a new struct like this: >>>>> >>>>> struct foo { >>>>> PCIDevice p; >>>>> MemoryRegion bar0; >>>>> }; >>>>> >>>>> Please check out any other random PCI device in QEMU. Almost all of them >>>>> do this >>>>> to store more information than their parent class can hold. >>>> >>>> Just want to be sure I understood you correctly: Do you mean something >>>> like this : ( I know I have to switch to QOM mechanism to share parameters) >>>> >>>> diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c >>>> index 92b1dc0..a948bc6 100644 >>>> --- a/hw/ppce500_pci.c >>>> +++ b/hw/ppce500_pci.c >>>> @@ -89,6 +89,12 @@ struct PPCE500PCIState { >>>> MemoryRegion iomem; >>>> }; >>>> >>>> +struct BHARAT { >>>> + PCIDevice p; >>>> + void *bar0; >>> >>> MemoryRegion *bar0 >> >> MemoryRegion bar0; > > Why? We want the same region that is mapped outside of the pci device be > available as BAR0 too.
A MemoryRegion can only have one container. If you want dual maps, use memory_region_init_alias(). It is possible (not trivial though) to extend the memory API to support m:n container:subregion relationships. I don't think it's worthwhile though. -- error compiling committee.c: too many arguments to function