[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=whLv3MO0Tvc62zJ+=4yvSfKMK17C0wfpbXBwUJqSjKbYA@mail.gmail.com>
Date: Thu, 13 Oct 2022 10:19:02 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: "Michael S. Tsirkin" <mst@...hat.com>, xiujianfeng@...wei.com,
kvm@...r.kernel.org, alvaro.karsz@...id-run.com,
Jason Wang <jasowang@...hat.com>, angus.chen@...uarmicro.com,
wangdeming@...pur.com, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
Netdev <netdev@...r.kernel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, lingshan.zhu@...el.com,
linuxppc-dev@...ts.ozlabs.org, gavinl@...dia.com
Subject: Re: [GIT PULL] virtio: fixes, features
On Wed, Oct 12, 2022 at 11:29 PM Arnd Bergmann <arnd@...db.de> wrote:
>
> On Thu, Oct 13, 2022, at 12:08 AM, Michael S. Tsirkin wrote:
> >
> > Do these two boxes even have pci?
>
> Footbridge/netwinder has PCI and PC-style ISA on-board devices
> (floppy, ps2 mouse/keyboard, parport, soundblaster, ...), RiscPC
> has neither.
It's worth noting that changing a driver that does
if (dev->irq == NO_IRQ)
return -ENODEV;
to use
if (!dev->irq)
return -ENODEV;
should be pretty much always fine.
Even *if* that driver is then compiled and used on an architecture
where NO_IRQ is one of the odd values, you end up having only two
cases
(a) irq 0 was actually a valid irq after all
(b) you just get the error later when actually trying to use the odd
NO_IRQ interrupt with request_irq() and friends
and here (a) basically never happens - certainly not for any PCI setup
- and (b) is harmless unless the driver was already terminally broken
anyway.
The one exception for (a) might be some platform irq code. On x86,
that would be the legacy timer interrupt, of course.
So if some odd platform actually has a "real" interrupt on irq0, that
platform should either just fix the irq number mapping, or should
consider that interrupt to be a platform-specific thing and handle it
very very specially.
On x86, for example, we do
if (request_irq(0, timer_interrupt, flags, "timer", NULL))
early in boot, and that's basically what then makes sure that no
driver can get that irq. It's done through the platform "timer_init"
code at the "late_time_init()" call.
(And that "late_time_init()" - despite the name - isn't very late at
all. It's just later than the very early timekeeping init - after
interrupts have been enabled at all.
Linus
Powered by blists - more mailing lists