qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup


From: Cao jin
Subject: Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup
Date: Wed, 18 May 2016 20:16:57 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

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 <address@hidden>

   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 <address@hidden>
---
  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 <address@hidden>






--
Yours Sincerely,

Cao jin





reply via email to

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