All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci_register_bar: cleanup
@ 2016-03-25  6:49 Cao jin
  2016-03-25  9:25 ` Paolo Bonzini
  2016-03-28  5:55 ` Marcel Apfelbaum
  0 siblings, 2 replies; 12+ messages in thread
From: Cao jin @ 2016-03-25  6:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

place relevant code tegother, make the code easier to read

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 hw/pci/pci.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e67664d..f0f41dc 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
                       uint8_t type, MemoryRegion *memory)
 {
     PCIIORegion *r;
-    uint32_t addr;
+    uint32_t addr; /* offset in pci config space */
     uint64_t wmask;
     pcibus_t size = memory_region_size(memory);
 
@@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
     r->addr = PCI_BAR_UNMAPPED;
     r->size = size;
     r->type = type;
-    r->memory = NULL;
+    r->memory = memory;
+    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
+                        ? pci_dev->bus->address_space_io
+                        : pci_dev->bus->address_space_mem;
 
     wmask = ~(size - 1);
-    addr = pci_bar(pci_dev, region_num);
     if (region_num == PCI_ROM_SLOT) {
         /* ROM enable bit is writable */
         wmask |= PCI_ROM_ADDRESS_ENABLE;
     }
+
+    addr = pci_bar(pci_dev, region_num);
     pci_set_long(pci_dev->config + addr, type);
+
     if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
         r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
         pci_set_quad(pci_dev->wmask + addr, wmask);
@@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
         pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
         pci_set_long(pci_dev->cmask + addr, 0xffffffff);
     }
-    pci_dev->io_regions[region_num].memory = memory;
-    pci_dev->io_regions[region_num].address_space
-        = type & PCI_BASE_ADDRESS_SPACE_IO
-        ? pci_dev->bus->address_space_io
-        : pci_dev->bus->address_space_mem;
 }
 
 static void pci_update_vga(PCIDevice *pci_dev)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-03-25  6:49 [Qemu-devel] [PATCH] pci_register_bar: cleanup Cao jin
@ 2016-03-25  9:25 ` Paolo Bonzini
  2016-05-12  1:39   ` Cao jin
  2016-03-28  5:55 ` Marcel Apfelbaum
  1 sibling, 1 reply; 12+ messages in thread
From: Paolo Bonzini @ 2016-03-25  9:25 UTC (permalink / raw)
  To: Cao jin, qemu-devel; +Cc: mst



On 25/03/2016 07:49, Cao jin wrote:
> place relevant code tegother, make the code easier to read
> 
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>  hw/pci/pci.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index e67664d..f0f41dc 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>                        uint8_t type, MemoryRegion *memory)
>  {
>      PCIIORegion *r;
> -    uint32_t addr;
> +    uint32_t addr; /* offset in pci config space */
>      uint64_t wmask;
>      pcibus_t size = memory_region_size(memory);
>  
> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>      r->addr = PCI_BAR_UNMAPPED;
>      r->size = size;
>      r->type = type;
> -    r->memory = NULL;
> +    r->memory = memory;
> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
> +                        ? pci_dev->bus->address_space_io
> +                        : pci_dev->bus->address_space_mem;
>  
>      wmask = ~(size - 1);
> -    addr = pci_bar(pci_dev, region_num);
>      if (region_num == PCI_ROM_SLOT) {
>          /* ROM enable bit is writable */
>          wmask |= PCI_ROM_ADDRESS_ENABLE;
>      }
> +
> +    addr = pci_bar(pci_dev, region_num);
>      pci_set_long(pci_dev->config + addr, type);
> +
>      if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>          r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>          pci_set_quad(pci_dev->wmask + addr, wmask);
> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>          pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>          pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>      }
> -    pci_dev->io_regions[region_num].memory = memory;
> -    pci_dev->io_regions[region_num].address_space
> -        = type & PCI_BASE_ADDRESS_SPACE_IO
> -        ? pci_dev->bus->address_space_io
> -        : pci_dev->bus->address_space_mem;
>  }
>  
>  static void pci_update_vga(PCIDevice *pci_dev)
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-03-25  6:49 [Qemu-devel] [PATCH] pci_register_bar: cleanup Cao jin
  2016-03-25  9:25 ` Paolo Bonzini
