From patchwork Mon May 15 10:12:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 94088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6815562vqo; Mon, 15 May 2023 03:34:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5TumL4yeHheCksWqV2vf372JE1TObu4P8SXT6CgSLXMoEat7vhp2+cqqkqH3TBuI3EBXef X-Received: by 2002:a17:902:d48d:b0:1ac:8835:b89b with SMTP id c13-20020a170902d48d00b001ac8835b89bmr30890441plg.5.1684146883418; Mon, 15 May 2023 03:34:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684146883; cv=pass; d=google.com; s=arc-20160816; b=IpKjhACfdNSSxr21RW7XWHy+EvV7qgtHcChNFQ43G4r8jWLrB6kr8O1pn7Y6uzbt2q SK3WQVwcTm2VxRxCmNzz60FbsOqp+mxTEmqS5qrFiHdXcjcYDE3BHq6VukiPiF41r2wU HZAdD96HZsQV9YQ1XkK0y78aIONiaiL/s5AuFREB+BXUgny6pm3YAjFOD9QunTPBhPdc NbxEZiLU0sixtNkBCeCV2ilB0GecO7mot4hk3QjjzFHPDr/girHk6ihKJAVz656q3dvq hd3DTNMcf5W9w+MoAkHNf86ud68E/kxcuzsGwK5fXJ+KT1VLrpuJ2hTNjM3ZdKUytrje 0hRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=olVuiJZGfA/LHV3YVLMLjpbt55lnzWTZbOuO9FJhuMI=; b=fokvkibepV2YNghinW4kUFxUwotzrgiknt27/mZwI7OoxnbdAngaEEpJVPxR7bTJEN VLgVmmoGBUrbrRRJPFm3ZpeR152JigaEvBWDQyCbEbvalEJl2PuijNXmASQ+hkjAoiuY bkqH/rutF/0Q3FM97uXA12d8a+GZo89PB7qRMZNqipVvvSKV8qBZxwL70jEIFJ1zAyba 612jW9Q9cYMCy9vmZ2CdS4aq9h8O8csW9TBl0RsgnO8WyRnjPTOsT1aCopXh+F+u2Chf WaF/pmL/32BbjeEyGsnuE4AxnAMjgPpSlJiw1blDqHR5XHXDh1JwDRh4SW2MtQ2+lvZS xqfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=CY+o6P9V; dkim=neutral (no key) header.i=@gerhold.net header.b=NpzOsiBC; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s28-20020a63af5c000000b00530b7eca08esi5237359pgo.340.2023.05.15.03.34.29; Mon, 15 May 2023 03:34:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=CY+o6P9V; dkim=neutral (no key) header.i=@gerhold.net header.b=NpzOsiBC; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241144AbjEOKQ1 (ORCPT + 99 others); Mon, 15 May 2023 06:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240832AbjEOKQM (ORCPT ); Mon, 15 May 2023 06:16:12 -0400 X-Greylist: delayed 179 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 15 May 2023 03:15:35 PDT Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E02BC2106; Mon, 15 May 2023 03:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684145544; cv=none; d=strato.com; s=strato-dkim-0002; b=qDTIIAzqDyNFmO0GjIMWdlTAsPfxoi9c54XrSPnPIBCD+/Ac0NqjPIo6RX6ZXYFA/v XfSRhLCFFqaZY+hM+ieOq8rjSYgktwQ/tfFSeaZAmb+l7MHOBSN4ag8OibJxs/nNzGuJ yqHI9U60zAdGQoDotldrbSoLHJ3sxR3Qfu9o4COGYCqhsQq6l6N9z7Kw7UQS2+hRBwIR ftSNtfx19eFQlt3El2cFRuG67B9/TXphBjO+Sjj2KW4jf6hH/KJ9cnxjcR4SGfqgcLPZ RArsEHlfPp6fstmF4Zj5Agy2rxlSMF7RV1jvuhngOzoXFykStQDrUs8J8MweXQjExpqD ybsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=olVuiJZGfA/LHV3YVLMLjpbt55lnzWTZbOuO9FJhuMI=; b=V6mauyZYvxwo5w3sMUAKskAbdeyyXVMqzWDRWwTuyaCbU9/14gd3OZUCy4fSob6NBl +pP2fjAi05cVDIRS9WVjjmdDh4HOuGTqMstUiaOGL+XIs9QGySlmIgEiCO4M1q/1iGSu MWPKD5uWoPvJ8KS524PAe+iZXzdMYRXYiM20K4LDW40/PHJ2AMGETzRzF5TxMXQxXVGa u3uIVWYGvYN4z1wyYRYEN69RSAS6OQjxcWqlhYXj9so/o/hJH0q/I11WFB7yU5AJ5Ta0 q9xTCt4ceGjb82ozounPElMKglNLribywWcnBbr5wYmG7TgOygKjw0qkUhK+O4y4CM4Z xfyg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=olVuiJZGfA/LHV3YVLMLjpbt55lnzWTZbOuO9FJhuMI=; b=CY+o6P9VjlLTzgmoC0ukNBftxBPWTp+7p5Sf63HXc0kUdrbe51QDEhkdp9Wtei8gCx 36mkGqS1MxlBxUd2aUZm8VSzzNvMDQ+iEyrYqhhDomIXlgCGy0lYIQlTuJVh/7vTZXjH LZk02fO22jf3tEZDtUtM/hEzd/CoSxwcSfng63j1v3SMB17uUs5bzuub7PAMNgvhSk5h fVs9gKoT23x5tolvWfYrBeCcMwEdRGVXI+f17rwhgYErxVvZpiA+WYm8KF5vlZFlNfSK JKBYgV4xLhWiG84cXENjPysczqq8CwbFkGjrxDqLv8EBWXhxPuxZ28E+Od8VshjfWQ3m NQpA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=olVuiJZGfA/LHV3YVLMLjpbt55lnzWTZbOuO9FJhuMI=; b=NpzOsiBC7Df5KrzmYokWRVug7C5LvTnshPFSpfjZg+SXou+lgjK2J8KTa7xrsVuGtr lptCIGHXxBH9BsowsSBg== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4ly9TY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id j6420az4FACO1JG (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 15 May 2023 12:12:24 +0200 (CEST) From: Stephan Gerhold Date: Mon, 15 May 2023 12:12:16 +0200 Subject: [PATCH 1/5] dt-bindings: reserved-memory: Add alloc-{bottom-up,top-down} MIME-Version: 1.0 Message-Id: <20230510-dt-resv-bottom-up-v1-1-3bf68873dbed@gerhold.net> References: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> In-Reply-To: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Rowand Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , devicetree@vger.kernel.org, devicetree-spec@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765956002194445469?= X-GMAIL-MSGID: =?utf-8?q?1765956002194445469?= Right now the allocation behavior for dynamic reserved memory is implementation-defined. On Linux it is dependent on the architecture. This is usually fine if the address is completely arbitrary. However, when using "alloc-ranges" it is helpful to allow controlling this. That way you can make sure that the reservations are placed next to other (static) allocations to keep the free memory contiguous if possible. Signed-off-by: Stephan Gerhold --- .../bindings/reserved-memory/reserved-memory.yaml | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml index c680e397cfd2..56f4bc6137e7 100644 --- a/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml +++ b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.yaml @@ -52,6 +52,18 @@ properties: Address and Length pairs. Specifies regions of memory that are acceptable to allocate from. + alloc-bottom-up: + type: boolean + description: > + Specifies that the memory region should be preferably allocated + at the lowest available address within the "alloc-ranges" region. + + alloc-top-down: + type: boolean + description: > + Specifies that the memory region should be preferably allocated + at the highest available address within the "alloc-ranges" region. + iommu-addresses: $ref: /schemas/types.yaml#/definitions/phandle-array description: > @@ -93,6 +105,10 @@ properties: system can use that region to store volatile or cached data that can be otherwise regenerated or migrated elsewhere. +dependencies: + alloc-bottom-up: [alloc-ranges] + alloc-top-down: [alloc-ranges] + allOf: - if: required: @@ -178,4 +194,27 @@ examples: }; }; }; + + - | + / { + compatible = "foo"; + model = "foo"; + + #address-cells = <2>; + #size-cells = <2>; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + adsp_mem: adsp { + size = <0x0 0x600000>; + alignment = <0x0 0x100000>; + alloc-ranges = <0x0 0x86800000 0x0 0x10000000>; + alloc-bottom-up; + no-map; + }; + }; + }; ... From patchwork Mon May 15 10:12:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 94081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6807868vqo; Mon, 15 May 2023 03:19:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vvnXqhW28fEK4CsD/fy+ucmohPJq6aB5e5DfTDrfALT/SnMh2bFV6NKSqv0NTgmIRJ4LW X-Received: by 2002:a17:902:a706:b0:1ae:1751:159 with SMTP id w6-20020a170902a70600b001ae17510159mr3385600plq.23.1684145984336; Mon, 15 May 2023 03:19:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684145984; cv=pass; d=google.com; s=arc-20160816; b=Ta5hLppY0aUiAwVXlfxVgjAPCkqB3nudLEkpXHHyVVzX9hAYSfdOEz9eEqjrTb3n/1 idN5i9/Z900WCVeUChpKnzbkjklxqOKreXO3o/9K0ciquWpwHi/ePHAQLNwTL+w95CgZ 5fxx8XYvfPfWVp91xi9f6POW1YH2gYRa6u0arG40fm/3AC7mnscYo/YUX2r/zCLHUwqg 4egXj1UA701Wa7/Ll5CF27mqm4WAcpiSoA3n5x3IPduGStxwz9yBoVwtjFSIMrEBogKP mBes5On35f75qDJGC113Ulaqeao2tDN0rYDG/pKR19rBwN5KlQoSxPv9bwh68BMk8s6R GBSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=jfB/CpVNa1JJ+lCLjNohI5jzcdCGpDmi64bliceUj4E=; b=l9/CT1Dd8rPKsJWAG8dS4tYYT75N6gdoVD+qSwAvkrhJpjsg7gAxyVQBqcclyP5s2O vPed4Zce6DHxSv/cYPzGPXbtQK1qZuvJcXOKsvnf07EvJcLyFstmX876vcwTWaN2KBSQ wA0Mi28k9XVgIMpZuPuXLZXwS78oPxebXDtNWIqXlJDLh6R6xOwpcAZUeJjhH6I5vVtj sHPLTbG/OM0935GDd+uMAVIyj34+mY9jVmoBslY4hFzuBN91kbz0cvzrZ60HTbhPAno1 svjMJGiobHazel3DlgbxasQNUNt4j2N0YsaFN7i0HFAyJfkMZefDz7cN4fxutJzRVG3X Sx4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=WROWHfEy; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=0IzAm2OS; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e2-20020a170902b78200b001ab197cb503si15415186pls.355.2023.05.15.03.19.31; Mon, 15 May 2023 03:19:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=WROWHfEy; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=0IzAm2OS; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240546AbjEOKQX (ORCPT + 99 others); Mon, 15 May 2023 06:16:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240414AbjEOKQL (ORCPT ); Mon, 15 May 2023 06:16:11 -0400 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [81.169.146.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A632102; Mon, 15 May 2023 03:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684145544; cv=none; d=strato.com; s=strato-dkim-0002; b=T8Uit922Ztk76khdVJSDdctVn6H1THgKHsSXYuvr+EKjImFJ5E7zJF9AMM91JczFgG t51IDdXavoFrTxcE/+JkConLRr1Pkv1O+T3VtExVAejK7bNZxrXK0h39sqExka9ZsIHm DvXiaURmi8hEVPj3+xKcKomyd0nAtI4Lk3mIKfYUhlUxMvepW+YIEFLwtEIf/LCdIsVH vlIahSVpxljh0uVZe2qaPECyxSP64xUD3TmVtBWCMuoVbLHDw4Soe2AYnEg4iJrArT02 RUyU4/PPRxPKsdG7Zk4RzMjOUe4PxO++QVMKdhAHxz3PBBY/7BIstevhZRL1nuZEfx6y zyNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=jfB/CpVNa1JJ+lCLjNohI5jzcdCGpDmi64bliceUj4E=; b=bC09aaEomTGV5NEiEiq0AOH/urBGNKEM/WfGT+qgQdfFrtI1BqsuKHJ9rXf7fdGCia sbCiafS8l1vCkM7XzRFX+q+mSSqBmEOM6xurlqtD2/t1Df14fsHxQdYAWdfKyM0lYY7t gh27yhgwLDWHIlFERSFxMlrI7kRb7D9cc5NrvKAp8ReVEARTMNHBK+2TqetvpsCpgNZv OIdtIHGiTYrFBkw2SwOdTyIYl0i3gXYtdY6eBSFHYE6Kv+odNenRcW6AA6SNV9pgcKFv hwQwOEGklFA/Lf5YkLRwtZID+ZC+fXpJA0x/HW6XAq/jUTFWqtC1rn+lyP0ou/hER5Ou ka1A== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=jfB/CpVNa1JJ+lCLjNohI5jzcdCGpDmi64bliceUj4E=; b=WROWHfEyjMq/Q/G1dolZPFwt4ZlT+ICnNtbgViYYzlfQwkEAcmL27Ezq8Lgr7439eC BHXmRl2eUjMEHnQyIVMgB+VoM6XCZNrMzH3/QOiOnP+MqFYha4Lj64im5n3vXH7Ea4Ch pxDms+Cf58akmv1XgezvGTPHzGCcJlMiBWvmWrVme3esZ30esR1G9NVpTGprb/U0r2Du 5oWM7c7l9c2VO1PjNuvrjwOuIElJo/1fcV+mZ+ypA4i1UcxaKvWpVo+6fKbu9IKW3qEg 4J95wqHk6h4KpGZ/1NZh8PVKGBKmyTVPT+d0CHWhahqMNmES7W5IBQ4RiIV64udkyLCF /FGQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=jfB/CpVNa1JJ+lCLjNohI5jzcdCGpDmi64bliceUj4E=; b=0IzAm2OSKSa3+6O4Nfm1SUdH5UqnTb2zgC4j3SBLyKUO0zGxZdG3JlmLSrT7PZHhsE 1vgoLsnBEKs5RsAFeoBA== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4ly9TY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id j6420az4FACO1JH (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 15 May 2023 12:12:24 +0200 (CEST) From: Stephan Gerhold Date: Mon, 15 May 2023 12:12:17 +0200 Subject: [PATCH 2/5] of: reserved_mem: Implement alloc-{bottom-up,top-down} MIME-Version: 1.0 Message-Id: <20230510-dt-resv-bottom-up-v1-2-3bf68873dbed@gerhold.net> References: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> In-Reply-To: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Rowand Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , devicetree@vger.kernel.org, devicetree-spec@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765955059487389211?= X-GMAIL-MSGID: =?utf-8?q?1765955059487389211?= Use memblock_set_bottom_up() to specify an explicit allocation order for dynamic reservations with "alloc-ranges". Since the default value varies between architectures the previous value is saved and restored after trying the allocations. If neither alloc-bottom-up or alloc-top-down are specified the previous implementation-defined allocation order is preserved. Signed-off-by: Stephan Gerhold Acked-by: Konrad Dybcio --- drivers/of/of_reserved_mem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 948efa9f99e3..6443140deacf 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -89,7 +89,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, phys_addr_t base = 0, align = 0, size; int len; const __be32 *prop; - bool nomap; + bool nomap, prev_bottom_up; int ret; prop = of_get_flat_dt_prop(node, "size", &len); @@ -130,6 +130,12 @@ static int __init __reserved_mem_alloc_size(unsigned long node, return -EINVAL; } + prev_bottom_up = memblock_bottom_up(); + if (of_get_flat_dt_prop(node, "alloc-bottom-up", NULL)) + memblock_set_bottom_up(true); + if (of_get_flat_dt_prop(node, "alloc-top-down", NULL)) + memblock_set_bottom_up(false); + base = 0; while (len > 0) { @@ -148,6 +154,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, len -= t_len; } + memblock_set_bottom_up(prev_bottom_up); } else { ret = early_init_dt_alloc_reserved_memory_arch(size, align, 0, 0, nomap, &base); From patchwork Mon May 15 10:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 94086 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6814143vqo; Mon, 15 May 2023 03:31:50 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4KUlWAcJnE00ByJmnIKCpGKrqYy3bNi/m97UwO1vRTrFF41fDEHGP4qIhi31svNTIkW3Z1 X-Received: by 2002:a17:903:2292:b0:1a2:3108:5cc9 with SMTP id b18-20020a170903229200b001a231085cc9mr45193453plh.40.1684146710332; Mon, 15 May 2023 03:31:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684146710; cv=pass; d=google.com; s=arc-20160816; b=qNAOezPr0HkkIwYf0TRAg6kMnO1ZqSGZ2yd7BetbfXAxntqJ9PcnqXVd19qZaVekPi fpfzQQ3AhsqEUnsyEW8E2oIBe+HBrCGmHkRIT5tLCVTW5P3sMBuBvvDQjUVEj0vhTIgY gPSuOng8d9PQKBe2GryXt8NZWkhCPq9Y4D3GBhhFdm6IMPTbzE6C2CPBLbcxuXZRLKCn J7ALisN0MfzpqCJUOehgZIFzSMMu5dtldwW3k3WZh+HvhZuL0ryJ0wgnNEtOI76HQDOr yMcrrsN7f+GFyK0lXItkuWrZngzhZBJFrCvxGvQ2WItgd/ke1c6AgisD6iTa1fxwajUY +dNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=DNTC0U3plBj7cthESRLpCld4G4lr+3CgqNixMQWGBow=; b=OPI7dbhT+PMiwii17lU6Odb8ZP8M3wTiYdls37w3qpDzAdsCAFFSEmJghSQEPVtmTv Icy++jnV8ehJEBitkNJn3ywBeYu1lGiUDXQKeGH337M0lAilityl8/Kb0P5p4m0MTbnp Tg3cDJHkfbm1PSq3BfHUhUgzEn/q4d40Tv0WXF6yDOMIiNPfHhgV9FP2AUNm/mTOf7Ei K1+J0yVKz8BUXhUnTJ2NH1dwFYwrKfsUplS8jFttIzdMpumlgpQzq3g0be8tonRkqTHO 00Vfvaqe1akAiojzU3Wbq5uY8RYSvIrMlKwSHpuXfCXZxJ1rlL84p0q2Vuvq2xgw0YFi LJoA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b="op7/C51o"; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=gMMt+EFd; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a17090332cf00b001aafea6f85esi17242004plr.435.2023.05.15.03.31.38; Mon, 15 May 2023 03:31:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b="op7/C51o"; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=gMMt+EFd; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239945AbjEOKQn (ORCPT + 99 others); Mon, 15 May 2023 06:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241077AbjEOKQN (ORCPT ); Mon, 15 May 2023 06:16:13 -0400 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AE82173C; Mon, 15 May 2023 03:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684145544; cv=none; d=strato.com; s=strato-dkim-0002; b=gid8Z8GPX+8U8veQDzigS8Kg6g36Fygn5Di1dTukcxwv9ENyB9BT7VxZHsIFy2fLS5 A/LqUC1JPW00lcgXen7jK16CCDBjCluAkZEWAS2BHyfmAvVrGBymfKuXv509DjqpLywO b8ltprG0Wd+RKsm3/tk7f4haWCVOfSEcGaQbNIQFYyoZnwOOcd2x3ycFFYRtjcEqfgnE 1ZVL909FOqrOY5d1Qvb9LVmVQD1diy38FVZKscTk5by5QilsXcKgm8h2N/C5xU0ZzxNS ZssZslo9rhxI7cW5Op0dusCJ3M7q5WzNfNOD5k1/DV6zpolgMzP/+tJAVRAIPf0iJ3Tt z3Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=DNTC0U3plBj7cthESRLpCld4G4lr+3CgqNixMQWGBow=; b=B640sq6QxE1g7r5NSs5nSKwdO0W6d5EZsOuxZ1B0bGH8H4VYZc2kuF6nfUSNze66oo uDYKmzbSB/feJ2pHf9fpDckepVVjyt47dwpfspm/S1syU8PnC/4ObI8Bg9Et/jkzTFIO eF0G+tb3SccVQRLWHdTwAFS/53TAXHEZMAmm6COT3TdPl3quPBeEC5pwZg7DFNlmyoJz Mtf0vtHHotD+zjRuDdXcy6tA2p/pkOv/txHRkUwrib0TcCGm6yc9jjTauOS1IqsP0kfu TVslfMhPw6UYTJ9bUI1QbL7szA/B0Imh9LOZd4jHwRyjvDV7I6iiWGji1PM2fdM5q49r Lgeg== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=DNTC0U3plBj7cthESRLpCld4G4lr+3CgqNixMQWGBow=; b=op7/C51ozPARSOEyrMPwMTrmQQgjf+W/Gx3IIhxw7EY8aDIImpixNrB6PSIS2YAZXY 40c5+jU2bqPIKPwlhcf/8ua+4uttvlmm/Z0/UTxvg8f2ViJEY7u0OTzNUk2ZYM57ckr2 UxRbDawLu/LFc5R4r0PjCd1MlaX2+ncl70AdCmc6cgIHzC1n4bR1zQUBYlOtAjUHo18d lLO/Zc/p0ewSGPnRhZ1WbvI23htdtVmVzKiodXnNdfdJeK8ro8ttLYam85ebX+6eRD5b jRERkKUE+s13J+91vGLuX9gB7Fh4OL3RJUvznHHi0j5w6JZ0xq2LAkW+UbhSGwojrSUf tW8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684145544; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=DNTC0U3plBj7cthESRLpCld4G4lr+3CgqNixMQWGBow=; b=gMMt+EFdTB5ds3J1kxDXQo7JfoVyAQx2QRs1dmiW5lPRexdNCZs/JQvvOFUBF4781W MEy3TBDkmpRCfTcEnkBQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4ly9TY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id j6420az4FACO1JI (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 15 May 2023 12:12:24 +0200 (CEST) From: Stephan Gerhold Date: Mon, 15 May 2023 12:12:18 +0200 Subject: [PATCH 3/5] of: reserved_mem: Use stable allocation order MIME-Version: 1.0 Message-Id: <20230510-dt-resv-bottom-up-v1-3-3bf68873dbed@gerhold.net> References: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> In-Reply-To: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Rowand Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , devicetree@vger.kernel.org, devicetree-spec@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765955820870555839?= X-GMAIL-MSGID: =?utf-8?q?1765955820870555839?= sort() in Linux is based on heapsort which is not a stable sort algorithm - equal elements are being reordered. For reserved memory in the device tree this happens mainly for dynamic allocations: They do not have an address to sort with, so they are reordered somewhat randomly when adding/removing other unrelated reserved memory nodes. Functionally this is not a big problem, but it's confusing during development when all the addresses change after adding unrelated reserved memory nodes. Make the order stable by sorting dynamic allocations according to the node order in the device tree. Static allocations are not affected by this because they are still sorted by their (fixed) address. Signed-off-by: Stephan Gerhold --- drivers/of/of_reserved_mem.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 6443140deacf..f6d14354a534 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -224,6 +224,11 @@ static int __init __rmem_cmp(const void *a, const void *b) if (ra->size > rb->size) return 1; + if (ra->fdt_node < rb->fdt_node) + return -1; + if (ra->fdt_node > rb->fdt_node) + return 1; + return 0; } From patchwork Mon May 15 10:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 94083 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6808185vqo; Mon, 15 May 2023 03:20:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Yh5aD4MwTKUWQCNNWeZ1vyfXIwjVhrHNpC6XrmG3aF9KO7YBbcm9flbNFXPcsMYwXOwov X-Received: by 2002:a17:902:c3d1:b0:1a9:581e:d809 with SMTP id j17-20020a170902c3d100b001a9581ed809mr33000494plj.7.1684146019787; Mon, 15 May 2023 03:20:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684146019; cv=pass; d=google.com; s=arc-20160816; b=NJxN/5QD+HhcWD2yt4Zxk5ecZPtfjeIrz8NhSjWAlOwjSrEPgW8SvVRPi4VfArEkZn HwdQ13U1o3TzDDMRU9GeEKLuZQnw/mhGSxlDesIk9oSdqKhMvzOXXobsrFvX851J+61C GhfI49gfC97BbAamW9/UzWlq7mrH877FajVUPAjQ0HM7eR5r5QTkw/dvdccHCisiWUkB GSBuVWU2Lv/IXAxkmSbKhzLOnv6PfkJEAoOZBWoFTP2SBqTeZokDTjYGWrZXfUtYe+v9 w3kUX33VcmwNDT8SKi2okSH7ClmfAoUBLgka9wEzmmF13N48L5hRPFFtLCL2Kup2xw/s ITQw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=3LlKTLyOPLCsMajuxocSXbDRZ9+pHs4RCOi8py6qtBg=; b=X851tmdBObHEslbjrZ6O9DVVMfuNtdTIia8QZNv5dbrdxhl02sMjYJ86hHIIwK92Ur B5SgCQfbo6y9ktA42h71yBhr9XsUOO4yEtmx/Z0rB1wNcuBJlzD2usy4e4FeTVyVTntg er9Wp1TFsRcRStfKOQ9nejyuM8hWC/uFlJPVF5mTwcRioFvDTbcW7WXVw+eC1nfg9TU7 B8cOFoM8km+8rVzMzRkTm/2tA26nQYB+YcrqeXhoIL0WxZj14t9wZgbKW/MYgIkZ8njb JkdXXsHHrxiIQo1tkT1Xbi+LYRZCvuF4+1yFMlxuZvBUemUx5qr/LdpK/eCla+R1sXYi J2/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=kYuWwP8R; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=SoA2ZDBV; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e2-20020a170902b78200b001ab197cb503si15415186pls.355.2023.05.15.03.20.07; Mon, 15 May 2023 03:20:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=kYuWwP8R; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003 header.b=SoA2ZDBV; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240953AbjEOKQg (ORCPT + 99 others); Mon, 15 May 2023 06:16:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241079AbjEOKQN (ORCPT ); Mon, 15 May 2023 06:16:13 -0400 Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B84010D1; Mon, 15 May 2023 03:15:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684145545; cv=none; d=strato.com; s=strato-dkim-0002; b=DU5Ntx1GSrrExqV7mBRR58zNc4UWfZ5m5g1wcJ0Z3p9gFB5T+clYDwVlAxXeZEv60d KqMfzbhg4MAVvDDzVooTeZCSDOk4ZkNxXpzB/97yKXbb8pswpoE7DMONMW3BDdLz5F7y JB3jbrXT77ZdtcRylB+b6iGdzrU1y4FDI2R/IYSHH4sRbduV/rIAACFpcW7noWqUSEbb +/JRS8AXq5v3CdzDtmkU3od4JvgybIWrvQ3tdJ1crZqFzV3rXfLTU/l1mfxdZBLRwLUg V/2q9kP531H7bRpIa/oOc4SkMeuCVTsyXceZiuX+oQtjfCdMkW1wHwwUpcgbmzWjTRcG NSJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145545; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=3LlKTLyOPLCsMajuxocSXbDRZ9+pHs4RCOi8py6qtBg=; b=bX/y9U8+/itPfSzXWRkC483pv8zAPoih7A2WKW1YZoJ7CB7KI6NYj2TqgJFecSm6vS tAwSIFmg89VmzNqiT19UB144MyJvz0emSsrjLyT5ZEd9zNPzfLLWpjTmS/vwqEpBRC66 hO51Un1ZCf/Qapr4GEIjptVnpKPGkgbF7yM8XStlbXW1jPLNmz8lu8uDyqbfSWWahsi3 vrPzv5YYapF1CMnynFRztsaMM87QAxRS9KL5c6eoN+8P7B26AWE9TqmWCw5bTno5o78U IFj8oZfZNjkII8RHng46Ygm8jXVRval2rlbDDzvJ9IdaX/Jrem00ZaZySrxNYE1IevX5 dd3A== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145545; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=3LlKTLyOPLCsMajuxocSXbDRZ9+pHs4RCOi8py6qtBg=; b=kYuWwP8RTvUBZFdkPMyR485etSDWgsiFGYHAItORqhf3cW58TJfaLY2NZPDxSSWGRX wuAhoxb07970pDU05wpHpRB1Xed+NPnvCITpNNG+yDwND6DqD501jpbyrAhMJX1Pm5qz oCtmA3W573E3Fya9zW5h+cBghK/eB0x/D7sePbujdkFLGY2XUTAMo47xoperDLinX3EJ Xc0x4VQAAgP94wnC+VwSx6IpqqRGVFrNBsqzNYxh/EDgQ9LFvTWwSXNj0dV+VchPNypL QwfJWmDQAuo6DMmaGfwN+jItj70PXlG/VZmzhPlY19fc2NHAs7FkCT21S2gxE3q/ZR92 Sapg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684145545; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=3LlKTLyOPLCsMajuxocSXbDRZ9+pHs4RCOi8py6qtBg=; b=SoA2ZDBVnycnBaA/jyKIPH3jOB+OlGcurcQXn89npJE4BewPTk4p2DSSEdiVRV+/oN WQnkCGapzkf3VsdTVVCA== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4ly9TY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id j6420az4FACO1JJ (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 15 May 2023 12:12:24 +0200 (CEST) From: Stephan Gerhold Date: Mon, 15 May 2023 12:12:19 +0200 Subject: [PATCH RFC 4/5] arm64: dts: qcom: msm8916: Enable modem on two phones MIME-Version: 1.0 Message-Id: <20230510-dt-resv-bottom-up-v1-4-3bf68873dbed@gerhold.net> References: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> In-Reply-To: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Rowand Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , devicetree@vger.kernel.org, devicetree-spec@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765955096712987809?= X-GMAIL-MSGID: =?utf-8?q?1765955096712987809?= DO NOT APPLY - this is just an example to show the motivation for the patch series. For clarity only some of the device trees are updated. On MSM8916 there are different independent firmware regions, e.g. for the modem (mpss), WiFi/Bluetooth (wcnss) or video acceleration (venus). They need a specific size but the address is relocatable within a certain memory region as long as the necessary alignment is respected. The modem firmware size varies from device to device depending on the available functionality. Right now msm8916.dtsi specifies the firmware sizes for the DragonBoard 410c SBC, which has smaller firmware because the modem firmware only implements GPS but not LTE etc. The modem firmware is much larger on actual smartphones. Unfortunately, changing the modem/mpss reserved memory size requires shifting all following reserved memory regions to new addresses as well, even though the size for the wcnss/venus firmware is the same for all devices. This introduces quite a lot of churn with many magic addresses and room for errors. Only two devices are shown in the example below, but similar diffs would need to be applied to 30+ more similar MSM8916 device trees. Note that msm8916-longcheer-l8150 is a single exception where the wcnss firmware is not relocatable and must be loaded at a specific address. It is included here to show that the dynamic reserved memory allocation in the next patch handles this automatically. Signed-off-by: Stephan Gerhold --- .../boot/dts/qcom/msm8916-longcheer-l8150.dts | 29 +++++++++++++++++++++- .../boot/dts/qcom/msm8916-samsung-serranove.dts | 28 +++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts index f1dd625e1822..4a5eab06c18b 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts @@ -21,14 +21,37 @@ chosen { stdout-path = "serial0"; }; + /* + * For some reason, the wcnss firmware is not relocatable, so it must be + * loaded at 0x8b600000. Unfortunately this overlaps with the memory + * region usually used for the modem firmware (0x86800000-0x8b800000). + * However, the modem firmware is relocatable, so wcnss is placed at the + * fixed address and all other firmware regions are moved to a fitting place. + */ reserved-memory { - /* wcnss.mdt is not relocatable, so it must be loaded at 0x8b600000 */ + /delete-node/ mpss@86800000; /delete-node/ wcnss@89300000; + /delete-node/ venus@89900000; wcnss_mem: wcnss@8b600000 { reg = <0x0 0x8b600000 0x0 0x600000>; no-map; }; + + venus_mem: venus@8bc00000 { + reg = <0x0 0x8bc00000 0x0 0x500000>; + no-map; + }; + + mpss_mem: mpss@8ec00000 { + reg = <0x0 0x8ec00000 0x0 0x5000000>; + no-map; + }; + + gps_mem: gps@93c00000 { + reg = <0x0 0x93c00000 0x0 0x200000>; + no-map; + }; }; gpio-keys { @@ -218,6 +241,10 @@ &blsp1_uart2 { status = "okay"; }; +&mpss { + status = "okay"; +}; + &pm8916_resin { status = "okay"; linux,code = ; diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts index 1a41a4db874d..25ad098b1503 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts @@ -36,11 +36,35 @@ chosen { }; reserved-memory { + /delete-node/ mpss@86800000; + /delete-node/ wcnss@89300000; + /delete-node/ venus@89900000; + /* Additional memory used by Samsung firmware modifications */ tz-apps@85500000 { reg = <0x0 0x85500000 0x0 0xb00000>; no-map; }; + + mpss_mem: mpss@86800000 { + reg = <0x0 0x86800000 0x0 0x5a00000>; + no-map; + }; + + gps_mem: gps@8c200000 { + reg = <0x0 0x8c200000 0x0 0x200000>; + no-map; + }; + + wcnss_mem: wcnss@8c400000 { + reg = <0x0 0x8c400000 0x0 0x600000>; + no-map; + }; + + venus_mem: venus@8ca00000 { + reg = <0x0 0x8ca00000 0x0 0x500000>; + no-map; + }; }; gpio-keys { @@ -263,6 +287,10 @@ &blsp1_uart2 { status = "okay"; }; +&mpss { + status = "okay"; +}; + &pm8916_resin { status = "okay"; linux,code = ; From patchwork Mon May 15 10:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Gerhold X-Patchwork-Id: 94080 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6807780vqo; Mon, 15 May 2023 03:19:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5bkfqZ6LSpk7Y//a9w4aRXGvgGTj1KNBAhNsxLgR57nkma825gxoyM3Z2xTrzbf7QZidpv X-Received: by 2002:a17:902:db08:b0:1a6:b496:4053 with SMTP id m8-20020a170902db0800b001a6b4964053mr39085380plx.59.1684145973809; Mon, 15 May 2023 03:19:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684145973; cv=pass; d=google.com; s=arc-20160816; b=mbLVXbWSm/Vi70ogF9JxFriAzkQbtYOBiyosHd7930vD8z/n3iocOqQVFjyizwevKX 22W0+EpdsMFDlyEvQx94CpQKL1BOnf/O1ooAOjwMD9OvR3VH+qpLdBERroNZ2v/RGhsE NvlsHpY0KtjkKztzXOw6dkGsLvl67P9k+UfG0+cSwO7yILldJNty4VXKBExShayf7rw9 u1AC3HbkukLQxjoTpbGM+/15ZqfLrSCpgCeDV8kf+nA6ACnTp4tkDuItABSWykzCvLHV ZFjmRY10GhuTPFQW2tSPQhCQrrvDxB3MLWxyxWZ8AZj1lOL6tuqNzlNXpPCww97t31G2 Dhvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature:dkim-signature; bh=PG1/HhYRt67ZjjvC3b/0RRaBqAYMx2ZNVcQFqLHzqRo=; b=grfR0ostTYsOiEYlDIrl6AqHKcQoN0AgfCTlVAFKmjW03/PrINgC0LCJhl+RxhJcU3 15kCfoUCgoZ8M1D1tDzgCYC3UJse7v0yfg/y0sIETkN4/SY0ml2EFv+ortQ14XRmuIzw oEVgN6LCeCLhMzaQ7pHQ9HwsZCKRtMsrj1nFOYp3GVQtNNItqlnYWiot8BQiZITU7gab rtTBGxo3ZfmWReJz/raak32QQywJG5grXiUPwBMPSiW2bjvG2a83grw2ppx4qqj8oWGl NY4mK1IjPU4d96/t1Bm6IKNMBOwJlvE0rni6OA0qHC+sLAn2JGBNS6N34IaQhjbGBHXH MI5A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=e6GsGuer; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a170903124c00b001a1be5ca65asi16288641plh.528.2023.05.15.03.19.20; Mon, 15 May 2023 03:19:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=e6GsGuer; dkim=neutral (no key) header.i=@gerhold.net header.s=strato-dkim-0003; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241085AbjEOKQT (ORCPT + 99 others); Mon, 15 May 2023 06:16:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240574AbjEOKQL (ORCPT ); Mon, 15 May 2023 06:16:11 -0400 X-Greylist: delayed 177 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 15 May 2023 03:15:34 PDT Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [81.169.146.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849C71720; Mon, 15 May 2023 03:15:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684145545; cv=none; d=strato.com; s=strato-dkim-0002; b=AVNObnpCebT2dn9dpdOekcEmluZb2EBW4sKZD6jFw/NAVDirkVYJ82rz19Vjn5aAGh Z1graIDVHSBvFIDTW7U7rIFOllPtXIoFDjS0HnhZ9ruIYTYRyM8S4iW20W1sui75ruIn kmrVY1fvBNxANYwcvrDjc7vsRw/buDWjpqqP5AYAME6wPLgDOaKdaaf/TFaAyMES+eWH R03OAYcDSws9he0qbBX4GuBdSCLg82+TJ3+69UhyPbkiDvZgTAmIsMksCdIfQmYyyBGD 9IfAs7xwvGtgwP4tpO9wk2n1CNVmf/tW5fWrwBrTkUlQ1tbvQdnagJ06IQFCtWZo/Lao ed9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145545; s=strato-dkim-0002; d=strato.com; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=PG1/HhYRt67ZjjvC3b/0RRaBqAYMx2ZNVcQFqLHzqRo=; b=p747C66IiskdjUifiSHaiWrLKw14UypkT3bRPBuwm6G4M480pvY2afWQ9sJGRryx0a YnIgQOvzhV/bYqlf74HUEvPreAlU9HxeocCDEB5mbQAA34dnvjwg06O7QBsjxXi+P0UQ FF5pZCFIMjVdhetycfMzf/KtYLUxC7H0qcYbHRfQVljjM9z/MakPP/3i6V8VLwCJrTKG KYCGgQaSphbbL1eACnbQZdtsUAx3g+viHkPkjr5J9vEzy4erAkWg8048/AtmCf1OgsxZ VrSyVNyTAe96640kbB6dz4J4X2EpTJyqZu5vwq8XuOKPhOKZHmgBgBnthc5oKtUSnkfE DUrA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1684145545; s=strato-dkim-0002; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=PG1/HhYRt67ZjjvC3b/0RRaBqAYMx2ZNVcQFqLHzqRo=; b=e6GsGuerdYL8cTjyPg0uxiNq163vL1fxE+X9VM7QMXjZ44YbW3lqpUfuvqcemzZSG4 HQyIv0Xv+GVTB5g6ydUvhrIXxJ43/GAPC3FjVJpRf7BfnYurtUk4tOH3zS6CkwUea/Kh Y15Iwgt3viuWbRfA3D4mBmkVfZuoHVaB+yKMnx0iBJNUX/xERZaB8n5GGPS14oMwoHm5 wehaN2YWsnfFUu25vWoSBZZKO9ERbXPgsQY7EQ+l/PzwA7TnHzKYxWig73mMTSeaxhRY FCNALeXZkQ3Xu3SgV9wPJijoIBeevmlhzXVGF026xnjybXWC/sXXin5FLefE8sRZMfQH imPw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1684145545; s=strato-dkim-0003; d=gerhold.net; h=Cc:To:In-Reply-To:References:Message-Id:Subject:Date:From:Cc:Date: From:Subject:Sender; bh=PG1/HhYRt67ZjjvC3b/0RRaBqAYMx2ZNVcQFqLHzqRo=; b=0XaHEr06/C9yX8Cr6qL0DbAi7kImA8Lndmyn+KVE2yj7oUVzbVuPmKljvDZAul9y8x MItCmQ6Xf7BHmyH1z6BQ== X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQjVd4CteZ/7jYgS+mLFY+H0JAn8u4ly9TY=" Received: from [192.168.244.3] by smtp.strato.de (RZmta 49.4.0 DYNA|AUTH) with ESMTPSA id j6420az4FACP1JK (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 15 May 2023 12:12:25 +0200 (CEST) From: Stephan Gerhold Date: Mon, 15 May 2023 12:12:20 +0200 Subject: [PATCH RFC 5/5] arm64: dts: qcom: msm8916: Reserve firmware memory dynamically MIME-Version: 1.0 Message-Id: <20230510-dt-resv-bottom-up-v1-5-3bf68873dbed@gerhold.net> References: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> In-Reply-To: <20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Frank Rowand Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , devicetree@vger.kernel.org, devicetree-spec@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Stephan Gerhold X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765955048582922753?= X-GMAIL-MSGID: =?utf-8?q?1765955048582922753?= DO NOT APPLY - this is just an example to show the motivation for the patch series. For clarity only some of the device trees are updated. Most of the reserved firmware memory on MSM8916 can be relocated when respecting the required alignment. To avoid having to precompute the reserved memory regions in every board DT, describe the actual requirements (size, alignment, alloc-ranges) using the dynamic reserved memory allocation. Use the new "alloc-bottom-up" option to allocate the memory contiguously to the other reserved memory regions. This approach has several advantages: 1. We can define "templates" for the reserved memory regions in msm8916.dtsi and keep only device-specific details in the board DT. This is useful for the "mpss" region size for example, which varies from device to device. It is no longer necessary to redefine all firmware regions to shift their addresses. 2. When some of the functionality (e.g. WiFi, Bluetooth, modem) is not enabled or needed for a device, the reserved memory can stay disabled, freeing up the unused reservation for Linux. 3. Devices with special requirements for one of the firmware regions are handled automatically. For example, msm8916-longcheer-l8150 has non-relocatable "wcnss" firmware that must be loaded exactly at address 0x8b600000. When this is defined as a static region, the other dynamic allocations automatically adjust to a different place with suitable alignment. All in all this approach significantly reduces the boilerplate necessary to define the different firmware regions, and makes it easier to enable functionality on the different devices. Signed-off-by: Stephan Gerhold --- arch/arm64/boot/dts/qcom/apq8016-sbc.dts | 13 +++++++ .../boot/dts/qcom/msm8916-longcheer-l8150.dts | 36 +++++++++---------- .../boot/dts/qcom/msm8916-samsung-serranove.dts | 41 +++++++++------------ arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi | 29 ++++++++------- arch/arm64/boot/dts/qcom/msm8916.dtsi | 42 ++++++++++++++++------ 5 files changed, 96 insertions(+), 65 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts index 59860a2223b8..534fc9b2f816 100644 --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts @@ -310,6 +310,10 @@ &lpass { status = "okay"; }; +&mba_mem { + status = "okay"; +}; + &mdss { status = "okay"; }; @@ -320,6 +324,11 @@ &mpss { firmware-name = "qcom/apq8016/mba.mbn", "qcom/apq8016/modem.mbn"; }; +&mpss_mem { + status = "okay"; + size = <0x0 0x2b00000>; +}; + &pm8916_resin { status = "okay"; linux,code = ; @@ -418,6 +427,10 @@ &wcnss_iris { compatible = "qcom,wcn3620"; }; +&wcnss_mem { + status = "okay"; +}; + /* Enable CoreSight */ &cti0 { status = "okay"; }; &cti1 { status = "okay"; }; diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts index 4a5eab06c18b..2d2bf255b315 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts @@ -29,29 +29,12 @@ chosen { * fixed address and all other firmware regions are moved to a fitting place. */ reserved-memory { - /delete-node/ mpss@86800000; - /delete-node/ wcnss@89300000; - /delete-node/ venus@89900000; + /delete-node/ wcnss; wcnss_mem: wcnss@8b600000 { reg = <0x0 0x8b600000 0x0 0x600000>; no-map; }; - - venus_mem: venus@8bc00000 { - reg = <0x0 0x8bc00000 0x0 0x500000>; - no-map; - }; - - mpss_mem: mpss@8ec00000 { - reg = <0x0 0x8ec00000 0x0 0x5000000>; - no-map; - }; - - gps_mem: gps@93c00000 { - reg = <0x0 0x93c00000 0x0 0x200000>; - no-map; - }; }; gpio-keys { @@ -241,10 +224,23 @@ &blsp1_uart2 { status = "okay"; }; +&gps_mem { + status = "okay"; +}; + +&mba_mem { + status = "okay"; +}; + &mpss { status = "okay"; }; +&mpss_mem { + status = "okay"; + size = <0x0 0x5000000>; +}; + &pm8916_resin { status = "okay"; linux,code = ; @@ -294,6 +290,10 @@ &wcnss_iris { compatible = "qcom,wcn3620"; }; +&wcnss_mem { + status = "okay"; +}; + &smd_rpm_regulators { vdd_l1_l2_l3-supply = <&pm8916_s3>; vdd_l4_l5_l6-supply = <&pm8916_s4>; diff --git a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts index 25ad098b1503..82402689b414 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts +++ b/arch/arm64/boot/dts/qcom/msm8916-samsung-serranove.dts @@ -36,35 +36,11 @@ chosen { }; reserved-memory { - /delete-node/ mpss@86800000; - /delete-node/ wcnss@89300000; - /delete-node/ venus@89900000; - /* Additional memory used by Samsung firmware modifications */ tz-apps@85500000 { reg = <0x0 0x85500000 0x0 0xb00000>; no-map; }; - - mpss_mem: mpss@86800000 { - reg = <0x0 0x86800000 0x0 0x5a00000>; - no-map; - }; - - gps_mem: gps@8c200000 { - reg = <0x0 0x8c200000 0x0 0x200000>; - no-map; - }; - - wcnss_mem: wcnss@8c400000 { - reg = <0x0 0x8c400000 0x0 0x600000>; - no-map; - }; - - venus_mem: venus@8ca00000 { - reg = <0x0 0x8ca00000 0x0 0x500000>; - no-map; - }; }; gpio-keys { @@ -287,10 +263,23 @@ &blsp1_uart2 { status = "okay"; }; +&gps_mem { + status = "okay"; +}; + +&mba_mem { + status = "okay"; +}; + &mpss { status = "okay"; }; +&mpss_mem { + status = "okay"; + size = <0x0 0x5a00000>; +}; + &pm8916_resin { status = "okay"; linux,code = ; @@ -348,6 +337,10 @@ &wcnss_iris { compatible = "qcom,wcn3660b"; }; +&wcnss_mem { + status = "okay"; +}; + &smd_rpm_regulators { vdd_l1_l2_l3-supply = <&pm8916_s3>; vdd_l4_l5_l6-supply = <&pm8916_s4>; diff --git a/arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi b/arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi index 50bae6f214f1..ec073cfbb435 100644 --- a/arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi @@ -16,18 +16,6 @@ chosen { stdout-path = "serial0"; }; - reserved-memory { - mpss_mem: mpss@86800000 { - reg = <0x0 0x86800000 0x0 0x5500000>; - no-map; - }; - - gps_mem: gps@8bd00000 { - reg = <0x0 0x8bd00000 0x0 0x200000>; - no-map; - }; - }; - gpio-keys { compatible = "gpio-keys"; @@ -91,10 +79,23 @@ &gcc { clocks = <&xo_board>, <&sleep_clk>, <0>, <0>, <0>, <0>, <0>; }; +&gps_mem { + status = "okay"; +}; + +&mba_mem { + status = "okay"; +}; + &mpss { status = "okay"; }; +&mpss_mem { + status = "okay"; + size = <0x0 0x5500000>; +}; + &pm8916_usbin { status = "okay"; }; @@ -126,6 +127,10 @@ &wcnss_iris { compatible = "qcom,wcn3620"; }; +&wcnss_mem { + status = "okay"; +}; + &smd_rpm_regulators { vdd_l1_l2_l3-supply = <&pm8916_s3>; vdd_l4_l5_l6-supply = <&pm8916_s4>; diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi index 7e0fa37a3adf..bc072a0e4d4f 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -78,24 +78,44 @@ rfsa@867e0000 { no-map; }; - mpss_mem: mpss@86800000 { - reg = <0x0 0x86800000 0x0 0x2b00000>; + mpss_mem: mpss { + /* size is device-specific */ + alignment = <0x0 0x400000>; + alloc-ranges = <0x0 0x86800000 0x0 0x10000000>; + alloc-bottom-up; no-map; + status = "disabled"; }; - - wcnss_mem: wcnss@89300000 { - reg = <0x0 0x89300000 0x0 0x600000>; + gps_mem: gps { + size = <0x0 0x200000>; + alignment = <0x0 0x100000>; + alloc-ranges = <0x0 0x86800000 0x0 0x10000000>; + alloc-bottom-up; no-map; + status = "disabled"; }; - - venus_mem: venus@89900000 { - reg = <0x0 0x89900000 0x0 0x600000>; + mba_mem: mba { + size = <0x0 0x100000>; + alignment = <0x0 0x100000>; + alloc-ranges = <0x0 0x86800000 0x0 0x10000000>; + alloc-bottom-up; no-map; + status = "disabled"; }; - - mba_mem: mba@8ea00000 { + wcnss_mem: wcnss { + size = <0x0 0x600000>; + alignment = <0x0 0x100000>; + alloc-ranges = <0x0 0x86800000 0x0 0x10000000>; + alloc-bottom-up; + no-map; + status = "disabled"; + }; + venus_mem: venus { + size = <0x0 0x500000>; + alignment = <0x0 0x100000>; + alloc-ranges = <0x0 0x86800000 0x0 0x10000000>; + alloc-bottom-up; no-map; - reg = <0 0x8ea00000 0 0x100000>; }; };