From patchwork Fri Aug 23 20:10:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 19513 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f199.google.com (mail-ye0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 18075248E6 for ; Fri, 23 Aug 2013 20:10:38 +0000 (UTC) Received: by mail-ye0-f199.google.com with SMTP id l13sf823729yen.6 for ; Fri, 23 Aug 2013 13:10:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state: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=OubOCjbqagNsOhuECfzeLCQrDJ4MDAfII7RtkvkvWoM=; b=FTUfmIOGYfNIHM9fvipcAwVYHzUk0ytYAJGoDxTxRSXjVr27u7DB90dAyQQjg7dJok seIqrpdIojpQqJEYXVyRZFPR2nIeDjlghbc9424Up5OlWembgDYWtiSYXzS8G5+UOSKx B9abByfImhCYxukAgh+syd/guZYgJcRmbnMA0VwG+gROKabiJSmlIYscVlG1/zCtmBBB Go28yPlHR3G1peUu/Lm1PooeGwxHhwx10gDnzMXar4GcA1wwaFaPopqSuK3MCTm29AvD 0uVOjVNpTopTHPmWgliRiDoJmuO9iLt5uuchQGSXNovFrqnPIFbhY2Gp+DOntx/Ik+IF jl8A== X-Received: by 10.236.111.73 with SMTP id v49mr447402yhg.46.1377288637861; Fri, 23 Aug 2013 13:10:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.199 with SMTP id y7ls1766722qed.78.gmail; Fri, 23 Aug 2013 13:10:37 -0700 (PDT) X-Received: by 10.220.164.202 with SMTP id f10mr939085vcy.25.1377288637771; Fri, 23 Aug 2013 13:10:37 -0700 (PDT) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id tf3si474323vec.68.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 13:10:37 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.45 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.45; Received: by mail-vb0-f45.google.com with SMTP id e15so764799vbg.32 for ; Fri, 23 Aug 2013 13:10:37 -0700 (PDT) X-Gm-Message-State: ALoCoQmcumLbw8dw0TKSab2HphDC1UxaHSARj62Ywpj6S1VotghAlJv75zH8CqDxNEwYTNGHorLT X-Received: by 10.58.230.135 with SMTP id sy7mr23163vec.42.1377288637682; Fri, 23 Aug 2013 13:10:37 -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 u4csp113354vcz; Fri, 23 Aug 2013 13:10:37 -0700 (PDT) X-Received: by 10.68.179.36 with SMTP id dd4mr1568985pbc.64.1377288636608; Fri, 23 Aug 2013 13:10:36 -0700 (PDT) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id iy4si757980pbb.215.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 13:10:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id z10so1085021pdj.17 for ; Fri, 23 Aug 2013 13:10:36 -0700 (PDT) X-Received: by 10.68.28.1 with SMTP id x1mr1450869pbg.113.1377288636099; Fri, 23 Aug 2013 13:10:36 -0700 (PDT) Received: from localhost.localdomain (c-67-169-183-77.hsd1.ca.comcast.net. [67.169.183.77]) by mx.google.com with ESMTPSA id py4sm1590135pbc.14.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 13:10:35 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall Subject: [PATCH 2/5] hw: arm_gic: Introduce GIC_SET_PRIORITY macro Date: Fri, 23 Aug 2013 13:10:21 -0700 Message-Id: <1377288624-7418-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377288624-7418-1-git-send-email-christoffer.dall@linaro.org> References: <1377288624-7418-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.45 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 --- hw/intc/arm_gic.c | 6 +----- hw/intc/gic_internal.h | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c index bff3f9e..a7bb528 100644 --- a/hw/intc/arm_gic.c +++ b/hw/intc/arm_gic.c @@ -444,11 +444,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(irq, cpu, 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 1426437..d835aa1 100644 --- a/hw/intc/gic_internal.h +++ b/hw/intc/gic_internal.h @@ -57,6 +57,12 @@ #define GIC_GET_PRIORITY(irq, cpu) (((irq) < GIC_INTERNAL) ? \ s->priority1[irq][cpu] : \ s->priority2[(irq) - GIC_INTERNAL]) +#define GIC_SET_PRIORITY(irq, cpu, val) do { \ + uint8_t *__x = ((irq) < GIC_INTERNAL) ? \ + &s->priority1[irq][cpu] : \ + &s->priority2[(irq) - GIC_INTERNAL]; \ + *__x = val; \ +} while (0) #define GIC_TARGET(irq) s->irq_target[irq] typedef struct gic_irq_state {