Re: [PATCH 1/2] irqchip/qcom-pdc: don't read version register if it is not available

Dmitry Baryshkov
2023-08-28T09:47:03Z

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