@ 2016-03-28  5:55 ` Marcel Apfelbaum
  2016-04-09  9:16   ` Cao jin
  1 sibling, 1 reply; 12+ messages in thread
From: Marcel Apfelbaum @ 2016-03-28  5:55 UTC (permalink / raw)
  To: Cao jin, qemu-devel; +Cc: mst

On 03/25/2016 09:49 AM, Cao jin wrote:
> place relevant code tegother, make the code easier to read

/s/tegother/together

Since is already reviewed, maybe the maintainer can fix this.

Thanks,
Marcel


>
> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
> ---
>   hw/pci/pci.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index e67664d..f0f41dc 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>                         uint8_t type, MemoryRegion *memory)
>   {
>       PCIIORegion *r;
> -    uint32_t addr;
> +    uint32_t addr; /* offset in pci config space */
>       uint64_t wmask;
>       pcibus_t size = memory_region_size(memory);
>
> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>       r->addr = PCI_BAR_UNMAPPED;
>       r->size = size;
>       r->type = type;
> -    r->memory = NULL;
> +    r->memory = memory;
> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
> +                        ? pci_dev->bus->address_space_io
> +                        : pci_dev->bus->address_space_mem;
>
>       wmask = ~(size - 1);
> -    addr = pci_bar(pci_dev, region_num);
>       if (region_num == PCI_ROM_SLOT) {
>           /* ROM enable bit is writable */
>           wmask |= PCI_ROM_ADDRESS_ENABLE;
>       }
> +
> +    addr = pci_bar(pci_dev, region_num);
>       pci_set_long(pci_dev->config + addr, type);
> +
>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>           pci_set_quad(pci_dev->wmask + addr, wmask);
> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>       }
> -    pci_dev->io_regions[region_num].memory = memory;
> -    pci_dev->io_regions[region_num].address_space
> -        = type & PCI_BASE_ADDRESS_SPACE_IO
> -        ? pci_dev->bus->address_space_io
> -        : pci_dev->bus->address_space_mem;
>   }
>
>   static void pci_update_vga(PCIDevice *pci_dev)
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-03-28  5:55 ` Marcel Apfelbaum
@ 2016-04-09  9:16   ` Cao jin
  0 siblings, 0 replies; 12+ messages in thread
From: Cao jin @ 2016-04-09  9:16 UTC (permalink / raw)
  To: marcel, qemu-devel; +Cc: mst

Hi,
     Is it missed to be pulled?

