[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <699d35cd36f3d77c112a6aa8705b043efaa63711.camel@sipsolutions.net>
Date: Tue, 28 Feb 2023 18:39:34 +0100
From: Johannes Berg <johannes@...solutions.net>
To: Vincent Whitchurch <vincent.whitchurch@...s.com>
Cc: Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
"robh@...nel.org" <robh@...nel.org>, devicetree@...r.kernel.org,
"linux-um@...ts.infradead.org" <linux-um@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
kernel <kernel@...s.com>
Subject: Re: [PATCH] virt-pci: add platform bus support
On Tue, 2023-02-14 at 13:12 +0100, Vincent Whitchurch wrote:
>
> Yes, Greg was initially totally opposed to the idea of putting platform
> devices under PCI devices, but in his latest email he seemed to
> allow it in some cases. It's still unclear if he'd be OK with a
> "virtual PCI-to-platform bridge" though. And yes, adding platform
> devices support like in this patch removes one layer and also eliminates
> the disadvantage of having to wait for user space to specify a PCI ID
> for the bridge device.
Right.
> > > + if (!dev->irq)
> > > + return;
> > >
> >
> > Does that mean platform devices don't have interrupts, or does that mean
> > not all of them must have interrupts?
>
> They don't have interrupts via this driver. There isn't any standard
> way for platform devices to handle interrupts since it it all depends on
> what interrupt-parent is specified in the devicetree and how that is
> implemented.
Ah, OK.
> > I'll note that this also would allow the device to send an MSI which
> > feels a bit wrong? But I guess it doesn't really matter.
>
> We could avoid setting up the IRQ/MSI virtqueue when we know we're
> dealing with platform devices.
Not sure it matters then?
> > So let me ask this: Conceptually, wouldn't the "right" way to handle
> > this be a new virtio device and protocol and everything, with a new
> > driver to handle it? I realise that would likely lead to quite a bit of
> > code duplication, for now I just want to understand the concept here a
> > bit better.
>
> Yes, that could be a way to do it. Or there could perhaps be some
> feature bits indicating that only MMIO read/write/memset are allowed.
Right.
> > How much code would we actually duplicate? Most of virt-pci is dedicated
> > to the mess of PCI MSI domains, bridges, etc.
>
> Probably not a huge amount, I can try to cook up a patch if you'd like.
> But, besides the code duplication, I'm not sure if adding another new
> virtio driver without a specification would be OK?
Yeah ... let's not worry. Was mostly trying to understand it better.
I'm not really bothered by it :)
> > The limitation to a single device feels odd, and the fact that you have
>
> The limitation to a single device here is not a problem since one can
> use simple-bus to instantiate any number of platform devices via the
> devicetree. The devicetree at the end of this email shows how that
> looks like.
OK cool.
> With a devicetree like the one below, using it shouldn't be all that
> different from using the normal virt-pci except that the register ranges
> and IRQ information are in the devicetree rather than coming via the
> config space implementation in the virtio device.
Makes sense.
Thanks for all the answers & examples! Let's just leave it as is then :)
johannes
Powered by blists - more mailing lists