From patchwork Fri May 8 16:33:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 48177 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 6A6B22121F for ; Fri, 8 May 2015 16:35:29 +0000 (UTC) Received: by lbcne10 with SMTP id ne10sf22566558lbc.1 for ; Fri, 08 May 2015 09:35:28 -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=KfNYqMHmu2KNlQ7qBcBnDGmxdT5bl6f/H7ltvZTVw8NR/ZibHqNWiAKpcwkQeKI0z9 mi8X/pb2NRaZ7Vq3KJYytXO5/AV+lmTQglWWhyvDN+QR8e2ldvERPghx7cE7Ptpi8mXQ Osh7TMVhFwsUAWOZNqS4bh4JTxfuYvTX6hgVtup2a465JrZJ2IVBE2VCkY18PHxQODGu xp9hj1FjaW0+FVaOTttfkMrtTQ0EKjRdM+tVuwTnPtW6pVY3feWODX0a9zUg+DraR2wa TSNvDKUa72lCDtIL7Ua9Gb8708mlgS8orV5ocSKscIeCeLEox+qIt3AeyXrWVqi5Ti7N YxzQ== X-Gm-Message-State: ALoCoQmEoTSdTUd9duE0UiSONI8RHwF/H1yHQYZpcf6TI2zqyOc7aKJN5iCbOTJ5jCQ7UAQU5w0Z X-Received: by 10.180.10.136 with SMTP id i8mr2271581wib.7.1431102928119; Fri, 08 May 2015 09:35:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.182.228 with SMTP id eh4ls350598lac.45.gmail; Fri, 08 May 2015 09:35:28 -0700 (PDT) X-Received: by 10.152.44.167 with SMTP id f7mr3485382lam.48.1431102927990; Fri, 08 May 2015 09:35:27 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id wv10si3593802lac.79.2015.05.08.09.35.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 May 2015 09:35:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by laat2 with SMTP id t2so56444004laa.1 for ; Fri, 08 May 2015 09:35:27 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr3446168lbb.112.1431102927874; Fri, 08 May 2015 09:35:27 -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 hn6csp125674lbb; Fri, 8 May 2015 09:35:27 -0700 (PDT) X-Received: by 10.55.51.141 with SMTP id z135mr10043334qkz.84.1431102925289; Fri, 08 May 2015 09:35:25 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id 188si5788276qhr.88.2015.05.08.09.35.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 May 2015 09:35:25 -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 1YqlDm-00013c-JP; Fri, 08 May 2015 16:33:54 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YqlDk-00011l-Ie for xen-devel@lists.xenproject.org; Fri, 08 May 2015 16:33:52 +0000 Received: from [193.109.254.147] by server-2.bemta-14.messagelabs.com id E9/17-03031-F65EC455; Fri, 08 May 2015 16:33:51 +0000 X-Env-Sender: julien.grall@citrix.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1431102829!15910391!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 11876 invoked from network); 8 May 2015 16:33:50 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-14.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 8 May 2015 16:33:50 -0000 X-IronPort-AV: E=Sophos;i="5.13,391,1427760000"; d="scan'208";a="263161791" From: Julien Grall To: Date: Fri, 8 May 2015 17:33:11 +0100 Message-ID: <1431102794-21263-4-git-send-email-julien.grall@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431102794-21263-1-git-send-email-julien.grall@citrix.com> References: <1431102794-21263-1-git-send-email-julien.grall@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Wei Liu , ian.campbell@citrix.com, tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com Subject: [Xen-devel] [PATCH v7 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.215.41 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),