* [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
@ 2023-08-25 21:35 Dmitry Baryshkov
2023-08-25 21:35 ` [PATCH 2/2] arm64: dts: qcom: sm8150: extend the size of the PDC resource Dmitry Baryshkov
2023-08-28 9:36 ` [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Maulik Shah (mkshah)
0 siblings, 2 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-25 21:35 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Thomas Gleixner,
Marc Zyngier
Cc: linux-arm-msm, linux-kernel, Neil Armstrong
On Qualcomm SM8150 the PDC resource has size 0x400. When PDC driver
tries to read the version register (0x1000), it reads past the end of
this resource, causing kernel crash.
Check the size of PDC resource before reading the PDC_VERSION register.
Fixes: bc82cc42644b ("irqchip/qcom-pdc: Add support for v3.2 HW")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/irqchip/qcom-pdc.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c
index 9bb6951257c2..431b213b5abb 100644
--- a/drivers/irqchip/qcom-pdc.c
+++ b/drivers/irqchip/qcom-pdc.c
@@ -324,6 +324,7 @@ static int pdc_setup_pin_mapping(struct device_node *np)
static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
{
struct irq_domain *parent_domain, *pdc_domain;
+ struct resource res;
int ret;
pdc_base = of_iomap(node, 0);
@@ -332,7 +333,14 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
return -ENXIO;
}
- pdc_version = pdc_reg_read(PDC_VERSION, 0);
+ if (of_address_to_resource(node, 0, &res))
+ return -EINVAL;
+
+ /* compat with old sm8150 DT which had very small region for PDC */
+ if (resource_size(&res) > PDC_VERSION)
+ pdc_version = pdc_reg_read(PDC_VERSION, 0);
+ else
+ pdc_version = 0;
parent_domain = irq_find_host(parent);
if (!parent_domain) {
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/2] arm64: dts: qcom: sm8150: extend the size of the PDC resource
2023-08-25 21:35 [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Dmitry Baryshkov
@ 2023-08-25 21:35 ` Dmitry Baryshkov
2023-08-26 9:49 ` Konrad Dybcio
2023-08-28 9:36 ` [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Maulik Shah (mkshah)
1 sibling, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-25 21:35 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Thomas Gleixner,
Marc Zyngier
Cc: linux-arm-msm, linux-kernel, Neil Armstrong
Follow the example of other platforms and extend the PDC resource region
to 0x30000, so that the PDC driver can read the PDC_VERSION register.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
arch/arm64/boot/dts/qcom/sm8150.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi
index 380712aee977..38c5d6dbd0d7 100644
--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi
@@ -3923,7 +3923,7 @@ dispcc: clock-controller@af00000 {
pdc: interrupt-controller@b220000 {
compatible = "qcom,sm8150-pdc", "qcom,pdc";
- reg = <0 0x0b220000 0 0x400>;
+ reg = <0 0x0b220000 0 0x30000>;
qcom,pdc-ranges = <0 480 94>, <94 609 31>,
<125 63 1>;
#interrupt-cells = <2>;
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/2] arm64: dts: qcom: sm8150: extend the size of the PDC resource
2023-08-25 21:35 ` [PATCH 2/2] arm64: dts: qcom: sm8150: extend the size of the PDC resource Dmitry Baryshkov
@ 2023-08-26 9:49 ` Konrad Dybcio
0 siblings, 0 replies; 12+ messages in thread
From: Konrad Dybcio @ 2023-08-26 9:49 UTC (permalink / raw)
To: Dmitry Baryshkov, Andy Gross, Bjorn Andersson, Thomas Gleixner,
Marc Zyngier
Cc: linux-arm-msm, linux-kernel, Neil Armstrong
On 25.08.2023 23:35, Dmitry Baryshkov wrote:
> Follow the example of other platforms and extend the PDC resource region
> to 0x30000, so that the PDC driver can read the PDC_VERSION register.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
Fixes: 397ad94668c1 ("arm64: dts: qcom: sm8150: Add pdc interrupt controller node")
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
> arch/arm64/boot/dts/qcom/sm8150.dtsi | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi b/arch/arm64/boot/dts/qcom/sm8150.dtsi
> index 380712aee977..38c5d6dbd0d7 100644
> --- a/arch/arm64/boot/dts/qcom/sm8150.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi
> @@ -3923,7 +3923,7 @@ dispcc: clock-controller@af00000 {
>
> pdc: interrupt-controller@b220000 {
> compatible = "qcom,sm8150-pdc", "qcom,pdc";
> - reg = <0 0x0b220000 0 0x400>;
> + reg = <0 0x0b220000 0 0x30000>;
> qcom,pdc-ranges = <0 480 94>, <94 609 31>,
> <125 63 1>;
> #interrupt-cells = <2>;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-25 21:35 [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Dmitry Baryshkov
2023-08-25 21:35 ` [PATCH 2/2] arm64: dts: qcom: sm8150: extend the size of the PDC resource Dmitry Baryshkov
@ 2023-08-28 9:36 ` Maulik Shah (mkshah)
2023-08-28 9:45 ` Konrad Dybcio
2023-08-28 9:46 ` Dmitry Baryshkov
1 sibling, 2 replies; 12+ messages in thread
From: Maulik Shah (mkshah) @ 2023-08-28 9:36 UTC (permalink / raw)
To: Dmitry Baryshkov, Andy Gross, Bjorn Andersson, Konrad Dybcio,
Thomas Gleixner, Marc Zyngier
Cc: linux-arm-msm, linux-kernel, Neil Armstrong
Hi Dmitry,
This patch may be useful if there was a case where some PDCs don't have
version register populated/available,
In all PDC versions, version register is always available but due to reg
size not good enough in device tree for SM8150 it failed to read.
reg size in device node must be expanded if its too small to access all
registers and i think
additional check in driver to check if size is good enough would not be
of much use.
Thanks,
Maulik
On 8/26/2023 3:05 AM, Dmitry Baryshkov wrote:
> On Qualcomm SM8150 the PDC resource has size 0x400. When PDC driver
> tries to read the version register (0x1000), it reads past the end of
> this resource, causing kernel crash.
>
> Check the size of PDC resource before reading the PDC_VERSION register.
>
> Fixes: bc82cc42644b ("irqchip/qcom-pdc: Add support for v3.2 HW")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 9:36 ` [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Maulik Shah (mkshah)
@ 2023-08-28 9:45 ` Konrad Dybcio
2023-08-28 9:46 ` Dmitry Baryshkov
1 sibling, 0 replies; 12+ messages in thread
From: Konrad Dybcio @ 2023-08-28 9:45 UTC (permalink / raw)
To: Maulik Shah (mkshah), Dmitry Baryshkov, Andy Gross,
Bjorn Andersson, Thomas Gleixner, Marc Zyngier
Cc: linux-arm-msm, linux-kernel, Neil Armstrong
On 28.08.2023 11:36, Maulik Shah (mkshah) wrote:
> Hi Dmitry,
>
> This patch may be useful if there was a case where some PDCs don't have version register populated/available,
> In all PDC versions, version register is always available but due to reg size not good enough in device tree for SM8150 it failed to read.
>
> reg size in device node must be expanded if its too small to access all registers and i think
> additional check in driver to check if size is good enough would not be of much use.
The devicetree change has already been commited and not taking care
of this on the driver side would break backwards compatibility with
devicetrees without this change.
Konrad
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 9:36 ` [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Maulik Shah (mkshah)
2023-08-28 9:45 ` Konrad Dybcio
@ 2023-08-28 9:46 ` Dmitry Baryshkov
2023-08-28 10:04 ` Marc Zyngier
1 sibling, 1 reply; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-28 9:46 UTC (permalink / raw)
To: Maulik Shah (mkshah)
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Thomas Gleixner,
Marc Zyngier, linux-arm-msm, linux-kernel, Neil Armstrong
On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
<quic_mkshah@quicinc.com> wrote:
>
> Hi Dmitry,
>
> This patch may be useful if there was a case where some PDCs don't have
> version register populated/available,
> In all PDC versions, version register is always available but due to reg
> size not good enough in device tree for SM8150 it failed to read.
>
> reg size in device node must be expanded if its too small to access all
> registers and i think
> additional check in driver to check if size is good enough would not be
> of much use.
Unfortunately, it doesn't work this way. DT files are ABI. Even if we
change the DT, the kernel should continue working with the older
version.
Thus, we have to add such bandaid code, which will keep the kernel
from crashing if old DT was used.
P.S. Can I please bring to your attention that top-posting is a
frowned upon practice.
>
> Thanks,
> Maulik
>
> On 8/26/2023 3:05 AM, Dmitry Baryshkov wrote:
>
> > On Qualcomm SM8150 the PDC resource has size 0x400. When PDC driver
> > tries to read the version register (0x1000), it reads past the end of
> > this resource, causing kernel crash.
> >
> > Check the size of PDC resource before reading the PDC_VERSION register.
> >
> > Fixes: bc82cc42644b ("irqchip/qcom-pdc: Add support for v3.2 HW")
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 9:46 ` Dmitry Baryshkov
@ 2023-08-28 10:04 ` Marc Zyngier
2023-08-28 10:18 ` Dmitry Baryshkov
2023-08-28 10:20 ` Konrad Dybcio
0 siblings, 2 replies; 12+ messages in thread
From: Marc Zyngier @ 2023-08-28 10:04 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Maulik Shah (mkshah), Andy Gross, Bjorn Andersson, Konrad Dybcio,
Thomas Gleixner, linux-arm-msm, linux-kernel, Neil Armstrong
On Mon, 28 Aug 2023 10:46:10 +0100,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
>
> On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
> <quic_mkshah@quicinc.com> wrote:
> >
> > Hi Dmitry,
> >
> > This patch may be useful if there was a case where some PDCs don't have
> > version register populated/available,
> > In all PDC versions, version register is always available but due to reg
> > size not good enough in device tree for SM8150 it failed to read.
> >
> > reg size in device node must be expanded if its too small to access all
> > registers and i think
> > additional check in driver to check if size is good enough would not be
> > of much use.
>
> Unfortunately, it doesn't work this way. DT files are ABI. Even if we
> change the DT, the kernel should continue working with the older
> version.
> Thus, we have to add such bandaid code, which will keep the kernel
> from crashing if old DT was used.
You're missing the point: all existing PDC HW have version register.
The fact that the DT is crap doesn't invalidate this simple fact. It
is thus perfectly possible for the driver to *ignore* the crap and do
the right thing by expanding the size of the mapping, rather than
falling back to the non-versioned code.
There is definitely precedents for this sort of behaviour, such as the
ARM GICv2 probe code.
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 10:04 ` Marc Zyngier
@ 2023-08-28 10:18 ` Dmitry Baryshkov
2023-08-28 10:26 ` Marc Zyngier
` (2 more replies)
2023-08-28 10:20 ` Konrad Dybcio
1 sibling, 3 replies; 12+ messages in thread
From: Dmitry Baryshkov @ 2023-08-28 10:18 UTC (permalink / raw)
To: Marc Zyngier
Cc: Maulik Shah (mkshah), Andy Gross, Bjorn Andersson, Konrad Dybcio,
Thomas Gleixner, linux-arm-msm, linux-kernel, Neil Armstrong
On Mon, 28 Aug 2023 at 13:04, Marc Zyngier <maz@kernel.org> wrote:
>
> On Mon, 28 Aug 2023 10:46:10 +0100,
> Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
> > <quic_mkshah@quicinc.com> wrote:
> > >
> > > Hi Dmitry,
> > >
> > > This patch may be useful if there was a case where some PDCs don't have
> > > version register populated/available,
> > > In all PDC versions, version register is always available but due to reg
> > > size not good enough in device tree for SM8150 it failed to read.
> > >
> > > reg size in device node must be expanded if its too small to access all
> > > registers and i think
> > > additional check in driver to check if size is good enough would not be
> > > of much use.
> >
> > Unfortunately, it doesn't work this way. DT files are ABI. Even if we
> > change the DT, the kernel should continue working with the older
> > version.
> > Thus, we have to add such bandaid code, which will keep the kernel
> > from crashing if old DT was used.
>
> You're missing the point: all existing PDC HW have version register.
> The fact that the DT is crap doesn't invalidate this simple fact. It
> is thus perfectly possible for the driver to *ignore* the crap and do
> the right thing by expanding the size of the mapping, rather than
> falling back to the non-versioned code.
Ah. Interesting idea. If that's the overall consensus I can send v2
doing this. Not sure what is better though.
>
> There is definitely precedents for this sort of behaviour, such as the
> ARM GICv2 probe code.
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 10:04 ` Marc Zyngier
2023-08-28 10:18 ` Dmitry Baryshkov
@ 2023-08-28 10:20 ` Konrad Dybcio
1 sibling, 0 replies; 12+ messages in thread
From: Konrad Dybcio @ 2023-08-28 10:20 UTC (permalink / raw)
To: Marc Zyngier, Dmitry Baryshkov
Cc: Maulik Shah (mkshah), Andy Gross, Bjorn Andersson,
Thomas Gleixner, linux-arm-msm, linux-kernel, Neil Armstrong
On 28.08.2023 12:04, Marc Zyngier wrote:
> On Mon, 28 Aug 2023 10:46:10 +0100,
> Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
>>
>> On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
>> <quic_mkshah@quicinc.com> wrote:
>>>
>>> Hi Dmitry,
>>>
>>> This patch may be useful if there was a case where some PDCs don't have
>>> version register populated/available,
>>> In all PDC versions, version register is always available but due to reg
>>> size not good enough in device tree for SM8150 it failed to read.
>>>
>>> reg size in device node must be expanded if its too small to access all
>>> registers and i think
>>> additional check in driver to check if size is good enough would not be
>>> of much use.
>>
>> Unfortunately, it doesn't work this way. DT files are ABI. Even if we
>> change the DT, the kernel should continue working with the older
>> version.
>> Thus, we have to add such bandaid code, which will keep the kernel
>> from crashing if old DT was used.
>
> You're missing the point: all existing PDC HW have version register.
> The fact that the DT is crap doesn't invalidate this simple fact. It
> is thus perfectly possible for the driver to *ignore* the crap and do
> the right thing by expanding the size of the mapping, rather than
> falling back to the non-versioned code.
I wasn't sure if this would cross the "too hacky" boundary, but if
you're fine with it, I'll happily ack this approach.
Konrad
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 10:18 ` Dmitry Baryshkov
@ 2023-08-28 10:26 ` Marc Zyngier
2023-08-28 12:02 ` Neil Armstrong
2023-08-29 4:25 ` Maulik Shah (mkshah)
2 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2023-08-28 10:26 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Maulik Shah (mkshah), Andy Gross, Bjorn Andersson, Konrad Dybcio,
Thomas Gleixner, linux-arm-msm, linux-kernel, Neil Armstrong
On Mon, 28 Aug 2023 11:18:10 +0100,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
>
> On Mon, 28 Aug 2023 at 13:04, Marc Zyngier <maz@kernel.org> wrote:
> >
> > On Mon, 28 Aug 2023 10:46:10 +0100,
> > Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
> > >
> > > On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
> > > <quic_mkshah@quicinc.com> wrote:
> > > >
> > > > Hi Dmitry,
> > > >
> > > > This patch may be useful if there was a case where some PDCs don't have
> > > > version register populated/available,
> > > > In all PDC versions, version register is always available but due to reg
> > > > size not good enough in device tree for SM8150 it failed to read.
> > > >
> > > > reg size in device node must be expanded if its too small to access all
> > > > registers and i think
> > > > additional check in driver to check if size is good enough would not be
> > > > of much use.
> > >
> > > Unfortunately, it doesn't work this way. DT files are ABI. Even if we
> > > change the DT, the kernel should continue working with the older
> > > version.
> > > Thus, we have to add such bandaid code, which will keep the kernel
> > > from crashing if old DT was used.
> >
> > You're missing the point: all existing PDC HW have version register.
> > The fact that the DT is crap doesn't invalidate this simple fact. It
> > is thus perfectly possible for the driver to *ignore* the crap and do
> > the right thing by expanding the size of the mapping, rather than
> > falling back to the non-versioned code.
>
> Ah. Interesting idea. If that's the overall consensus I can send v2
> doing this. Not sure what is better though.
Given that DT files are mostly generated using copy-paste by people
making a point not to read specifications, odds are that your current
patch would end-up applying the v0 behaviour to v3.2 HW.
What could possibly go wrong?
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 10:18 ` Dmitry Baryshkov
2023-08-28 10:26 ` Marc Zyngier
@ 2023-08-28 12:02 ` Neil Armstrong
2023-08-29 4:25 ` Maulik Shah (mkshah)
2 siblings, 0 replies; 12+ messages in thread
From: Neil Armstrong @ 2023-08-28 12:02 UTC (permalink / raw)
To: Dmitry Baryshkov, Marc Zyngier
Cc: Maulik Shah (mkshah), Andy Gross, Bjorn Andersson, Konrad Dybcio,
Thomas Gleixner, linux-arm-msm, linux-kernel
On 28/08/2023 12:18, Dmitry Baryshkov wrote:
> On Mon, 28 Aug 2023 at 13:04, Marc Zyngier <maz@kernel.org> wrote:
>>
>> On Mon, 28 Aug 2023 10:46:10 +0100,
>> Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
>>>
>>> On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
>>> <quic_mkshah@quicinc.com> wrote:
>>>>
>>>> Hi Dmitry,
>>>>
>>>> This patch may be useful if there was a case where some PDCs don't have
>>>> version register populated/available,
>>>> In all PDC versions, version register is always available but due to reg
>>>> size not good enough in device tree for SM8150 it failed to read.
>>>>
>>>> reg size in device node must be expanded if its too small to access all
>>>> registers and i think
>>>> additional check in driver to check if size is good enough would not be
>>>> of much use.
>>>
>>> Unfortunately, it doesn't work this way. DT files are ABI. Even if we
>>> change the DT, the kernel should continue working with the older
>>> version.
>>> Thus, we have to add such bandaid code, which will keep the kernel
>>> from crashing if old DT was used.
>>
>> You're missing the point: all existing PDC HW have version register.
>> The fact that the DT is crap doesn't invalidate this simple fact. It
>> is thus perfectly possible for the driver to *ignore* the crap and do
>> the right thing by expanding the size of the mapping, rather than
>> falling back to the non-versioned code.
>
> Ah. Interesting idea. If that's the overall consensus I can send v2
> doing this. Not sure what is better though.
Please take my PDC 3.2 patch in the same set!
Neil
>
>>
>> There is definitely precedents for this sort of behaviour, such as the
>> ARM GICv2 probe code.
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available
2023-08-28 10:18 ` Dmitry Baryshkov
2023-08-28 10:26 ` Marc Zyngier
2023-08-28 12:02 ` Neil Armstrong
@ 2023-08-29 4:25 ` Maulik Shah (mkshah)
2 siblings, 0 replies; 12+ messages in thread
From: Maulik Shah (mkshah) @ 2023-08-29 4:25 UTC (permalink / raw)
To: Dmitry Baryshkov, Marc Zyngier
Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Thomas Gleixner,
linux-arm-msm, linux-kernel, Neil Armstrong
Hi,
On 8/28/2023 3:48 PM, Dmitry Baryshkov wrote:
> On Mon, 28 Aug 2023 at 13:04, Marc Zyngier <maz@kernel.org> wrote:
>> On Mon, 28 Aug 2023 10:46:10 +0100,
>> Dmitry Baryshkov <dmitry.baryshkov@linaro.org> wrote:
>>> On Mon, 28 Aug 2023 at 12:36, Maulik Shah (mkshah)
>>> <quic_mkshah@quicinc.com> wrote:
>>>> Hi Dmitry,
>>>>
>>>> This patch may be useful if there was a case where some PDCs don't have
>>>> version register populated/available,
>>>> In all PDC versions, version register is always available but due to reg
>>>> size not good enough in device tree for SM8150 it failed to read.
>>>>
>>>> reg size in device node must be expanded if its too small to access all
>>>> registers and i think
>>>> additional check in driver to check if size is good enough would not be
>>>> of much use.
>>> Unfortunately, it doesn't work this way. DT files are ABI. Even if we
>>> change the DT, the kernel should continue working with the older
>>> version.
>>> Thus, we have to add such bandaid code, which will keep the kernel
>>> from crashing if old DT was used.
>> You're missing the point: all existing PDC HW have version register.
>> The fact that the DT is crap doesn't invalidate this simple fact. It
>> is thus perfectly possible for the driver to *ignore* the crap and do
>> the right thing by expanding the size of the mapping, rather than
>> falling back to the non-versioned code.
> Ah. Interesting idea. If that's the overall consensus I can send v2
> doing this. Not sure what is better though.
if expanding register size and reading version register looks too hacky
the other way is to have "qcom,pdc-v3.2" compatible for newer targets
post which don't need to read version register to figure out as the
compatible string is enough to tell if v3.2 HW behavior needs to apply.
I am ok with either approach but biased towards using version register
rather than compatibles.
Thanks,
Maulik
>> There is definitely precedents for this sort of behaviour, such as the
>> ARM GICv2 probe code.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-08-29 4:26 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-25 21:35 [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Dmitry Baryshkov
2023-08-25 21:35 ` [PATCH 2/2] arm64: dts: qcom: sm8150: extend the size of the PDC resource Dmitry Baryshkov
2023-08-26 9:49 ` Konrad Dybcio
2023-08-28 9:36 ` [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available Maulik Shah (mkshah)
2023-08-28 9:45 ` Konrad Dybcio
2023-08-28 9:46 ` Dmitry Baryshkov
2023-08-28 10:04 ` Marc Zyngier
2023-08-28 10:18 ` Dmitry Baryshkov
2023-08-28 10:26 ` Marc Zyngier
2023-08-28 12:02 ` Neil Armstrong
2023-08-29 4:25 ` Maulik Shah (mkshah)
2023-08-28 10:20 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox