From patchwork Thu Nov 18 21:03:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lizhi Hou X-Patchwork-Id: 1556809 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=ituJR5vt; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4HwC3M3sz4z9sPf for ; Fri, 19 Nov 2021 08:04:31 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbhKRVHa (ORCPT ); Thu, 18 Nov 2021 16:07:30 -0500 Received: from mail-bn8nam11on2059.outbound.protection.outlook.com ([40.107.236.59]:2721 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229830AbhKRVHa (ORCPT ); Thu, 18 Nov 2021 16:07:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aRCBM6oSMY202Up9TjiJJ7prk9wZ5Hv+1zK/GihyvzN/DFdIEGIf71akxZlE7ANkMKOJqv2b2vpNOivVQt8ukquqdJi5cVwbenzx5QRWZqYLPQtMlgMtoPDMS2F+u1lKY8W7ojDtsiVXYdKFLUvuB4OiT5fT062Dfs3fePfMKQNSiB4Rhhd9T56WpxmhsxogtihfgXuP1iyVnm88wlMPhViMP/pzz9B3R6W8JBYO2zfak9RiZlT760lYhYN/ea+HgOCSeS82tP9ZIAfvqkT1VxrFWEALjIEfEYWqMYHjGO4E33/SMp8EYf7Dunwe0IhQ/ce3PuRwilCIM2YgvRqAxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QECNB7kmHRaIsQ7iC4f8bVPstXJH1ZGOxqBSelutlXM=; b=JhQHtUCc4dp8+YHzdduHJIze0rJmT3SefyRwdxPo0B0M4FeTDhXzs5thLF2T+Vu0kFSWHCS0XWAySsWnW6FGmKDHoGwCFZFMtt2AYFs7Tg/hiVX2H7UMwzdtPf11ZbYBgpjaIefq9DwhQrujrJQyhBmk5jLFQ2lhGmlA+LR7UGqFkiDo7ECYUvqX0wFwD4y2f0NiS20QKfQYTePV2Eownb5ix8h5lA1fL9Nqlc8CuECMUNQbw6/OWO+5XX+YQzPXU9b+1MUEcsRCEC/bqVpWksUiGT0vWQfCvpk2CXlw5u/ld64kBEjp17P5d4gFnVD9ZFQdjbLqD+My3yCnAvZb+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=infradead.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QECNB7kmHRaIsQ7iC4f8bVPstXJH1ZGOxqBSelutlXM=; b=ituJR5vt9IdHxnWvg5VGa7UwmLNpnVcfgrRnB3QfTRVniZDyzd9C7pDI2tP5663ntxl0yoAFcEW39j1eEtdJz33GMKCmHl86W3UNdmDSJ7OBd2JRdQhcI+awlquZ2m4k1x9S8SDFjWW3sxDh/i8tboKhclq4P0NxR1+eIWahyis= Received: from SN6PR05CA0015.namprd05.prod.outlook.com (2603:10b6:805:de::28) by BN7PR02MB4004.namprd02.prod.outlook.com (2603:10b6:406:fe::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 21:04:26 +0000 Received: from SN1NAM02FT0058.eop-nam02.prod.protection.outlook.com (2603:10b6:805:de:cafe::8f) by SN6PR05CA0015.outlook.office365.com (2603:10b6:805:de::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.7 via Frontend Transport; Thu, 18 Nov 2021 21:04:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0058.mail.protection.outlook.com (10.97.5.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 21:04:26 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 18 Nov 2021 13:04:00 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 18 Nov 2021 13:04:00 -0800 Envelope-to: dwmw2@infradead.org, mdf@kernel.org, robh@kernel.org, trix@redhat.com, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Received: from [172.19.72.93] (port=37752 helo=xsj-xw9400.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mnoZc-0007Dk-DU; Thu, 18 Nov 2021 13:04:00 -0800 Received: by xsj-xw9400.xilinx.com (Postfix, from userid 21952) id B406B600061; Thu, 18 Nov 2021 13:03:36 -0800 (PST) From: Lizhi Hou To: CC: Lizhi Hou , , , , , , , , , , , , Max Zhen Subject: [PATCH V1 XRT Alveo Infrastructure 2/9] Documentation: devicetree: bindings: add xrt group binding Date: Thu, 18 Nov 2021 13:03:16 -0800 Message-ID: <20211118210323.1070283-3-lizhi.hou@xilinx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118210323.1070283-1-lizhi.hou@xilinx.com> References: <20211118210323.1070283-1-lizhi.hou@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a78db70a-b157-4e3e-141b-08d9aad70150 X-MS-TrafficTypeDiagnostic: BN7PR02MB4004: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mH7XRKyYbjiQe13MYtGXD2W8o23tNW0JD2ndlSdJYPN7ljcHCIMKY57Dv2XIp5HRBbaqAGOot03CCXYvy+i7qe54ZCbjHLfrnjdBur9DsdputAuwzgaU3XosPEQcZlFjrQpLYsQdHPMWFt2RIf6Q96mEq6FJHqkJCT+B7icSnUiYz5NnaNTSQ9kYSv1Lbg0BHMxBnQq4XMpGa4zj9MSZ7a4/xzor3kGkBJU7SxquY5RChwyVAHFyVAIwseauqYDnhTCV5fJhRrk4G3U+Kyjl6Fm1jBNok6zI/6wdWbIK35ek3Zj2+4JKXrcBy+1tETwRwow/3uOlkzmQCmNiCBc1jhfC68hkXu60tRISNwxFDhM1bFeF3/fYkrtq2QX4tDOYOZuWwK58wQZb74/wmWH1+OIgFt+5PFsvtGy2GvT6L61lm2Vpu1BYZkfG9VRBga1EBkaw6Xm57XGjDFcvZIYGf8DYUYVehY4da0c2RACT9/lBBRaAJvSOUPMQykE+KYokb+MomTtlJpRIQX1MY5ZKHGKZ8O/vVjhWGQwFnyr8bATP7ijDSPDEG/UXHRCc6BaRJixEhb45X35CXBu+5NdMaTw5Cn24SYQLZIIXhBu/T8gTPCR9MzJ1dGx1k8kpspNk5UaFbY6HMl7vPJO4OV6+JxZaDLFwOSWd0TcmRS/F7DVrEtqtfhhEtKCNm1KOfomt7ecSpL82dQv3Tm5lU0tL2w7DK+eL0E5SSARF4Rxhz8NggVUrq3pKOT/8fsSTwZvBpSmQ0bJGKupXGX5GR1NjpOe7aFCUWgKqA2wgzsd75oNbl1DpO9z33FRm8hwApNlv+7uPsTaL9kaGPT5jI3JrXw== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(36840700001)(46966006)(5660300002)(44832011)(70586007)(2906002)(4326008)(54906003)(36756003)(6666004)(8676002)(426003)(36860700001)(6266002)(336012)(7636003)(26005)(966005)(47076005)(356005)(1076003)(2616005)(8936002)(82310400003)(42186006)(186003)(70206006)(508600001)(36906005)(316002)(107886003)(6916009);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 21:04:26.5541 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a78db70a-b157-4e3e-141b-08d9aad70150 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0058.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB4004 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Create device tree binding document for xrt group device. Signed-off-by: Sonal Santan Signed-off-by: Max Zhen Signed-off-by: Lizhi Hou --- .../bindings/xrt/xlnx,xrt-group.yaml | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/xrt/xlnx,xrt-group.yaml diff --git a/Documentation/devicetree/bindings/xrt/xlnx,xrt-group.yaml b/Documentation/devicetree/bindings/xrt/xlnx,xrt-group.yaml new file mode 100644 index 000000000000..112c493eb2d2 --- /dev/null +++ b/Documentation/devicetree/bindings/xrt/xlnx,xrt-group.yaml @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/xrt/xlnx,xrt-group.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx XRT group for Alveo platforms + +description: | + The xrt group is a pseudo device which is used to manage and + support xrt devices in the same Alveo partition. It is part + of XRT infrastructure. + +maintainers: + - Lizhi Hou + +properties: + compatible: + const: xlnx,xrt-group + + "#address-cells": + const: 3 + + "#size-cells": + const: 2 + + ranges: true + +patternProperties: + "^.*@[0-5],[0-9a-f]+,[0-9a-f]+$": + description: xrt devices belongs to this group + type: object + +required: + - compatible + - "#address-cells" + - "#size-cells" + - ranges + +additionalProperties: false + +examples: + - | + xrt-bus { + #address-cells = <2>; + #size-cells = <2>; + xrt-group@48,0 { + compatible = "xlnx,xrt-group"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0 0 0 0 0xe0000000 0 0x2000000 + 2 0 0 0 0xe4200000 0 0x40000>; + ep_fpga_configuration_00@0,0,1e88000 { + reg = <0 0 0x1e88000 0 0x8000>; + compatible = "xilinx.com,reg_abs-axi_hwicap-1.0", + "axi_hwicap"; + }; + }; + }; From patchwork Thu Nov 18 21:03:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lizhi Hou X-Patchwork-Id: 1556810 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=oYos8GYK; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4HwC3T1llMz9sPf for ; Fri, 19 Nov 2021 08:04:37 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231543AbhKRVHg (ORCPT ); Thu, 18 Nov 2021 16:07:36 -0500 Received: from mail-bn7nam10on2050.outbound.protection.outlook.com ([40.107.92.50]:20926 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233954AbhKRVHf (ORCPT ); Thu, 18 Nov 2021 16:07:35 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U4ScFZpWm+FEu5/aGc6jmLvWbBIR+MxQZFx40sJIKWIKhaOOXxKXVVhgHV6Jxvv5brvxM7Wty3DzY+lvK2ePQTy/TnW95pvnf+Ff8XES4pob8QCvctZB1rEvriYIfo2n/Wngzvti67q0xW9IVRVbClwNSHeVR4J//Zh8KUlBTALni2Am4wt3lg82iXTRk95SajuB3t8515dWZLVQPnZKJMDohjqbzNy6o7kKuRI0lNug5kLG/YTt3eYW+/TTAqeHc2WwhauCO0Cdx9TuK0rOTLTseN35UBMNF9JAt3IADxFJCLBX9e/L9nxqjeHprIgXOvfKcFoqKhZ2Y9/zYhaVRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1igVE7zaLdniu8vfszrZASVNDL49MDeN+YyJ7SpgO6k=; b=UkZg+qyEx7EW0aNJIfSEHpDdrm8Oi3ZkotWDwX3VsGR3g1nBUvd1mUhSLx/D+0GEeHRkL01bxA7gFzIOYy84Q5KHRqtawxEiZqDg8z2BuaOV0TwX47Glzs6qLV/w4gJrposSO9rfH3wha62QLfmR/ES64Ytw/Wc+mOpKR1VpkKeW8ns/od3XjHUi8YeuHgy8u6KPkfjDzY5nedwkO7g9RPtEZ2qg0EzkZGieOrfx08Ctdg7GWUzrfswJ+atzQIO7Tp1dm228Q7Zj/19VvTuGFLl3FZ/YISwWRMOsHK6ksWJ5cjx9Fymqd73qeH3kqjRH68q+PiTcH8ocjMWm2xPb8g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=infradead.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1igVE7zaLdniu8vfszrZASVNDL49MDeN+YyJ7SpgO6k=; b=oYos8GYKsDSXpBZZjbXDJHqGk+/nHuPzONKdvlSmlOsAKV5IluvBrcAZhBFNXT/s15Zi5WwMEsVrAJ2EAHuWnInZ/eE7d0BuchZHtPAEUHmBA91CV5ZimuKuxI7D+S5ZwywSYnI6YkT+06mZBeY4J8HlpvGf2RfWIFWBaDmJMRI= Received: from BN0PR04CA0021.namprd04.prod.outlook.com (2603:10b6:408:ee::26) by CH2PR02MB6679.namprd02.prod.outlook.com (2603:10b6:610:7a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.20; Thu, 18 Nov 2021 21:04:32 +0000 Received: from BN1NAM02FT039.eop-nam02.prod.protection.outlook.com (2603:10b6:408:ee:cafe::27) by BN0PR04CA0021.outlook.office365.com (2603:10b6:408:ee::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27 via Frontend Transport; Thu, 18 Nov 2021 21:04:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BN1NAM02FT039.mail.protection.outlook.com (10.13.2.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 21:04:30 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 18 Nov 2021 13:04:12 -0800 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 18 Nov 2021 13:04:12 -0800 Envelope-to: dwmw2@infradead.org, mdf@kernel.org, robh@kernel.org, trix@redhat.com, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Received: from [172.19.72.93] (port=37754 helo=xsj-xw9400.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mnoZo-0001YV-FB; Thu, 18 Nov 2021 13:04:12 -0800 Received: by xsj-xw9400.xilinx.com (Postfix, from userid 21952) id CE081600143; Thu, 18 Nov 2021 13:03:36 -0800 (PST) From: Lizhi Hou To: CC: Lizhi Hou , , , , , , , , , , , , Max Zhen Subject: [PATCH V1 XRT Alveo Infrastructure 3/9] of: handle fdt buffer alignment inside unflatten function Date: Thu, 18 Nov 2021 13:03:17 -0800 Message-ID: <20211118210323.1070283-4-lizhi.hou@xilinx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118210323.1070283-1-lizhi.hou@xilinx.com> References: <20211118210323.1070283-1-lizhi.hou@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e48aca60-c825-4824-bd79-08d9aad70393 X-MS-TrafficTypeDiagnostic: CH2PR02MB6679: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O/ThyLr+AzL586F9ZtGtSBHu4bxlFDMJp+K4T6EBOZYnOje/BNg28jivBVlaDKrfZo+/cg77czQtUQCzYLr+YSg8oWnQB9HJ76p4X94ySTQ2GsfFjbVS3GPRKeXuF0uEZLs+CUk35SvE0kgCPdtwf5SJAiZq/FzNXkW8Amf0NDg6QSfT1XJ4Bni4Ku5jYV5k9MerI1uMvzgiACV4YZP7FVM9BotwTfFPhPjyVCBSuLcqBa7UKKm6xCOtYURGcDiUpfBIyIBDo8Kb5xruU/0bvkfngN4lnzzFNC3zPeagZA8AgJqfvDyJh6minPDSAUH+8Q8yQDens6E2pmqPJzZAkhCwv7oa6R7VXmUhwe66SQCkOBno5I+vHVABkgLjCILXcz5dAswEQ2Uqh/Rf3cry1HvhPjjEKQK+d74tRCyqSR+E4M4+JaVHz3iF6BJSrXXNLDNfUv7cl+u4JcnYmSX9JMjmBeTO65vlq1pP99qL3u/356kqBVGjbidPl9Xbtph9dMilqhfQFpk3YzfNq5wDhX5Or+Db+gKztSKGwBEu6Cx/FRxtVTzTgYWo4cyTBdH8eSYGIXA3UPrS1TTNcgaqry3ajVTD1pAZxWSBtSLF34R+yApvvNUHHF337VaNtXRCuZ0tUICBKRQbCwk++plyfIgBdgsMjKk/TX1L0y2eIvWoH025eqc+43s42deiUKtY7JAqfJzs2U+ixReZxd+1cg== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(46966006)(36840700001)(36860700001)(8676002)(107886003)(6666004)(5660300002)(83380400001)(2906002)(508600001)(47076005)(26005)(356005)(70206006)(70586007)(36756003)(186003)(54906003)(426003)(82310400003)(336012)(7636003)(42186006)(4326008)(6916009)(1076003)(6266002)(36906005)(8936002)(44832011)(2616005)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 21:04:30.2930 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e48aca60-c825-4824-bd79-08d9aad70393 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BN1NAM02FT039.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR02MB6679 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add alignment check to of_fdt_unflatten_tree(). If it is not aligned, allocate a aligned buffer and copy the fdt blob. So the caller does not have to deal with the buffer alignment before calling this function. XRT uses this function to unflatten fdt which is from Alveo firmware. Signed-off-by: Sonal Santan Signed-off-by: Max Zhen Signed-off-by: Lizhi Hou --- drivers/of/fdt.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 4546572af24b..d64445e43ceb 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -455,13 +455,28 @@ void *of_fdt_unflatten_tree(const unsigned long *blob, struct device_node *dad, struct device_node **mynodes) { + void *new_fdt = NULL, *fdt_align; void *mem; + if (fdt_check_header(blob)) { + pr_err("Invalid fdt blob\n"); + return NULL; + } + fdt_align = (void *)PTR_ALIGN(blob, FDT_ALIGN_SIZE); + if (fdt_align != blob) { + new_fdt = kmalloc(fdt_totalsize(blob) + FDT_ALIGN_SIZE, GFP_KERNEL); + if (!new_fdt) + return NULL; + fdt_align = PTR_ALIGN(new_fdt, FDT_ALIGN_SIZE); + } + mutex_lock(&of_fdt_unflatten_mutex); - mem = __unflatten_device_tree(blob, dad, mynodes, &kernel_tree_alloc, + mem = __unflatten_device_tree(fdt_align, dad, mynodes, &kernel_tree_alloc, true); mutex_unlock(&of_fdt_unflatten_mutex); + kfree(new_fdt); + return mem; } EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree); From patchwork Thu Nov 18 21:03:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lizhi Hou X-Patchwork-Id: 1556811 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=d3BFhpGS; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4HwC4038Ggz9sPf for ; Fri, 19 Nov 2021 08:05:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233137AbhKRVID (ORCPT ); Thu, 18 Nov 2021 16:08:03 -0500 Received: from mail-dm6nam11on2041.outbound.protection.outlook.com ([40.107.223.41]:62177 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231667AbhKRVIC (ORCPT ); Thu, 18 Nov 2021 16:08:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MTP6CoD+RI5Ow2UmAvUopslPM21i96auIlx8qHPUyUmlvTNWxeOr6a6JB7QCXALCpicqTCWDEMz3zhPSIGJLGhDGzBqZwyQrGNns/jOPtuCUhpx2XBJEjUh1nkaHqYWBnvd/3jXig41A8hIf3qjA81Csu2QEOLyKfD0sH9iLwAf1crspp8D6OgR+qlKPULpIu7ofhyO1PS/CpiQnb1ELwdI5siubXc3aVGWCbbSo/RZAY+5W3HFmrDFb3+yTuFkw8Zg6NsSmVK3wiaTkBLydUixfS7S3CHvPeSK0vrQuSwkou+llLk8yr6Pc6XwFSuLZi2A61ODy9J2/Cni0DT0VIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dor8ozB7mx0oWaaCwou5aFQnENTnttIBANnGY2uccQ8=; b=JqhVpVGT/XpAuNcnShlly3n75QkclBdPtHAx3JvAQOB8fr+qScj/cC9krAgoc8HtRRjKbMDoFf0pmBibF/xjRi71nqTcl+SKKr9TZ+oRWZ15hv7WQ5ws/wVcqBLZAEuL87nXsyuSybAkMutJcc0+JXdCDR4dr3vlsRlti+NZ2xW0eZ5WawsgASvvd6n8FU7QN8OEyFogYWCXRli+NmLpmSpdSU8YBVSlbi7H5eVAUdZLZQ37RA4millr6+JBE2i2nPI7l4bT6klOSgZ/I1sV29vp5RaZZTv/gPA/LvnG26Jwni3FroM25TW3gQmYed7KFnrRK3tFiC3+TB0AOhm+zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=infradead.org smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dor8ozB7mx0oWaaCwou5aFQnENTnttIBANnGY2uccQ8=; b=d3BFhpGStij0tb8qcHE3BB2bTbRGx6mD8nuSvlpd2R4ur8YHIT8e1RVlox2Onmehn1w+ZwX8bdSu1Itp+O6ayID3S6tfZY+k1UyiSzGJHgRbA9Hz7xiM9HrQ7C6GMhyUs003OTpSxhOC2Sgk21vwf75URz8q32+jLsiWoXOCxew= Received: from SN6PR16CA0070.namprd16.prod.outlook.com (2603:10b6:805:ca::47) by SA1PR02MB8400.namprd02.prod.outlook.com (2603:10b6:806:1f4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Thu, 18 Nov 2021 21:04:59 +0000 Received: from SN1NAM02FT0018.eop-nam02.prod.protection.outlook.com (2603:10b6:805:ca:cafe::59) by SN6PR16CA0070.outlook.office365.com (2603:10b6:805:ca::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 21:04:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0018.mail.protection.outlook.com (10.97.5.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 21:04:59 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 18 Nov 2021 13:04:48 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 18 Nov 2021 13:04:48 -0800 Envelope-to: dwmw2@infradead.org, mdf@kernel.org, robh@kernel.org, trix@redhat.com, devicetree@vger.kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Received: from [172.19.72.93] (port=37760 helo=xsj-xw9400.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mnoaO-0007HC-KA; Thu, 18 Nov 2021 13:04:48 -0800 Received: by xsj-xw9400.xilinx.com (Postfix, from userid 21952) id 105C9600147; Thu, 18 Nov 2021 13:03:36 -0800 (PST) From: Lizhi Hou To: CC: Lizhi Hou , , , , , , , , , , , , Max Zhen Subject: [PATCH V1 XRT Alveo Infrastructure 4/9] of: create empty of root Date: Thu, 18 Nov 2021 13:03:18 -0800 Message-ID: <20211118210323.1070283-5-lizhi.hou@xilinx.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211118210323.1070283-1-lizhi.hou@xilinx.com> References: <20211118210323.1070283-1-lizhi.hou@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3cb75961-2ea5-4cd1-8a60-08d9aad714bf X-MS-TrafficTypeDiagnostic: SA1PR02MB8400: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zyYZQlkZUxh7piK10PdqPbAg1G5Md5CNCQL8A5NWHlM6O5EyBw26G03oMsoVSgaDXYD5N8YDsjYXz39N9UL8RxZJv3ARODeqZULvUv2puuhUpeKRqZ6zyiQOsWirv1h8f1Kb+fA6rUnfX8PAqn5sZ5TRdMjQsbtD9N+DL+nkxMxfmjOd8CVd5kTdY7sQIQg/FZR/TLDown2Q4mdCzEXsK72eu0X0u1EtAfVKfCvgI9HsjOOq1ZWZs3ibjE0ZaRL69geSjDTRTcBDUZ2MdHxSCF02csJH6vJwXDx8JUO1epB4ZBlNv8fQBcWLLE1z4PEI5BA8waiqkcaZez7100XiJbfKv7JgI2QlC42SMC+NrG6eOye27u+tNUgXCzD62I8jjskzm7i3edpaIoJtxoNifLP9blIUJSlPpGtR+Czz3QbKwRHrLcByG5fpDjFsjXzWFHX6vOzVsZMZWqo7aY3Snxssa3FUjgveO1yguT+ERewD3LhIlQpvCBrtxBkaBWUnCT7TUPc8aJgB1wnEFF9wGC+pWVk3GVHiIJM5jIFuFSJT+DVm5DlxEncZq61kxmDGzlT658Dnsp+zUh4k+FgztTGqLUgB+ANvJYHS4zTqzKNrSbD9F7nbWa8e4Ca5K3rZ9rgnwCRrvnU/PWQFUZCBruI0tTJs8S4tuCIQyKgez1bV4KzG8srEbP6n4vr0lgW25m/+Z8CLWv+a99npyzqL0w== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(46966006)(36840700001)(6916009)(5660300002)(1076003)(186003)(82310400003)(36906005)(26005)(6666004)(70206006)(70586007)(8936002)(8676002)(508600001)(336012)(36860700001)(42186006)(4326008)(6266002)(44832011)(107886003)(2616005)(356005)(47076005)(426003)(2906002)(7636003)(83380400001)(316002)(36756003)(54906003);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 21:04:59.1613 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3cb75961-2ea5-4cd1-8a60-08d9aad714bf X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0018.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR02MB8400 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When OF_FLATTREE is selected and there is not a device tree, create an empty device tree root node. of/unittest.c code is referenced. Signed-off-by: Sonal Santan Signed-off-by: Max Zhen Signed-off-by: Lizhi Hou --- drivers/of/Makefile | 2 +- drivers/of/fdt.c | 20 ++++++++++++++++++++ drivers/of/fdt_default.dts | 5 +++++ drivers/of/of_private.h | 5 +++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 drivers/of/fdt_default.dts diff --git a/drivers/of/Makefile b/drivers/of/Makefile index c13b982084a3..815f5220465b 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -2,7 +2,7 @@ obj-y = base.o device.o platform.o property.o obj-$(CONFIG_OF_KOBJ) += kobj.o obj-$(CONFIG_OF_DYNAMIC) += dynamic.o -obj-$(CONFIG_OF_FLATTREE) += fdt.o +obj-$(CONFIG_OF_FLATTREE) += fdt.o fdt_default.dtb.o obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o obj-$(CONFIG_OF_PROMTREE) += pdt.o obj-$(CONFIG_OF_ADDRESS) += address.o diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index d64445e43ceb..3d6e4543419e 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -481,6 +481,26 @@ void *of_fdt_unflatten_tree(const unsigned long *blob, } EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree); +static int __init of_fdt_root_init(void) +{ + struct device_node *np; + + if (of_root) + return 0; + + if (!of_fdt_unflatten_tree((const unsigned long *)__dtb_fdt_default_begin, + NULL, &of_root)) { + pr_warn("%s: unflatten default tree failed\n", __func__); + return -ENODATA; + } + + for_each_of_allnodes(np) + __of_attach_node_sysfs(np); + + return 0; +} +late_initcall(of_fdt_root_init); + /* Everything below here references initial_boot_params directly. */ int __initdata dt_root_addr_cells; int __initdata dt_root_size_cells; diff --git a/drivers/of/fdt_default.dts b/drivers/of/fdt_default.dts new file mode 100644 index 000000000000..d1f12a76dfc6 --- /dev/null +++ b/drivers/of/fdt_default.dts @@ -0,0 +1,5 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; + +/ { +}; diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h index 631489f7f8c0..47c6bb47ef25 100644 --- a/drivers/of/of_private.h +++ b/drivers/of/of_private.h @@ -41,6 +41,11 @@ extern struct mutex of_mutex; extern struct list_head aliases_lookup; extern struct kset *of_kset; +#if defined(CONFIG_OF_FLATTREE) +extern u8 __dtb_fdt_default_begin[]; +extern u8 __dtb_fdt_default_end[]; +#endif + #if defined(CONFIG_OF_DYNAMIC) extern int of_property_notify(int action, struct device_node *np, struct property *prop, struct property *old_prop);