linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies
@ 2023-07-03 13:52 Niklas Schnelle
  2023-07-03 13:52 ` [PATCH v6 1/2] PCI: Make quirk using inw() depend on HAS_IOPORT Niklas Schnelle
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Niklas Schnelle @ 2023-07-03 13:52 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Arnd Bergmann, linux-pci, linux-kernel

Hi Bjorn,

This is a follow up to my ongoing effort of making the inb()/outb() and
similar I/O port accessors compile-time optional. Previously I sent this as
a complete treewide series titled "treewide: Remove I/O port accessors for
HAS_IOPORT=n" with the latest being its 5th version[0]. Now about half of
the per-subsystem patches have been merged so I'm changing over to stand
alone subsystem patches. These series are stand alone and should be merged
via the relevant tree such that with all subsystems complete we can follow
this up with the last patch[1] that will make the I/O port accessors
compile-time optional.

As for compile-time vs runtime see Linus' reply to my first attempt[2].

Other than rebasing on current master there are no changes to these
two patches for the PCI subsystem.

Thanks,
Niklas

[0] https://lore.kernel.org/all/20230516110038.2413224-1-schnelle@linux.ibm.com/
[1] https://lore.kernel.org/all/20230516110038.2413224-42-schnelle@linux.ibm.com/
[2] https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/

Niklas Schnelle (2):
  PCI: Make quirk using inw() depend on HAS_IOPORT
  PCI/sysfs: Make I/O resource depend on HAS_IOPORT

 drivers/pci/pci-sysfs.c | 4 ++++
 drivers/pci/quirks.c    | 2 ++
 2 files changed, 6 insertions(+)


base-commit: a901a3568fd26ca9c4a82d8bc5ed5b3ed844d451
-- 
2.39.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v6 1/2] PCI: Make quirk using inw() depend on HAS_IOPORT
  2023-07-03 13:52 [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Niklas Schnelle
@ 2023-07-03 13:52 ` Niklas Schnelle
  2023-07-03 13:52 ` [PATCH v6 2/2] PCI/sysfs: Make I/O resource " Niklas Schnelle
  2023-07-03 17:42 ` [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Bjorn Helgaas
  2 siblings, 0 replies; 7+ messages in thread
From: Niklas Schnelle @ 2023-07-03 13:52 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Arnd Bergmann, linux-pci, linux-kernel

In the future inw() and friends will not be compiled on architectures
without I/O port support.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pci/quirks.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 321156ca273d..ef193661c3d1 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -361,6 +361,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC,	PCI_DEVICE_ID_NEC_CBUS_2,	quirk_isa_d
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC,	PCI_DEVICE_ID_NEC_CBUS_3,	quirk_isa_dma_hangs);
 #endif
 
