From patchwork Mon Feb 22 17:06:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Rosato X-Patchwork-Id: 586403 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 BD313140C3B for ; Tue, 23 Feb 2016 04:07:55 +1100 (AEDT) Received: from localhost ([::1]:50585 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXtxh-0008NJ-1o for incoming@patchwork.ozlabs.org; Mon, 22 Feb 2016 12:07:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXtwz-00077z-MR for qemu-devel@nongnu.org; Mon, 22 Feb 2016 12:07:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aXtwv-0006s0-77 for qemu-devel@nongnu.org; Mon, 22 Feb 2016 12:07:09 -0500 Received: from e33.co.us.ibm.com ([32.97.110.151]:42804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aXtwu-0006rw-SO for qemu-devel@nongnu.org; Mon, 22 Feb 2016 12:07:05 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 22 Feb 2016 10:07:03 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 22 Feb 2016 10:07:01 -0700 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: mjrosato@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 7C7123E4004F for ; Mon, 22 Feb 2016 10:07:00 -0700 (MST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u1MH70hC35717244 for ; Mon, 22 Feb 2016 17:07:00 GMT Received: from d01av03.pok.ibm.com (localhost [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u1MH6w46008269 for ; Mon, 22 Feb 2016 12:06:59 -0500 Received: from rosatomj-ThinkPad-W530.ibm.com (sig-9-65-92-199.ibm.com [9.65.92.199]) by d01av03.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u1MH6ckB005444; Mon, 22 Feb 2016 12:06:49 -0500 From: Matthew Rosato To: qemu-devel@nongnu.org Date: Mon, 22 Feb 2016 12:06:36 -0500 Message-Id: <1456160797-832-7-git-send-email-mjrosato@linux.vnet.ibm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456160797-832-1-git-send-email-mjrosato@linux.vnet.ibm.com> References: <1456160797-832-1-git-send-email-mjrosato@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16022217-0009-0000-0000-0000129D4255 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 32.97.110.151 Cc: dahi@linux.vnet.ibm.com, agraf@suse.de, borntraeger@de.ibm.com, imammedo@redhat.com, bharata@linux.vnet.ibm.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, afaerber@suse.de, rth@twiddle.net Subject: [Qemu-devel] [PATCH v6 6/7] cpu: Add a last_cpu macro 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 Add last_cpu to grab last CPU in the queue. Rename one existing use of last_cpu as a variable name. Signed-off-by: Matthew Rosato --- hw/intc/openpic.c | 12 ++++++------ include/qom/cpu.h | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c index 903888c..0dd908e 100644 --- a/hw/intc/openpic.c +++ b/hw/intc/openpic.c @@ -217,7 +217,7 @@ typedef struct IRQSource { uint32_t ivpr; /* IRQ vector/priority register */ uint32_t idr; /* IRQ destination register */ uint32_t destmask; /* bitmap of CPU destinations */ - int last_cpu; + int cpu_last; int output; /* IRQ level, e.g. OPENPIC_OUTPUT_INT */ int pending; /* TRUE if IRQ is pending */ IRQType type; @@ -476,9 +476,9 @@ static void openpic_update_irq(OpenPICState *opp, int n_IRQ) return; } - if (src->destmask == (1 << src->last_cpu)) { + if (src->destmask == (1 << src->cpu_last)) { /* Only one CPU is allowed to receive this IRQ */ - IRQ_local_pipe(opp, src->last_cpu, n_IRQ, active, was_active); + IRQ_local_pipe(opp, src->cpu_last, n_IRQ, active, was_active); } else if (!(src->ivpr & IVPR_MODE_MASK)) { /* Directed delivery mode */ for (i = 0; i < opp->nb_cpus; i++) { @@ -488,13 +488,13 @@ static void openpic_update_irq(OpenPICState *opp, int n_IRQ) } } else { /* Distributed delivery mode */ - for (i = src->last_cpu + 1; i != src->last_cpu; i++) { + for (i = src->cpu_last + 1; i != src->cpu_last; i++) { if (i == opp->nb_cpus) { i = 0; } if (src->destmask & (1 << i)) { IRQ_local_pipe(opp, i, n_IRQ, active, was_active); - src->last_cpu = i; + src->cpu_last = i; break; } } @@ -1444,7 +1444,7 @@ static const VMStateDescription vmstate_openpic_irqsource = { VMSTATE_UINT32(ivpr, IRQSource), VMSTATE_UINT32(idr, IRQSource), VMSTATE_UINT32(destmask, IRQSource), - VMSTATE_INT32(last_cpu, IRQSource), + VMSTATE_INT32(cpu_last, IRQSource), VMSTATE_INT32(pending, IRQSource), VMSTATE_END_OF_LIST() } diff --git a/include/qom/cpu.h b/include/qom/cpu.h index ff54600..3645c19 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -364,6 +364,7 @@ extern struct CPUTailQ cpus; #define CPU_FOREACH_REVERSE(cpu) \ QTAILQ_FOREACH_REVERSE(cpu, &cpus, CPUTailQ, node) #define first_cpu QTAILQ_FIRST(&cpus) +#define last_cpu QTAILQ_LAST(&cpus, CPUTailQ) extern __thread CPUState *current_cpu;