[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a1916db-a359-45bb-828c-ecbccaf65f2b@linaro.org>
Date: Wed, 20 Nov 2024 15:21:26 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, Mukesh Ojha
<quic_mojha@...cinc.com>, Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Stephan Gerhold <stephan.gerhold@...aro.org>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Kuldeep Singh <quic_kuldsing@...cinc.com>,
Elliot Berman <quic_eberman@...cinc.com>,
Andrew Halaney <ahalaney@...hat.com>,
Avaneesh Kumar Dwivedi <quic_akdwived@...cinc.com>,
Andy Gross <andy.gross@...aro.org>, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/6] firmware: qcom: scm: Handle various probe ordering
for qcom_scm_assign_mem()
On 20/11/2024 15:19, Krzysztof Kozlowski wrote:
> On 20/11/2024 15:07, Bartosz Golaszewski wrote:
>>> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
>>> index 5d91b8e22844608f35432f1ba9c08d477d4ff762..93212c8f20ad65ecc44804b00f4b93e3eaaf8d95 100644
>>> --- a/drivers/firmware/qcom/qcom_scm.c
>>> +++ b/drivers/firmware/qcom/qcom_scm.c
>>> @@ -1075,6 +1075,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
>>> int ret, i, b;
>>> u64 srcvm_bits = *srcvm;
>>>
>>> + if (!qcom_scm_is_available())
>>> + return -EPROBE_DEFER;
>>> +
>>
>> Should we be returning -EPROBE_DEFER from functions that are not
>> necessarily limited to being used in probe()? For instance ath10k uses
>> it in a workqueue job. I think this is why this driver is probed in
One more here: qcom_scm_assign_mem() is used in both contexts: probe()
and some other cases like mentioned workqueue. EAGAIN for probe() would
not result in defered probe, I think.
>> subsys_initcall() rather than module_initcall().
> Uh, good point. To my understanding, every resource like function can do
> it, e.g. clk_get. Whether drivers call it in probe() or somewhere else -
> e.g. some startup call like there is plenty in the ASoC or DMA
> device_alloc_chan_resources() - is responsibility of the
> driver/consumer, not the provider of that resource.
>
> With such explanation returning EPROBE_DEFER is ok, just like returning
> anything else (e.g. EINVAL).
>
> Now about this function: it is not exactly "get a resource" one, but
> still the caller might want to call it again later, which is implied by
> EPROBE_DEFER. Maybe this should be EAGAIN instead? Just like
> power-supply is doing in power_supply_get_property().
>
Best regards,
Krzysztof
Powered by blists - more mailing lists