From patchwork Mon Oct 12 16:41:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 529209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6D98C1402B0 for ; Tue, 13 Oct 2015 03:48:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=kyOUAwBT; dkim-atps=neutral Received: from localhost ([::1]:56647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlgGj-00071X-3S for incoming@patchwork.ozlabs.org; Mon, 12 Oct 2015 12:48:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlgCj-0000CM-06 for qemu-devel@nongnu.org; Mon, 12 Oct 2015 12:44:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlgCh-0001Nf-UO for qemu-devel@nongnu.org; Mon, 12 Oct 2015 12:44:04 -0400 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:36150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlgCh-0001NC-PV for qemu-devel@nongnu.org; Mon, 12 Oct 2015 12:44:03 -0400 Received: by pacex6 with SMTP id ex6so4359374pac.3 for ; Mon, 12 Oct 2015 09:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=6EZLVJeopOcasUdudJBywDMjBw/bjqBQIuFAgTzA3KE=; b=kyOUAwBTuNMPwkp3oTWERODUSExtmKc7Lc9N3xz8emN671sJ+2JA2TaTunHIr1RFpq dgUH4jKLtuYI7CVoZWKBxvlWTUQoub+asbguL3gJHfNZGX7QPO7167ARu1g4bNsfevuh WBta/dRZhapePRjI8ZXj2fNsriwIa3cVrpcjT5qEfDRVs5bwV3LcWNxywsw7B50T3Ji5 fx6Pb+fkn+MKiaB4x+uTI+WXUzbWl7Y+ei+ErJERTw/pk4+ywA/Qi3rB5pIgYgUaGAlA hWj64f3I4ZSli7nJriJG6MtJYH31WZbndLyYiQfR7mTLKME8hODLFc2h6t9vi2rffDhJ bemQ== X-Received: by 10.66.124.168 with SMTP id mj8mr8651348pab.45.1444668243363; Mon, 12 Oct 2015 09:44:03 -0700 (PDT) Received: from localhost (APoitiers-257-1-35-234.w90-38.abo.wanadoo.fr. [90.38.210.234]) by smtp.gmail.com with ESMTPSA id gt1sm19320649pbc.10.2015.10.12.09.43.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2015 09:44:02 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Mon, 12 Oct 2015 18:41:02 +0200 Message-Id: <1444668104-22955-9-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1444668104-22955-1-git-send-email-marcandre.lureau@redhat.com> References: <1444668104-22955-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22e Cc: peter.maydell@linaro.org, drjones@redhat.com, claudio.fontana@huawei.com, stefanha@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , pbonzini@redhat.com, cam@cs.ualberta.ca Subject: [Qemu-devel] [PULL v2 08/50] ivshmem: remove superflous ivshmem_attr field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- 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;