+#ifdef CONFIG_HAS_IOPORT
 /*
  * Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear
  * for some HT machines to use C4 w/o hanging.
@@ -380,6 +381,7 @@ static void quirk_tigerpoint_bm_sts(struct pci_dev *dev)
 	}
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts);
+#endif
 
 /* Chipsets where PCI->PCI transfers vanish or hang */
 static void quirk_nopcipci(struct pci_dev *dev)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v6 2/2] PCI/sysfs: Make I/O resource depend on HAS_IOPORT
  2023-07-03 13:52 [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Niklas Schnelle
  2023-07-03 13:52 ` [PATCH v6 1/2] PCI: Make quirk using inw() depend on HAS_IOPORT Niklas Schnelle
@ 2023-07-03 13:52 ` Niklas Schnelle
  2023-07-03 17:42 ` [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Bjorn Helgaas
  2 siblings, 0 replies; 7+ messages in thread
From: Niklas Schnelle @ 2023-07-03 13:52 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Arnd Bergmann, linux-pci, linux-kernel

If legacy I/O spaces are not supported simply return an error when
trying to access them via pci_resource_io(). This allows inb() and
friends to become undefined when they are known at compile time to be
non-functional in a later patch.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/pci/pci-sysfs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index ab32a91f287b..d9eede2dbc0e 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
 			       struct bin_attribute *attr, char *buf,
 			       loff_t off, size_t count, bool write)
 {
+#ifdef CONFIG_HAS_IOPORT
 	struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
 	int bar = (unsigned long)attr->private;
 	unsigned long port = off;
@@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
 		return 4;
 	}
 	return -EINVAL;
+#else
+	return -ENXIO;
+#endif
 }
 
 static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies
  2023-07-03 13:52 [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Niklas Schnelle
  2023-07-03 13:52 ` [PATCH v6 1/2] PCI: Make quirk using inw() depend on HAS_IOPORT Niklas Schnelle
  2023-07-03 13:52 ` [PATCH v6 2/2] PCI/sysfs: Make I/O resource " Niklas Schnelle
@ 2023-07-03 17:42 ` Bjorn Helgaas
  2023-07-03 18:02   ` Niklas Schnelle
  2 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2023-07-03 17:42 UTC (permalink / raw)
  To: Niklas Schnelle; +Cc: Bjorn Helgaas, Arnd Bergmann, linux-pci, linux-kernel

On Mon, Jul 03, 2023 at 03:52:53PM +0200, Niklas Schnelle wrote:
> Hi Bjorn,
> 
> This is a follow up to my ongoing effort of making the inb()/outb() and
> similar I/O port accessors compile-time optional. Previously I sent this as
> a complete treewide series titled "treewide: Remove I/O port accessors for
> HAS_IOPORT=n" with the latest being its 5th version[0]. Now about half of
> the per-subsystem patches have been merged so I'm changing over to stand
> alone subsystem patches. These series are stand alone and should be merged
> via the relevant tree such that with all subsystems complete we can follow
> this up with the last patch[1] that will make the I/O port accessors
> compile-time optional.

Is the merge plan for each subsystem to merge this separately?  I
acked these so they could be merged along with all the tree-wide
changes.

> As for compile-time vs runtime see Linus' reply to my first attempt[2].
> 
> Other than rebasing on current master there are no changes to these
> two patches for the PCI subsystem.
> 
> Thanks,
> Niklas
> 
> [0] https://lore.kernel.org/all/20230516110038.2413224-1-schnelle@linux.ibm.com/
> [1] https://lore.kernel.org/all/20230516110038.2413224-42-schnelle@linux.ibm.com/
> [2] https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/
> 
> Niklas Schnelle (2):
>   PCI: Make quirk using inw() depend on HAS_IOPORT
>   PCI/sysfs: Make I/O resource depend on HAS_IOPORT
> 
>  drivers/pci/pci-sysfs.c | 4 ++++
>  drivers/pci/quirks.c    | 2 ++
>  2 files changed, 6 insertions(+)
> 
> 
> base-commit: a901a3568fd26ca9c4a82d8bc5ed5b3ed844d451
> -- 
> 2.39.2
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies
  2023-07-03 17:42 ` [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Bjorn Helgaas
@ 2023-07-03 18:02   ` Niklas Schnelle
  2023-07-18 21:12     ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Niklas Schnelle @ 2023-07-03 18:02 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: Bjorn Helgaas, Arnd Bergmann, linux-pci, linux-kernel

On Mon, 2023-07-03 at 12:42 -0500, Bjorn Helgaas wrote:
> On Mon, Jul 03, 2023 at 03:52:53PM +0200, Niklas Schnelle wrote:
> > Hi Bjorn,
> > 
> > This is a follow up to my ongoing effort of making the inb()/outb() and
> > similar I/O port accessors compile-time optional. Previously I sent this as
> > a complete treewide series titled "treewide: Remove I/O port accessors for
> > HAS_IOPORT=n" with the latest being its 5th version[0]. Now about half of
> > the per-subsystem patches have been merged so I'm changing over to stand
> > alone subsystem patches. These series are stand alone and should be merged
> > via the relevant tree such that with all subsystems complete we can follow
> > this up with the last patch[1] that will make the I/O port accessors
> > compile-time optional.
> 
> Is the merge plan for each subsystem to merge this separately?  I
> acked these so they could be merged along with all the tree-wide
> changes.

Hi Björn,

Yeah this went back and forth a little, sorry about that. With the
Kconfig introduction of HAS_IOPORT merged about half of the original
patches have been merged via subsystem maintainers or are at least
sitting in linux-next already.  Arnd was anticipating that he'll pick
up some left overs but at the moment the simplest is for subsystems to
pick the patches up themselves ideally and if small enough for v6.5
still.

Thanks,
Niklas

> 
> > As for compile-time vs runtime see Linus' reply to my first attempt[2].
> > 
> > Other than rebasing on current master there are no changes to these
> > two patches for the PCI subsystem.
> > 
> > Thanks,
> > Niklas
> > 
> > [0] https://lore.kernel.org/all/20230516110038.2413224-1-schnelle@linux.ibm.com/
> > [1] https://lore.kernel.org/all/20230516110038.2413224-42-schnelle@linux.ibm.com/
> > [2] https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/
> > 
> > Niklas Schnelle (2):
> >   PCI: Make quirk using inw() depend on HAS_IOPORT
> >   PCI/sysfs: Make I/O resource depend on HAS_IOPORT
> > 
> >  drivers/pci/pci-sysfs.c | 4 ++++
> >  drivers/pci/quirks.c    | 2 ++
> >  2 files changed, 6 insertions(+)
> > 
> > 
> > base-commit: a901a3568fd26ca9c4a82d8bc5ed5b3ed844d451
> > -- 
> > 2.39.2
> > 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies
  2023-07-03 18:02   ` Niklas Schnelle
@ 2023-07-18 21:12     ` Bjorn Helgaas
  2023-07-18 21:58       ` Bjorn Helgaas
  0 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2023-07-18 21:12 UTC (permalink / raw)
  To: Niklas Schnelle; +Cc: Bjorn Helgaas, Arnd Bergmann, linux-pci, linux-kernel

On Mon, Jul 03, 2023 at 08:02:40PM +0200, Niklas Schnelle wrote:
> On Mon, 2023-07-03 at 12:42 -0500, Bjorn Helgaas wrote:
> > On Mon, Jul 03, 2023 at 03:52:53PM +0200, Niklas Schnelle wrote:
> > > Hi Bjorn,
> > > 
> > > This is a follow up to my ongoing effort of making the inb()/outb() and
> > > similar I/O port accessors compile-time optional. Previously I sent this as
> > > a complete treewide series titled "treewide: Remove I/O port accessors for
> > > HAS_IOPORT=n" with the latest being its 5th version[0]. Now about half of
> > > the per-subsystem patches have been merged so I'm changing over to stand
> > > alone subsystem patches. These series are stand alone and should be merged
> > > via the relevant tree such that with all subsystems complete we can follow
> > > this up with the last patch[1] that will make the I/O port accessors
> > > compile-time optional.
> > 
> > Is the merge plan for each subsystem to merge this separately?  I
> > acked these so they could be merged along with all the tree-wide
> > changes.
> 
> Hi Björn,
> 
> Yeah this went back and forth a little, sorry about that. With the
> Kconfig introduction of HAS_IOPORT merged about half of the original
> patches have been merged via subsystem maintainers or are at least
> sitting in linux-next already.  Arnd was anticipating that he'll pick
> up some left overs but at the moment the simplest is for subsystems to
> pick the patches up themselves ideally and if small enough for v6.5
> still.

I didn't merge these in time for the v6.5 merge window.  If you want
these in v6.5, it's fine with me, and it would probably make more
sense for you to bundle them with any other leftovers.

Otherwise, let me know and I'm happy to queue them for v6.6.

Bjorn

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies
  2023-07-18 21:12     ` Bjorn Helgaas
@ 2023-07-18 21:58       ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2023-07-18 21:58 UTC (permalink / raw)
  To: Niklas Schnelle; +Cc: Bjorn Helgaas, Arnd Bergmann, linux-pci, linux-kernel

On Tue, Jul 18, 2023 at 04:12:24PM -0500, Bjorn Helgaas wrote:
> On Mon, Jul 03, 2023 at 08:02:40PM +0200, Niklas Schnelle wrote:
> > On Mon, 2023-07-03 at 12:42 -0500, Bjorn Helgaas wrote:
> > > On Mon, Jul 03, 2023 at 03:52:53PM +0200, Niklas Schnelle wrote:
> > > > Hi Bjorn,
> > > > 
> > > > This is a follow up to my ongoing effort of making the inb()/outb() and
> > > > similar I/O port accessors compile-time optional. Previously I sent this as
> > > > a complete treewide series titled "treewide: Remove I/O port accessors for
> > > > HAS_IOPORT=n" with the latest being its 5th version[0]. Now about half of
> > > > the per-subsystem patches have been merged so I'm changing over to stand
> > > > alone subsystem patches. These series are stand alone and should be merged
> > > > via the relevant tree such that with all subsystems complete we can follow
> > > > this up with the last patch[1] that will make the I/O port accessors
> > > > compile-time optional.
> > > 
> > > Is the merge plan for each subsystem to merge this separately?  I
> > > acked these so they could be merged along with all the tree-wide
> > > changes.
> > 
> > Hi Björn,
> > 
> > Yeah this went back and forth a little, sorry about that. With the
> > Kconfig introduction of HAS_IOPORT merged about half of the original
> > patches have been merged via subsystem maintainers or are at least
> > sitting in linux-next already.  Arnd was anticipating that he'll pick
> > up some left overs but at the moment the simplest is for subsystems to
> > pick the patches up themselves ideally and if small enough for v6.5
> > still.
> 
> I didn't merge these in time for the v6.5 merge window.  If you want
> these in v6.5, it's fine with me, and it would probably make more
> sense for you to bundle them with any other leftovers.
> 
> Otherwise, let me know and I'm happy to queue them for v6.6.

I provisionally put these on pci/ioport for v6.6.  If you pick them up
for v6.5, let me know and I'll just drop that branch.

Bjorn

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-18 21:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-03 13:52 [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Niklas Schnelle
2023-07-03 13:52 ` [PATCH v6 1/2] PCI: Make quirk using inw() depend on HAS_IOPORT Niklas Schnelle
2023-07-03 13:52 ` [PATCH v6 2/2] PCI/sysfs: Make I/O resource " Niklas Schnelle
2023-07-03 17:42 ` [PATCH v6 0/2] PCI: Handle HAS_IOPORT dependencies Bjorn Helgaas
2023-07-03 18:02   ` Niklas Schnelle
2023-07-18 21:12     ` Bjorn Helgaas
2023-07-18 21:58       ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).