On 03/28/2016 01:55 PM, Marcel Apfelbaum wrote:
> On 03/25/2016 09:49 AM, Cao jin wrote:
>> place relevant code tegother, make the code easier to read
>
> /s/tegother/together
>
> Since is already reviewed, maybe the maintainer can fix this.
>
> Thanks,
> Marcel
>
>
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   hw/pci/pci.c | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index e67664d..f0f41dc 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int
>> region_num,
>>                         uint8_t type, MemoryRegion *memory)
>>   {
>>       PCIIORegion *r;
>> -    uint32_t addr;
>> +    uint32_t addr; /* offset in pci config space */
>>       uint64_t wmask;
>>       pcibus_t size = memory_region_size(memory);
>>
>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>> region_num,
>>       r->addr = PCI_BAR_UNMAPPED;
>>       r->size = size;
>>       r->type = type;
>> -    r->memory = NULL;
>> +    r->memory = memory;
>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>> +                        ? pci_dev->bus->address_space_io
>> +                        : pci_dev->bus->address_space_mem;
>>
>>       wmask = ~(size - 1);
>> -    addr = pci_bar(pci_dev, region_num);
>>       if (region_num == PCI_ROM_SLOT) {
>>           /* ROM enable bit is writable */
>>           wmask |= PCI_ROM_ADDRESS_ENABLE;
>>       }
>> +
>> +    addr = pci_bar(pci_dev, region_num);
>>       pci_set_long(pci_dev->config + addr, type);
>> +
>>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>           pci_set_quad(pci_dev->wmask + addr, wmask);
>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
>> region_num,
>>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>       }
>> -    pci_dev->io_regions[region_num].memory = memory;
>> -    pci_dev->io_regions[region_num].address_space
>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>> -        ? pci_dev->bus->address_space_io
>> -        : pci_dev->bus->address_space_mem;
>>   }
>>
>>   static void pci_update_vga(PCIDevice *pci_dev)
>>
>
>
>
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-03-25  9:25 ` Paolo Bonzini
@ 2016-05-12  1:39   ` Cao jin
  2016-05-18  1:38     ` Cao jin
  0 siblings, 1 reply; 12+ messages in thread
From: Cao jin @ 2016-05-12  1:39 UTC (permalink / raw)
  To: Paolo Bonzini, mst; +Cc: qemu-devel

Hi,

   Since it has been

   Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

   for almost 2 months, is it forgot to put into upstream?

On 03/25/2016 05:25 PM, Paolo Bonzini wrote:
>
>
> On 25/03/2016 07:49, Cao jin wrote:
>> place relevant code tegother, make the code easier to read
>>
>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>> ---
>>   hw/pci/pci.c | 16 ++++++++--------
>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>> index e67664d..f0f41dc 100644
>> --- a/hw/pci/pci.c
>> +++ b/hw/pci/pci.c
>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>>                         uint8_t type, MemoryRegion *memory)
>>   {
>>       PCIIORegion *r;
>> -    uint32_t addr;
>> +    uint32_t addr; /* offset in pci config space */
>>       uint64_t wmask;
>>       pcibus_t size = memory_region_size(memory);
>>
>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>>       r->addr = PCI_BAR_UNMAPPED;
>>       r->size = size;
>>       r->type = type;
>> -    r->memory = NULL;
>> +    r->memory = memory;
>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>> +                        ? pci_dev->bus->address_space_io
>> +                        : pci_dev->bus->address_space_mem;
>>
>>       wmask = ~(size - 1);
>> -    addr = pci_bar(pci_dev, region_num);
>>       if (region_num == PCI_ROM_SLOT) {
>>           /* ROM enable bit is writable */
>>           wmask |= PCI_ROM_ADDRESS_ENABLE;
>>       }
>> +
>> +    addr = pci_bar(pci_dev, region_num);
>>       pci_set_long(pci_dev->config + addr, type);
>> +
>>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>           pci_set_quad(pci_dev->wmask + addr, wmask);
>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>       }
>> -    pci_dev->io_regions[region_num].memory = memory;
>> -    pci_dev->io_regions[region_num].address_space
>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>> -        ? pci_dev->bus->address_space_io
>> -        : pci_dev->bus->address_space_mem;
>>   }
>>
>>   static void pci_update_vga(PCIDevice *pci_dev)
>>
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
>
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-05-12  1:39   ` Cao jin
@ 2016-05-18  1:38     ` Cao jin
  2016-05-18 12:16       ` Cao jin
  0 siblings, 1 reply; 12+ messages in thread
From: Cao jin @ 2016-05-18  1:38 UTC (permalink / raw)
  To: Paolo Bonzini, mst; +Cc: qemu-devel

ping?

