From patchwork Thu Nov 6 10:12:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 40266 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB8D724237 for ; Thu, 6 Nov 2014 10:14:30 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id h11sf449306wiw.11 for ; Thu, 06 Nov 2014 02:14:30 -0800 (PST) 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=O4SWwG49fU/dC9/CqWlg3ZHnpMaZuyQUFFCgnddoLjU=; b=ABr6Rg0Ywbl1OfX4wLC3t9fk2lx2HPkXJlAHfvqor/HISqK+/9DIyfMVXu3RdmNUFf BfKFgusj1lGT20chfQJP0/jVvJu/MyHTs5vqG37ARLAk46RvLBN6/lII8LrnP/p7+O5O jfLCkA+ZOLIzBvSgEAI5B0fCm4Cp6QPjom4/Ttc64hpwJiDVE1awmzB5XNY57ZEuqFO4 seoo2/zaLtDLxLit4Jd6ruyynFfB72VpvFufjb0nK7RAToeIvY6MstsrFXgFMnvwYiRS 6hZKCoAArTSNuvgBXi9wlwLIGtKww6MNdaZzry4ETEUNG9vQk6Vor9kUGehGGlXK4FV2 UiMg== X-Gm-Message-State: ALoCoQl4xM0Zqx1UvKHG31ZCov/EpKR3vhcvxMwuyZ/t7naaZrKmEiWXLCOtjcL6QnMb4m50WUWX X-Received: by 10.180.90.234 with SMTP id bz10mr3885731wib.0.1415268870262; Thu, 06 Nov 2014 02:14:30 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.138 with SMTP id q10ls64515laj.83.gmail; Thu, 06 Nov 2014 02:14:30 -0800 (PST) X-Received: by 10.112.63.133 with SMTP id g5mr2537102lbs.33.1415268870096; Thu, 06 Nov 2014 02:14:30 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id ka2si10989394lbc.9.2014.11.06.02.14.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 02:14:29 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id mc6so2251886lab.40 for ; Thu, 06 Nov 2014 02:14:29 -0800 (PST) X-Received: by 10.152.120.199 with SMTP id le7mr3878942lab.67.1415268869422; Thu, 06 Nov 2014 02:14:29 -0800 (PST) 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.112.184.201 with SMTP id ew9csp21661lbc; Thu, 6 Nov 2014 02:14:28 -0800 (PST) X-Received: by 10.140.20.38 with SMTP id 35mr4777582qgi.29.1415268867994; Thu, 06 Nov 2014 02:14:27 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id w2si11159143qab.9.2014.11.06.02.14.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 02:14:27 -0800 (PST) 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 1XmK4T-00005G-5E; Thu, 06 Nov 2014 10:13:41 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XmK4R-0008V7-4m for xen-devel@lists.xen.org; Thu, 06 Nov 2014 10:13:39 +0000 Received: from [193.109.254.147] by server-15.bemta-14.messagelabs.com id 02/C0-02699-2D94B545; Thu, 06 Nov 2014 10:13:38 +0000 X-Env-Sender: frediano.ziglio@huawei.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1415268803!11770096!1 X-Originating-IP: [119.145.14.65] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NSA9PiA3NzQ2Mw==\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20009 invoked from network); 6 Nov 2014 10:13:37 -0000 Received: from szxga02-in.huawei.com (HELO szxga02-in.huawei.com) (119.145.14.65) by server-10.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 6 Nov 2014 10:13:37 -0000 Received: from 172.24.2.119 (EHLO szxeml460-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CBY67004; Thu, 06 Nov 2014 18:13:22 +0800 (CST) Received: from localhost.localdomain (10.47.67.20) by szxeml460-hub.china.huawei.com (10.82.67.203) with Microsoft SMTP Server id 14.3.158.1; Thu, 6 Nov 2014 18:13:13 +0800 From: Frediano Ziglio To: Ian Campbell , Stefano Stabellini , Tim Deegan , Julien Grall , Date: Thu, 6 Nov 2014 10:12:09 +0000 Message-ID: <1415268731-6519-6-git-send-email-frediano.ziglio@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415268731-6519-1-git-send-email-frediano.ziglio@huawei.com> References: <1415268731-6519-1-git-send-email-frediano.ziglio@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.67.20] X-CFilter-Loop: Reflected Cc: zoltan.kiss@huawei.com, xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v3 5/7] xen/arm: handle GICH register changes for hip04-d01 platform 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: frediano.ziglio@huawei.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.215.53 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: The GICH in this platform is mainly compatible with the standard GICv2 beside APR and LR register offsets. Signed-off-by: Frediano Ziglio --- xen/arch/arm/gic-v2.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 9ab30ce..d766438 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -61,6 +61,9 @@ #define GICH_V2_VMCR_PRIORITY_MASK 0x1f #define GICH_V2_VMCR_PRIORITY_SHIFT 27 +#define HIP04_GICH_APR 0x70 +#define HIP04_GICH_LR 0x80 + /* Global state */ static struct { paddr_t dbase; /* Address of distributor registers */ @@ -85,6 +88,8 @@ static DEFINE_PER_CPU(u16, gic_cpu_id); static unsigned int nr_gic_cpu_if = 8; static unsigned int gicd_sgi_target_shift = GICD_SGI_TARGET_SHIFT; static unsigned int gic_cpu_mask = 0xff; +static unsigned int gich_apr = GICH_APR; +static unsigned int gich_lr = GICH_LR; #define is_hip04() (nr_gic_cpu_if == 16) @@ -157,9 +162,9 @@ static void gicv2_save_state(struct vcpu *v) * accessed simultaneously by another pCPU. */ for ( i = 0; i < gicv2_info.nr_lrs; i++ ) - v->arch.gic.v2.lr[i] = readl_gich(GICH_LR + i * 4); + v->arch.gic.v2.lr[i] = readl_gich(gich_lr + i * 4); - v->arch.gic.v2.apr = readl_gich(GICH_APR); + v->arch.gic.v2.apr = readl_gich(gich_apr); v->arch.gic.v2.vmcr = readl_gich(GICH_VMCR); /* Disable until next VCPU scheduled */ writel_gich(0, GICH_HCR); @@ -170,9 +175,9 @@ static void gicv2_restore_state(const struct vcpu *v) int i; for ( i = 0; i < gicv2_info.nr_lrs; i++ ) - writel_gich(v->arch.gic.v2.lr[i], GICH_LR + i * 4); + writel_gich(v->arch.gic.v2.lr[i], gich_lr + i * 4); - writel_gich(v->arch.gic.v2.apr, GICH_APR); + writel_gich(v->arch.gic.v2.apr, gich_apr); writel_gich(v->arch.gic.v2.vmcr, GICH_VMCR); writel_gich(GICH_HCR_EN, GICH_HCR); } @@ -185,7 +190,7 @@ static void gicv2_dump_state(const struct vcpu *v) { for ( i = 0; i < gicv2_info.nr_lrs; i++ ) printk(" HW_LR[%d]=%x\n", i, - readl_gich(GICH_LR + i * 4)); + readl_gich(gich_lr + i * 4)); } else { @@ -439,12 +444,12 @@ static void gicv2_update_lr(int lr, const struct pending_irq *p, << GICH_V2_LR_PHYSICAL_SHIFT); } - writel_gich(lr_reg, GICH_LR + lr * 4); + writel_gich(lr_reg, gich_lr + lr * 4); } static void gicv2_clear_lr(int lr) { - writel_gich(0, GICH_LR + lr * 4); + writel_gich(0, gich_lr + lr * 4); } static int gicv2v_setup(struct domain *d) @@ -494,7 +499,7 @@ static void gicv2_read_lr(int lr, struct gic_lr *lr_reg) { uint32_t lrv; - lrv = readl_gich(GICH_LR + lr * 4); + lrv = readl_gich(gich_lr + lr * 4); lr_reg->pirq = (lrv >> GICH_V2_LR_PHYSICAL_SHIFT) & GICH_V2_LR_PHYSICAL_MASK; lr_reg->virq = (lrv >> GICH_V2_LR_VIRTUAL_SHIFT) & GICH_V2_LR_VIRTUAL_MASK; lr_reg->priority = (lrv >> GICH_V2_LR_PRIORITY_SHIFT) & GICH_V2_LR_PRIORITY_MASK; @@ -517,7 +522,7 @@ static void gicv2_write_lr(int lr, const struct gic_lr *lr_reg) << GICH_V2_LR_HW_SHIFT) | ((uint32_t)(lr_reg->grp & GICH_V2_LR_GRP_MASK) << GICH_V2_LR_GRP_SHIFT) ); - writel_gich(lrv, GICH_LR + lr * 4); + writel_gich(lrv, gich_lr + lr * 4); } static void gicv2_hcr_status(uint32_t flag, bool_t status) @@ -540,7 +545,7 @@ static unsigned int gicv2_read_vmcr_priority(void) static unsigned int gicv2_read_apr(int apr_reg) { - return readl_gich(GICH_APR); + return readl_gich(gich_apr); } static void gicv2_irq_enable(struct irq_desc *desc) @@ -803,6 +808,8 @@ static int __init hip04_gicv2_init(struct dt_device_node *node, const void *data nr_gic_cpu_if = 16; gicd_sgi_target_shift = 8; gic_cpu_mask = 0xffff; + gich_apr = HIP04_GICH_APR; + gich_lr = HIP04_GICH_LR; return gicv2_init_default(node, data); }