From patchwork Sat Dec 21 06:09:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 22700 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f72.google.com (mail-pb0-f72.google.com [209.85.160.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CAC9320822 for ; Sat, 21 Dec 2013 06:10:00 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id jt11sf8954356pbb.3 for ; Fri, 20 Dec 2013 22:10:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=xYf0CdxkW/uxE3DB7he5ENUtbxoeP3K9ZQgKJEG74AY=; b=fEMREqwhWucyMqjWDKtBAF3z3YHNja/gvHKJLP5eLLMVlrlJ9UB5UtdR6u530h03/m arapdUeYP51mWQsTAQITw9NSrl+jTrA+n0uQ35hSyXUQWHrCwgOGFySpGTu3nFq2NcVO T0xlOeOKkzA/W26R6qDsKNez0TcQ3Mh0XsGIc9EmrmsjTlntVRyCaBzjDnMpYmwk7OLg iEt/lv1ZG6OCM6wafGvzXa4+nGEYfZLQi8bujblgqVTfImpJvojHnDowbeBwo+nl2fzb wbwTj/mNcv/t85CEdZfzdYNG6K/9k2icvqNt3qkjU77jCoiemiDEgWSDFwSdZaPLZrDI Jh5Q== X-Gm-Message-State: ALoCoQmIBzP8IlKtEBtJPPa8ZjMCqQaAWpwazpmGUygSMfXTtSnZJ11TcUC1sU2Wp57AMFXznZr8 X-Received: by 10.66.154.199 with SMTP id vq7mr627551pab.5.1387606199919; Fri, 20 Dec 2013 22:09:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.70 with SMTP id v6ls1015170qec.47.gmail; Fri, 20 Dec 2013 22:09:59 -0800 (PST) X-Received: by 10.58.255.233 with SMTP id at9mr2784744ved.20.1387606199796; Fri, 20 Dec 2013 22:09:59 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id sl9si2305858vdc.60.2013.12.20.22.09.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 22:09:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so2037094veb.30 for ; Fri, 20 Dec 2013 22:09:59 -0800 (PST) X-Received: by 10.52.232.135 with SMTP id to7mr146074vdc.58.1387606199699; Fri, 20 Dec 2013 22:09:59 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp109299ved; Fri, 20 Dec 2013 22:09:58 -0800 (PST) X-Received: by 10.66.220.198 with SMTP id py6mr13132385pac.21.1387606197773; Fri, 20 Dec 2013 22:09:57 -0800 (PST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id pk8si7033030pab.329.2013.12.20.22.09.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 22:09:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id w10so3356031pde.7 for ; Fri, 20 Dec 2013 22:09:57 -0800 (PST) X-Received: by 10.66.220.198 with SMTP id py6mr13132353pac.21.1387606197143; Fri, 20 Dec 2013 22:09:57 -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 ae5sm24345852pac.18.2013.12.20.22.09.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Dec 2013 22:09:56 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v4 2/8] hw: arm_gic: Introduce gic_set_priority function Date: Fri, 20 Dec 2013 22:09:33 -0800 Message-Id: <1387606179-22709-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5 In-Reply-To: <1387606179-22709-1-git-send-email-christoffer.dall@linaro.org> References: <1387606179-22709-1-git-send-email-christoffer.dall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 27c258a..6c59650 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -168,6 +168,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; @@ -443,11 +452,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 efac78d..8c02d58 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 */