On 05/12/2016 09:39 AM, Cao jin wrote:
> Hi,
>
>    Since it has been
>
>    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
>    for almost 2 months, is it forgot to put into upstream?
>
> On 03/25/2016 05:25 PM, Paolo Bonzini wrote:
>>
>>
>> On 25/03/2016 07:49, Cao jin wrote:
>>> place relevant code tegother, make the code easier to read
>>>
>>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>>> ---
>>>   hw/pci/pci.c | 16 ++++++++--------
>>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>> index e67664d..f0f41dc 100644
>>> --- a/hw/pci/pci.c
>>> +++ b/hw/pci/pci.c
>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>> region_num,
>>>                         uint8_t type, MemoryRegion *memory)
>>>   {
>>>       PCIIORegion *r;
>>> -    uint32_t addr;
>>> +    uint32_t addr; /* offset in pci config space */
>>>       uint64_t wmask;
>>>       pcibus_t size = memory_region_size(memory);
>>>
>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>> region_num,
>>>       r->addr = PCI_BAR_UNMAPPED;
>>>       r->size = size;
>>>       r->type = type;
>>> -    r->memory = NULL;
>>> +    r->memory = memory;
>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>>> +                        ? pci_dev->bus->address_space_io
>>> +                        : pci_dev->bus->address_space_mem;
>>>
>>>       wmask = ~(size - 1);
>>> -    addr = pci_bar(pci_dev, region_num);
>>>       if (region_num == PCI_ROM_SLOT) {
>>>           /* ROM enable bit is writable */
>>>           wmask |= PCI_ROM_ADDRESS_ENABLE;
>>>       }
>>> +
>>> +    addr = pci_bar(pci_dev, region_num);
>>>       pci_set_long(pci_dev->config + addr, type);
>>> +
>>>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>>           pci_set_quad(pci_dev->wmask + addr, wmask);
>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>> region_num,
>>>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>>       }
>>> -    pci_dev->io_regions[region_num].memory = memory;
>>> -    pci_dev->io_regions[region_num].address_space
>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>>> -        ? pci_dev->bus->address_space_io
>>> -        : pci_dev->bus->address_space_mem;
>>>   }
>>>
>>>   static void pci_update_vga(PCIDevice *pci_dev)
>>>
>>
>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>>
>>
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-05-18  1:38     ` Cao jin
@ 2016-05-18 12:16       ` Cao jin
  2016-05-18 12:17         ` Paolo Bonzini
  0 siblings, 1 reply; 12+ messages in thread
From: Cao jin @ 2016-05-18 12:16 UTC (permalink / raw)
  To: qemu-trivial, Michael Tokarev; +Cc: Paolo Bonzini, mst, qemu-devel

I guess maybe this one is more suitable for trivial.

mjt, could you help to pick it up?

On 05/18/2016 09:38 AM, Cao jin wrote:
> ping?
>
> On 05/12/2016 09:39 AM, Cao jin wrote:
>> Hi,
>>
>>    Since it has been
>>
>>    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>>    for almost 2 months, is it forgot to put into upstream?
>>
>> On 03/25/2016 05:25 PM, Paolo Bonzini wrote:
>>>
>>>
>>> On 25/03/2016 07:49, Cao jin wrote:
>>>> place relevant code tegother, make the code easier to read
>>>>
>>>> Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
>>>> ---
>>>>   hw/pci/pci.c | 16 ++++++++--------
>>>>   1 file changed, 8 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>>> index e67664d..f0f41dc 100644
>>>> --- a/hw/pci/pci.c
>>>> +++ b/hw/pci/pci.c
>>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>> region_num,
>>>>                         uint8_t type, MemoryRegion *memory)
>>>>   {
>>>>       PCIIORegion *r;
>>>> -    uint32_t addr;
>>>> +    uint32_t addr; /* offset in pci config space */
>>>>       uint64_t wmask;
>>>>       pcibus_t size = memory_region_size(memory);
>>>>
>>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>> region_num,
>>>>       r->addr = PCI_BAR_UNMAPPED;
>>>>       r->size = size;
>>>>       r->type = type;
>>>> -    r->memory = NULL;
>>>> +    r->memory = memory;
>>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>>>> +                        ? pci_dev->bus->address_space_io
>>>> +                        : pci_dev->bus->address_space_mem;
>>>>
>>>>       wmask = ~(size - 1);
>>>> -    addr = pci_bar(pci_dev, region_num);
>>>>       if (region_num == PCI_ROM_SLOT) {
>>>>           /* ROM enable bit is writable */
>>>>           wmask |= PCI_ROM_ADDRESS_ENABLE;
>>>>       }
>>>> +
>>>> +    addr = pci_bar(pci_dev, region_num);
>>>>       pci_set_long(pci_dev->config + addr, type);
>>>> +
>>>>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>>>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>>>           pci_set_quad(pci_dev->wmask + addr, wmask);
>>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>> region_num,
>>>>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>>>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>>>       }
>>>> -    pci_dev->io_regions[region_num].memory = memory;
>>>> -    pci_dev->io_regions[region_num].address_space
>>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>>>> -        ? pci_dev->bus->address_space_io
>>>> -        : pci_dev->bus->address_space_mem;
>>>>   }
>>>>
>>>>   static void pci_update_vga(PCIDevice *pci_dev)
>>>>
>>>
>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>>
>>>
>>>
>>
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-05-18 12:16       ` Cao jin
@ 2016-05-18 12:17         ` Paolo Bonzini
  2016-05-18 12:27           ` Cao jin
  2016-05-18 12:31           ` Michael S. Tsirkin
  0 siblings, 2 replies; 12+ messages in thread
From: Paolo Bonzini @ 2016-05-18 12:17 UTC (permalink / raw)
  To: Cao jin, qemu-trivial, Michael Tokarev; +Cc: mst, qemu-devel

On 18/05/2016 14:16, Cao jin wrote:
> I guess maybe this one is more suitable for trivial.

No, it's not trivial.  I guess it missed soft freeze.  Michael Tsirkin
will pick it up.

Thanks,

Paolo

>>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>>>> index e67664d..f0f41dc 100644
>>>>> --- a/hw/pci/pci.c
>>>>> +++ b/hw/pci/pci.c
>>>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>>>>>                         uint8_t type, MemoryRegion *memory)
>>>>>   {
>>>>>       PCIIORegion *r;
>>>>> -    uint32_t addr;
>>>>> +    uint32_t addr; /* offset in pci config space */
>>>>>       uint64_t wmask;
>>>>>       pcibus_t size = memory_region_size(memory);
>>>>>
>>>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>> region_num,
>>>>>       r->addr = PCI_BAR_UNMAPPED;
>>>>>       r->size = size;
>>>>>       r->type = type;
>>>>> -    r->memory = NULL;
>>>>> +    r->memory = memory;
>>>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>> +                        ? pci_dev->bus->address_space_io
>>>>> +                        : pci_dev->bus->address_space_mem;
>>>>>
>>>>>       wmask = ~(size - 1);
>>>>> -    addr = pci_bar(pci_dev, region_num);
>>>>>       if (region_num == PCI_ROM_SLOT) {
>>>>>           /* ROM enable bit is writable */
>>>>>           wmask |= PCI_ROM_ADDRESS_ENABLE;
>>>>>       }
>>>>> +
>>>>> +    addr = pci_bar(pci_dev, region_num);
>>>>>       pci_set_long(pci_dev->config + addr, type);
>>>>> +
>>>>>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>>>>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>>>>           pci_set_quad(pci_dev->wmask + addr, wmask);
>>>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>> region_num,
>>>>>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>>>>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>>>>       }
>>>>> -    pci_dev->io_regions[region_num].memory = memory;
>>>>> -    pci_dev->io_regions[region_num].address_space
>>>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>> -        ? pci_dev->bus->address_space_io
>>>>> -        : pci_dev->bus->address_space_mem;
>>>>>   }
>>>>>
>>>>>   static void pci_update_vga(PCIDevice *pci_dev)
>>>>>
>>>>
>>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-05-18 12:17         ` Paolo Bonzini
@ 2016-05-18 12:27           ` Cao jin
  2016-05-18 12:31           ` Michael S. Tsirkin
  1 sibling, 0 replies; 12+ messages in thread
