From patchwork Tue Nov 19 06:18:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 292296 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A36BA2C007B for ; Tue, 19 Nov 2013 17:21:01 +1100 (EST) Received: from localhost ([::1]:47350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViegE-0004PI-OD for incoming@patchwork.ozlabs.org; Tue, 19 Nov 2013 01:20:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viecb-0008Mt-Uw for qemu-devel@nongnu.org; Tue, 19 Nov 2013 01:17:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ViecV-0004kQ-Vs for qemu-devel@nongnu.org; Tue, 19 Nov 2013 01:17:13 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:50691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ViecV-0004kG-Pm for qemu-devel@nongnu.org; Tue, 19 Nov 2013 01:17:07 -0500 Received: by mail-pd0-f182.google.com with SMTP id v10so2078361pde.27 for ; Mon, 18 Nov 2013 22:17:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=iqc+oKMozdz68BlJmK0gk93p27wWi9PlH2JVF5VjyYA=; b=NP/wob2L7dcBjdx06ksRIXFDWXGt0yWLhAnIbbn+mWJUC7jIIrk2wwbNxOiocqdanE MSz2nNhhuKGD8gPcoJXxaorAlotwQCajaA7Ekq77dQYLQykiFSr4WW04WzfXfeCY2hPC VUEo/jFUdDNXDpX5Y/oZZGZEA0FD0fifYtaXGD/yfiNq3hdPCwFr4jj0LfycendxNbpC Sm+ug2qYxTpn1I3Yz+l6Glqpr8ZJUfJIh2MNAovOn4esj3toTLjURarsDoN0V5tp9pR/ bCJ306MDZc3gTV4rXzzo4JHMJuYE4GhtGecHZ1WrBgxds/ZIGuY7+cj99QMROyxICE/L gA3w== X-Gm-Message-State: ALoCoQkCjYyx8iX5oU0L84Uqil9Xiymg+rCVvT/OiNS548CERBLh+X+tXXmmWhlZ0ht81Jq+ZsFI X-Received: by 10.68.189.101 with SMTP id gh5mr24366940pbc.39.1384841827172; Mon, 18 Nov 2013 22:17:07 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id rz6sm19165159pab.22.2013.11.18.22.17.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:17:06 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Date: Mon, 18 Nov 2013 22:18:08 -0800 Message-Id: <1384841896-19566-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1384841896-19566-1-git-send-email-christoffer.dall@linaro.org> References: <1384841896-19566-1-git-send-email-christoffer.dall@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.182 Cc: kvmarm@lists.cs.columbia.edu, Christoffer Dall , patches@linaro.org Subject: [Qemu-devel] [RFC PATCH v3 02/10] hw: arm_gic: Introduce gic_set_priority function 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 To make the code slightly cleaner to look at and make the save/restore code easier to understand, introduce this function to set the priority of interrupts. Reviewed-by: Peter Maydell Signed-off-by: Christoffer Dall --- hw/intc/arm_gic.c | 15 ++++++++++----- hw/intc/gic_internal.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index c7a24d5..7eaa55f 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -169,6 +169,15 @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu) return new_irq; } +void gic_set_priority(GICState *s, int cpu, int irq, uint8_t val) +{ + if (irq < GIC_INTERNAL) { + s->priority1[irq][cpu] = val; + } else { + s->priority2[(irq) - GIC_INTERNAL] = val; + } +} + void gic_complete_irq(GICState *s, int cpu, int irq) { int update = 0; @@ -444,11 +453,7 @@ static void gic_dist_writeb(void *opaque, hwaddr offset, irq = (offset - 0x400) + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; - if (irq < GIC_INTERNAL) { - s->priority1[irq][cpu] = value; - } else { - s->priority2[irq - GIC_INTERNAL] = value; - } + gic_set_priority(s, cpu, irq, value); } else if (offset < 0xc00) { /* Interrupt CPU Target. RAZ/WI on uniprocessor GICs, with the * annoying exception of the 11MPCore's GIC. diff --git a/hw/intc/gic_internal.h b/hw/intc/gic_internal.h index 3989fd1..f916725 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -61,5 +61,6 @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu); void gic_complete_irq(GICState *s, int cpu, int irq); void gic_update(GICState *s); void gic_init_irqs_and_distributor(GICState *s, int num_irq); +void gic_set_priority(GICState *s, int cpu, int irq, uint8_t val); #endif /* !QEMU_ARM_GIC_INTERNAL_H */