From patchwork Thu Sep 26 21:03:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 20650 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BD0FC23A4E for ; Thu, 26 Sep 2013 21:03:41 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id db12sf1605205veb.10 for ; Thu, 26 Sep 2013 14:03:41 -0700 (PDT) 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=U/wgNE3X7FlUO63WupRz2Eaw7JP2nA5E8raGIv5wAL4=; b=EH95jjJJC7IrrwiGqUmpKI0XNR0XbuPRezYa1z+eV8fYOJcwX1U5ACjYtne36H8tz/ Bnswl6mfJSqAPB16a9bHtu02QEVszvak2rTxchGzhhIJdYXBtv8XbaaJ8wJlhR49pmfZ N+XcflBWqp46HSgym1/EYr91Z4QruQ4k+97srMUq1/Y7VaVs9gfGpKKv15uV3PbSpkm4 ZkpstvhakZBBcub3wZf893X8xd+zDAyhRcXN9Eo4kGM9ss1JUuOiyo8pAd40TB2khxLX r7a8Bm3hWVQJyhUAk0qHIrsqdi0B82d0FlE0hNpMrwZuGrXEpL5jPGAcvZQdXzJPOztj JHzg== X-Gm-Message-State: ALoCoQlO/ihfbX1TdhVZpDjl2dhYzGRFNc9eH8v6L29q0jROeMw5xytt7HLjfxQrtS0KI8cBkNa9 X-Received: by 10.58.118.211 with SMTP id ko19mr314075veb.6.1380229421613; Thu, 26 Sep 2013 14:03:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.43 with SMTP id e11ls1107723qej.54.gmail; Thu, 26 Sep 2013 14:03:41 -0700 (PDT) X-Received: by 10.58.73.202 with SMTP id n10mr2526186vev.7.1380229421503; Thu, 26 Sep 2013 14:03:41 -0700 (PDT) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by mx.google.com with ESMTPS id wp10si899358vdb.6.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.54 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.54; Received: by mail-vb0-f54.google.com with SMTP id q14so1294822vbe.27 for ; Thu, 26 Sep 2013 14:03:11 -0700 (PDT) X-Received: by 10.52.65.136 with SMTP id x8mr2116027vds.23.1380229391345; Thu, 26 Sep 2013 14:03:11 -0700 (PDT) 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.220.174.196 with SMTP id u4csp388813vcz; Thu, 26 Sep 2013 14:03:10 -0700 (PDT) X-Received: by 10.68.129.135 with SMTP id nw7mr3370677pbb.200.1380229390495; Thu, 26 Sep 2013 14:03:10 -0700 (PDT) Received: from mail-pb0-f54.google.com (mail-pb0-f54.google.com [209.85.160.54]) by mx.google.com with ESMTPS id pd6si3651715pac.311.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:10 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.54 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.160.54; Received: by mail-pb0-f54.google.com with SMTP id ro12so1649298pbb.41 for ; Thu, 26 Sep 2013 14:03:10 -0700 (PDT) X-Received: by 10.66.146.42 with SMTP id sz10mr7750368pab.100.1380229390094; Thu, 26 Sep 2013 14:03:10 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id 7sm7385572paf.22.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Sep 2013 14:03:09 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v2 2/6] hw: arm_gic: Introduce GIC_SET_PRIORITY macro Date: Thu, 26 Sep 2013 14:03:02 -0700 Message-Id: <1380229386-24166-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1380229386-24166-1-git-send-email-christoffer.dall@linaro.org> References: <1380229386-24166-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.212.54 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 macro to set the priority of interrupts. Signed-off-by: Christoffer Dall Reviewed-by: Peter Maydell --- 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 b3788a8..09e7722 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -111,6 +111,7 @@ 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); #define TYPE_ARM_GIC_COMMON "arm_gic_common" #define ARM_GIC_COMMON(obj) \