From patchwork Tue May 12 14:33:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48392 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3B288214A1 for ; Tue, 12 May 2015 14:36:04 +0000 (UTC) Received: by wixv7 with SMTP id v7sf3564364wix.0 for ; Tue, 12 May 2015 07:36:03 -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=NMcshfdg9z/5+xCewwUcKk6NFaPQhHmzQ3V0zxyydBA=; b=OXBEX3JzLdWk1ddiYUV/dkbLTGVYyGQem30+F4NiUskzDGmJvN0KFKQS7Ec+rQ9el9 i4d3gxIEwFKwmKOqYn8ufcKEP9tzC5AeVanSlfri7HPS+7HXycx+t/Gdn70tIM/H1/49 qMYhn2jRc/ZTqDM81u20jAa4bjJbB1SAgk1M+nYV1ag4o4QxjKVdBnOvodGqM9+a5YN7 2fCQrKJAk4LIP6+DUfTWklLkUY9xm4OJm5BbaBAZBhPWq/19YYDf1iVXoSkFarg0ZrrB finUIy0AkgHUXVAM121knYXX/fUuJk15T9Oi30rvKcl4qZJwrKA9OjncGfaoVNUwoxK3 /AxA== X-Gm-Message-State: ALoCoQmEoU+rerDYKaKYduklTX9Uit3PPK+d0uBWcegVmK6tpMvtFpPOHU/dHjb853b9DSCTpemw X-Received: by 10.180.10.136 with SMTP id i8mr1990815wib.7.1431441363452; Tue, 12 May 2015 07:36:03 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.8 with SMTP id s8ls36590lal.67.gmail; Tue, 12 May 2015 07:36:03 -0700 (PDT) X-Received: by 10.112.17.8 with SMTP id k8mr12255984lbd.28.1431441363330; Tue, 12 May 2015 07:36:03 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id na4si10470902lbb.143.2015.05.12.07.36.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 May 2015 07:36:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbzk7 with SMTP id zk7so7565165lbb.0 for ; Tue, 12 May 2015 07:36:03 -0700 (PDT) X-Received: by 10.112.198.74 with SMTP id ja10mr12395504lbc.19.1431441363229; Tue, 12 May 2015 07:36:03 -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 hn6csp2129731lbb; Tue, 12 May 2015 07:36:02 -0700 (PDT) X-Received: by 10.140.93.199 with SMTP id d65mr20201139qge.27.1431441354038; Tue, 12 May 2015 07:35:54 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gs2si11901077qcb.23.2015.05.12.07.35.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 May 2015 07:35:54 -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 1YsBFu-0002GS-21; Tue, 12 May 2015 14:33:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YsBFs-0002GB-QQ for xen-devel@lists.xenproject.org; Tue, 12 May 2015 14:33:56 +0000 Received: from [85.158.139.211] by server-11.bemta-5.messagelabs.com id 78/77-02789-45F02555; Tue, 12 May 2015 14:33:56 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1431441232!8699719!2 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 25224 invoked from network); 12 May 2015 14:33:55 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-11.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 12 May 2015 14:33:55 -0000 X-IronPort-AV: E=Sophos;i="5.13,415,1427760000"; d="scan'208";a="264226898" From: Julien Grall To: Date: Tue, 12 May 2015 15:33:09 +0100 Message-ID: <1431441192-27897-4-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431441192-27897-1-git-send-email-julien.grall@citrix.com> References: <1431441192-27897-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 v8 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.178 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 6ad8b21..e144535 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 2b57785..3254617 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),