From patchwork Wed Nov 5 09:41:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frediano Ziglio X-Patchwork-Id: 40172 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 364F9240A6 for ; Wed, 5 Nov 2014 09:43:59 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id w7sf239356lbi.4 for ; Wed, 05 Nov 2014 01:43:58 -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=7I3cU66myQTF2eZXXQEWp9hTWT3/TyaBXC4Cz7aFuHE=; b=N269POsYD9NlpHH8Nbo+ff7VSRPJTJkjlZniLx4hZwiDXAlQEPJqZpcZEF2YURKkbl pidRjj3owwzDvd5pGtW189QvtwlpyktdpcBiOTjnQpZbHb+HTEHr1GKoAGknwaL3Y33P 86W2vQCa5awFU0wnslBKNMG3N8kBAfIu9kpFRI2zJg94f8xQ/gekWIDwdroOPESRZYeX EvPLsd+InHAsX5DuBJb7gN1fXe6ljjBC9eUVZTBrfSqfKQuFPuLhnpH0xZXvMnlzpMov OmZCP4Eok/vAYHQ0sjZ24CGS5KCHnuxogulpKFEjqzjdCX+dMBpIm6Fp+wrh2osBkLia 8XaQ== X-Gm-Message-State: ALoCoQmLjvV3ipYB8XS9t+b4y8/34DzJI/0GfkIoW07ArxCW2hJUjuZ9imy44AmIjtnJmEYxV/T7 X-Received: by 10.194.191.137 with SMTP id gy9mr2926303wjc.0.1415180638007; Wed, 05 Nov 2014 01:43:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.133 with SMTP id b5ls912277lah.26.gmail; Wed, 05 Nov 2014 01:43:57 -0800 (PST) X-Received: by 10.152.170.131 with SMTP id am3mr65516538lac.15.1415180637827; Wed, 05 Nov 2014 01:43:57 -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 l8si5286779lah.23.2014.11.05.01.43.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 01:43:57 -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 mc6so318427lab.26 for ; Wed, 05 Nov 2014 01:43:57 -0800 (PST) X-Received: by 10.112.189.10 with SMTP id ge10mr65719214lbc.23.1415180637397; Wed, 05 Nov 2014 01:43:57 -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 ew9csp256344lbc; Wed, 5 Nov 2014 01:43:56 -0800 (PST) X-Received: by 10.52.240.229 with SMTP id wd5mr4669441vdc.9.1415180636049; Wed, 05 Nov 2014 01:43:56 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id d2si2694553vdc.60.2014.11.05.01.43.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Nov 2014 01:43:56 -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 1Xlx73-0007dd-8z; Wed, 05 Nov 2014 09:42:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xlx71-0007c7-SX for xen-devel@lists.xen.org; Wed, 05 Nov 2014 09:42:48 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 2E/19-05632-711F9545; Wed, 05 Nov 2014 09:42:47 +0000 X-Env-Sender: frediano.ziglio@huawei.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1415180562!11750791!1 X-Originating-IP: [119.145.14.64] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NCA9PiA4MDE5MQ==\n X-StarScan-Received: X-StarScan-Version: 6.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31453 invoked from network); 5 Nov 2014 09:42:46 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (119.145.14.64) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 5 Nov 2014 09:42:46 -0000 Received: from 172.24.2.119 (EHLO szxeml450-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CDY97078; Wed, 05 Nov 2014 17:42:41 +0800 (CST) Received: from localhost.localdomain (10.47.71.64) by szxeml450-hub.china.huawei.com (10.82.67.193) with Microsoft SMTP Server id 14.3.158.1; Wed, 5 Nov 2014 17:42:33 +0800 From: Frediano Ziglio To: Ian Campbell , Stefano Stabellini , Tim Deegan , Julien Grall , Date: Wed, 5 Nov 2014 09:41:15 +0000 Message-ID: <1415180475-8339-9-git-send-email-frediano.ziglio@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415180475-8339-1-git-send-email-frediano.ziglio@huawei.com> References: <1415180475-8339-1-git-send-email-frediano.ziglio@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.71.64] X-CFilter-Loop: Reflected Cc: zoltan.kiss@huawei.com, xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v3 8/8] xen/arm: Handle translated addresses for hardware domains 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: Translated address could have an offset applied to them. Replicate same value for device node to avoid improper address computation in the OS. Signed-off-by: Frediano Ziglio --- xen/arch/arm/gic-v2.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 2f6bbd5..271074d 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -67,8 +67,10 @@ /* Global state */ static struct { paddr_t dbase; /* Address of distributor registers */ + paddr_t dbase_raw; /* Untranslated address of distributor registers */ void __iomem * map_dbase; /* IO mapped Address of distributor registers */ paddr_t cbase; /* Address of CPU interface registers */ + paddr_t cbase_raw; /* Untranslated address of CPU interface registers */ void __iomem * map_cbase[2]; /* IO mapped Address of CPU interface registers */ paddr_t hbase; /* Address of virtual interface registers */ void __iomem * map_hbase; /* IO Address of virtual interface registers */ @@ -671,8 +673,17 @@ static int gicv2_make_dt_node(const struct domain *d, return -FDT_ERR_XEN(ENOMEM); tmp = new_cells; - dt_set_range(&tmp, node, d->arch.vgic.dbase, PAGE_SIZE); - dt_set_range(&tmp, node, d->arch.vgic.cbase, PAGE_SIZE * 2); + + if ( is_hardware_domain(d) ) + { + dt_set_range(&tmp, node, gicv2.dbase_raw, PAGE_SIZE); + dt_set_range(&tmp, node, gicv2.cbase_raw, PAGE_SIZE * 2); + } + else + { + dt_set_range(&tmp, node, d->arch.vgic.dbase, PAGE_SIZE); + dt_set_range(&tmp, node, d->arch.vgic.cbase, PAGE_SIZE * 2); + } res = fdt_property(fdt, "reg", new_cells, len); xfree(new_cells); @@ -739,10 +750,18 @@ static int __init gicv2_init_default(struct dt_device_node *node, const void *da if ( res || !gicv2.dbase || (gicv2.dbase & ~PAGE_MASK) ) panic("GICv2: Cannot find a valid address for the distributor"); + res = dt_device_get_address_raw(node, 0, &gicv2.dbase_raw); + if ( res ) + panic("GICv2: Cannot find a valid address for the distributor"); + res = dt_device_get_address(node, 1, &gicv2.cbase, NULL); if ( res || !gicv2.cbase || (gicv2.cbase & ~PAGE_MASK) ) panic("GICv2: Cannot find a valid address for the CPU"); + res = dt_device_get_address_raw(node, 1, &gicv2.cbase_raw); + if ( res ) + panic("GICv2: Cannot find a valid address for the CPU"); + res = dt_device_get_address(node, 2, &gicv2.hbase, NULL); if ( res || !gicv2.hbase || (gicv2.hbase & ~PAGE_MASK) ) panic("GICv2: Cannot find a valid address for the hypervisor");