qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] Adding BAR0 for e500 PCI controller


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 2/2] Adding BAR0 for e500 PCI controller
Date: Sun, 07 Oct 2012 14:41:13 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

On 10/07/2012 01:57 PM, Alexander Graf wrote:
> 
> 
> On 07.10.2012, at 11:48, Avi Kivity <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]