From: Cao jin @ 2016-05-18 12:27 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-trivial, Michael Tokarev; +Cc: mst, qemu-devel

Ok, I see. Thanks Paolo

Cao.

On 05/18/2016 08:17 PM, Paolo Bonzini wrote:
> On 18/05/2016 14:16, Cao jin wrote:
>> I guess maybe this one is more suitable for trivial.
>
> No, it's not trivial.  I guess it missed soft freeze.  Michael Tsirkin
> will pick it up.
>
> Thanks,
>
> Paolo
>
>>>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>>>>> index e67664d..f0f41dc 100644
>>>>>> --- a/hw/pci/pci.c
>>>>>> +++ b/hw/pci/pci.c
>>>>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>>>>>>                          uint8_t type, MemoryRegion *memory)
>>>>>>    {
>>>>>>        PCIIORegion *r;
>>>>>> -    uint32_t addr;
>>>>>> +    uint32_t addr; /* offset in pci config space */
>>>>>>        uint64_t wmask;
>>>>>>        pcibus_t size = memory_region_size(memory);
>>>>>>
>>>>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>>> region_num,
>>>>>>        r->addr = PCI_BAR_UNMAPPED;
>>>>>>        r->size = size;
>>>>>>        r->type = type;
>>>>>> -    r->memory = NULL;
>>>>>> +    r->memory = memory;
>>>>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>>> +                        ? pci_dev->bus->address_space_io
>>>>>> +                        : pci_dev->bus->address_space_mem;
>>>>>>
>>>>>>        wmask = ~(size - 1);
>>>>>> -    addr = pci_bar(pci_dev, region_num);
>>>>>>        if (region_num == PCI_ROM_SLOT) {
>>>>>>            /* ROM enable bit is writable */
>>>>>>            wmask |= PCI_ROM_ADDRESS_ENABLE;
>>>>>>        }
>>>>>> +
>>>>>> +    addr = pci_bar(pci_dev, region_num);
>>>>>>        pci_set_long(pci_dev->config + addr, type);
>>>>>> +
>>>>>>        if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>>>>>            r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>>>>>            pci_set_quad(pci_dev->wmask + addr, wmask);
>>>>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>>> region_num,
>>>>>>            pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>>>>>            pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>>>>>        }
>>>>>> -    pci_dev->io_regions[region_num].memory = memory;
>>>>>> -    pci_dev->io_regions[region_num].address_space
>>>>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>>> -        ? pci_dev->bus->address_space_io
>>>>>> -        : pci_dev->bus->address_space_mem;
>>>>>>    }
>>>>>>
>>>>>>    static void pci_update_vga(PCIDevice *pci_dev)
>>>>>>
>>>>>
>>>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
>
> .
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-05-18 12:17         ` Paolo Bonzini
  2016-05-18 12:27           ` Cao jin
