Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3857927rdb; Mon, 11 Dec 2023 01:54:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IENXi9m51WqX4LlgF9tulOadppZyM9k2lV/r64hxfwvFV7xJ5pi2D4SPj8PTRnz9GmkH8N1 X-Received: by 2002:a17:902:f541:b0:1d0:c906:f5fc with SMTP id h1-20020a170902f54100b001d0c906f5fcmr1353159plf.110.1702288490819; Mon, 11 Dec 2023 01:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702288490; cv=none; d=google.com; s=arc-20160816; b=L5QxafvycrVruqHUE8ZJ4vySVJkDtv3ZsbCrJtj72ONSBykiwJNxTT6/6vXqwSOjaa e92eqHh74HVc/12NJaeIWNraRiMk3Ef9/5wa7Ugwgp1mZbhJ7D3ziQdZM408c4h+ZV8J mdvbJLTPenJqaMnRNN/gqP92/I6dnsCuiDdwkNd7JNYD5SwX7EgJt2/EPW1JDaNiodH7 UA3C1+dPOYYTWVM7jbOxw5vanHrAsOMtC+6OcTzeC7IYBPOsgqfiMkTWt/vy73q6WaG5 7rwxEEUcJshLiyN6WDYRDmDZGHybJmhZZnAmbw8F8miLHEyyqM6bYxvk0GpeGXbkxYYb 6fPA== 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=p8MzHulTEQwH/VQnablYSXp/5FraUwl5sD73PXbZ4w8=; fh=1uD9pM5rzr9kaHeyay0CttTYYWJXoCWxcnKp1aWvpFY=; b=aC7iPp7Or9ZNWaiTj9m6Y0Xw5GwCCIqd7ebJTdOjr0AIJ/GyW+aOHPVG+cTzkxMcK8 AxdziCocV7F/vkWUS/a4nwjJaYWq/Fsdo1ntk6BNZq5ujU9Gj7ZxskSDaJqXdQXheUk7 Txldca71WJFaVqbtw2oUu2YwSUC62lvHPvZkkxNpRfgd9R3J6mL0ZJd4W4y+1/G8dsDn yBhXdTjSvey/CLOiAXB/Bhbs38p2O3IPEgl69t1M6mYgjPyoA+7kGK//DMZFQURVoiYg 5gOAby5InNuUgWijSVAYbHLSYwiPlpJBm6n5hZPYGhPKNjUdMb2RiO1htO6fIO4V0Vfu Zj1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T6Yrzkh5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l12-20020a170903120c00b001d06d47c3c8si5951534plh.299.2023.12.11.01.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 01:54:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T6Yrzkh5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id B5294807500D; Mon, 11 Dec 2023 01:54:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234655AbjLKJyc (ORCPT + 99 others); Mon, 11 Dec 2023 04:54:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjLKJyb (ORCPT ); Mon, 11 Dec 2023 04:54:31 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F9F4CB for ; Mon, 11 Dec 2023 01:54:37 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a1e2f34467aso403148066b.2 for ; Mon, 11 Dec 2023 01:54:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702288475; x=1702893275; 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=p8MzHulTEQwH/VQnablYSXp/5FraUwl5sD73PXbZ4w8=; b=T6Yrzkh5hEGbDH0CzOy2S9CWb2s20XhCh3I30Wu1vFElaqcvXiXIR2vOG79qazljv7 4FuNnrhSUKnT8Xj6hRjLwWWvOfDcppoa9VqGUzfYW7dHO5BAJB7wtWvbb1pvWawrAsN4 BWRo+2sGpQOgXpR5Cg6ygiovHoFNqyxF5Ppmc7Ihc9wjUcbJ8W05oKTAcCU9kFHmkdFH sG2bDHBLEGYraNuUwJjLwjUExRq/5dXrr2SsdNLPgatqdsZ+EpFq8/+XsiiQOoi27wFg oR59IPNEPeaioZCslz9r5NfAm0r5pQmevUTY5ufYldJIRmZeQug17mEQEHCGgO29hUmJ 3O1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702288475; x=1702893275; 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=p8MzHulTEQwH/VQnablYSXp/5FraUwl5sD73PXbZ4w8=; b=lmadAqfzPYHRJnkCtpz9LbByGYGvT3QnpInv0sapJU91vNwZRUGLC4yENHpM5SMm90 ugweYIN04fLNwcO4AVHcaziA0sPFo2xjJBnmg8cSXtKS7C7XEcmgRjWVzTQgF6gUMF8a NOFwxLVx5rBt0SqLw0qgCCZI4aYdniYfTJO3AfVlAYalRN/IFJa5O/ZU3w8uypWmEy95 2a4yVZU3778VynH/REwnAsFLyky7fR8qSBd4+hAdu/p8V7a+/MqpE7INMSaLxdy3la3/ RwbCrKLrZ3tdnPcUnNSsfBzFiU7iu9FGtjKgAu1mnuL7eyvLvsHePt79NL5x9citI8Xt xQgw== X-Gm-Message-State: AOJu0YwnTfSUIU3PznTLvsDkvgdy15fc8eX2g6VchqspBn4ZuH55j4Hj eXEpgnpfTdtxY9FFmkxdluLGqg== X-Received: by 2002:a17:906:7490:b0:a1f:99e1:8a67 with SMTP id e16-20020a170906749000b00a1f99e18a67mr954087ejl.2.1702288475189; Mon, 11 Dec 2023 01:54:35 -0800 (PST) Received: from [192.168.36.128] (178235179179.dynamic-4-waw-k-1-3-0.vectranet.pl. [178.235.179.179]) by smtp.gmail.com with ESMTPSA id tb16-20020a1709078b9000b00a1d06fb6800sm4507360ejc.36.2023.12.11.01.54.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Dec 2023 01:54:34 -0800 (PST) Message-ID: Date: Mon, 11 Dec 2023 10:54:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/3] remoteproc: qcom: pas: make region assign more generic Content-Language: en-US To: neil.armstrong@linaro.org, Andy Gross , Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mukesh Ojha References: <20231208-topic-sm8650-upstream-remoteproc-v4-0-a96c3e5f0913@linaro.org> <20231208-topic-sm8650-upstream-remoteproc-v4-2-a96c3e5f0913@linaro.org> <76f18323-a59e-4724-96ec-6306e5dcd2dc@linaro.org> <374addd2-e336-4625-9e0c-45e5efe1eb47@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//YQV6fkbqQCceYebGg6TiisWCy8LG77zV7DB0VMIWJv7Km7Sz0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7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <374addd2-e336-4625-9e0c-45e5efe1eb47@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 01:54:48 -0800 (PST) On 11.12.2023 10:37, Neil Armstrong wrote: > On 09/12/2023 19:06, Konrad Dybcio wrote: >> On 8.12.2023 16:04, Neil Armstrong wrote: >>> The current memory region assign only supports a single >>> memory region. >>> >>> But new platforms introduces more regions to make the >>> memory requirements more flexible for various use cases. >>> Those new platforms also shares the memory region between the >>> DSP and HLOS. >>> >>> To handle this, make the region assign more generic in order >>> to support more than a single memory region and also permit >>> setting the regions permissions as shared. >>> >>> Reviewed-by: Mukesh Ojha >>> Signed-off-by: Neil Armstrong >>> --- >> [...] >> >>> +    for (offset = 0; offset < adsp->region_assign_count; ++offset) { >>> +        struct reserved_mem *rmem = NULL; >>> + >>> +        node = of_parse_phandle(adsp->dev->of_node, "memory-region", >>> +                    adsp->region_assign_idx + offset); >>> +        if (node) >>> +            rmem = of_reserved_mem_lookup(node); >>> +        of_node_put(node); >> Shouldn't this only be called when parse_phandle succeeds? (separate >> patch with a fix + cc stable if so?) > > It's not a bug, it was added like that because of_node_put() already > checks for a NULL pointer: > https://elixir.bootlin.com/linux/v6.7-rc5/source/drivers/of/dynamic.c#L45 Ack > >> >>> +        if (!rmem) { >>> +            dev_err(adsp->dev, "unable to resolve shareable memory-region index %d\n", >>> +                offset); >>> +            return -EINVAL; >>> +        } >>>   -    perm.vmid = QCOM_SCM_VMID_MSS_MSA; >>> -    perm.perm = QCOM_SCM_PERM_RW; >>> +        if (adsp->region_assign_shared)  { >>> +            perm[0].vmid = QCOM_SCM_VMID_HLOS; >>> +            perm[0].perm = QCOM_SCM_PERM_RW; >>> +            perm[1].vmid = adsp->region_assign_vmid; >>> +            perm[1].perm = QCOM_SCM_PERM_RW; >>> +            perm_size = 2; >>> +        } else { >>> +            perm[0].vmid = adsp->region_assign_vmid; >>> +            perm[0].perm = QCOM_SCM_PERM_RW; >>> +            perm_size = 1; >>> +        } >>>   -    adsp->region_assign_phys = rmem->base; >>> -    adsp->region_assign_size = rmem->size; >>> -    adsp->region_assign_perms = BIT(QCOM_SCM_VMID_HLOS); >>> +        adsp->region_assign_phys[offset] = rmem->base; >>> +        adsp->region_assign_size[offset] = rmem->size; >>> +        adsp->region_assign_perms[offset] = BIT(QCOM_SCM_VMID_HLOS); >>>   -    ret = qcom_scm_assign_mem(adsp->region_assign_phys, >>> -                  adsp->region_assign_size, >>> -                  &adsp->region_assign_perms, >> I think this should be renamed to region_assign_owner(s) > > Why ? this bitfield is names "perms" everywhere qcom_scm_assign_mem is used And IMO that's not correct - there's the qcom_scm_vmperm.perm field which is oneOf r/w/x/rw/rwx and this one is filled with ORed BIT()-ed elements allowed in qcom_scm_vmperm.vmid (QCOM_SCM_VMID_...) Konrad