[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DEFL4TG0WX1C.2GLH4417EPU3V@kernel.org>
Date: Sun, 23 Nov 2025 11:43:08 +1300
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Jason Gunthorpe" <jgg@...pe.ca>
Cc: "Peter Colberg" <pcolberg@...hat.com>, "Bjorn Helgaas"
<bhelgaas@...gle.com>, Krzysztof Wilczyński
<kwilczynski@...nel.org>, "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Abdiel Janulgue"
<abdiel.janulgue@...il.com>, "Daniel Almeida"
<daniel.almeida@...labora.com>, "Robin Murphy" <robin.murphy@....com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Dave Ertman"
<david.m.ertman@...el.com>, "Ira Weiny" <ira.weiny@...el.com>, "Leon
Romanovsky" <leon@...nel.org>, <linux-pci@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
"Alexandre Courbot" <acourbot@...dia.com>, "Alistair Popple"
<apopple@...dia.com>, "Joel Fernandes" <joelagnelf@...dia.com>, "John
Hubbard" <jhubbard@...dia.com>, "Zhi Wang" <zhiw@...dia.com>
Subject: Re: [PATCH 7/8] rust: pci: add physfn(), to return PF device for VF
device
On Sun Nov 23, 2025 at 5:16 AM NZDT, Jason Gunthorpe wrote:
> I think to make progress along this line you need to still somehow
> validate that the PF driver is working right, either by checking that
> the driver is bound to a rust driver somehow or using the same
> approach as the core helper.
Do you refer to the
if (pf_dev->driver != pf_driver)
check? If so, that's (in a slightly different form) already part of the generic
Device::drvdata() accessor.
> I'm not sure the idea to force all drivers to do disable sriov is
> going to be easy, and I'd rather see rust bindings progress without
> opening such a topic..
I'm sorry, I should have mentioned what I actually propose:
My idea would be to provide a bool in struct pci_driver, which, if set,
guarantees that all VFs are unbound when the PF is unbound.
With this bool being set, the PCI bus can provide the guarantee that VF bound
implies PF bound; the Rust accessor can then leverage this guarantee.
This can also be leveraged by the C code, where we could have a separate
accessor that checks the bool rather than askes the driver to promise that the
PF is bound, which pci_iov_get_pf_drvdata() does.
(Although I have to admit that without the additional type system capabilities
we have in Rust, it is not that big of an improvement.)
Powered by blists - more mailing lists