From patchwork Thu May 22 12:32:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 30622 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 02BDE20671 for ; Thu, 22 May 2014 12:53:11 +0000 (UTC) Received: by mail-pb0-f72.google.com with SMTP id ma3sf10776871pbc.3 for ; Thu, 22 May 2014 05:53:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=pDdn9Pnf5Qzox6GHW8Wm+IHdeCahcJ2+8yM3z4hg1dQ=; b=duY0hD1OQ4gbQWZx6WuKG2msbXDnF0ebkfZZf1PYzUtbLfZRjljqkDr4VQLDgiIwju YvFuUekBoBOXiZYlrOfWjUmF4kYbFbOhmvIuTqUpPpfbmAWjV3/RpH0Ymut+znjITQs+ F3KyPbNRZj2wFHMO9TVc27D56/r3wmIMsMq5A2/qzl9s0niNyXpZbJaAscCPv5dcO2d+ AShcCJHASRFnSGczpH0oZRXocpYUXi7NqcwRcYyUM1Ll/z34mIFARwcFGbh0pKStQGHy OWbATGEDcsQRTCGkohOsgFHT0tTMPd6ILiZ77aw4vr0m09VZ7iW9RfcLxQK0AU9RD+6p sp4w== X-Gm-Message-State: ALoCoQkjoOLHg7CSojHx4LFcGGrPFilZ0HhATYcGtzCKmu2l6aWDtna1xFarC1QgyhAt6wA9DbMI X-Received: by 10.66.252.198 with SMTP id zu6mr22381804pac.25.1400763191323; Thu, 22 May 2014 05:53:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.132 with SMTP id u4ls1193817qga.36.gmail; Thu, 22 May 2014 05:53:11 -0700 (PDT) X-Received: by 10.52.185.72 with SMTP id fa8mr13206708vdc.12.1400763191199; Thu, 22 May 2014 05:53:11 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id ul8si2484918vec.99.2014.05.22.05.53.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 05:53:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id oz11so4313227veb.16 for ; Thu, 22 May 2014 05:53:11 -0700 (PDT) X-Received: by 10.52.12.36 with SMTP id v4mr13436892vdb.20.1400763191116; Thu, 22 May 2014 05:53:11 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp196147vcb; Thu, 22 May 2014 05:53:10 -0700 (PDT) X-Received: by 10.229.97.71 with SMTP id k7mr79715064qcn.4.1400763189473; Thu, 22 May 2014 05:53:09 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id g50si5010513qgg.23.2014.05.22.05.53.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 05:53:09 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnST3-00067r-1y; Thu, 22 May 2014 12:51:29 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnST2-00067m-6R for xen-devel@lists.xensource.com; Thu, 22 May 2014 12:51:28 +0000 Received: from [85.158.137.68:5623] by server-12.bemta-3.messagelabs.com id 2C/99-14831-FC2FD735; Thu, 22 May 2014 12:51:27 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-9.tower-31.messagelabs.com!1400763085!1796287!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5476 invoked from network); 22 May 2014 12:51:26 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 22 May 2014 12:51:26 -0000 X-IronPort-AV: E=Sophos;i="4.98,887,1392163200"; d="scan'208";a="133892407" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 22 May 2014 12:51:24 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 May 2014 08:51:24 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WnSBI-0003tn-DJ; Thu, 22 May 2014 13:33:08 +0100 From: Stefano Stabellini To: Date: Thu, 22 May 2014 13:32:29 +0100 Message-ID: <1400761950-25035-12-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v8 12/13] xen/arm: introduce GIC_PRI_TO_GUEST macro X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: GICH_LR registers and GICH_VMCR only support 5 bits for guest irq priorities. Introduce a macro to reduce the 8-bit priority fields to 5 bits; use it in gic.c. Signed-off-by: Stefano Stabellini Acked-by: Ian Campbell --- Changes in v8: - fix typo and hard tabs. --- xen/arch/arm/gic.c | 2 +- xen/include/asm-arm/gic.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index de8dd1c..2bfaba9 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -555,7 +555,7 @@ static inline void gic_set_lr(int lr, struct pending_irq *p, BUG_ON(lr < 0); BUG_ON(state & ~(GICH_LR_STATE_MASK<priority >> 3) << GICH_LR_PRIORITY_SHIFT) | + lr_val = state | (GIC_PRI_TO_GUEST(p->priority) << GICH_LR_PRIORITY_SHIFT) | ((p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT); if ( p->desc != NULL ) lr_val |= GICH_LR_HW | (p->desc->irq << GICH_LR_PHYSICAL_SHIFT); diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 30e92cf..bf6fb1e 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -152,6 +152,8 @@ #define GIC_PRI_IRQ 0xa0 #define GIC_PRI_IPI 0x90 /* IPIs must preempt normal interrupts */ #define GIC_PRI_HIGHEST 0x80 /* Higher priorities belong to Secure-World */ +#define GIC_PRI_TO_GUEST(pri) (pri >> 3) /* GICH_LR and GICH_VMCR only support + 5 bits for guest irq priority */ #ifndef __ASSEMBLY__