From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIoVz-0006a9-V2 for qemu-devel@nongnu.org; Thu, 30 Jun 2016 22:49:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIoVv-0005sg-UU for qemu-devel@nongnu.org; Thu, 30 Jun 2016 22:49:11 -0400 Received: from [59.151.112.132] (port=46970 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIoVu-0005nP-LY for qemu-devel@nongnu.org; Thu, 30 Jun 2016 22:49:07 -0400 References: <1458888577-12477-1-git-send-email-caoj.fnst@cn.fujitsu.com> <56F5041C.2060307@redhat.com> <5733DEDF.90606@cn.fujitsu.com> <573BC79F.4070602@cn.fujitsu.com> <573C5D39.10404@cn.fujitsu.com> <8c278e28-6afe-b02e-5a92-2c05ddf2f532@redhat.com> <20160518153131-mutt-send-email-mst@redhat.com> <5767637A.5020509@cn.fujitsu.com> From: Cao jin Message-ID: <5775DB91.2030603@cn.fujitsu.com> Date: Fri, 1 Jul 2016 10:55:13 +0800 MIME-Version: 1.0 In-Reply-To: <5767637A.5020509@cn.fujitsu.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] pci_register_bar: cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , Paolo Bonzini Cc: qemu-devel@nongnu.org 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 >> >> >> . >> > -- Yours Sincerely, Cao jin