Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4851302rdb; Fri, 15 Sep 2023 14:30:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEoQYSiVdydbTmGzior5sM1yNDy+ZnieQ2RNqeMtpO9C0J5KA3789TEoALpVbBjS3ffF7PQ X-Received: by 2002:a17:902:e742:b0:1c3:94a4:34bf with SMTP id p2-20020a170902e74200b001c394a434bfmr3068599plf.66.1694813456074; Fri, 15 Sep 2023 14:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694813456; cv=none; d=google.com; s=arc-20160816; b=kgbzSMddGqjQN2KFanQTdc4VljlbFnSYtUgUHewBPBB7vA3w2/Ye+2aoPoRTwe8Neq uYiQhO0eQvoAdiAEHApkPtaTsvzmAFbdRwzCYO797+XbLNxYuLiAlKTswvDr63GdlIv6 ROoFll3S0k5DSbctdU64OnRZzy0A4zvjlOKZAXeB2j69LDjaQzSTj3Ti64p4a8Zn+xy0 YcankzqoDIyldoiQWyZ8bBziTasN1fAbekovLjJmB94pdaM0V8KQcJ6U171wVlWMTxCf UJgAFzGINVmpHo9juubXQv+iNzzMGvL17huBdfp3u7k39FjV5GQkGPUVBxKd1zksJx3/ mXeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=dvBrYykFcdabK3VBwLNpD2+rQenLlz52r2r7e+pmXS0=; fh=YPIzcf0kjdKwYIqtGsjW5wxryGnrtWY48g2jvFhw1nE=; b=ihJo4jo6r+eDaNkJRa0gJT3y5PdeSlVhhH0FigbALD76YBoBJdnGDaYwEUSwcj64mM ThsuLmtlZyheLEuucohwar9Z21YlMgT9wQvPxlKN4WkYca8oDHbloa0IyQoK1U4ECTZg UZ54cYPm+p5dpjI/lO0sxV8gt1AAeHOOQBS0llSHBeOuKVFvnQnp9n+l7hP8yc90pqjh sewXfmGFcCXUbTDx5V9EtTOSKhwx8JWcmgVrgX/nS1BP8Bfar3dEYcufD0fjTa7nHJH5 mOdqg5MCwfXBNMN8DMJwtcr23NbCKL7NS6G7gUdxzM/2fBb0kjhBwWYhfnqxic2hV/vz Jmgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h11Ea29j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m3-20020a170902db0300b001c43ff69d93si1086051plx.324.2023.09.15.14.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:30:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h11Ea29j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CF16B8097883; Fri, 15 Sep 2023 06:52:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234806AbjIONwq (ORCPT + 99 others); Fri, 15 Sep 2023 09:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234801AbjIONwp (ORCPT ); Fri, 15 Sep 2023 09:52:45 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC86EB8 for ; Fri, 15 Sep 2023 06:52:39 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9ad8bf9bfabso279895466b.3 for ; Fri, 15 Sep 2023 06:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694785958; x=1695390758; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dvBrYykFcdabK3VBwLNpD2+rQenLlz52r2r7e+pmXS0=; b=h11Ea29jz8cI/slGn2bxtRgwXnIycO/3E0jAvk7b05WkC8XBHk34aAZFdQVdI/61h1 eawToXkFS67i8Fjfc0gSPz5p+CZCOwKPL3DUKbEVKVmexvM5kyB2IBaea/mPdLmzKpv4 P4ULJVlP6Ag7T3yDTVzdaEbU4y2+INL1LsfipuQrWln+vek+aV7Zm7zACM2/CGVujB4o T5E4A0lP5F6f8WzoH8VtXNB3UbYHylbA92e+u/Ifigqy7xgXscOoil1Q4MztO9SFjut8 JMRZOkhk8xOrAoUg/0Tv/tqzkVkOFvTLfQpKFeHZ59PLmzGBE85jsYKrg2FqCtO8l7TJ yfQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694785958; x=1695390758; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dvBrYykFcdabK3VBwLNpD2+rQenLlz52r2r7e+pmXS0=; b=bboqxoprTM74mKlHsebGXTM2emq22jfL1YSx0oz/uUupxzIqOh4MMMcO7CTTMYg3KW vM40HJbY8hYpqnjIz1xqFIzc5Cb1hXZ7xG3bkDxjFm28+Y5YkgtD/pLHpwbasz4Au35v Wn+p6ZTks52IbCScqUsRdnQEq/9NwqQQYCDVa7iUtDj0eew04+LggT8Zb/T5MRhexpyN Cr7OLsOFhtSDu30M1MjiAmO066UBGAJ3WdMszbdSbs/3BHIntaJzKmVH0eMieXsiAlXb vWbuWYn5Z8EdzxwWtXJYR2SJwmV+2JQB+RHxAJgmO6e3fqnw/40Fe7cgHDU67To1ejsM AeYA== X-Gm-Message-State: AOJu0YyyYiainNq927YWSJqjUc1wTcIFAAGiuBgZ6ZcXqz+vNFZuz2sp /qI3ms22jSdOkSop2QlpNxmi9Q== X-Received: by 2002:a17:907:a064:b0:9a1:e8c0:7e2e with SMTP id ia4-20020a170907a06400b009a1e8c07e2emr1438238ejc.14.1694785958347; Fri, 15 Sep 2023 06:52:38 -0700 (PDT) Received: from [192.168.37.232] (178235177024.dynamic-4-waw-k-1-1-0.vectranet.pl. [178.235.177.24]) by smtp.gmail.com with ESMTPSA id p25-20020a1709060e9900b00992b50fbbe9sm2467926ejf.90.2023.09.15.06.52.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Sep 2023 06:52:37 -0700 (PDT) Message-ID: <9ad1264f-efb5-40b5-bd7a-1477e86501a1@linaro.org> Date: Fri, 15 Sep 2023 15:52:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/9] arm64: dts: qcom: msm8916: Reserve firmware memory dynamically Content-Language: en-US To: Stephan Gerhold Cc: Bryan O'Donoghue , Bjorn Andersson , Andy Gross , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230911-msm8916-rmem-v1-0-b7089ec3e3a1@gerhold.net> <20230911-msm8916-rmem-v1-4-b7089ec3e3a1@gerhold.net> <912f90ee-0816-43ae-bc6f-a9a9a3e33d8a@linaro.org> <9b1beb38-9ec2-4bdb-97f5-fccf98d3b0c3@linaro.org> <568b4e18-1ade-4a12-9766-d16d8ca9838d@linaro.org> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwONM3eCI3qcYm5JNc5X+JthZOWsbIPSC1Rhxz3JmWIwP1udr5E3oNRe9u2LIEq+wH/toH kpPDhTeMkvt4KfE5m5ercid9+ZXAqoaYLUL4HCEw+HW0DXcKDwARAQABzShLb25yYWQgRHli Y2lvIDxrb25yYWQuZHliY2lvQGxpbmFyby5vcmc+wsGOBBMBCAA4FiEEU24if9oCL2zdAAQV R4cBcg5dfFgFAmQ5bqwCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQR4cBcg5dfFjO BQ//YQV6fkbqQCceYebGg6TiisWCy8LG77zV7DB0VMIWJv7Km7Sz0QQrHQVzhEr3trNenZrf yy+o2tQOF2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sSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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_BLOCKED, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 06:52:43 -0700 (PDT) On 14.09.2023 16:09, Stephan Gerhold wrote: > On Wed, Sep 13, 2023 at 09:39:50PM +0200, Konrad Dybcio wrote: >> On 13.09.2023 12:14, Stephan Gerhold wrote: >>> On Wed, Sep 13, 2023 at 10:12:12AM +0100, Bryan O'Donoghue wrote: >>>> On 13/09/2023 10:06, Konrad Dybcio wrote: >>>>> On 11.09.2023 19:41, Stephan Gerhold wrote: >>>>>> 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. >>>>>> >>>>>> 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. WCNSS, Modem, Venus) 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 >>>>>> --- >>>>> [...] >>>>> >>>>>> mpss_mem: mpss@86800000 { >>>>>> + /* >>>>>> + * The memory region for the mpss firmware is generally >>>>>> + * relocatable and could be allocated dynamically. >>>>>> + * However, many firmware versions tend to fail when >>>>>> + * loaded to some special addresses, so it is hard to >>>>>> + * define reliable alloc-ranges. >>>>>> + * >>>>>> + * alignment = <0x0 0x400000>; >>>>>> + * alloc-ranges = <0x0 0x86800000 0x0 0x8000000>; >>>>>> + */ >>>>> Do we know of any devices that this would actually work on? >> [...] >>> - On DB410c it works just fine. All addresses I tried work without any >>> problems. >>> >>> - On longcheer-l8150 the modem firmare works fine when the memory >>> region starts somewhere between 0x86800000 and 0x8a800000. It also >>> works again after 0x8e800000. But on anything between 0x8a800000 and >>> 0x8e800000 it's broken for who knows what reason. >>> [...] >> Were you able to find a phone (likely a very reference-design-based >> one) that this worked on, btw? > > Actually I would count the Longcheer devices (l8150 = Wileyfox Swift and > l8910 = BQ Aquaris X5) to the category of close-to-QRD-based devices. > Based on quick tests both behave like described above (only > 0x8a800000-0x8e800000 is broken). Same for wingtech-wt88047. > > In other words, for those using the dynamic allocation would work fine, > because the alloc-ranges = <0x0 0x86800000 0x0 0x8000000>; only includes > working start addresses from 0x86800000 to ~0x89800000 (with a size of > 0x5000000). > > I guess I could use it for them and only make other devices use a fixed > address. But I also don't quite have the capacity to test every device > to see if relocating the region works or not. > > I think it's still easiest to allocate mpss on a fixed address > everywhere. The only real disadvantage is that overriding "reg", e.g. > > &mpss_mem { > reg = <0x0 0x86800000 0x0 0x5100000>; > }; > > is a bit more ugly than overriding size: > > &mpss_mem { > size = <0x0 0x5100000>; > }; > > but well, this is a very minor disadvantage. So in other words, this only *really* works on apq8016? Konrad