Subject: Re: [PATCH] sh: Avoid using IRQ0 on SH3 and SH4

Hi Guenter!

On Thu, 2023-07-06 at 06:57 -0700, Guenter Roeck wrote:
> On Thu, Jun 01, 2023 at 11:22:17PM +0300, Sergey Shtylyov wrote:
> > IRQ0 is no longer returned by platform_get_irq() and its ilk -- they now
> > return -EINVAL instead. However, the kernel code supporting SH3/4-based
> > SoCs still maps the IRQ #s starting at 0 -- modify that code to start the
> > IRQ #s from 16 instead.
> >
> > The patch should mostly affect the AP-SH4A-3A/AP-SH4AD-0A boards as they
> > indeed are using IRQ0 for the SMSC911x compatible Ethernet chip.
> >
>
> Unfortunately it also affects all sh4 emulations in qemu, and results in
> boot stalls with those. There isn't a relevant log to attach because there
> is no error message - booting just stalls until the emulation is aborted.
>
> Reverting this patch fixes the problem.
>
> Bisect log is attached for reference. Note that bisect requires applying
> commit 7497840d462c ("sh: Provide unxlate_dev_mem_ptr() in asm/io.h"),
> which is also the reason why the problem was not observed earlier since
> it was hiding behind a build failure.

Interesting. My naive understanding was that IRQ0 is no longer usable in the
kernel as Sergey claimed. Was that not correct?

Adrian

--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913


2023-07-06 16:17:47

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] sh: Avoid using IRQ0 on SH3 and SH4

On 7/6/23 07:01, John Paul Adrian Glaubitz wrote:
> Hi Guenter!
>
> On Thu, 2023-07-06 at 06:57 -0700, Guenter Roeck wrote:
>> On Thu, Jun 01, 2023 at 11:22:17PM +0300, Sergey Shtylyov wrote:
>>> IRQ0 is no longer returned by platform_get_irq() and its ilk -- they now
>>> return -EINVAL instead. However, the kernel code supporting SH3/4-based
>>> SoCs still maps the IRQ #s starting at 0 -- modify that code to start the
>>> IRQ #s from 16 instead.
>>>
>>> The patch should mostly affect the AP-SH4A-3A/AP-SH4AD-0A boards as they
>>> indeed are using IRQ0 for the SMSC911x compatible Ethernet chip.
>>>
>>
>> Unfortunately it also affects all sh4 emulations in qemu, and results in
>> boot stalls with those. There isn't a relevant log to attach because there
>> is no error message - booting just stalls until the emulation is aborted.
>>
>> Reverting this patch fixes the problem.
>>
>> Bisect log is attached for reference. Note that bisect requires applying
>> commit 7497840d462c ("sh: Provide unxlate_dev_mem_ptr() in asm/io.h"),
>> which is also the reason why the problem was not observed earlier since
>> it was hiding behind a build failure.
>
> Interesting. My naive understanding was that IRQ0 is no longer usable in the
> kernel as Sergey claimed. Was that not correct?
>

I have no idea. All I know is that all my sh4 qemu emulations hang during boot
after this patch is applied. I don't have CONFIG_SMSC911X enabled in my builds.
I also don't see any error messages from failed IRQ requests after reverting
this patch.

Guenter


2023-07-08 21:42:30

by Sergey Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] sh: Avoid using IRQ0 on SH3 and SH4

On 7/6/23 5:01 PM, John Paul Adrian Glaubitz wrote:
[...]

>> On Thu, Jun 01, 2023 at 11:22:17PM +0300, Sergey Shtylyov wrote:
>>> IRQ0 is no longer returned by platform_get_irq() and its ilk -- they now
>>> return -EINVAL instead. However, the kernel code supporting SH3/4-based
>>> SoCs still maps the IRQ #s starting at 0 -- modify that code to start the
>>> IRQ #s from 16 instead.
>>>
>>> The patch should mostly affect the AP-SH4A-3A/AP-SH4AD-0A boards as they
>>> indeed are using IRQ0 for the SMSC911x compatible Ethernet chip.
>>>
>>
>> Unfortunately it also affects all sh4 emulations in qemu, and results in
>> boot stalls with those. There isn't a relevant log to attach because there
>> is no error message - booting just stalls until the emulation is aborted.
>>
>> Reverting this patch fixes the problem.
>>
>> Bisect log is attached for reference. Note that bisect requires applying
>> commit 7497840d462c ("sh: Provide unxlate_dev_mem_ptr() in asm/io.h"),
>> which is also the reason why the problem was not observed earlier since
>> it was hiding behind a build failure.
>
> Interesting. My naive understanding was that IRQ0 is no longer usable in the
> kernel as Sergey claimed. Was that not correct?

According to Linus, using IRQ0 should only be allowed in the arch/ code
(usually the i8253 driver). As for the platform devices, this have been finally
enforced by this patch.

> Adrian

MBR, Sergey