@ 2016-05-18 12:31           ` Michael S. Tsirkin
  2016-06-20  3:31             ` Cao jin
  1 sibling, 1 reply; 12+ messages in thread
From: Michael S. Tsirkin @ 2016-05-18 12:31 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Cao jin, qemu-trivial, Michael Tokarev, qemu-devel

On Wed, May 18, 2016 at 02:17:20PM +0200, Paolo Bonzini wrote:
> On 18/05/2016 14:16, Cao jin wrote:
> > I guess maybe this one is more suitable for trivial.
> 
> No, it's not trivial.  I guess it missed soft freeze.  Michael Tsirkin
> will pick it up.
> 
> Thanks,
> 
> Paolo

Yes - please repost whatever was posted before freeze.
I'll review and pick this one up.
Thanks!

> >>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> >>>>> index e67664d..f0f41dc 100644
> >>>>> --- a/hw/pci/pci.c
> >>>>> +++ b/hw/pci/pci.c
> >>>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
> >>>>>                         uint8_t type, MemoryRegion *memory)
> >>>>>   {
> >>>>>       PCIIORegion *r;
> >>>>> -    uint32_t addr;
> >>>>> +    uint32_t addr; /* offset in pci config space */
> >>>>>       uint64_t wmask;
> >>>>>       pcibus_t size = memory_region_size(memory);
> >>>>>
> >>>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
> >>>>> region_num,
> >>>>>       r->addr = PCI_BAR_UNMAPPED;
> >>>>>       r->size = size;
> >>>>>       r->type = type;
> >>>>> -    r->memory = NULL;
> >>>>> +    r->memory = memory;
> >>>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
> >>>>> +                        ? pci_dev->bus->address_space_io
> >>>>> +                        : pci_dev->bus->address_space_mem;
> >>>>>
> >>>>>       wmask = ~(size - 1);
> >>>>> -    addr = pci_bar(pci_dev, region_num);
> >>>>>       if (region_num == PCI_ROM_SLOT) {
> >>>>>           /* ROM enable bit is writable */
> >>>>>           wmask |= PCI_ROM_ADDRESS_ENABLE;
> >>>>>       }
> >>>>> +
> >>>>> +    addr = pci_bar(pci_dev, region_num);
> >>>>>       pci_set_long(pci_dev->config + addr, type);
> >>>>> +
> >>>>>       if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
> >>>>>           r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
> >>>>>           pci_set_quad(pci_dev->wmask + addr, wmask);
> >>>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
> >>>>> region_num,
> >>>>>           pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
> >>>>>           pci_set_long(pci_dev->cmask + addr, 0xffffffff);
> >>>>>       }
> >>>>> -    pci_dev->io_regions[region_num].memory = memory;
> >>>>> -    pci_dev->io_regions[region_num].address_space
> >>>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
> >>>>> -        ? pci_dev->bus->address_space_io
> >>>>> -        : pci_dev->bus->address_space_mem;
> >>>>>   }
> >>>>>
> >>>>>   static void pci_update_vga(PCIDevice *pci_dev)
> >>>>>
> >>>>
> >>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-05-18 12:31           ` Michael S. Tsirkin
@ 2016-06-20  3:31             ` Cao jin
  2016-07-01  2:55               ` Cao jin
  0 siblings, 1 reply; 12+ messages in thread
From: Cao jin @ 2016-06-20  3:31 UTC (permalink / raw)
  To: Michael S. Tsirkin, Paolo Bonzini; +Cc: qemu-devel

Hi Michael,

Would you please take a look at this one? It has been forgotten for a 
long time.

On 05/18/2016 08:31 PM, Michael S. Tsirkin wrote:
> On Wed, May 18, 2016 at 02:17:20PM +0200, Paolo Bonzini wrote:
>> On 18/05/2016 14:16, Cao jin wrote:
>>> I guess maybe this one is more suitable for trivial.
>>
>> No, it's not trivial.  I guess it missed soft freeze.  Michael Tsirkin
>> will pick it up.
>>
>> Thanks,
>>
>> Paolo
>
> Yes - please repost whatever was posted before freeze.
> I'll review and pick this one up.
> Thanks!
>
>>>>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>>>>>> index e67664d..f0f41dc 100644
>>>>>>> --- a/hw/pci/pci.c
>>>>>>> +++ b/hw/pci/pci.c
>>>>>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num,
>>>>>>>                          uint8_t type, MemoryRegion *memory)
>>>>>>>    {
>>>>>>>        PCIIORegion *r;
>>>>>>> -    uint32_t addr;
>>>>>>> +    uint32_t addr; /* offset in pci config space */
>>>>>>>        uint64_t wmask;
>>>>>>>        pcibus_t size = memory_region_size(memory);
>>>>>>>
>>>>>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>>>> region_num,
>>>>>>>        r->addr = PCI_BAR_UNMAPPED;
>>>>>>>        r->size = size;
>>>>>>>        r->type = type;
>>>>>>> -    r->memory = NULL;
>>>>>>> +    r->memory = memory;
>>>>>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>>>> +                        ? pci_dev->bus->address_space_io
>>>>>>> +                        : pci_dev->bus->address_space_mem;
>>>>>>>
>>>>>>>        wmask = ~(size - 1);
>>>>>>> -    addr = pci_bar(pci_dev, region_num);
>>>>>>>        if (region_num == PCI_ROM_SLOT) {
>>>>>>>            /* ROM enable bit is writable */
>>>>>>>            wmask |= PCI_ROM_ADDRESS_ENABLE;
>>>>>>>        }
>>>>>>> +
>>>>>>> +    addr = pci_bar(pci_dev, region_num);
>>>>>>>        pci_set_long(pci_dev->config + addr, type);
>>>>>>> +
>>>>>>>        if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>>>>>>            r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>>>>>>            pci_set_quad(pci_dev->wmask + addr, wmask);
>>>>>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>>>> region_num,
>>>>>>>            pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>>>>>>            pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>>>>>>        }
>>>>>>> -    pci_dev->io_regions[region_num].memory = memory;
>>>>>>> -    pci_dev->io_regions[region_num].address_space
>>>>>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>>>> -        ? pci_dev->bus->address_space_io
>>>>>>> -        : pci_dev->bus->address_space_mem;
>>>>>>>    }
>>>>>>>
>>>>>>>    static void pci_update_vga(PCIDevice *pci_dev)
>>>>>>>
>>>>>>
>>>>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
>
> .
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
  2016-06-20  3:31             ` Cao jin
