From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZguEZ-0003oK-6Q for qemu-devel@nongnu.org; Tue, 29 Sep 2015 08:42:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZguEV-0003z6-6r for qemu-devel@nongnu.org; Tue, 29 Sep 2015 08:42:15 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:41821) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZguEU-0003yh-V4 for qemu-devel@nongnu.org; Tue, 29 Sep 2015 08:42:11 -0400 References: <1443094669-4144-1-git-send-email-marcandre.lureau@redhat.com> <1443094669-4144-8-git-send-email-marcandre.lureau@redhat.com> From: Claudio Fontana Message-ID: <560A871F.4080404@huawei.com> Date: Tue, 29 Sep 2015 14:42:07 +0200 MIME-Version: 1.0 In-Reply-To: <1443094669-4144-8-git-send-email-marcandre.lureau@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v4 07/47] ivshmem: remove superflous ivshmem_attr field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: marcandre.lureau@redhat.com, qemu-devel@nongnu.org Cc: pbonzini@redhat.com, drjones@redhat.com, cam@cs.ualberta.ca, stefanha@redhat.com On 24.09.2015 13:37, marcandre.lureau@redhat.com wrote: > From: Marc-André Lureau > > Signed-off-by: Marc-André Lureau > --- > hw/misc/ivshmem.c | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index fbeb731..7138b8d 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -85,7 +85,6 @@ typedef struct IVShmemState { > MemoryRegion bar; > MemoryRegion ivshmem; > uint64_t ivshmem_size; /* size of shared memory region */ > - uint32_t ivshmem_attr; > uint32_t ivshmem_64bit; > int shm_fd; /* shared memory file descriptor */ > > @@ -345,7 +344,7 @@ static int check_shm_size(IVShmemState *s, int fd) { > > /* create the shared memory BAR when we are not using the server, so we can > * create the BAR and map the memory immediately */ > -static void create_shared_memory_BAR(IVShmemState *s, int fd) { > +static void create_shared_memory_BAR(IVShmemState *s, int fd, uint8_t attr) { > > void * ptr; > > @@ -359,7 +358,7 @@ static void create_shared_memory_BAR(IVShmemState *s, int fd) { > memory_region_add_subregion(&s->bar, 0, &s->ivshmem); > > /* region for shared memory */ > - pci_register_bar(PCI_DEVICE(s), 2, s->ivshmem_attr, &s->bar); > + pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar); > } > > static void ivshmem_add_eventfd(IVShmemState *s, int posn, int i) > @@ -714,6 +713,8 @@ static int pci_ivshmem_init(PCIDevice *dev) > { > IVShmemState *s = IVSHMEM(dev); > uint8_t *pci_conf; > + uint8_t attr = PCI_BASE_ADDRESS_SPACE_MEMORY | > + PCI_BASE_ADDRESS_MEM_PREFETCH; > > if (s->sizearg == NULL) > s->ivshmem_size = 4 << 20; /* 4 MB default */ > @@ -768,10 +769,8 @@ static int pci_ivshmem_init(PCIDevice *dev) > &s->ivshmem_mmio); > > memory_region_init(&s->bar, OBJECT(s), "ivshmem-bar2-container", s->ivshmem_size); > - s->ivshmem_attr = PCI_BASE_ADDRESS_SPACE_MEMORY | > - PCI_BASE_ADDRESS_MEM_PREFETCH; > if (s->ivshmem_64bit) { > - s->ivshmem_attr |= PCI_BASE_ADDRESS_MEM_TYPE_64; > + attr |= PCI_BASE_ADDRESS_MEM_TYPE_64; > } > > if ((s->server_chr != NULL) && > @@ -798,7 +797,7 @@ static int pci_ivshmem_init(PCIDevice *dev) > /* allocate/initialize space for interrupt handling */ > s->peers = g_malloc0(s->nb_peers * sizeof(Peer)); > > - pci_register_bar(dev, 2, s->ivshmem_attr, &s->bar); > + pci_register_bar(dev, 2, attr, &s->bar); > > s->eventfd_chr = g_malloc0(s->vectors * sizeof(CharDriverState *)); > > @@ -835,8 +834,7 @@ static int pci_ivshmem_init(PCIDevice *dev) > exit(1); > } > > - create_shared_memory_BAR(s, fd); > - > + create_shared_memory_BAR(s, fd, attr); > } > > dev->config_write = ivshmem_write_config; > Reviewed-by: Claudio Fontana