From patchwork Thu Sep 24 11:37:46 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: 522274 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 E90D2140281 for ; Thu, 24 Sep 2015 21:59:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Jr8x4ka7; dkim-atps=neutral Received: from localhost ([::1]:58330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf5B6-0000V0-2e for incoming@patchwork.ozlabs.org; Thu, 24 Sep 2015 07:59:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4sU-0001aw-VS for qemu-devel@nongnu.org; Thu, 24 Sep 2015 07:39:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zf4sT-0007Lu-DC for qemu-devel@nongnu.org; Thu, 24 Sep 2015 07:39:54 -0400 Received: from mail-qk0-x232.google.com ([2607:f8b0:400d:c09::232]:35827) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zf4sT-0007Lm-9Y for qemu-devel@nongnu.org; Thu, 24 Sep 2015 07:39:53 -0400 Received: by qkap81 with SMTP id p81so28336083qka.2 for ; Thu, 24 Sep 2015 04:39:53 -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=ICzOydtrteSHIjKJiwClyUovV1+/i0CXZibbVKeWNiY=; b=Jr8x4ka7hAvb4/lSqJgRE2qPVmuz1vn7PgqMhpCuoi7PJSwCAP87uWsv6iYLlrjPlN cXLILOKF9SgvCpo/19z7HJci1wbNeb325+uDIkF6QHCe9xMRFTp5r45VrS06K8NIHFk8 1qRqwG9zRde5EFCj8XbTu7PiVx0rUwsjdIUrCdMt8kcGY4iIkfnUX6ATbV9zdAnRb/YV BURpc2A1J3AQNl7m6ZZe33O9uslwRm97yqXgPCWkBDnxvmroffxZinuqKVJejxiiaO0N lG0Qsuhx5HIfL/mFXpxQw1+h0L3XQ2+t+J6ACg6HP0y0ePu4YIvXuq4fWCTYMxB2VUWK 6XRA== X-Received: by 10.55.201.83 with SMTP id q80mr41656396qki.58.1443094793055; Thu, 24 Sep 2015 04:39:53 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id s52sm3267169qge.19.2015.09.24.04.39.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Sep 2015 04:39:52 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 24 Sep 2015 13:37:46 +0200 Message-Id: <1443094669-4144-45-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443094669-4144-1-git-send-email-marcandre.lureau@redhat.com> References: <1443094669-4144-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:400d:c09::232 Cc: 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] [PATCH v4 44/47] ivshmem: remove EventfdEntry.vector 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 No need to store an extra int for the vector number when it can be computed easily by looking at the position in the array. Signed-off-by: Marc-André Lureau Reviewed-by: Claudio Fontana --- hw/misc/ivshmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 9628e14..619947e 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -68,7 +68,6 @@ typedef struct Peer { typedef struct EventfdEntry { PCIDevice *pdev; - int vector; } EventfdEntry; typedef struct IVShmemState { @@ -287,9 +286,11 @@ static void fake_irqfd(void *opaque, const uint8_t *buf, int size) { EventfdEntry *entry = opaque; PCIDevice *pdev = entry->pdev; + IVShmemState *s = IVSHMEM(pdev); + int vector = entry - s->eventfd_table; - IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, entry->vector); - msix_notify(pdev, entry->vector); + IVSHMEM_DPRINTF("interrupt on vector %p %d\n", pdev, vector); + msix_notify(pdev, vector); } static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier *n, @@ -311,7 +312,6 @@ static CharDriverState* create_eventfd_chr_device(void * opaque, EventNotifier * /* if MSI is supported we need multiple interrupts */ if (ivshmem_has_feature(s, IVSHMEM_MSI)) { s->eventfd_table[vector].pdev = PCI_DEVICE(s); - s->eventfd_table[vector].vector = vector; qemu_chr_add_handlers(chr, ivshmem_can_receive, fake_irqfd, ivshmem_event, &s->eventfd_table[vector]);