@ 2016-07-01  2:55               ` Cao jin
  0 siblings, 0 replies; 12+ messages in thread
From: Cao jin @ 2016-07-01  2:55 UTC (permalink / raw)
  To: Michael S. Tsirkin, Paolo Bonzini; +Cc: qemu-devel

ping?
This one has been posted almost 3 months

On 06/20/2016 11:31 AM, Cao jin wrote:
> Hi Michael,
>
> Would you please take a look at this one? It has been forgotten for a
> long time.
>
> On 05/18/2016 08:31 PM, Michael S. Tsirkin wrote:
>> On Wed, May 18, 2016 at 02:17:20PM +0200, Paolo Bonzini wrote:
>>> On 18/05/2016 14:16, Cao jin wrote:
>>>> I guess maybe this one is more suitable for trivial.
>>>
>>> No, it's not trivial.  I guess it missed soft freeze.  Michael Tsirkin
>>> will pick it up.
>>>
>>> Thanks,
>>>
>>> Paolo
>>
>> Yes - please repost whatever was posted before freeze.
>> I'll review and pick this one up.
>> Thanks!
>>
>>>>>>>> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
>>>>>>>> index e67664d..f0f41dc 100644
>>>>>>>> --- a/hw/pci/pci.c
>>>>>>>> +++ b/hw/pci/pci.c
>>>>>>>> @@ -974,7 +974,7 @@ void pci_register_bar(PCIDevice *pci_dev,
>>>>>>>> int region_num,
>>>>>>>>                          uint8_t type, MemoryRegion *memory)
>>>>>>>>    {
>>>>>>>>        PCIIORegion *r;
>>>>>>>> -    uint32_t addr;
>>>>>>>> +    uint32_t addr; /* offset in pci config space */
>>>>>>>>        uint64_t wmask;
>>>>>>>>        pcibus_t size = memory_region_size(memory);
>>>>>>>>
>>>>>>>> @@ -990,15 +990,20 @@ void pci_register_bar(PCIDevice *pci_dev, int
>>>>>>>> region_num,
>>>>>>>>        r->addr = PCI_BAR_UNMAPPED;
>>>>>>>>        r->size = size;
>>>>>>>>        r->type = type;
>>>>>>>> -    r->memory = NULL;
>>>>>>>> +    r->memory = memory;
>>>>>>>> +    r->address_space = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>>>>> +                        ? pci_dev->bus->address_space_io
>>>>>>>> +                        : pci_dev->bus->address_space_mem;
>>>>>>>>
>>>>>>>>        wmask = ~(size - 1);
>>>>>>>> -    addr = pci_bar(pci_dev, region_num);
>>>>>>>>        if (region_num == PCI_ROM_SLOT) {
>>>>>>>>            /* ROM enable bit is writable */
>>>>>>>>            wmask |= PCI_ROM_ADDRESS_ENABLE;
>>>>>>>>        }
>>>>>>>> +
>>>>>>>> +    addr = pci_bar(pci_dev, region_num);
>>>>>>>>        pci_set_long(pci_dev->config + addr, type);
>>>>>>>> +
>>>>>>>>        if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO) &&
>>>>>>>>            r->type & PCI_BASE_ADDRESS_MEM_TYPE_64) {
>>>>>>>>            pci_set_quad(pci_dev->wmask + addr, wmask);
>>>>>>>> @@ -1007,11 +1012,6 @@ void pci_register_bar(PCIDevice *pci_dev,
>>>>>>>> int
>>>>>>>> region_num,
>>>>>>>>            pci_set_long(pci_dev->wmask + addr, wmask & 0xffffffff);
>>>>>>>>            pci_set_long(pci_dev->cmask + addr, 0xffffffff);
>>>>>>>>        }
>>>>>>>> -    pci_dev->io_regions[region_num].memory = memory;
>>>>>>>> -    pci_dev->io_regions[region_num].address_space
>>>>>>>> -        = type & PCI_BASE_ADDRESS_SPACE_IO
>>>>>>>> -        ? pci_dev->bus->address_space_io
>>>>>>>> -        : pci_dev->bus->address_space_mem;
>>>>>>>>    }
>>>>>>>>
>>>>>>>>    static void pci_update_vga(PCIDevice *pci_dev)
>>>>>>>>
>>>>>>>
>>>>>>> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>>
>> .
>>
>

-- 
Yours Sincerely,

Cao jin

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-07-01  2:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-25  6:49 [Qemu-devel] [PATCH] pci_register_bar: cleanup Cao jin
2016-03-25  9:25 ` Paolo Bonzini
2016-05-12  1:39   ` Cao jin
2016-05-18  1:38     ` Cao jin
2016-05-18 12:16       ` Cao jin
2016-05-18 12:17         ` Paolo Bonzini
2016-05-18 12:27           ` Cao jin
2016-05-18 12:31           ` Michael S. Tsirkin
2016-06-20  3:31             ` Cao jin
2016-07-01  2:55               ` Cao jin
2016-03-28  5:55 ` Marcel Apfelbaum
2016-04-09  9:16   ` Cao jin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.