From patchwork Wed May 13 18:33:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48460 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E0FC82121F for ; Wed, 13 May 2015 18:45:50 +0000 (UTC) Received: by lamp14 with SMTP id p14sf12280960lam.3 for ; Wed, 13 May 2015 11:45:49 -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:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=tFMnGfi8L/oFYKBwmCPjSJT43aeQcYe6tR9Z6CDLb+I=; b=Z0Auyyxo30xYmachPG76F15dwa6GS/VRxIZMqR5itPece86TSCBfYbYn4l03EdR7EH VYu2OFP4m0a5E9yANVgB6RbcyM79E8nsg8Se7Bf9zBCQUcVpuyQCfvEqFHNb4x+7Xghy VhMlewTQd5pc+lkvu5d0RVIWAwtePb/Eer5cVgJRm5ezUUjg3HF0dDNLjZiCJxtBowqQ +FFnBAxzZvPiS8T+XDr+uCG1zhr6B7Ia4ZZOgYKFJShdX0Z63wV3y35/7l0jC+FWvkbz WtpjDXPQVHBOgQK9jXMibFJyLilfjHU2LDQDXsBe0db+vzYjRw45Ut/yzjPHygrDxk7p Gh3g== X-Gm-Message-State: ALoCoQlrseyDpaSMB9Wz/HNJKWRfEMuEyDbhwxFBuWIGf6xd378jsm80niDu0qrcTnj51v/hzCJ3 X-Received: by 10.180.216.12 with SMTP id om12mr6291558wic.1.1431542749602; Wed, 13 May 2015 11:45:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.34 with SMTP id n2ls268808laj.15.gmail; Wed, 13 May 2015 11:45:49 -0700 (PDT) X-Received: by 10.152.87.164 with SMTP id az4mr192110lab.123.1431542749476; Wed, 13 May 2015 11:45:49 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id ld3si12890966lac.175.2015.05.13.11.45.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 May 2015 11:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbqq2 with SMTP id qq2so36242565lbb.3 for ; Wed, 13 May 2015 11:45:49 -0700 (PDT) X-Received: by 10.152.87.204 with SMTP id ba12mr221411lab.35.1431542749336; Wed, 13 May 2015 11:45:49 -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.112.108.230 with SMTP id hn6csp704168lbb; Wed, 13 May 2015 11:45:48 -0700 (PDT) X-Received: by 10.140.216.5 with SMTP id m5mr470868qhb.52.1431542746525; Wed, 13 May 2015 11:45:46 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id h30si20297155qgh.17.2015.05.13.11.45.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 13 May 2015 11:45:46 -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 1YsbdO-0001Ko-JS; Wed, 13 May 2015 18:43:58 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YsbdN-0001KT-S1 for xen-devel@lists.xenproject.org; Wed, 13 May 2015 18:43:57 +0000 Received: from [193.109.254.147] by server-8.bemta-14.messagelabs.com id 00/F1-03204-C6B93555; Wed, 13 May 2015 18:43:56 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-12.tower-27.messagelabs.com!1431542634!17369534!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 6.13.14; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31195 invoked from network); 13 May 2015 18:43:56 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-12.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 13 May 2015 18:43:56 -0000 X-IronPort-AV: E=Sophos;i="5.13,422,1427760000"; d="scan'208";a="264786293" From: Julien Grall To: Date: Wed, 13 May 2015 19:33:39 +0100 Message-ID: <1431542022-16138-4-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431542022-16138-1-git-send-email-julien.grall@citrix.com> References: <1431542022-16138-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v9 3/6] tools/libxl: arm: Use an higher value for the GIC phandle 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: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 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: From: Julien Grall The partial device tree may contains phandle. The Device Tree Compiler tends to allocate the phandle from 1. Reserve the ID 65000 for the GIC phandle. I think we can safely assume that the partial device tree will never contain a such ID. Signed-off-by: Julien Grall Acked-by: Ian Campbell Cc: Ian Jackson Cc: Wei Liu --- To allocate dynamically the phandle, we would need to fill in post-hoc (like we do with e.g the initramfs location) the #interrupt-parent in "/". That would also require some refactoring in the code to pass the phandle every time. Defer this solution to a follow-up in order as having 65000 would be very unlikely. Changes in v6: - Add a note in the doc about the reserved phandle Changes in v5: - Add Ian C.'s Ack. Changes in v3: - Patch added --- docs/man/xl.cfg.pod.5 | 3 +++ tools/libxl/libxl_arm.c | 9 +++++---- tools/libxl/libxl_types.idl | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index ead8a5c..fb8721f 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -470,6 +470,9 @@ the user to defined aliases which can be used by the guest kernel. Given the complexity of verifying the validity of a device tree, this option should only be used with trusted device tree. +Note that the partial device tree should avoid to use the phandle 65000 +which is reserved by the toolstack. + =back =head2 Devices diff --git a/tools/libxl/libxl_arm.c b/tools/libxl/libxl_arm.c index 71dbb9e..4fb5e26 100644 --- a/tools/libxl/libxl_arm.c +++ b/tools/libxl/libxl_arm.c @@ -81,10 +81,11 @@ static struct arch_info { {"xen-3.0-aarch64", "arm,armv8-timer", "arm,armv8" }, }; -enum { - PHANDLE_NONE = 0, - PHANDLE_GIC, -}; +/* + * The device tree compiler (DTC) is allocating the phandle from 1 to + * onwards. Reserve a high value for the GIC phandle. + */ +#define PHANDLE_GIC (65000) typedef uint32_t be32; typedef be32 gic_interrupt[3]; diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 4ea1290..f1c62ed 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -416,6 +416,8 @@ libxl_domain_build_info = Struct("domain_build_info",[ # Given the complexity of verifying the validity of a device tree, # libxl doesn't do any security check on it. It's the responsibility # of the caller to provide only trusted device tree. + # Note that the partial device tree should avoid to use the phandle + # 65000 which is reserved by the toolstack. ("device_tree", string), ("u", KeyedUnion(None, libxl_domain_type, "type", [("hvm", Struct(None, [("firmware", string),