Re: platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe
From: Andy Shevchenko
Date: Tue Nov 19 2024 - 04:37:43 EST
On Tue, Nov 19, 2024 at 02:20:48AM +0000, Shinichiro Kawasaki wrote:
> On Nov 18, 2024 / 17:15, Daniel Walker (danielwa) wrote:
> > On Mon, Nov 18, 2024 at 05:00:52PM +0100, Hans de Goede wrote:
[...]
> > > > Hans, there will be no need to fix anything if they implement correct access
> > > > to the GPIO, i.e. via driver and board code with GPIO lookup tables.
> > >
> > > Agreed, still I'm not sure how I feel about us hiding the previously unhidden P2SB.
> > >
> > > OTOH I guess it may have only been unhidden in the BIOS to make the hack they
> > > are using possible in the first place.
> >
> > From a flexibility POV I would suggest if you can not hide it if it's not already
> > hidden by the BIOS that would be better since some company may have a good
> > reason to make a custom driver or to export the pci device to userspace thru
> > UIO. The current situation is you can't make a custom driver if p2sb is enable
> > with this additional patch even if you unhide the device inside the BIOS.
> >
> > In our case it seems like we could use the already existing solution with
> > pinctrl, but others may not be able to do that or may not want to for different
> > reasons.
>
> I don't have strong opinion about the choice, but I wonder how the p2sb code
> will be if we keep the unhidden P2SB. I created a trial patch below. If the
> device is not hidden, it does not call pci_scan_single_device() and
> pci_stop_and_remove_bus_device(). Instead, it calls pci_get_slot() and
> pci_dev_put(). I don't have the environment which unhides P2SB. Daniel, if you
> have time to afford, please try it out.
...
> - ret = p2sb_scan_and_cache(bus, devfn_p2sb);
> + ret = p2sb_scan_and_cache(bus, devfn_p2sb, hidden);
If you still want to implement this, rather make the two different calls here
if (hidden)
ret = p2sb_scan_and_cache(bus, devfn_p2sb);
else
ret = p2sb_read_and_cache(...);
otherwise the code looks much uglier... :-(
--
With Best Regards,
Andy Shevchenko