linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 00/13] Remove implicit devres from pci_intx()
@ 2024-10-09  8:35 Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
                   ` (13 more replies)
  0 siblings, 14 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

Hi all,

this series removes a problematic feature from pci_intx(). That function
sometimes implicitly uses devres for automatic cleanup. We should get
rid of this implicit behavior.

To do so, a pci_intx() version that is always-managed, and one that is
never-managed are provided. Then, all pci_intx() users are ported to the
version they need. Afterwards, pci_intx() can be cleaned up and the
users of the never-managed version be ported back to pci_intx().

This way we'd get this PCI API consistent again.

The last patch obviously reverts the previous patches that made drivers
use pci_intx_unmanaged(). But this way it's easier to review and
approve. It also makes sure that each checked out commit should provide
correct behavior, not just the entire series as a whole.

Merge plan for this would be to enter through the PCI tree.

Please say so if you've got concerns with the general idea behind the
RFC.

Regards,
P.

Philipp Stanner (13):
  PCI: Prepare removing devres from pci_intx()
  ALSA: hda: hda_intel: Use always-managed version of pcim_intx()
  drivers/xen: Use never-managed version of pci_intx()
  net/ethernet: Use never-managed version of pci_intx()
  net/ntb: Use never-managed version of pci_intx()
  misc: Use never-managed version of pci_intx()
  vfio/pci: Use never-managed version of pci_intx()
  PCI: MSI: Use never-managed version of pci_intx()
  ata: Use always-managed version of pci_intx()
  staging: rts5280: Use always-managed version of pci_intx()
  wifi: qtnfmac: use always-managed version of pcim_intx()
  HID: amd_sfh: Use always-managed version of pcim_intx()
  Remove devres from pci_intx()

 drivers/ata/ahci.c                            |  2 +-
 drivers/ata/ata_piix.c                        |  2 +-
 drivers/ata/pata_rdc.c                        |  2 +-
 drivers/ata/sata_sil24.c                      |  2 +-
 drivers/ata/sata_sis.c                        |  2 +-
 drivers/ata/sata_uli.c                        |  2 +-
 drivers/ata/sata_vsc.c                        |  2 +-
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c        |  4 ++--
 drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c |  2 +-
 .../wireless/quantenna/qtnfmac/pcie/pcie.c    |  2 +-
 drivers/pci/devres.c                          | 24 +++----------------
 drivers/pci/pci.c                             | 14 +----------
 drivers/staging/rts5208/rtsx.c                |  2 +-
 include/linux/pci.h                           |  1 +
 sound/pci/hda/hda_intel.c                     |  2 +-
 15 files changed, 18 insertions(+), 47 deletions(-)

-- 
2.46.1


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

* [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  9:10   ` Damien Le Moal
                     ` (2 more replies)
  2024-10-09  8:35 ` [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx() Philipp Stanner
                   ` (12 subsequent siblings)
  13 siblings, 3 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which sometimes performs devres
operations, depending on whether pcim_enable_device() has been used to
enable the pci_dev. This sometimes-managed nature of the function is
problematic. Notably, it causes the function to allocate under some
circumstances which makes it unusable from interrupt context.

To, ultimately, remove the hybrid nature from pci_intx(), it is first
necessary to provide an always-managed and a never-managed version
of that function. Then, all callers of pci_intx() can be ported to the
version they need, depending whether they use pci_enable_device() or
pcim_enable_device().

An always-managed function exists, namely pcim_intx(), for which
__pcim_intx(), a never-managed version of pci_intx() had been
implemented.

Make __pcim_intx() a public function under the name
pci_intx_unmanaged(). Make pcim_intx() a public function.

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/pci/devres.c | 24 +++---------------------
 drivers/pci/pci.c    | 26 ++++++++++++++++++++++++++
 include/linux/pci.h  |  2 ++
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index b133967faef8..475a3ae5c33f 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -411,31 +411,12 @@ static inline bool mask_contains_bar(int mask, int bar)
 	return mask & BIT(bar);
 }
 
-/*
- * This is a copy of pci_intx() used to bypass the problem of recursive
- * function calls due to the hybrid nature of pci_intx().
- */
-static void __pcim_intx(struct pci_dev *pdev, int enable)
-{
-	u16 pci_command, new;
-
-	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
-
-	if (enable)
-		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
-	else
-		new = pci_command | PCI_COMMAND_INTX_DISABLE;
-
-	if (new != pci_command)
-		pci_write_config_word(pdev, PCI_COMMAND, new);
-}
-
 static void pcim_intx_restore(struct device *dev, void *data)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct pcim_intx_devres *res = data;
 
-	__pcim_intx(pdev, res->orig_intx);
+	pci_intx_unmanaged(pdev, res->orig_intx);
 }
 
 static struct pcim_intx_devres *get_or_create_intx_devres(struct device *dev)
@@ -472,10 +453,11 @@ int pcim_intx(struct pci_dev *pdev, int enable)
 		return -ENOMEM;
 
 	res->orig_intx = !enable;
-	__pcim_intx(pdev, enable);
+	pci_intx_unmanaged(pdev, enable);
 
 	return 0;
 }
+EXPORT_SYMBOL(pcim_intx);
 
 static void pcim_disable_device(void *pdev_raw)
 {
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7d85c04fbba2..318cfb5b5e15 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4476,6 +4476,32 @@ void pci_disable_parity(struct pci_dev *dev)
 	}
 }
 
+/**
+ * pci_intx - enables/disables PCI INTx for device dev, unmanaged version
+ * @pdev: the PCI device to operate on
+ * @enable: boolean: whether to enable or disable PCI INTx
+ *
+ * Enables/disables PCI INTx for device @pdev
+ *
+ * This function behavios identically to pci_intx(), but is never managed with
+ * devres.
+ */
+void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
+{
+	u16 pci_command, new;
+
+	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
+
+	if (enable)
+		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
+	else
+		new = pci_command | PCI_COMMAND_INTX_DISABLE;
+
+	if (new != pci_command)
+		pci_write_config_word(pdev, PCI_COMMAND, new);
+}
+EXPORT_SYMBOL_GPL(pci_intx_unmanaged);
+
 /**
  * pci_intx - enables/disables PCI INTx for device dev
  * @pdev: the PCI device to operate on
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 573b4c4c2be6..6b8cde76d564 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1353,6 +1353,7 @@ int __must_check pcim_set_mwi(struct pci_dev *dev);
 int pci_try_set_mwi(struct pci_dev *dev);
 void pci_clear_mwi(struct pci_dev *dev);
 void pci_disable_parity(struct pci_dev *dev);
+void pci_intx_unmanaged(struct pci_dev *pdev, int enable);
 void pci_intx(struct pci_dev *dev, int enable);
 bool pci_check_and_mask_intx(struct pci_dev *dev);
 bool pci_check_and_unmask_intx(struct pci_dev *dev);
@@ -2293,6 +2294,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
 				    struct pci_dev *dev) { }
 #endif
 
+int pcim_intx(struct pci_dev *pdev, int enabled);
 void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
 void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
 				const char *name);
-- 
2.46.1


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

* [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-10 14:46   ` Andy Shevchenko
  2024-10-09  8:35 ` [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx() Philipp Stanner
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

hda_intel enables its PCI-Device with pcim_enable_device(). Thus, it needs
the always-managed version.

Replace pci_intx() with pcim_intx().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 sound/pci/hda/hda_intel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b4540c5cd2a6..b44ca7b6e54f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -786,7 +786,7 @@ static int azx_acquire_irq(struct azx *chip, int do_disconnect)
 	}
 	bus->irq = chip->pci->irq;
 	chip->card->sync_irq = bus->irq;
-	pci_intx(chip->pci, !chip->msi);
+	pcim_intx(chip->pci, !chip->msi);
 	return 0;
 }
 
-- 
2.46.1


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

* [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx() Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:51   ` Juergen Gross
  2024-10-09  8:35 ` [RFC PATCH 04/13] net/ethernet: " Philipp Stanner
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

xen enables its PCI-Device with pci_enable_device(). Thus, it
needs the never-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/xen/xen-pciback/conf_space_header.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c
index fc0332645966..8d26d64232e8 100644
--- a/drivers/xen/xen-pciback/conf_space_header.c
+++ b/drivers/xen/xen-pciback/conf_space_header.c
@@ -106,7 +106,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 
 	if (dev_data && dev_data->allow_interrupt_control &&
 	    ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE))
-		pci_intx(dev, !(value & PCI_COMMAND_INTX_DISABLE));
+		pci_intx_unmanaged(dev, !(value & PCI_COMMAND_INTX_DISABLE));
 
 	cmd->val = value;
 
-- 
2.46.1


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

* [RFC PATCH 04/13] net/ethernet: Use never-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (2 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx() Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 05/13] net/ntb: " Philipp Stanner
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

broadcom/bnx2x and brocade/bna enable their PCI-Device with
pci_enable_device(). Thus, they need the never-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 2 +-
 drivers/net/ethernet/brocade/bna/bnad.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 678829646cec..2ae63d6e6792 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -1669,7 +1669,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp)
 	REG_WR(bp, IGU_REG_PF_CONFIGURATION, val);
 
 	if (val & IGU_PF_CONF_INT_LINE_EN)
-		pci_intx(bp->pdev, true);
+		pci_intx_unmanaged(bp->pdev, true);
 
 	barrier();
 
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index ece6f3b48327..2b37462d406e 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -2669,7 +2669,7 @@ bnad_enable_msix(struct bnad *bnad)
 		}
 	}
 
-	pci_intx(bnad->pcidev, 0);
+	pci_intx_unmanaged(bnad->pcidev, 0);
 
 	return;
 
-- 
2.46.1


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

* [RFC PATCH 05/13] net/ntb: Use never-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (3 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 04/13] net/ethernet: " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-10  4:37   ` Shyam Sundar S K
  2024-10-10  4:42   ` Shyam Sundar S K
  2024-10-09  8:35 ` [RFC PATCH 06/13] misc: " Philipp Stanner
                   ` (8 subsequent siblings)
  13 siblings, 2 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

hw/amd and how/intel enable their PCI-Device with pci_enable_device().
Thus, they need the never-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/ntb/hw/amd/ntb_hw_amd.c    | 4 ++--
 drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index d687e8c2cc78..b146f170e839 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
 err_msi_enable:
 
 	/* Try to set up intx irq */
-	pci_intx(pdev, 1);
+	pci_intx_unmanaged(pdev, 1);
 
 	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
 			 "ndev_irq_isr", ndev);
@@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev)
 		if (pci_dev_msi_enabled(pdev))
 			pci_disable_msi(pdev);
 		else
-			pci_intx(pdev, 0);
+			pci_intx_unmanaged(pdev, 0);
 	}
 }
 
diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c
index 079b8cd79785..9ad9d7fe227e 100644
--- a/drivers/ntb/hw/intel/ntb_hw_gen1.c
+++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c
@@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev,
 
 	/* Try to set up intx irq */
 
-	pci_intx(pdev, 1);
+	pci_intx_unmanaged(pdev, 1);
 
 	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
 			 "ndev_irq_isr", ndev);
-- 
2.46.1


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

* [RFC PATCH 06/13] misc: Use never-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (4 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 05/13] net/ntb: " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 07/13] vfio/pci: " Philipp Stanner
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

cardreader/rtsx_pcr.c and tifm_7xx1.c enable their PCI-Device with
pci_enable_device(). Thus, they need the never-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/misc/cardreader/rtsx_pcr.c | 2 +-
 drivers/misc/tifm_7xx1.c           | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index be3d4e0e50cc..e25e6d560dd7 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1057,7 +1057,7 @@ static int rtsx_pci_acquire_irq(struct rtsx_pcr *pcr)
 	}
 
 	pcr->irq = pcr->pci->irq;
-	pci_intx(pcr->pci, !pcr->msi_en);
+	pci_intx_unmanaged(pcr->pci, !pcr->msi_en);
 
 	return 0;
 }
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 1d54680d6ed2..5f9c7ccae8d2 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -327,7 +327,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
 		goto err_out;
 	}
 
-	pci_intx(dev, 1);
+	pci_intx_unmanaged(dev, 1);
 
 	fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
 				? 4 : 2, &dev->dev);
@@ -368,7 +368,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
 err_out_free:
 	tifm_free_adapter(fm);
 err_out_int:
-	pci_intx(dev, 0);
+	pci_intx_unmanaged(dev, 0);
 	pci_release_regions(dev);
 err_out:
 	if (!pci_dev_busy)
@@ -392,7 +392,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev)
 		tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt));
 
 	iounmap(fm->addr);
-	pci_intx(dev, 0);
+	pci_intx_unmanaged(dev, 0);
 	pci_release_regions(dev);
 
 	pci_disable_device(dev);
-- 
2.46.1


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

* [RFC PATCH 07/13] vfio/pci: Use never-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (5 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 06/13] misc: " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 08/13] PCI: MSI: " Philipp Stanner
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

vfio enables its PCI-Device with pci_enable_device(). Thus, it
needs the never-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/vfio/pci/vfio_pci_core.c  |  2 +-
 drivers/vfio/pci/vfio_pci_intrs.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 1ab58da9f38a..90240c8d51aa 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
 		if (vfio_pci_nointx(pdev)) {
 			pci_info(pdev, "Masking broken INTx support\n");
 			vdev->nointx = true;
-			pci_intx(pdev, 0);
+			pci_intx_unmanaged(pdev, 0);
 		} else
 			vdev->pci_2_3 = pci_intx_mask_supported(pdev);
 	}
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index 8382c5834335..40abb0b937a2 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
 	 */
 	if (unlikely(!is_intx(vdev))) {
 		if (vdev->pci_2_3)
-			pci_intx(pdev, 0);
+			pci_intx_unmanaged(pdev, 0);
 		goto out_unlock;
 	}
 
@@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
 		 * mask, not just when something is pending.
 		 */
 		if (vdev->pci_2_3)
-			pci_intx(pdev, 0);
+			pci_intx_unmanaged(pdev, 0);
 		else
 			disable_irq_nosync(pdev->irq);
 
@@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data)
 	 */
 	if (unlikely(!is_intx(vdev))) {
 		if (vdev->pci_2_3)
-			pci_intx(pdev, 1);
+			pci_intx_unmanaged(pdev, 1);
 		goto out_unlock;
 	}
 
@@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
 	 */
 	ctx->masked = vdev->virq_disabled;
 	if (vdev->pci_2_3) {
-		pci_intx(pdev, !ctx->masked);
+		pci_intx_unmanaged(pdev, !ctx->masked);
 		irqflags = IRQF_SHARED;
 	} else {
 		irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0;
@@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
 	 * via their shutdown paths.  Restore for NoINTx devices.
 	 */
 	if (vdev->nointx)
-		pci_intx(pdev, 0);
+		pci_intx_unmanaged(pdev, 0);
 
 	vdev->irq_type = VFIO_PCI_NUM_IRQS;
 }
-- 
2.46.1


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

* [RFC PATCH 08/13] PCI: MSI: Use never-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (6 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 07/13] vfio/pci: " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 09/13] ata: Use always-managed " Philipp Stanner
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

MSI sets up its own separate devres callback implicitly in
pcim_setup_msi_release(). This callback ultimately uses pci_intx(),
which is problematic since the callback of course runs on driver-detach.

That problem has last been described here:
https://lore.kernel.org/all/ee44ea7ac760e73edad3f20b30b4d2fff66c1a85.camel@redhat.com/

Replace the call to pci_intx() with one to the never-managed version
pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
This MSI part here is probably the part of the series that needs most
attention.
---
 drivers/pci/msi/api.c | 2 +-
 drivers/pci/msi/msi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c
index b956ce591f96..c95e2e7dc9ab 100644
--- a/drivers/pci/msi/api.c
+++ b/drivers/pci/msi/api.c
@@ -289,7 +289,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 			 */
 			if (affd)
 				irq_create_affinity_masks(1, affd);
-			pci_intx(dev, 1);
+			pci_intx_unmanaged(dev, 1);
 			return 1;
 		}
 	}
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 3a45879d85db..53f13b09db50 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(pci_write_msi_msg);
 static void pci_intx_for_msi(struct pci_dev *dev, int enable)
 {
 	if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
-		pci_intx(dev, enable);
+		pci_intx_unmanaged(dev, enable);
 }
 
 static void pci_msi_set_enable(struct pci_dev *dev, int enable)
-- 
2.46.1


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

* [RFC PATCH 09/13] ata: Use always-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (7 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 08/13] PCI: MSI: " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:51   ` Damien Le Moal
  2024-10-09  8:35 ` [RFC PATCH 10/13] staging: rts5280: " Philipp Stanner
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

All users in ata enable their PCI-Device with pcim_enable_device(). Thus,
they need the always-managed version.

Replace pci_intx() with pci_intx_unmanaged().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/ata/ahci.c       | 2 +-
 drivers/ata/ata_piix.c   | 2 +-
 drivers/ata/pata_rdc.c   | 2 +-
 drivers/ata/sata_sil24.c | 2 +-
 drivers/ata/sata_sis.c   | 2 +-
 drivers/ata/sata_uli.c   | 2 +-
 drivers/ata/sata_vsc.c   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 45f63b09828a..9273ff3d4732 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -1985,7 +1985,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	if (ahci_init_msi(pdev, n_ports, hpriv) < 0) {
 		/* legacy intx interrupts */
-		pci_intx(pdev, 1);
+		pcim_intx(pdev, 1);
 	}
 	hpriv->irq = pci_irq_vector(pdev, 0);
 
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 093b940bc953..d441246fa357 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1725,7 +1725,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 * message-signalled interrupts currently).
 	 */
 	if (port_flags & PIIX_FLAG_CHECKINTR)
-		pci_intx(pdev, 1);
+		pcim_intx(pdev, 1);
 
 	if (piix_check_450nx_errata(pdev)) {
 		/* This writes into the master table but it does not
diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
index 0a9689862f71..09792aac7f9d 100644
--- a/drivers/ata/pata_rdc.c
+++ b/drivers/ata/pata_rdc.c
@@ -340,7 +340,7 @@ static int rdc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		return rc;
 	host->private_data = hpriv;
 
-	pci_intx(pdev, 1);
+	pcim_intx(pdev, 1);
 
 	host->flags |= ATA_HOST_PARALLEL_SCAN;
 
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 72c03cbdaff4..b771ebd41252 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -1317,7 +1317,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	if (sata_sil24_msi && !pci_enable_msi(pdev)) {
 		dev_info(&pdev->dev, "Using MSI\n");
-		pci_intx(pdev, 0);
+		pcim_intx(pdev, 0);
 	}
 
 	pci_set_master(pdev);
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index ef8724986de3..b8b6d9eff3b8 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -290,7 +290,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	}
 
 	pci_set_master(pdev);
-	pci_intx(pdev, 1);
+	pcim_intx(pdev, 1);
 	return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
 				 IRQF_SHARED, &sis_sht);
 }
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index 60ea45926cd1..52894ff49dcb 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -221,7 +221,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	}
 
 	pci_set_master(pdev);
-	pci_intx(pdev, 1);
+	pcim_intx(pdev, 1);
 	return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
 				 IRQF_SHARED, &uli_sht);
 }
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index d39b87537168..a53a2dfc1e17 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -384,7 +384,7 @@ static int vsc_sata_init_one(struct pci_dev *pdev,
 		pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x80);
 
 	if (pci_enable_msi(pdev) == 0)
-		pci_intx(pdev, 0);
+		pcim_intx(pdev, 0);
 
 	/*
 	 * Config offset 0x98 is "Extended Control and Status Register 0"
-- 
2.46.1


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

* [RFC PATCH 10/13] staging: rts5280: Use always-managed version of pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (8 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 09/13] ata: Use always-managed " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  9:38   ` Greg Kroah-Hartman
  2024-10-09  8:35 ` [RFC PATCH 11/13] wifi: qtnfmac: use always-managed version of pcim_intx() Philipp Stanner
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

rts5208 enables its PCI-Device with pcim_enable_device(). Thus, it needs the
always-managed version.

Replace pci_intx() with pcim_intx().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/staging/rts5208/rtsx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index c4f54c311d05..4831eb035bf7 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -246,7 +246,7 @@ static int rtsx_acquire_irq(struct rtsx_dev *dev)
 	}
 
 	dev->irq = dev->pci->irq;
-	pci_intx(dev->pci, !chip->msi_en);
+	pcim_intx(dev->pci, !chip->msi_en);
 
 	return 0;
 }
-- 
2.46.1


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

* [RFC PATCH 11/13] wifi: qtnfmac: use always-managed version of pcim_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (9 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 10/13] staging: rts5280: " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-09  8:35 ` [RFC PATCH 12/13] HID: amd_sfh: Use " Philipp Stanner
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

qtnfmac enables its PCI-Device with pcim_enable_device(). Thus, it needs the
always-managed version.

Replace pci_intx() with pcim_intx().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
index f66eb43094d4..3adcfac2886f 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pcie/pcie.c
@@ -204,7 +204,7 @@ static void qtnf_pcie_init_irq(struct qtnf_pcie_bus_priv *priv, bool use_msi)
 
 	if (!priv->msi_enabled) {
 		pr_warn("legacy PCIE interrupts enabled\n");
-		pci_intx(pdev, 1);
+		pcim_intx(pdev, 1);
 	}
 }
 
-- 
2.46.1


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

* [RFC PATCH 12/13] HID: amd_sfh: Use always-managed version of pcim_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (10 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 11/13] wifi: qtnfmac: use always-managed version of pcim_intx() Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-10  7:20   ` Basavaraj Natikar
  2024-10-09  8:35 ` [RFC PATCH 13/13] Remove devres from pci_intx() Philipp Stanner
  2024-10-09 18:32 ` [RFC PATCH 00/13] Remove implicit " Heiner Kallweit
  13 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. To remove this hybrid nature from pci_intx(), it is necessary to
port users to either an always-managed or a never-managed version.

All users of amd_mp2_pci_remove(), where pci_intx() is used, call
pcim_enable_device(), which is why the driver needs the always-managed
version.

Replace pci_intx() with pcim_intx().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c        | 4 ++--
 drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 0c28ca349bcd..48cfd0c58241 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -122,7 +122,7 @@ int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
 {
 	int rc;
 
-	pci_intx(privdata->pdev, true);
+	pcim_intx(privdata->pdev, true);
 
 	rc = devm_request_irq(&privdata->pdev->dev, privdata->pdev->irq,
 			      amd_sfh_irq_handler, 0, DRIVER_NAME, privdata);
@@ -248,7 +248,7 @@ static void amd_mp2_pci_remove(void *privdata)
 	struct amd_mp2_dev *mp2 = privdata;
 	amd_sfh_hid_client_deinit(privdata);
 	mp2->mp2_ops->stop_all(mp2);
-	pci_intx(mp2->pdev, false);
+	pcim_intx(mp2->pdev, false);
 	amd_sfh_clear_intr(mp2);
 }
 
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
index db36d87d5634..ec9feb8e023b 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
@@ -289,7 +289,7 @@ static void amd_mp2_pci_remove(void *privdata)
 	sfh_deinit_emp2();
 	amd_sfh_hid_client_deinit(privdata);
 	mp2->mp2_ops->stop_all(mp2);
-	pci_intx(mp2->pdev, false);
+	pcim_intx(mp2->pdev, false);
 	amd_sfh_clear_intr(mp2);
 }
 
-- 
2.46.1


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

* [RFC PATCH 13/13] Remove devres from pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (11 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 12/13] HID: amd_sfh: Use " Philipp Stanner
@ 2024-10-09  8:35 ` Philipp Stanner
  2024-10-10  8:50   ` Dan Carpenter
  2024-10-09 18:32 ` [RFC PATCH 00/13] Remove implicit " Heiner Kallweit
  13 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09  8:35 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Philipp Stanner, Mario Limonciello,
	Chen Ni, Ricky Wu, Al Viro, Breno Leitao, Kevin Tian,
	Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

pci_intx() is a hybrid function which can sometimes be managed through
devres. This hybrid nature is undesirable.

Since all users of pci_intx() have by now been ported either to
always-managed pcim_intx() or never-managed pci_intx_unmanaged(), the
devres functionality can be removed from pci_intx().

Consequently, pci_intx_unmanaged() is now redundant, because pci_intx()
itself is now unmanaged.

Remove the devres functionality from pci_intx(). Remove pci_intx_unmanaged().
Have all users of pci_intx_unmanaged() call pci_intx().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
---
 drivers/misc/cardreader/rtsx_pcr.c            |  2 +-
 drivers/misc/tifm_7xx1.c                      |  6 +--
 .../net/ethernet/broadcom/bnx2x/bnx2x_main.c  |  2 +-
 drivers/net/ethernet/brocade/bna/bnad.c       |  2 +-
 drivers/ntb/hw/amd/ntb_hw_amd.c               |  4 +-
 drivers/ntb/hw/intel/ntb_hw_gen1.c            |  2 +-
 drivers/pci/devres.c                          |  4 +-
 drivers/pci/msi/api.c                         |  2 +-
 drivers/pci/msi/msi.c                         |  2 +-
 drivers/pci/pci.c                             | 40 +------------------
 drivers/vfio/pci/vfio_pci_core.c              |  2 +-
 drivers/vfio/pci/vfio_pci_intrs.c             | 10 ++---
 drivers/xen/xen-pciback/conf_space_header.c   |  2 +-
 include/linux/pci.h                           |  1 -
 14 files changed, 21 insertions(+), 60 deletions(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index e25e6d560dd7..be3d4e0e50cc 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1057,7 +1057,7 @@ static int rtsx_pci_acquire_irq(struct rtsx_pcr *pcr)
 	}
 
 	pcr->irq = pcr->pci->irq;
-	pci_intx_unmanaged(pcr->pci, !pcr->msi_en);
+	pci_intx(pcr->pci, !pcr->msi_en);
 
 	return 0;
 }
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 5f9c7ccae8d2..1d54680d6ed2 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -327,7 +327,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
 		goto err_out;
 	}
 
-	pci_intx_unmanaged(dev, 1);
+	pci_intx(dev, 1);
 
 	fm = tifm_alloc_adapter(dev->device == PCI_DEVICE_ID_TI_XX21_XX11_FM
 				? 4 : 2, &dev->dev);
@@ -368,7 +368,7 @@ static int tifm_7xx1_probe(struct pci_dev *dev,
 err_out_free:
 	tifm_free_adapter(fm);
 err_out_int:
-	pci_intx_unmanaged(dev, 0);
+	pci_intx(dev, 0);
 	pci_release_regions(dev);
 err_out:
 	if (!pci_dev_busy)
@@ -392,7 +392,7 @@ static void tifm_7xx1_remove(struct pci_dev *dev)
 		tifm_7xx1_sock_power_off(tifm_7xx1_sock_addr(fm->addr, cnt));
 
 	iounmap(fm->addr);
-	pci_intx_unmanaged(dev, 0);
+	pci_intx(dev, 0);
 	pci_release_regions(dev);
 
 	pci_disable_device(dev);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 2ae63d6e6792..678829646cec 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -1669,7 +1669,7 @@ static void bnx2x_igu_int_enable(struct bnx2x *bp)
 	REG_WR(bp, IGU_REG_PF_CONFIGURATION, val);
 
 	if (val & IGU_PF_CONF_INT_LINE_EN)
-		pci_intx_unmanaged(bp->pdev, true);
+		pci_intx(bp->pdev, true);
 
 	barrier();
 
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 2b37462d406e..ece6f3b48327 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -2669,7 +2669,7 @@ bnad_enable_msix(struct bnad *bnad)
 		}
 	}
 
-	pci_intx_unmanaged(bnad->pcidev, 0);
+	pci_intx(bnad->pcidev, 0);
 
 	return;
 
diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
index b146f170e839..d687e8c2cc78 100644
--- a/drivers/ntb/hw/amd/ntb_hw_amd.c
+++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
@@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
 err_msi_enable:
 
 	/* Try to set up intx irq */
-	pci_intx_unmanaged(pdev, 1);
+	pci_intx(pdev, 1);
 
 	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
 			 "ndev_irq_isr", ndev);
@@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev)
 		if (pci_dev_msi_enabled(pdev))
 			pci_disable_msi(pdev);
 		else
-			pci_intx_unmanaged(pdev, 0);
+			pci_intx(pdev, 0);
 	}
 }
 
diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c
index 9ad9d7fe227e..079b8cd79785 100644
--- a/drivers/ntb/hw/intel/ntb_hw_gen1.c
+++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c
@@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev,
 
 	/* Try to set up intx irq */
 
-	pci_intx_unmanaged(pdev, 1);
+	pci_intx(pdev, 1);
 
 	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
 			 "ndev_irq_isr", ndev);
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
index 475a3ae5c33f..402558fd2436 100644
--- a/drivers/pci/devres.c
+++ b/drivers/pci/devres.c
@@ -416,7 +416,7 @@ static void pcim_intx_restore(struct device *dev, void *data)
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct pcim_intx_devres *res = data;
 
-	pci_intx_unmanaged(pdev, res->orig_intx);
+	pci_intx(pdev, res->orig_intx);
 }
 
 static struct pcim_intx_devres *get_or_create_intx_devres(struct device *dev)
@@ -453,7 +453,7 @@ int pcim_intx(struct pci_dev *pdev, int enable)
 		return -ENOMEM;
 
 	res->orig_intx = !enable;
-	pci_intx_unmanaged(pdev, enable);
+	pci_intx(pdev, enable);
 
 	return 0;
 }
diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c
index c95e2e7dc9ab..b956ce591f96 100644
--- a/drivers/pci/msi/api.c
+++ b/drivers/pci/msi/api.c
@@ -289,7 +289,7 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 			 */
 			if (affd)
 				irq_create_affinity_masks(1, affd);
-			pci_intx_unmanaged(dev, 1);
+			pci_intx(dev, 1);
 			return 1;
 		}
 	}
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 53f13b09db50..3a45879d85db 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(pci_write_msi_msg);
 static void pci_intx_for_msi(struct pci_dev *dev, int enable)
 {
 	if (!(dev->dev_flags & PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG))
-		pci_intx_unmanaged(dev, enable);
+		pci_intx(dev, enable);
 }
 
 static void pci_msi_set_enable(struct pci_dev *dev, int enable)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 318cfb5b5e15..2d5992fbd413 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4476,43 +4476,12 @@ void pci_disable_parity(struct pci_dev *dev)
 	}
 }
 
-/**
- * pci_intx - enables/disables PCI INTx for device dev, unmanaged version
- * @pdev: the PCI device to operate on
- * @enable: boolean: whether to enable or disable PCI INTx
- *
- * Enables/disables PCI INTx for device @pdev
- *
- * This function behavios identically to pci_intx(), but is never managed with
- * devres.
- */
-void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
-{
-	u16 pci_command, new;
-
-	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
-
-	if (enable)
-		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
-	else
-		new = pci_command | PCI_COMMAND_INTX_DISABLE;
-
-	if (new != pci_command)
-		pci_write_config_word(pdev, PCI_COMMAND, new);
-}
-EXPORT_SYMBOL_GPL(pci_intx_unmanaged);
-
 /**
  * pci_intx - enables/disables PCI INTx for device dev
  * @pdev: the PCI device to operate on
  * @enable: boolean: whether to enable or disable PCI INTx
  *
  * Enables/disables PCI INTx for device @pdev
- *
- * NOTE:
- * This is a "hybrid" function: It's normally unmanaged, but becomes managed
- * when pcim_enable_device() has been called in advance. This hybrid feature is
- * DEPRECATED! If you want managed cleanup, use pcim_intx() instead.
  */
 void pci_intx(struct pci_dev *pdev, int enable)
 {
@@ -4525,15 +4494,8 @@ void pci_intx(struct pci_dev *pdev, int enable)
 	else
 		new = pci_command | PCI_COMMAND_INTX_DISABLE;
 
-	if (new != pci_command) {
-		/* Preserve the "hybrid" behavior for backwards compatibility */
-		if (pci_is_managed(pdev)) {
-			WARN_ON_ONCE(pcim_intx(pdev, enable) != 0);
-			return;
-		}
-
+	if (new != pci_command)
 		pci_write_config_word(pdev, PCI_COMMAND, new);
-	}
 }
 EXPORT_SYMBOL_GPL(pci_intx);
 
diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
index 90240c8d51aa..1ab58da9f38a 100644
--- a/drivers/vfio/pci/vfio_pci_core.c
+++ b/drivers/vfio/pci/vfio_pci_core.c
@@ -498,7 +498,7 @@ int vfio_pci_core_enable(struct vfio_pci_core_device *vdev)
 		if (vfio_pci_nointx(pdev)) {
 			pci_info(pdev, "Masking broken INTx support\n");
 			vdev->nointx = true;
-			pci_intx_unmanaged(pdev, 0);
+			pci_intx(pdev, 0);
 		} else
 			vdev->pci_2_3 = pci_intx_mask_supported(pdev);
 	}
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index 40abb0b937a2..8382c5834335 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -118,7 +118,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
 	 */
 	if (unlikely(!is_intx(vdev))) {
 		if (vdev->pci_2_3)
-			pci_intx_unmanaged(pdev, 0);
+			pci_intx(pdev, 0);
 		goto out_unlock;
 	}
 
@@ -132,7 +132,7 @@ static bool __vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
 		 * mask, not just when something is pending.
 		 */
 		if (vdev->pci_2_3)
-			pci_intx_unmanaged(pdev, 0);
+			pci_intx(pdev, 0);
 		else
 			disable_irq_nosync(pdev->irq);
 
@@ -178,7 +178,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *data)
 	 */
 	if (unlikely(!is_intx(vdev))) {
 		if (vdev->pci_2_3)
-			pci_intx_unmanaged(pdev, 1);
+			pci_intx(pdev, 1);
 		goto out_unlock;
 	}
 
@@ -296,7 +296,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
 	 */
 	ctx->masked = vdev->virq_disabled;
 	if (vdev->pci_2_3) {
-		pci_intx_unmanaged(pdev, !ctx->masked);
+		pci_intx(pdev, !ctx->masked);
 		irqflags = IRQF_SHARED;
 	} else {
 		irqflags = ctx->masked ? IRQF_NO_AUTOEN : 0;
@@ -569,7 +569,7 @@ static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
 	 * via their shutdown paths.  Restore for NoINTx devices.
 	 */
 	if (vdev->nointx)
-		pci_intx_unmanaged(pdev, 0);
+		pci_intx(pdev, 0);
 
 	vdev->irq_type = VFIO_PCI_NUM_IRQS;
 }
diff --git a/drivers/xen/xen-pciback/conf_space_header.c b/drivers/xen/xen-pciback/conf_space_header.c
index 8d26d64232e8..fc0332645966 100644
--- a/drivers/xen/xen-pciback/conf_space_header.c
+++ b/drivers/xen/xen-pciback/conf_space_header.c
@@ -106,7 +106,7 @@ static int command_write(struct pci_dev *dev, int offset, u16 value, void *data)
 
 	if (dev_data && dev_data->allow_interrupt_control &&
 	    ((cmd->val ^ value) & PCI_COMMAND_INTX_DISABLE))
-		pci_intx_unmanaged(dev, !(value & PCI_COMMAND_INTX_DISABLE));
+		pci_intx(dev, !(value & PCI_COMMAND_INTX_DISABLE));
 
 	cmd->val = value;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 6b8cde76d564..1b2a6dd1dfed 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1353,7 +1353,6 @@ int __must_check pcim_set_mwi(struct pci_dev *dev);
 int pci_try_set_mwi(struct pci_dev *dev);
 void pci_clear_mwi(struct pci_dev *dev);
 void pci_disable_parity(struct pci_dev *dev);
-void pci_intx_unmanaged(struct pci_dev *pdev, int enable);
 void pci_intx(struct pci_dev *dev, int enable);
 bool pci_check_and_mask_intx(struct pci_dev *dev);
 bool pci_check_and_unmask_intx(struct pci_dev *dev);
-- 
2.46.1


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

* Re: [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx() Philipp Stanner
@ 2024-10-09  8:51   ` Juergen Gross
  2024-10-09 10:50     ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Juergen Gross @ 2024-10-09  8:51 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound


[-- Attachment #1.1.1: Type: text/plain, Size: 644 bytes --]

On 09.10.24 10:35, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> xen enables its PCI-Device with pci_enable_device(). Thus, it
> needs the never-managed version.
> 
> Replace pci_intx() with pci_intx_unmanaged().
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

Acked-by: Juergen Gross <jgross@suse.com>

BTW, the diffstat in the [PATCH 00/13] mail is missing some files,
e.g. the changes of this patch.


Juergen


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

* Re: [RFC PATCH 09/13] ata: Use always-managed version of pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 09/13] ata: Use always-managed " Philipp Stanner
@ 2024-10-09  8:51   ` Damien Le Moal
  2024-10-09 10:55     ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Damien Le Moal @ 2024-10-09  8:51 UTC (permalink / raw)
  To: Philipp Stanner, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

On 10/9/24 17:35, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> All users in ata enable their PCI-Device with pcim_enable_device(). Thus,
> they need the always-managed version.
> 
> Replace pci_intx() with pci_intx_unmanaged().

This contradicts the sentence above and the patche replaces pci_intx() with
pcim_intx()... So s/pci_intx_unmanaged/pcim_intx in the above sentence ?

> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
>  drivers/ata/ahci.c       | 2 +-
>  drivers/ata/ata_piix.c   | 2 +-
>  drivers/ata/pata_rdc.c   | 2 +-
>  drivers/ata/sata_sil24.c | 2 +-
>  drivers/ata/sata_sis.c   | 2 +-
>  drivers/ata/sata_uli.c   | 2 +-
>  drivers/ata/sata_vsc.c   | 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 45f63b09828a..9273ff3d4732 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -1985,7 +1985,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	if (ahci_init_msi(pdev, n_ports, hpriv) < 0) {
>  		/* legacy intx interrupts */
> -		pci_intx(pdev, 1);
> +		pcim_intx(pdev, 1);
>  	}
>  	hpriv->irq = pci_irq_vector(pdev, 0);
>  
> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> index 093b940bc953..d441246fa357 100644
> --- a/drivers/ata/ata_piix.c
> +++ b/drivers/ata/ata_piix.c
> @@ -1725,7 +1725,7 @@ static int piix_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	 * message-signalled interrupts currently).
>  	 */
>  	if (port_flags & PIIX_FLAG_CHECKINTR)
> -		pci_intx(pdev, 1);
> +		pcim_intx(pdev, 1);
>  
>  	if (piix_check_450nx_errata(pdev)) {
>  		/* This writes into the master table but it does not
> diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
> index 0a9689862f71..09792aac7f9d 100644
> --- a/drivers/ata/pata_rdc.c
> +++ b/drivers/ata/pata_rdc.c
> @@ -340,7 +340,7 @@ static int rdc_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  		return rc;
>  	host->private_data = hpriv;
>  
> -	pci_intx(pdev, 1);
> +	pcim_intx(pdev, 1);
>  
>  	host->flags |= ATA_HOST_PARALLEL_SCAN;
>  
> diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
> index 72c03cbdaff4..b771ebd41252 100644
> --- a/drivers/ata/sata_sil24.c
> +++ b/drivers/ata/sata_sil24.c
> @@ -1317,7 +1317,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  
>  	if (sata_sil24_msi && !pci_enable_msi(pdev)) {
>  		dev_info(&pdev->dev, "Using MSI\n");
> -		pci_intx(pdev, 0);
> +		pcim_intx(pdev, 0);
>  	}
>  
>  	pci_set_master(pdev);
> diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
> index ef8724986de3..b8b6d9eff3b8 100644
> --- a/drivers/ata/sata_sis.c
> +++ b/drivers/ata/sata_sis.c
> @@ -290,7 +290,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	}
>  
>  	pci_set_master(pdev);
> -	pci_intx(pdev, 1);
> +	pcim_intx(pdev, 1);
>  	return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
>  				 IRQF_SHARED, &sis_sht);
>  }
> diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
> index 60ea45926cd1..52894ff49dcb 100644
> --- a/drivers/ata/sata_uli.c
> +++ b/drivers/ata/sata_uli.c
> @@ -221,7 +221,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	}
>  
>  	pci_set_master(pdev);
> -	pci_intx(pdev, 1);
> +	pcim_intx(pdev, 1);
>  	return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt,
>  				 IRQF_SHARED, &uli_sht);
>  }
> diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
> index d39b87537168..a53a2dfc1e17 100644
> --- a/drivers/ata/sata_vsc.c
> +++ b/drivers/ata/sata_vsc.c
> @@ -384,7 +384,7 @@ static int vsc_sata_init_one(struct pci_dev *pdev,
>  		pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, 0x80);
>  
>  	if (pci_enable_msi(pdev) == 0)
> -		pci_intx(pdev, 0);
> +		pcim_intx(pdev, 0);
>  
>  	/*
>  	 * Config offset 0x98 is "Extended Control and Status Register 0"


-- 
Damien Le Moal
Western Digital Research

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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
@ 2024-10-09  9:10   ` Damien Le Moal
  2024-10-10 14:40   ` Andy Shevchenko
  2024-10-10 17:43   ` Alex Williamson
  2 siblings, 0 replies; 43+ messages in thread
From: Damien Le Moal @ 2024-10-09  9:10 UTC (permalink / raw)
  To: Philipp Stanner, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

On 10/9/24 17:35, Philipp Stanner wrote:
> pci_intx() is a hybrid function which sometimes performs devres
> operations, depending on whether pcim_enable_device() has been used to
> enable the pci_dev. This sometimes-managed nature of the function is
> problematic. Notably, it causes the function to allocate under some
> circumstances which makes it unusable from interrupt context.
> 
> To, ultimately, remove the hybrid nature from pci_intx(), it is first
> necessary to provide an always-managed and a never-managed version
> of that function. Then, all callers of pci_intx() can be ported to the
> version they need, depending whether they use pci_enable_device() or
> pcim_enable_device().
> 
> An always-managed function exists, namely pcim_intx(), for which
> __pcim_intx(), a never-managed version of pci_intx() had been

s/had/has ? Not sure about this, English is not my first language :)

> implemented.
> 
> Make __pcim_intx() a public function under the name
> pci_intx_unmanaged(). Make pcim_intx() a public function.
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

Regardless of the above nit, looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

-- 
Damien Le Moal
Western Digital Research

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

* Re: [RFC PATCH 10/13] staging: rts5280: Use always-managed version of pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 10/13] staging: rts5280: " Philipp Stanner
@ 2024-10-09  9:38   ` Greg Kroah-Hartman
  2024-10-09 19:41     ` Philipp Hortmann
  0 siblings, 1 reply; 43+ messages in thread
From: Greg Kroah-Hartman @ 2024-10-09  9:38 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann, Alex Dubov,
	Sudarsana Kalluru, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rasesh Mody, GR-Linux-NIC-Dev,
	Igor Mitsyanko, Sergey Matyukevich, Kalle Valo, Sanjay R Mehta,
	Shyam Sundar S K, Jon Mason, Dave Jiang, Allen Hubbe,
	Bjorn Helgaas, Alex Williamson, Juergen Gross, Stefano Stabellini,
	Oleksandr Tyshchenko, Jaroslav Kysela, Takashi Iwai,
	Mario Limonciello, Chen Ni, Ricky Wu, Al Viro, Breno Leitao,
	Kevin Tian, Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Wed, Oct 09, 2024 at 10:35:16AM +0200, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> rts5208 enables its PCI-Device with pcim_enable_device(). Thus, it needs the
> always-managed version.
> 
> Replace pci_intx() with pcim_intx().
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
>  drivers/staging/rts5208/rtsx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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

* Re: [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx()
  2024-10-09  8:51   ` Juergen Gross
@ 2024-10-09 10:50     ` Philipp Stanner
  0 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09 10:50 UTC (permalink / raw)
  To: Juergen Gross, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

On Wed, 2024-10-09 at 10:51 +0200, Juergen Gross wrote:
> On 09.10.24 10:35, Philipp Stanner wrote:
> > pci_intx() is a hybrid function which can sometimes be managed
> > through
> > devres. To remove this hybrid nature from pci_intx(), it is
> > necessary to
> > port users to either an always-managed or a never-managed version.
> > 
> > xen enables its PCI-Device with pci_enable_device(). Thus, it
> > needs the never-managed version.
> > 
> > Replace pci_intx() with pci_intx_unmanaged().
> > 
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> 
> Acked-by: Juergen Gross <jgross@suse.com>
> 
> BTW, the diffstat in the [PATCH 00/13] mail is missing some files,
> e.g. the changes of this patch.

Ooops, probably something exploded when I copied the backed-up cover-
letter after regenerating the patches. Will fix.

But good to see that someone actually reads cover letters :p

P.

> 
> 
> Juergen
> 


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

* Re: [RFC PATCH 09/13] ata: Use always-managed version of pci_intx()
  2024-10-09  8:51   ` Damien Le Moal
@ 2024-10-09 10:55     ` Philipp Stanner
  0 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-09 10:55 UTC (permalink / raw)
  To: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

On Wed, 2024-10-09 at 17:51 +0900, Damien Le Moal wrote:
> On 10/9/24 17:35, Philipp Stanner wrote:
> > pci_intx() is a hybrid function which can sometimes be managed
> > through
> > devres. To remove this hybrid nature from pci_intx(), it is
> > necessary to
> > port users to either an always-managed or a never-managed version.
> > 
> > All users in ata enable their PCI-Device with pcim_enable_device().
> > Thus,
> > they need the always-managed version.
> > 
> > Replace pci_intx() with pci_intx_unmanaged().
> 
> This contradicts the sentence above and the patche replaces
> pci_intx() with
> pcim_intx()... So s/pci_intx_unmanaged/pcim_intx in the above
> sentence ?

Yes, absolutely correct, the commit message is broken. The code itself
is fine, I grepped through it for pci_enable / pcim_enable

P.

> 
> > 
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > ---
> >  drivers/ata/ahci.c       | 2 +-
> >  drivers/ata/ata_piix.c   | 2 +-
> >  drivers/ata/pata_rdc.c   | 2 +-
> >  drivers/ata/sata_sil24.c | 2 +-
> >  drivers/ata/sata_sis.c   | 2 +-
> >  drivers/ata/sata_uli.c   | 2 +-
> >  drivers/ata/sata_vsc.c   | 2 +-
> >  7 files changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> > index 45f63b09828a..9273ff3d4732 100644
> > --- a/drivers/ata/ahci.c
> > +++ b/drivers/ata/ahci.c
> > @@ -1985,7 +1985,7 @@ static int ahci_init_one(struct pci_dev
> > *pdev, const struct pci_device_id *ent)
> >  
> >  	if (ahci_init_msi(pdev, n_ports, hpriv) < 0) {
> >  		/* legacy intx interrupts */
> > -		pci_intx(pdev, 1);
> > +		pcim_intx(pdev, 1);
> >  	}
> >  	hpriv->irq = pci_irq_vector(pdev, 0);
> >  
> > diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> > index 093b940bc953..d441246fa357 100644
> > --- a/drivers/ata/ata_piix.c
> > +++ b/drivers/ata/ata_piix.c
> > @@ -1725,7 +1725,7 @@ static int piix_init_one(struct pci_dev
> > *pdev, const struct pci_device_id *ent)
> >  	 * message-signalled interrupts currently).
> >  	 */
> >  	if (port_flags & PIIX_FLAG_CHECKINTR)
> > -		pci_intx(pdev, 1);
> > +		pcim_intx(pdev, 1);
> >  
> >  	if (piix_check_450nx_errata(pdev)) {
> >  		/* This writes into the master table but it does
> > not
> > diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
> > index 0a9689862f71..09792aac7f9d 100644
> > --- a/drivers/ata/pata_rdc.c
> > +++ b/drivers/ata/pata_rdc.c
> > @@ -340,7 +340,7 @@ static int rdc_init_one(struct pci_dev *pdev,
> > const struct pci_device_id *ent)
> >  		return rc;
> >  	host->private_data = hpriv;
> >  
> > -	pci_intx(pdev, 1);
> > +	pcim_intx(pdev, 1);
> >  
> >  	host->flags |= ATA_HOST_PARALLEL_SCAN;
> >  
> > diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
> > index 72c03cbdaff4..b771ebd41252 100644
> > --- a/drivers/ata/sata_sil24.c
> > +++ b/drivers/ata/sata_sil24.c
> > @@ -1317,7 +1317,7 @@ static int sil24_init_one(struct pci_dev
> > *pdev, const struct pci_device_id *ent)
> >  
> >  	if (sata_sil24_msi && !pci_enable_msi(pdev)) {
> >  		dev_info(&pdev->dev, "Using MSI\n");
> > -		pci_intx(pdev, 0);
> > +		pcim_intx(pdev, 0);
> >  	}
> >  
> >  	pci_set_master(pdev);
> > diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
> > index ef8724986de3..b8b6d9eff3b8 100644
> > --- a/drivers/ata/sata_sis.c
> > +++ b/drivers/ata/sata_sis.c
> > @@ -290,7 +290,7 @@ static int sis_init_one(struct pci_dev *pdev,
> > const struct pci_device_id *ent)
> >  	}
> >  
> >  	pci_set_master(pdev);
> > -	pci_intx(pdev, 1);
> > +	pcim_intx(pdev, 1);
> >  	return ata_host_activate(host, pdev->irq,
> > ata_bmdma_interrupt,
> >  				 IRQF_SHARED, &sis_sht);
> >  }
> > diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
> > index 60ea45926cd1..52894ff49dcb 100644
> > --- a/drivers/ata/sata_uli.c
> > +++ b/drivers/ata/sata_uli.c
> > @@ -221,7 +221,7 @@ static int uli_init_one(struct pci_dev *pdev,
> > const struct pci_device_id *ent)
> >  	}
> >  
> >  	pci_set_master(pdev);
> > -	pci_intx(pdev, 1);
> > +	pcim_intx(pdev, 1);
> >  	return ata_host_activate(host, pdev->irq,
> > ata_bmdma_interrupt,
> >  				 IRQF_SHARED, &uli_sht);
> >  }
> > diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
> > index d39b87537168..a53a2dfc1e17 100644
> > --- a/drivers/ata/sata_vsc.c
> > +++ b/drivers/ata/sata_vsc.c
> > @@ -384,7 +384,7 @@ static int vsc_sata_init_one(struct pci_dev
> > *pdev,
> >  		pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE,
> > 0x80);
> >  
> >  	if (pci_enable_msi(pdev) == 0)
> > -		pci_intx(pdev, 0);
> > +		pcim_intx(pdev, 0);
> >  
> >  	/*
> >  	 * Config offset 0x98 is "Extended Control and Status
> > Register 0"
> 
> 


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

* Re: [RFC PATCH 00/13] Remove implicit devres from pci_intx()
  2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
                   ` (12 preceding siblings ...)
  2024-10-09  8:35 ` [RFC PATCH 13/13] Remove devres from pci_intx() Philipp Stanner
@ 2024-10-09 18:32 ` Heiner Kallweit
  2024-10-10  8:09   ` Philipp Stanner
  13 siblings, 1 reply; 43+ messages in thread
From: Heiner Kallweit @ 2024-10-09 18:32 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

On 09.10.2024 10:35, Philipp Stanner wrote:
> Hi all,
> 
> this series removes a problematic feature from pci_intx(). That function
> sometimes implicitly uses devres for automatic cleanup. We should get
> rid of this implicit behavior.
> 
> To do so, a pci_intx() version that is always-managed, and one that is
> never-managed are provided. Then, all pci_intx() users are ported to the
> version they need. Afterwards, pci_intx() can be cleaned up and the
> users of the never-managed version be ported back to pci_intx().
> 
> This way we'd get this PCI API consistent again.
> 
AFAICS pci_intx() is used only by drivers which haven't been converted
to the pci_alloc_irq_vectors() API yet. Wouldn't it be better to do this
instead of trying to improve pci_intx()?
Eventually pci_intx() would have to be used in PCI core only.

> The last patch obviously reverts the previous patches that made drivers
> use pci_intx_unmanaged(). But this way it's easier to review and
> approve. It also makes sure that each checked out commit should provide
> correct behavior, not just the entire series as a whole.
> 
> Merge plan for this would be to enter through the PCI tree.
> 
> Please say so if you've got concerns with the general idea behind the
> RFC.
> 
> Regards,
> P.
> 
> Philipp Stanner (13):
>   PCI: Prepare removing devres from pci_intx()
>   ALSA: hda: hda_intel: Use always-managed version of pcim_intx()
>   drivers/xen: Use never-managed version of pci_intx()
>   net/ethernet: Use never-managed version of pci_intx()
>   net/ntb: Use never-managed version of pci_intx()
>   misc: Use never-managed version of pci_intx()
>   vfio/pci: Use never-managed version of pci_intx()
>   PCI: MSI: Use never-managed version of pci_intx()
>   ata: Use always-managed version of pci_intx()
>   staging: rts5280: Use always-managed version of pci_intx()
>   wifi: qtnfmac: use always-managed version of pcim_intx()
>   HID: amd_sfh: Use always-managed version of pcim_intx()
>   Remove devres from pci_intx()
> 
>  drivers/ata/ahci.c                            |  2 +-
>  drivers/ata/ata_piix.c                        |  2 +-
>  drivers/ata/pata_rdc.c                        |  2 +-
>  drivers/ata/sata_sil24.c                      |  2 +-
>  drivers/ata/sata_sis.c                        |  2 +-
>  drivers/ata/sata_uli.c                        |  2 +-
>  drivers/ata/sata_vsc.c                        |  2 +-
>  drivers/hid/amd-sfh-hid/amd_sfh_pcie.c        |  4 ++--
>  drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c |  2 +-
>  .../wireless/quantenna/qtnfmac/pcie/pcie.c    |  2 +-
>  drivers/pci/devres.c                          | 24 +++----------------
>  drivers/pci/pci.c                             | 14 +----------
>  drivers/staging/rts5208/rtsx.c                |  2 +-
>  include/linux/pci.h                           |  1 +
>  sound/pci/hda/hda_intel.c                     |  2 +-
>  15 files changed, 18 insertions(+), 47 deletions(-)
> 


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

* Re: [RFC PATCH 10/13] staging: rts5280: Use always-managed version of pci_intx()
  2024-10-09  9:38   ` Greg Kroah-Hartman
@ 2024-10-09 19:41     ` Philipp Hortmann
  2024-10-10  8:03       ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Philipp Hortmann @ 2024-10-09 19:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann, Alex Dubov,
	Sudarsana Kalluru, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rasesh Mody, GR-Linux-NIC-Dev,
	Igor Mitsyanko, Sergey Matyukevich, Kalle Valo, Sanjay R Mehta,
	Shyam Sundar S K, Jon Mason, Dave Jiang, Allen Hubbe,
	Bjorn Helgaas, Alex Williamson, Juergen Gross, Stefano Stabellini,
	Oleksandr Tyshchenko, Jaroslav Kysela, Takashi Iwai,
	Mario Limonciello, Chen Ni, Ricky Wu, Al Viro, Breno Leitao,
	Kevin Tian, Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On 10/9/24 11:38, Greg Kroah-Hartman wrote:
> On Wed, Oct 09, 2024 at 10:35:16AM +0200, Philipp Stanner wrote:
>> pci_intx() is a hybrid function which can sometimes be managed through
>> devres. To remove this hybrid nature from pci_intx(), it is necessary to
>> port users to either an always-managed or a never-managed version.
>>
>> rts5208 enables its PCI-Device with pcim_enable_device(). Thus, it needs the
>> always-managed version.
>>
>> Replace pci_intx() with pcim_intx().
>>
>> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
>> ---
>>   drivers/staging/rts5208/rtsx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 

Hi Philipp,

this driver (rts5208) will be removed soon - patch is send in.

Discussion about removal:
https://lore.kernel.org/linux-staging/2024100943-shank-washed-a765@gregkh/T/#t

Thanks for your support.

Bye Philipp


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

* Re: [RFC PATCH 05/13] net/ntb: Use never-managed version of pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 05/13] net/ntb: " Philipp Stanner
@ 2024-10-10  4:37   ` Shyam Sundar S K
  2024-10-10  4:42   ` Shyam Sundar S K
  1 sibling, 0 replies; 43+ messages in thread
From: Shyam Sundar S K @ 2024-10-10  4:37 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Jon Mason, Dave Jiang, Allen Hubbe,
	Bjorn Helgaas, Alex Williamson, Juergen Gross, Stefano Stabellini,
	Oleksandr Tyshchenko, Jaroslav Kysela, Takashi Iwai,
	Mario Limonciello, Chen Ni, Ricky Wu, Al Viro, Breno Leitao,
	Kevin Tian, Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound



On 10/9/2024 14:05, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> hw/amd and how/intel enable their PCI-Device with pci_enable_device().
> Thus, they need the never-managed version.
> 
> Replace pci_intx() with pci_intx_unmanaged().
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> #for ntb_hw_amd.c

> ---
>  drivers/ntb/hw/amd/ntb_hw_amd.c    | 4 ++--
>  drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
> index d687e8c2cc78..b146f170e839 100644
> --- a/drivers/ntb/hw/amd/ntb_hw_amd.c
> +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
> @@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
>  err_msi_enable:
>  
>  	/* Try to set up intx irq */
> -	pci_intx(pdev, 1);
> +	pci_intx_unmanaged(pdev, 1);
>  
>  	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
>  			 "ndev_irq_isr", ndev);
> @@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev)
>  		if (pci_dev_msi_enabled(pdev))
>  			pci_disable_msi(pdev);
>  		else
> -			pci_intx(pdev, 0);
> +			pci_intx_unmanaged(pdev, 0);
>  	}
>  }
>  
> diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c
> index 079b8cd79785..9ad9d7fe227e 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c
> +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c
> @@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev,
>  
>  	/* Try to set up intx irq */
>  
> -	pci_intx(pdev, 1);
> +	pci_intx_unmanaged(pdev, 1);
>  
>  	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
>  			 "ndev_irq_isr", ndev);

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

* Re: [RFC PATCH 05/13] net/ntb: Use never-managed version of pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 05/13] net/ntb: " Philipp Stanner
  2024-10-10  4:37   ` Shyam Sundar S K
@ 2024-10-10  4:42   ` Shyam Sundar S K
  1 sibling, 0 replies; 43+ messages in thread
From: Shyam Sundar S K @ 2024-10-10  4:42 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Jon Mason, Dave Jiang, Allen Hubbe, Bjorn Helgaas,
	Alex Williamson, Juergen Gross, Stefano Stabellini,
	Oleksandr Tyshchenko, Jaroslav Kysela, Takashi Iwai, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound



On 10/9/2024 14:05, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> hw/amd and how/intel enable their PCI-Device with pci_enable_device().
> Thus, they need the never-managed version.
> 
> Replace pci_intx() with pci_intx_unmanaged().
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> #for ntb_hw_amd.c

> ---
>  drivers/ntb/hw/amd/ntb_hw_amd.c    | 4 ++--
>  drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/hw/amd/ntb_hw_amd.c b/drivers/ntb/hw/amd/ntb_hw_amd.c
> index d687e8c2cc78..b146f170e839 100644
> --- a/drivers/ntb/hw/amd/ntb_hw_amd.c
> +++ b/drivers/ntb/hw/amd/ntb_hw_amd.c
> @@ -791,7 +791,7 @@ static int ndev_init_isr(struct amd_ntb_dev *ndev,
>  err_msi_enable:
>  
>  	/* Try to set up intx irq */
> -	pci_intx(pdev, 1);
> +	pci_intx_unmanaged(pdev, 1);
>  
>  	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
>  			 "ndev_irq_isr", ndev);
> @@ -831,7 +831,7 @@ static void ndev_deinit_isr(struct amd_ntb_dev *ndev)
>  		if (pci_dev_msi_enabled(pdev))
>  			pci_disable_msi(pdev);
>  		else
> -			pci_intx(pdev, 0);
> +			pci_intx_unmanaged(pdev, 0);
>  	}
>  }
>  
> diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c
> index 079b8cd79785..9ad9d7fe227e 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c
> +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c
> @@ -445,7 +445,7 @@ int ndev_init_isr(struct intel_ntb_dev *ndev,
>  
>  	/* Try to set up intx irq */
>  
> -	pci_intx(pdev, 1);
> +	pci_intx_unmanaged(pdev, 1);
>  
>  	rc = request_irq(pdev->irq, ndev_irq_isr, IRQF_SHARED,
>  			 "ndev_irq_isr", ndev);

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

* Re: [RFC PATCH 12/13] HID: amd_sfh: Use always-managed version of pcim_intx()
  2024-10-09  8:35 ` [RFC PATCH 12/13] HID: amd_sfh: Use " Philipp Stanner
@ 2024-10-10  7:20   ` Basavaraj Natikar
  0 siblings, 0 replies; 43+ messages in thread
From: Basavaraj Natikar @ 2024-10-10  7:20 UTC (permalink / raw)
  To: Philipp Stanner, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound


On 10/9/2024 2:05 PM, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
>
> All users of amd_mp2_pci_remove(), where pci_intx() is used, call
> pcim_enable_device(), which is why the driver needs the always-managed
> version.
>
> Replace pci_intx() with pcim_intx().
>
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
>   drivers/hid/amd-sfh-hid/amd_sfh_pcie.c        | 4 ++--
>   drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> index 0c28ca349bcd..48cfd0c58241 100644
> --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
> @@ -122,7 +122,7 @@ int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
>   {
>   	int rc;
>   
> -	pci_intx(privdata->pdev, true);
> +	pcim_intx(privdata->pdev, true);
>   
>   	rc = devm_request_irq(&privdata->pdev->dev, privdata->pdev->irq,
>   			      amd_sfh_irq_handler, 0, DRIVER_NAME, privdata);
> @@ -248,7 +248,7 @@ static void amd_mp2_pci_remove(void *privdata)
>   	struct amd_mp2_dev *mp2 = privdata;
>   	amd_sfh_hid_client_deinit(privdata);
>   	mp2->mp2_ops->stop_all(mp2);
> -	pci_intx(mp2->pdev, false);
> +	pcim_intx(mp2->pdev, false);
>   	amd_sfh_clear_intr(mp2);
>   }
>   
> diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> index db36d87d5634..ec9feb8e023b 100644
> --- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> +++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c
> @@ -289,7 +289,7 @@ static void amd_mp2_pci_remove(void *privdata)
>   	sfh_deinit_emp2();
>   	amd_sfh_hid_client_deinit(privdata);
>   	mp2->mp2_ops->stop_all(mp2);
> -	pci_intx(mp2->pdev, false);
> +	pcim_intx(mp2->pdev, false);
>   	amd_sfh_clear_intr(mp2);
>   }
>   

Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>

Thanks,
--
Basavaraj



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

* Re: [RFC PATCH 10/13] staging: rts5280: Use always-managed version of pci_intx()
  2024-10-09 19:41     ` Philipp Hortmann
@ 2024-10-10  8:03       ` Philipp Stanner
  2024-10-10  9:03         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-10  8:03 UTC (permalink / raw)
  To: Philipp Hortmann, Greg Kroah-Hartman
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann, Alex Dubov,
	Sudarsana Kalluru, Manish Chopra, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Rasesh Mody, GR-Linux-NIC-Dev,
	Igor Mitsyanko, Sergey Matyukevich, Kalle Valo, Sanjay R Mehta,
	Shyam Sundar S K, Jon Mason, Dave Jiang, Allen Hubbe,
	Bjorn Helgaas, Alex Williamson, Juergen Gross, Stefano Stabellini,
	Oleksandr Tyshchenko, Jaroslav Kysela, Takashi Iwai,
	Mario Limonciello, Chen Ni, Ricky Wu, Al Viro, Breno Leitao,
	Kevin Tian, Thomas Gleixner, Ilpo Järvinen, Mostafa Saleh,
	Andy Shevchenko, Hannes Reinecke, John Garry, Soumya Negi,
	Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Wed, 2024-10-09 at 21:41 +0200, Philipp Hortmann wrote:
> On 10/9/24 11:38, Greg Kroah-Hartman wrote:
> > On Wed, Oct 09, 2024 at 10:35:16AM +0200, Philipp Stanner wrote:
> > > pci_intx() is a hybrid function which can sometimes be managed
> > > through
> > > devres. To remove this hybrid nature from pci_intx(), it is
> > > necessary to
> > > port users to either an always-managed or a never-managed
> > > version.
> > > 
> > > rts5208 enables its PCI-Device with pcim_enable_device(). Thus,
> > > it needs the
> > > always-managed version.
> > > 
> > > Replace pci_intx() with pcim_intx().
> > > 
> > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > > ---
> > >   drivers/staging/rts5208/rtsx.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > 
> 
> Hi Philipp,
> 
> this driver (rts5208) will be removed soon - patch is send in.
> 
> Discussion about removal:
> https://lore.kernel.org/linux-staging/2024100943-shank-washed-a765@gregkh/T/#t


Alright, thx for the heads up.

I'm not entirely how best to deal with that, though. I could drop this
patch, but then the driver would end up with an unmanaged pci_intx().

Might this be a problem for users if my series lands sooner than the
removal, say in v6.13 and your removal in v6.14?

P.

> 
> Thanks for your support.
> 
> Bye Philipp
> 


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

* Re: [RFC PATCH 00/13] Remove implicit devres from pci_intx()
  2024-10-09 18:32 ` [RFC PATCH 00/13] Remove implicit " Heiner Kallweit
@ 2024-10-10  8:09   ` Philipp Stanner
  2024-10-10 14:50     ` Andy Shevchenko
  0 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-10  8:09 UTC (permalink / raw)
  To: Heiner Kallweit, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier
  Cc: linux-ide, linux-kernel, linux-input, netdev, linux-wireless, ntb,
	linux-pci, linux-staging, kvm, xen-devel, linux-sound

On Wed, 2024-10-09 at 20:32 +0200, Heiner Kallweit wrote:
> On 09.10.2024 10:35, Philipp Stanner wrote:
> > Hi all,
> > 
> > this series removes a problematic feature from pci_intx(). That
> > function
> > sometimes implicitly uses devres for automatic cleanup. We should
> > get
> > rid of this implicit behavior.
> > 
> > To do so, a pci_intx() version that is always-managed, and one that
> > is
> > never-managed are provided. Then, all pci_intx() users are ported
> > to the
> > version they need. Afterwards, pci_intx() can be cleaned up and the
> > users of the never-managed version be ported back to pci_intx().
> > 
> > This way we'd get this PCI API consistent again.
> > 
> AFAICS pci_intx() is used only by drivers which haven't been
> converted
> to the pci_alloc_irq_vectors() API yet. Wouldn't it be better to do
> this
> instead of trying to improve pci_intx()?

This would be the créme-de-la-créme-solution, yes.

But such a portation would require more detailed knowledge of the old
drivers.

In this discussion, Alex points out that at least in some drivers, you
can't replace pci_intx() without further ado:
https://lore.kernel.org/all/20240904151020.486f599e.alex.williamson@redhat.com/


What we could do is mark pci_intx() and pcim_intx() as deprecated and
point everyone to pci_alloc_irq_vectors(). Then someone can look into
porting the old drivers at some point in the future.


P.


> Eventually pci_intx() would have to be used in PCI core only.
> 
> > The last patch obviously reverts the previous patches that made
> > drivers
> > use pci_intx_unmanaged(). But this way it's easier to review and
> > approve. It also makes sure that each checked out commit should
> > provide
> > correct behavior, not just the entire series as a whole.
> > 
> > Merge plan for this would be to enter through the PCI tree.
> > 
> > Please say so if you've got concerns with the general idea behind
> > the
> > RFC.
> > 
> > Regards,
> > P.
> > 
> > Philipp Stanner (13):
> >   PCI: Prepare removing devres from pci_intx()
> >   ALSA: hda: hda_intel: Use always-managed version of pcim_intx()
> >   drivers/xen: Use never-managed version of pci_intx()
> >   net/ethernet: Use never-managed version of pci_intx()
> >   net/ntb: Use never-managed version of pci_intx()
> >   misc: Use never-managed version of pci_intx()
> >   vfio/pci: Use never-managed version of pci_intx()
> >   PCI: MSI: Use never-managed version of pci_intx()
> >   ata: Use always-managed version of pci_intx()
> >   staging: rts5280: Use always-managed version of pci_intx()
> >   wifi: qtnfmac: use always-managed version of pcim_intx()
> >   HID: amd_sfh: Use always-managed version of pcim_intx()
> >   Remove devres from pci_intx()
> > 
> >  drivers/ata/ahci.c                            |  2 +-
> >  drivers/ata/ata_piix.c                        |  2 +-
> >  drivers/ata/pata_rdc.c                        |  2 +-
> >  drivers/ata/sata_sil24.c                      |  2 +-
> >  drivers/ata/sata_sis.c                        |  2 +-
> >  drivers/ata/sata_uli.c                        |  2 +-
> >  drivers/ata/sata_vsc.c                        |  2 +-
> >  drivers/hid/amd-sfh-hid/amd_sfh_pcie.c        |  4 ++--
> >  drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c |  2 +-
> >  .../wireless/quantenna/qtnfmac/pcie/pcie.c    |  2 +-
> >  drivers/pci/devres.c                          | 24 +++------------
> > ----
> >  drivers/pci/pci.c                             | 14 +----------
> >  drivers/staging/rts5208/rtsx.c                |  2 +-
> >  include/linux/pci.h                           |  1 +
> >  sound/pci/hda/hda_intel.c                     |  2 +-
> >  15 files changed, 18 insertions(+), 47 deletions(-)
> > 
> 


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

* Re: [RFC PATCH 13/13] Remove devres from pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 13/13] Remove devres from pci_intx() Philipp Stanner
@ 2024-10-10  8:50   ` Dan Carpenter
  2024-10-10  9:11     ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Dan Carpenter @ 2024-10-10  8:50 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Wed, Oct 09, 2024 at 10:35:19AM +0200, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. This hybrid nature is undesirable.
> 
> Since all users of pci_intx() have by now been ported either to
> always-managed pcim_intx() or never-managed pci_intx_unmanaged(), the
> devres functionality can be removed from pci_intx().
> 
> Consequently, pci_intx_unmanaged() is now redundant, because pci_intx()
> itself is now unmanaged.
> 
> Remove the devres functionality from pci_intx(). Remove pci_intx_unmanaged().
> Have all users of pci_intx_unmanaged() call pci_intx().
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>

I don't like when we change a function like this but it still compiles fine.
If someone is working on a driver and hasn't pushed it yet, then it's probably
supposed to be using the new pcim_intx() but they won't discover that until they
detect the leaks at runtime.

Why not leave the pci_intx_unmanaged() name.  It's ugly and that will discorage
people from introducing new uses.

regards,
dan carpenter


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

* Re: [RFC PATCH 10/13] staging: rts5280: Use always-managed version of pci_intx()
  2024-10-10  8:03       ` Philipp Stanner
@ 2024-10-10  9:03         ` Greg Kroah-Hartman
  2024-10-10  9:12           ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Greg Kroah-Hartman @ 2024-10-10  9:03 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Philipp Hortmann, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Alex Dubov, Sudarsana Kalluru, Manish Chopra, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rasesh Mody,
	GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich, Kalle Valo,
	Sanjay R Mehta, Shyam Sundar S K, Jon Mason, Dave Jiang,
	Allen Hubbe, Bjorn Helgaas, Alex Williamson, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, Oct 10, 2024 at 10:03:30AM +0200, Philipp Stanner wrote:
> On Wed, 2024-10-09 at 21:41 +0200, Philipp Hortmann wrote:
> > On 10/9/24 11:38, Greg Kroah-Hartman wrote:
> > > On Wed, Oct 09, 2024 at 10:35:16AM +0200, Philipp Stanner wrote:
> > > > pci_intx() is a hybrid function which can sometimes be managed
> > > > through
> > > > devres. To remove this hybrid nature from pci_intx(), it is
> > > > necessary to
> > > > port users to either an always-managed or a never-managed
> > > > version.
> > > > 
> > > > rts5208 enables its PCI-Device with pcim_enable_device(). Thus,
> > > > it needs the
> > > > always-managed version.
> > > > 
> > > > Replace pci_intx() with pcim_intx().
> > > > 
> > > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > > > ---
> > > >   drivers/staging/rts5208/rtsx.c | 2 +-
> > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > 
> > 
> > Hi Philipp,
> > 
> > this driver (rts5208) will be removed soon - patch is send in.
> > 
> > Discussion about removal:
> > https://lore.kernel.org/linux-staging/2024100943-shank-washed-a765@gregkh/T/#t
> 
> 
> Alright, thx for the heads up.
> 
> I'm not entirely how best to deal with that, though. I could drop this
> patch, but then the driver would end up with an unmanaged pci_intx().
> 
> Might this be a problem for users if my series lands sooner than the
> removal, say in v6.13 and your removal in v6.14?

The removal will happen in 6.13, I'm going to be queueing it up right
now.

thanks,

greg k-h

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

* Re: [RFC PATCH 13/13] Remove devres from pci_intx()
  2024-10-10  8:50   ` Dan Carpenter
@ 2024-10-10  9:11     ` Philipp Stanner
  2024-10-10 17:43       ` Alex Williamson
  0 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-10  9:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Andy Shevchenko,
	Hannes Reinecke, John Garry, Soumya Negi, Jason Gunthorpe, Yi Liu,
	Dr. David Alan Gilbert, Christian Brauner, Ankit Agrawal,
	Reinette Chatre, Eric Auger, Ye Bin,
	Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 2024-10-10 at 11:50 +0300, Dan Carpenter wrote:
> On Wed, Oct 09, 2024 at 10:35:19AM +0200, Philipp Stanner wrote:
> > pci_intx() is a hybrid function which can sometimes be managed
> > through
> > devres. This hybrid nature is undesirable.
> > 
> > Since all users of pci_intx() have by now been ported either to
> > always-managed pcim_intx() or never-managed pci_intx_unmanaged(),
> > the
> > devres functionality can be removed from pci_intx().
> > 
> > Consequently, pci_intx_unmanaged() is now redundant, because
> > pci_intx()
> > itself is now unmanaged.
> > 
> > Remove the devres functionality from pci_intx(). Remove
> > pci_intx_unmanaged().
> > Have all users of pci_intx_unmanaged() call pci_intx().
> > 
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> 
> I don't like when we change a function like this but it still
> compiles fine.
> If someone is working on a driver and hasn't pushed it yet, then it's
> probably
> supposed to be using the new pcim_intx() but they won't discover that
> until they
> detect the leaks at runtime.

There wouldn't be any *leaks*, it's just that the INTx state would not
automatically be restored. BTW the official documentation in its
current state does not hint at pci_intx() doing anything automatically,
but rather actively marks it as deprecated.

But you are right that a hypothetical new driver and OOT drivers could
experience bugs through this change.

> 
> Why not leave the pci_intx_unmanaged() name.  It's ugly and that will
> discorage
> people from introducing new uses.

I'd be OK with that. Then we'd have to remove pci_intx() as it has new
users anymore.

Either way should be fine and keep the behavior for existing drivers
identical.

I think Bjorn should express a preference

P.

> 
> regards,
> dan carpenter
> 


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

* Re: [RFC PATCH 10/13] staging: rts5280: Use always-managed version of pci_intx()
  2024-10-10  9:03         ` Greg Kroah-Hartman
@ 2024-10-10  9:12           ` Philipp Stanner
  0 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-10  9:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Philipp Hortmann, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Alex Dubov, Sudarsana Kalluru, Manish Chopra, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rasesh Mody,
	GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich, Kalle Valo,
	Sanjay R Mehta, Shyam Sundar S K, Jon Mason, Dave Jiang,
	Allen Hubbe, Bjorn Helgaas, Alex Williamson, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 2024-10-10 at 11:03 +0200, Greg Kroah-Hartman wrote:
> On Thu, Oct 10, 2024 at 10:03:30AM +0200, Philipp Stanner wrote:
> > On Wed, 2024-10-09 at 21:41 +0200, Philipp Hortmann wrote:
> > > On 10/9/24 11:38, Greg Kroah-Hartman wrote:
> > > > On Wed, Oct 09, 2024 at 10:35:16AM +0200, Philipp Stanner
> > > > wrote:
> > > > > pci_intx() is a hybrid function which can sometimes be
> > > > > managed
> > > > > through
> > > > > devres. To remove this hybrid nature from pci_intx(), it is
> > > > > necessary to
> > > > > port users to either an always-managed or a never-managed
> > > > > version.
> > > > > 
> > > > > rts5208 enables its PCI-Device with pcim_enable_device().
> > > > > Thus,
> > > > > it needs the
> > > > > always-managed version.
> > > > > 
> > > > > Replace pci_intx() with pcim_intx().
> > > > > 
> > > > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > > > > ---
> > > > >   drivers/staging/rts5208/rtsx.c | 2 +-
> > > > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > > 
> > > 
> > > Hi Philipp,
> > > 
> > > this driver (rts5208) will be removed soon - patch is send in.
> > > 
> > > Discussion about removal:
> > > https://lore.kernel.org/linux-staging/2024100943-shank-washed-a765@gregkh/T/#t
> > 
> > 
> > Alright, thx for the heads up.
> > 
> > I'm not entirely how best to deal with that, though. I could drop
> > this
> > patch, but then the driver would end up with an unmanaged
> > pci_intx().
> > 
> > Might this be a problem for users if my series lands sooner than
> > the
> > removal, say in v6.13 and your removal in v6.14?
> 
> The removal will happen in 6.13, I'm going to be queueing it up right
> now.

Alright, thx. Then I drop patch #10.

P.

> 
> thanks,
> 
> greg k-h
> 


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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
  2024-10-09  9:10   ` Damien Le Moal
@ 2024-10-10 14:40   ` Andy Shevchenko
  2024-10-11 12:16     ` Philipp Stanner
  2024-10-10 17:43   ` Alex Williamson
  2 siblings, 1 reply; 43+ messages in thread
From: Andy Shevchenko @ 2024-10-10 14:40 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Wed, Oct 09, 2024 at 10:35:07AM +0200, Philipp Stanner wrote:
> pci_intx() is a hybrid function which sometimes performs devres
> operations, depending on whether pcim_enable_device() has been used to
> enable the pci_dev. This sometimes-managed nature of the function is
> problematic. Notably, it causes the function to allocate under some
> circumstances which makes it unusable from interrupt context.
> 
> To, ultimately, remove the hybrid nature from pci_intx(), it is first
> necessary to provide an always-managed and a never-managed version
> of that function. Then, all callers of pci_intx() can be ported to the
> version they need, depending whether they use pci_enable_device() or
> pcim_enable_device().
> 
> An always-managed function exists, namely pcim_intx(), for which
> __pcim_intx(), a never-managed version of pci_intx() had been
> implemented.

> Make __pcim_intx() a public function under the name
> pci_intx_unmanaged(). Make pcim_intx() a public function.

To avoid an additional churn we can make just completely new APIs, namely:
pcim_int_x()
pci_int_x()

You won't need all dirty dances with double underscored function naming and
renaming.


...

> +	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> +
> +	if (enable)
> +		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> +	else
> +		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> +
> +	if (new != pci_command)

I would use positive conditionals as easy to read (yes, a couple of lines
longer, but also a win is the indentation and avoiding an additional churn in
the future in case we need to add something in this branch.

> +		pci_write_config_word(pdev, PCI_COMMAND, new);

...

Otherwise I'm for the idea in general.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx()
  2024-10-09  8:35 ` [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx() Philipp Stanner
@ 2024-10-10 14:46   ` Andy Shevchenko
  2024-10-11 12:27     ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Andy Shevchenko @ 2024-10-10 14:46 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Wed, Oct 09, 2024 at 10:35:08AM +0200, Philipp Stanner wrote:
> pci_intx() is a hybrid function which can sometimes be managed through
> devres. To remove this hybrid nature from pci_intx(), it is necessary to
> port users to either an always-managed or a never-managed version.
> 
> hda_intel enables its PCI-Device with pcim_enable_device(). Thus, it needs
> the always-managed version.
> 
> Replace pci_intx() with pcim_intx().

...

>  	bus->irq = chip->pci->irq;
>  	chip->card->sync_irq = bus->irq;
> -	pci_intx(chip->pci, !chip->msi);
> +	pcim_intx(chip->pci, !chip->msi);
>  	return 0;

I believe each driver needs an individual approach. Looking at the above
I would first to understand why this one is being used and why we can't
switch to pci{m}_alloc_irq_vectors(). (Yeah, managed pci_alloc_irq_vectors()
is probably still missing, I don't remember if you introduced it or not.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [RFC PATCH 00/13] Remove implicit devres from pci_intx()
  2024-10-10  8:09   ` Philipp Stanner
@ 2024-10-10 14:50     ` Andy Shevchenko
  0 siblings, 0 replies; 43+ messages in thread
From: Andy Shevchenko @ 2024-10-10 14:50 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Heiner Kallweit, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, Oct 10, 2024 at 10:09:12AM +0200, Philipp Stanner wrote:
> On Wed, 2024-10-09 at 20:32 +0200, Heiner Kallweit wrote:
> > On 09.10.2024 10:35, Philipp Stanner wrote:

...

> > > To do so, a pci_intx() version that is always-managed, and one that
> > > is
> > > never-managed are provided. Then, all pci_intx() users are ported
> > > to the
> > > version they need. Afterwards, pci_intx() can be cleaned up and the
> > > users of the never-managed version be ported back to pci_intx().
> > > 
> > > This way we'd get this PCI API consistent again.
> > > 
> > AFAICS pci_intx() is used only by drivers which haven't been
> > converted
> > to the pci_alloc_irq_vectors() API yet. Wouldn't it be better to do
> > this
> > instead of trying to improve pci_intx()?

My first impression was the same...

> This would be the créme-de-la-créme-solution, yes.
> 
> But such a portation would require more detailed knowledge of the old
> drivers.
> 
> In this discussion, Alex points out that at least in some drivers, you
> can't replace pci_intx() without further ado:
> https://lore.kernel.org/all/20240904151020.486f599e.alex.williamson@redhat.com/
> 
> What we could do is mark pci_intx() and pcim_intx() as deprecated and
> point everyone to pci_alloc_irq_vectors(). Then someone can look into
> porting the old drivers at some point in the future.

...but here I got the point by Philipp.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
  2024-10-09  9:10   ` Damien Le Moal
  2024-10-10 14:40   ` Andy Shevchenko
@ 2024-10-10 17:43   ` Alex Williamson
  2024-10-11 12:03     ` Philipp Stanner
  2 siblings, 1 reply; 43+ messages in thread
From: Alex Williamson @ 2024-10-10 17:43 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Wed,  9 Oct 2024 10:35:07 +0200
Philipp Stanner <pstanner@redhat.com> wrote:

> pci_intx() is a hybrid function which sometimes performs devres
> operations, depending on whether pcim_enable_device() has been used to
> enable the pci_dev. This sometimes-managed nature of the function is
> problematic. Notably, it causes the function to allocate under some
> circumstances which makes it unusable from interrupt context.
> 
> To, ultimately, remove the hybrid nature from pci_intx(), it is first
> necessary to provide an always-managed and a never-managed version
> of that function. Then, all callers of pci_intx() can be ported to the
> version they need, depending whether they use pci_enable_device() or
> pcim_enable_device().
> 
> An always-managed function exists, namely pcim_intx(), for which
> __pcim_intx(), a never-managed version of pci_intx() had been
> implemented.
> 
> Make __pcim_intx() a public function under the name
> pci_intx_unmanaged(). Make pcim_intx() a public function.
> 
> Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> ---
>  drivers/pci/devres.c | 24 +++---------------------
>  drivers/pci/pci.c    | 26 ++++++++++++++++++++++++++
>  include/linux/pci.h  |  2 ++
>  3 files changed, 31 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
> index b133967faef8..475a3ae5c33f 100644
> --- a/drivers/pci/devres.c
> +++ b/drivers/pci/devres.c
> @@ -411,31 +411,12 @@ static inline bool mask_contains_bar(int mask, int bar)
>  	return mask & BIT(bar);
>  }
>  
> -/*
> - * This is a copy of pci_intx() used to bypass the problem of recursive
> - * function calls due to the hybrid nature of pci_intx().
> - */
> -static void __pcim_intx(struct pci_dev *pdev, int enable)
> -{
> -	u16 pci_command, new;
> -
> -	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> -
> -	if (enable)
> -		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> -	else
> -		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> -
> -	if (new != pci_command)
> -		pci_write_config_word(pdev, PCI_COMMAND, new);
> -}
> -
>  static void pcim_intx_restore(struct device *dev, void *data)
>  {
>  	struct pci_dev *pdev = to_pci_dev(dev);
>  	struct pcim_intx_devres *res = data;
>  
> -	__pcim_intx(pdev, res->orig_intx);
> +	pci_intx_unmanaged(pdev, res->orig_intx);
>  }
>  
>  static struct pcim_intx_devres *get_or_create_intx_devres(struct device *dev)
> @@ -472,10 +453,11 @@ int pcim_intx(struct pci_dev *pdev, int enable)
>  		return -ENOMEM;
>  
>  	res->orig_intx = !enable;
> -	__pcim_intx(pdev, enable);
> +	pci_intx_unmanaged(pdev, enable);
>  
>  	return 0;
>  }
> +EXPORT_SYMBOL(pcim_intx);

What precludes this from _GPL?  Also note that this is now calling a
GPL symbol, so by default I'd assume it should also be GPL.  Thanks,

Alex

>  
>  static void pcim_disable_device(void *pdev_raw)
>  {
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7d85c04fbba2..318cfb5b5e15 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4476,6 +4476,32 @@ void pci_disable_parity(struct pci_dev *dev)
>  	}
>  }
>  
> +/**
> + * pci_intx - enables/disables PCI INTx for device dev, unmanaged version
> + * @pdev: the PCI device to operate on
> + * @enable: boolean: whether to enable or disable PCI INTx
> + *
> + * Enables/disables PCI INTx for device @pdev
> + *
> + * This function behavios identically to pci_intx(), but is never managed with
> + * devres.
> + */
> +void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
> +{
> +	u16 pci_command, new;
> +
> +	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> +
> +	if (enable)
> +		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> +	else
> +		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> +
> +	if (new != pci_command)
> +		pci_write_config_word(pdev, PCI_COMMAND, new);
> +}
> +EXPORT_SYMBOL_GPL(pci_intx_unmanaged);
> +
>  /**
>   * pci_intx - enables/disables PCI INTx for device dev
>   * @pdev: the PCI device to operate on
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 573b4c4c2be6..6b8cde76d564 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -1353,6 +1353,7 @@ int __must_check pcim_set_mwi(struct pci_dev *dev);
>  int pci_try_set_mwi(struct pci_dev *dev);
>  void pci_clear_mwi(struct pci_dev *dev);
>  void pci_disable_parity(struct pci_dev *dev);
> +void pci_intx_unmanaged(struct pci_dev *pdev, int enable);
>  void pci_intx(struct pci_dev *dev, int enable);
>  bool pci_check_and_mask_intx(struct pci_dev *dev);
>  bool pci_check_and_unmask_intx(struct pci_dev *dev);
> @@ -2293,6 +2294,7 @@ static inline void pci_fixup_device(enum pci_fixup_pass pass,
>  				    struct pci_dev *dev) { }
>  #endif
>  
> +int pcim_intx(struct pci_dev *pdev, int enabled);
>  void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
>  void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
>  				const char *name);


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

* Re: [RFC PATCH 13/13] Remove devres from pci_intx()
  2024-10-10  9:11     ` Philipp Stanner
@ 2024-10-10 17:43       ` Alex Williamson
  2024-10-10 18:34         ` Dan Carpenter
  2024-10-11 12:07         ` Philipp Stanner
  0 siblings, 2 replies; 43+ messages in thread
From: Alex Williamson @ 2024-10-10 17:43 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Dan Carpenter, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 10 Oct 2024 11:11:36 +0200
Philipp Stanner <pstanner@redhat.com> wrote:

> On Thu, 2024-10-10 at 11:50 +0300, Dan Carpenter wrote:
> > On Wed, Oct 09, 2024 at 10:35:19AM +0200, Philipp Stanner wrote:  
> > > pci_intx() is a hybrid function which can sometimes be managed
> > > through
> > > devres. This hybrid nature is undesirable.
> > > 
> > > Since all users of pci_intx() have by now been ported either to
> > > always-managed pcim_intx() or never-managed pci_intx_unmanaged(),
> > > the
> > > devres functionality can be removed from pci_intx().
> > > 
> > > Consequently, pci_intx_unmanaged() is now redundant, because
> > > pci_intx()
> > > itself is now unmanaged.
> > > 
> > > Remove the devres functionality from pci_intx(). Remove
> > > pci_intx_unmanaged().
> > > Have all users of pci_intx_unmanaged() call pci_intx().
> > > 
> > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>  
> > 
> > I don't like when we change a function like this but it still
> > compiles fine.
> > If someone is working on a driver and hasn't pushed it yet, then it's
> > probably
> > supposed to be using the new pcim_intx() but they won't discover that
> > until they
> > detect the leaks at runtime.  
> 
> There wouldn't be any *leaks*, it's just that the INTx state would not
> automatically be restored. BTW the official documentation in its
> current state does not hint at pci_intx() doing anything automatically,
> but rather actively marks it as deprecated.
> 
> But you are right that a hypothetical new driver and OOT drivers could
> experience bugs through this change.
> 
> > 
> > Why not leave the pci_intx_unmanaged() name.  It's ugly and that will
> > discorage
> > people from introducing new uses.  
> 
> I'd be OK with that. Then we'd have to remove pci_intx() as it has new
> users anymore.
> 
> Either way should be fine and keep the behavior for existing drivers
> identical.
> 
> I think Bjorn should express a preference

FWIW, I think pcim_intx() and pci_intx() align better to our naming
convention for devres interfaces.  Would it be sufficient if pci_intx()
triggered a WARN_ON if called for a pci_is_managed() device?  Thanks,

Alex


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

* Re: [RFC PATCH 13/13] Remove devres from pci_intx()
  2024-10-10 17:43       ` Alex Williamson
@ 2024-10-10 18:34         ` Dan Carpenter
  2024-10-11 12:07         ` Philipp Stanner
  1 sibling, 0 replies; 43+ messages in thread
From: Dan Carpenter @ 2024-10-10 18:34 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Philipp Stanner, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, Oct 10, 2024 at 11:43:14AM -0600, Alex Williamson wrote:
> FWIW, I think pcim_intx() and pci_intx() align better to our naming
> convention for devres interfaces.  Would it be sufficient if pci_intx()
> triggered a WARN_ON if called for a pci_is_managed() device?  Thanks,
> 

To be honest, I also don't mind if you also just merge the patchset as-is.  I
was mostly just throwing out ideas.

regards,
dan carpenter

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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-10 17:43   ` Alex Williamson
@ 2024-10-11 12:03     ` Philipp Stanner
  0 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-11 12:03 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 2024-10-10 at 11:43 -0600, Alex Williamson wrote:
> On Wed,  9 Oct 2024 10:35:07 +0200
> Philipp Stanner <pstanner@redhat.com> wrote:
> 
> > pci_intx() is a hybrid function which sometimes performs devres
> > operations, depending on whether pcim_enable_device() has been used
> > to
> > enable the pci_dev. This sometimes-managed nature of the function
> > is
> > problematic. Notably, it causes the function to allocate under some
> > circumstances which makes it unusable from interrupt context.
> > 
> > To, ultimately, remove the hybrid nature from pci_intx(), it is
> > first
> > necessary to provide an always-managed and a never-managed version
> > of that function. Then, all callers of pci_intx() can be ported to
> > the
> > version they need, depending whether they use pci_enable_device()
> > or
> > pcim_enable_device().
> > 
> > An always-managed function exists, namely pcim_intx(), for which
> > __pcim_intx(), a never-managed version of pci_intx() had been
> > implemented.
> > 
> > Make __pcim_intx() a public function under the name
> > pci_intx_unmanaged(). Make pcim_intx() a public function.
> > 
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > ---
> >  drivers/pci/devres.c | 24 +++---------------------
> >  drivers/pci/pci.c    | 26 ++++++++++++++++++++++++++
> >  include/linux/pci.h  |  2 ++
> >  3 files changed, 31 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c
> > index b133967faef8..475a3ae5c33f 100644
> > --- a/drivers/pci/devres.c
> > +++ b/drivers/pci/devres.c
> > @@ -411,31 +411,12 @@ static inline bool mask_contains_bar(int
> > mask, int bar)
> >  	return mask & BIT(bar);
> >  }
> >  
> > -/*
> > - * This is a copy of pci_intx() used to bypass the problem of
> > recursive
> > - * function calls due to the hybrid nature of pci_intx().
> > - */
> > -static void __pcim_intx(struct pci_dev *pdev, int enable)
> > -{
> > -	u16 pci_command, new;
> > -
> > -	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> > -
> > -	if (enable)
> > -		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> > -	else
> > -		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> > -
> > -	if (new != pci_command)
> > -		pci_write_config_word(pdev, PCI_COMMAND, new);
> > -}
> > -
> >  static void pcim_intx_restore(struct device *dev, void *data)
> >  {
> >  	struct pci_dev *pdev = to_pci_dev(dev);
> >  	struct pcim_intx_devres *res = data;
> >  
> > -	__pcim_intx(pdev, res->orig_intx);
> > +	pci_intx_unmanaged(pdev, res->orig_intx);
> >  }
> >  
> >  static struct pcim_intx_devres *get_or_create_intx_devres(struct
> > device *dev)
> > @@ -472,10 +453,11 @@ int pcim_intx(struct pci_dev *pdev, int
> > enable)
> >  		return -ENOMEM;
> >  
> >  	res->orig_intx = !enable;
> > -	__pcim_intx(pdev, enable);
> > +	pci_intx_unmanaged(pdev, enable);
> >  
> >  	return 0;
> >  }
> > +EXPORT_SYMBOL(pcim_intx);
> 
> What precludes this from _GPL?  Also note that this is now calling a
> GPL symbol, so by default I'd assume it should also be GPL.  Thanks,

Ah right, I overlooked that pci_intx() also has the _GPL version.
Will make consistent.

Thx,
P.

> 
> Alex
> 
> >  
> >  static void pcim_disable_device(void *pdev_raw)
> >  {
> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > index 7d85c04fbba2..318cfb5b5e15 100644
> > --- a/drivers/pci/pci.c
> > +++ b/drivers/pci/pci.c
> > @@ -4476,6 +4476,32 @@ void pci_disable_parity(struct pci_dev *dev)
> >  	}
> >  }
> >  
> > +/**
> > + * pci_intx - enables/disables PCI INTx for device dev, unmanaged
> > version
> > + * @pdev: the PCI device to operate on
> > + * @enable: boolean: whether to enable or disable PCI INTx
> > + *
> > + * Enables/disables PCI INTx for device @pdev
> > + *
> > + * This function behavios identically to pci_intx(), but is never
> > managed with
> > + * devres.
> > + */
> > +void pci_intx_unmanaged(struct pci_dev *pdev, int enable)
> > +{
> > +	u16 pci_command, new;
> > +
> > +	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> > +
> > +	if (enable)
> > +		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> > +	else
> > +		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> > +
> > +	if (new != pci_command)
> > +		pci_write_config_word(pdev, PCI_COMMAND, new);
> > +}
> > +EXPORT_SYMBOL_GPL(pci_intx_unmanaged);
> > +
> >  /**
> >   * pci_intx - enables/disables PCI INTx for device dev
> >   * @pdev: the PCI device to operate on
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 573b4c4c2be6..6b8cde76d564 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -1353,6 +1353,7 @@ int __must_check pcim_set_mwi(struct pci_dev
> > *dev);
> >  int pci_try_set_mwi(struct pci_dev *dev);
> >  void pci_clear_mwi(struct pci_dev *dev);
> >  void pci_disable_parity(struct pci_dev *dev);
> > +void pci_intx_unmanaged(struct pci_dev *pdev, int enable);
> >  void pci_intx(struct pci_dev *dev, int enable);
> >  bool pci_check_and_mask_intx(struct pci_dev *dev);
> >  bool pci_check_and_unmask_intx(struct pci_dev *dev);
> > @@ -2293,6 +2294,7 @@ static inline void pci_fixup_device(enum
> > pci_fixup_pass pass,
> >  				    struct pci_dev *dev) { }
> >  #endif
> >  
> > +int pcim_intx(struct pci_dev *pdev, int enabled);
> >  void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned
> > long maxlen);
> >  void __iomem *pcim_iomap_region(struct pci_dev *pdev, int bar,
> >  				const char *name);
> 


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

* Re: [RFC PATCH 13/13] Remove devres from pci_intx()
  2024-10-10 17:43       ` Alex Williamson
  2024-10-10 18:34         ` Dan Carpenter
@ 2024-10-11 12:07         ` Philipp Stanner
  1 sibling, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-11 12:07 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Dan Carpenter, Damien Le Moal, Niklas Cassel, Sergey Shtylyov,
	Basavaraj Natikar, Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Juergen Gross,
	Stefano Stabellini, Oleksandr Tyshchenko, Jaroslav Kysela,
	Takashi Iwai, Mario Limonciello, Chen Ni, Ricky Wu, Al Viro,
	Breno Leitao, Kevin Tian, Thomas Gleixner, Ilpo Järvinen,
	Mostafa Saleh, Andy Shevchenko, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 2024-10-10 at 11:43 -0600, Alex Williamson wrote:
> On Thu, 10 Oct 2024 11:11:36 +0200
> Philipp Stanner <pstanner@redhat.com> wrote:
> 
> > On Thu, 2024-10-10 at 11:50 +0300, Dan Carpenter wrote:
> > > On Wed, Oct 09, 2024 at 10:35:19AM +0200, Philipp Stanner wrote: 
> > > > pci_intx() is a hybrid function which can sometimes be managed
> > > > through
> > > > devres. This hybrid nature is undesirable.
> > > > 
> > > > Since all users of pci_intx() have by now been ported either to
> > > > always-managed pcim_intx() or never-managed
> > > > pci_intx_unmanaged(),
> > > > the
> > > > devres functionality can be removed from pci_intx().
> > > > 
> > > > Consequently, pci_intx_unmanaged() is now redundant, because
> > > > pci_intx()
> > > > itself is now unmanaged.
> > > > 
> > > > Remove the devres functionality from pci_intx(). Remove
> > > > pci_intx_unmanaged().
> > > > Have all users of pci_intx_unmanaged() call pci_intx().
> > > > 
> > > > Signed-off-by: Philipp Stanner <pstanner@redhat.com>  
> > > 
> > > I don't like when we change a function like this but it still
> > > compiles fine.
> > > If someone is working on a driver and hasn't pushed it yet, then
> > > it's
> > > probably
> > > supposed to be using the new pcim_intx() but they won't discover
> > > that
> > > until they
> > > detect the leaks at runtime.  
> > 
> > There wouldn't be any *leaks*, it's just that the INTx state would
> > not
> > automatically be restored. BTW the official documentation in its
> > current state does not hint at pci_intx() doing anything
> > automatically,
> > but rather actively marks it as deprecated.
> > 
> > But you are right that a hypothetical new driver and OOT drivers
> > could
> > experience bugs through this change.
> > 
> > > 
> > > Why not leave the pci_intx_unmanaged() name.  It's ugly and that
> > > will
> > > discorage
> > > people from introducing new uses.  
> > 
> > I'd be OK with that. Then we'd have to remove pci_intx() as it has
> > new
> > users anymore.
> > 
> > Either way should be fine and keep the behavior for existing
> > drivers
> > identical.
> > 
> > I think Bjorn should express a preference
> 
> FWIW, I think pcim_intx() and pci_intx() align better to our naming
> convention for devres interfaces.

Yup, also my personal preference. But we can mark those functions as
deprecated via docstring-comment. That should fullfill Damien's goal.

>   Would it be sufficient if pci_intx()
> triggered a WARN_ON if called for a pci_is_managed() device?

No, I don't think that's a good idea; reason being that
pci_is_managed() just checks that global boolean which we inherited
from the old implementation and which should not be necessary with
proper devres.
The boolean is used for making functions such as pci_intx() and
__pci_request_region() hybrid. So with our non-hybrid version we never
need it.

P.

>   Thanks,
> 
> Alex
> 


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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-10 14:40   ` Andy Shevchenko
@ 2024-10-11 12:16     ` Philipp Stanner
  2024-10-11 13:50       ` Andy Shevchenko
  0 siblings, 1 reply; 43+ messages in thread
From: Philipp Stanner @ 2024-10-11 12:16 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 2024-10-10 at 17:40 +0300, Andy Shevchenko wrote:
> On Wed, Oct 09, 2024 at 10:35:07AM +0200, Philipp Stanner wrote:
> > pci_intx() is a hybrid function which sometimes performs devres
> > operations, depending on whether pcim_enable_device() has been used
> > to
> > enable the pci_dev. This sometimes-managed nature of the function
> > is
> > problematic. Notably, it causes the function to allocate under some
> > circumstances which makes it unusable from interrupt context.
> > 
> > To, ultimately, remove the hybrid nature from pci_intx(), it is
> > first
> > necessary to provide an always-managed and a never-managed version
> > of that function. Then, all callers of pci_intx() can be ported to
> > the
> > version they need, depending whether they use pci_enable_device()
> > or
> > pcim_enable_device().
> > 
> > An always-managed function exists, namely pcim_intx(), for which
> > __pcim_intx(), a never-managed version of pci_intx() had been
> > implemented.
> 
> > Make __pcim_intx() a public function under the name
> > pci_intx_unmanaged(). Make pcim_intx() a public function.
> 
> To avoid an additional churn we can make just completely new APIs,
> namely:
> pcim_int_x()
> pci_int_x()
> 
> You won't need all dirty dances with double underscored function
> naming and
> renaming.

Ähm.. I can't follow. The new version doesn't use double underscores
anymore. __pcim_intx() is being removed, effectively.
After this series, we'd end up with a clean:

	pci_intx() <-> pcim_intx()

just as in the other PCI APIs.


> 
> 
> ...
> 
> > +	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> > +
> > +	if (enable)
> > +		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> > +	else
> > +		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> > +
> > +	if (new != pci_command)
> 
> I would use positive conditionals as easy to read (yes, a couple of
> lines
> longer, but also a win is the indentation and avoiding an additional
> churn in
> the future in case we need to add something in this branch.

I can't follow. You mean:

if (new == pci_command)
    return;

?

That's exactly the same level of indentation. Plus, I just copied the
code.

> 
> > +		pci_write_config_word(pdev, PCI_COMMAND, new);
> 
> ...
> 
> Otherwise I'm for the idea in general.

\o/

> 


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

* Re: [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx()
  2024-10-10 14:46   ` Andy Shevchenko
@ 2024-10-11 12:27     ` Philipp Stanner
  0 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-11 12:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Thu, 2024-10-10 at 17:46 +0300, Andy Shevchenko wrote:
> On Wed, Oct 09, 2024 at 10:35:08AM +0200, Philipp Stanner wrote:
> > pci_intx() is a hybrid function which can sometimes be managed
> > through
> > devres. To remove this hybrid nature from pci_intx(), it is
> > necessary to
> > port users to either an always-managed or a never-managed version.
> > 
> > hda_intel enables its PCI-Device with pcim_enable_device(). Thus,
> > it needs
> > the always-managed version.
> > 
> > Replace pci_intx() with pcim_intx().
> 
> ...
> 
> >  	bus->irq = chip->pci->irq;
> >  	chip->card->sync_irq = bus->irq;
> > -	pci_intx(chip->pci, !chip->msi);
> > +	pcim_intx(chip->pci, !chip->msi);
> >  	return 0;
> 
> I believe each driver needs an individual approach. Looking at the
> above
> I would first to understand why this one is being used and why we
> can't
> switch to pci{m}_alloc_irq_vectors(). (Yeah, managed
> pci_alloc_irq_vectors()
> is probably still missing, I don't remember if you introduced it or
> not.
> 

Alright alright – we touched it in the other mail briefly, but let me
point out another specific problem:

pci_alloc_irq_vectors() *uses* pci_intx(). And pci_intx() can be
managed sometimes.

See the problem? :(

So it's not just that I couldn't port the driver Alex is concerned
about, it's also that MSI itself is a user of pci_intx().

So a pcim_alloc_irq_vectors() might end up doing double-devres or God
knows what else. Only once pci_intx() is clean one can start thinking
about the code in pci/msi/

It's the biggest reason why I want to clean it up as suggested here,
and also why the only patch I'm really nervous about is number 8.


P.


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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-11 12:16     ` Philipp Stanner
@ 2024-10-11 13:50       ` Andy Shevchenko
  2024-10-14  9:12         ` Philipp Stanner
  0 siblings, 1 reply; 43+ messages in thread
From: Andy Shevchenko @ 2024-10-11 13:50 UTC (permalink / raw)
  To: Philipp Stanner
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Fri, Oct 11, 2024 at 02:16:06PM +0200, Philipp Stanner wrote:
> On Thu, 2024-10-10 at 17:40 +0300, Andy Shevchenko wrote:
> > On Wed, Oct 09, 2024 at 10:35:07AM +0200, Philipp Stanner wrote:
> > > pci_intx() is a hybrid function which sometimes performs devres
> > > operations, depending on whether pcim_enable_device() has been used
> > > to
> > > enable the pci_dev. This sometimes-managed nature of the function
> > > is
> > > problematic. Notably, it causes the function to allocate under some
> > > circumstances which makes it unusable from interrupt context.
> > > 
> > > To, ultimately, remove the hybrid nature from pci_intx(), it is
> > > first
> > > necessary to provide an always-managed and a never-managed version
> > > of that function. Then, all callers of pci_intx() can be ported to
> > > the
> > > version they need, depending whether they use pci_enable_device()
> > > or
> > > pcim_enable_device().

> > > An always-managed function exists, namely pcim_intx(), for which
> > > __pcim_intx(), a never-managed version of pci_intx() had been
> > > implemented.
> > 
> > > Make __pcim_intx() a public function under the name
> > > pci_intx_unmanaged(). Make pcim_intx() a public function.

It seems I got confused by these two paragraphs. Why the double underscored
function is even mentioned here?

> > To avoid an additional churn we can make just completely new APIs,
> > namely:
> > pcim_int_x()
> > pci_int_x()
> > 
> > You won't need all dirty dances with double underscored function
> > naming and
> > renaming.
> 
> Ähm.. I can't follow. The new version doesn't use double underscores
> anymore. __pcim_intx() is being removed, effectively.
> After this series, we'd end up with a clean:
> 
> 	pci_intx() <-> pcim_intx()
> 
> just as in the other PCI APIs.

...

> > > +	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> > > +
> > > +	if (enable)
> > > +		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> > > +	else
> > > +		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> > > +
> > > +	if (new != pci_command)
> > 
> > I would use positive conditionals as easy to read (yes, a couple of
> > lines
> > longer, but also a win is the indentation and avoiding an additional
> > churn in
> > the future in case we need to add something in this branch.
> 
> I can't follow. You mean:
> 
> if (new == pci_command)
>     return;
> 
> ?
> 
> That's exactly the same level of indentation.

No, the body gets one level off.

> Plus, I just copied the code.
> 
> > > +		pci_write_config_word(pdev, PCI_COMMAND, new);

	if (new == pci_command)
		return;

	pci_write_config_word(pdev, PCI_COMMAND, new);

See the difference?
Also, imaging adding a new code in your case:

	if (new != pci_command)
		pci_write_config_word(pdev, PCI_COMMAND, new);

==>

	if (new != pci_command) {
		...foo...
		pci_write_config_word(pdev, PCI_COMMAND, new);
		...bar...
	}

And in mine:

	if (new == pci_command)
		return;

	...foo...
	pci_write_config_word(pdev, PCI_COMMAND, new);
	...bar...

I hope it's clear now what I meant.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [RFC PATCH 01/13] PCI: Prepare removing devres from pci_intx()
  2024-10-11 13:50       ` Andy Shevchenko
@ 2024-10-14  9:12         ` Philipp Stanner
  0 siblings, 0 replies; 43+ messages in thread
From: Philipp Stanner @ 2024-10-14  9:12 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Damien Le Moal, Niklas Cassel, Sergey Shtylyov, Basavaraj Natikar,
	Jiri Kosina, Benjamin Tissoires, Arnd Bergmann,
	Greg Kroah-Hartman, Alex Dubov, Sudarsana Kalluru, Manish Chopra,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rasesh Mody, GR-Linux-NIC-Dev, Igor Mitsyanko, Sergey Matyukevich,
	Kalle Valo, Sanjay R Mehta, Shyam Sundar S K, Jon Mason,
	Dave Jiang, Allen Hubbe, Bjorn Helgaas, Alex Williamson,
	Juergen Gross, Stefano Stabellini, Oleksandr Tyshchenko,
	Jaroslav Kysela, Takashi Iwai, Mario Limonciello, Chen Ni,
	Ricky Wu, Al Viro, Breno Leitao, Kevin Tian, Thomas Gleixner,
	Ilpo Järvinen, Mostafa Saleh, Hannes Reinecke, John Garry,
	Soumya Negi, Jason Gunthorpe, Yi Liu, Dr. David Alan Gilbert,
	Christian Brauner, Ankit Agrawal, Reinette Chatre, Eric Auger,
	Ye Bin, Marek Marczykowski-Górecki, Pierre-Louis Bossart,
	Maarten Lankhorst, Kai Vehmanen, Peter Ujfalusi, Rui Salvaterra,
	Marc Zyngier, linux-ide, linux-kernel, linux-input, netdev,
	linux-wireless, ntb, linux-pci, linux-staging, kvm, xen-devel,
	linux-sound

On Fri, 2024-10-11 at 16:50 +0300, Andy Shevchenko wrote:
> On Fri, Oct 11, 2024 at 02:16:06PM +0200, Philipp Stanner wrote:
> > On Thu, 2024-10-10 at 17:40 +0300, Andy Shevchenko wrote:
> > > On Wed, Oct 09, 2024 at 10:35:07AM +0200, Philipp Stanner wrote:
> > > > pci_intx() is a hybrid function which sometimes performs devres
> > > > operations, depending on whether pcim_enable_device() has been
> > > > used
> > > > to
> > > > enable the pci_dev. This sometimes-managed nature of the
> > > > function
> > > > is
> > > > problematic. Notably, it causes the function to allocate under
> > > > some
> > > > circumstances which makes it unusable from interrupt context.
> > > > 
> > > > To, ultimately, remove the hybrid nature from pci_intx(), it is
> > > > first
> > > > necessary to provide an always-managed and a never-managed
> > > > version
> > > > of that function. Then, all callers of pci_intx() can be ported
> > > > to
> > > > the
> > > > version they need, depending whether they use
> > > > pci_enable_device()
> > > > or
> > > > pcim_enable_device().
> 
> > > > An always-managed function exists, namely pcim_intx(), for
> > > > which
> > > > __pcim_intx(), a never-managed version of pci_intx() had been
> > > > implemented.
> > > 
> > > > Make __pcim_intx() a public function under the name
> > > > pci_intx_unmanaged(). Make pcim_intx() a public function.
> 
> It seems I got confused by these two paragraphs. Why the double
> underscored
> function is even mentioned here?

It's mentioned because it's being moved.

> 
> > > To avoid an additional churn we can make just completely new
> > > APIs,
> > > namely:
> > > pcim_int_x()
> > > pci_int_x()
> > > 
> > > You won't need all dirty dances with double underscored function
> > > naming and
> > > renaming.
> > 
> > Ähm.. I can't follow. The new version doesn't use double
> > underscores
> > anymore. __pcim_intx() is being removed, effectively.
> > After this series, we'd end up with a clean:
> > 
> > 	pci_intx() <-> pcim_intx()
> > 
> > just as in the other PCI APIs.
> 
> ...
> 
> > > > +	pci_read_config_word(pdev, PCI_COMMAND, &pci_command);
> > > > +
> > > > +	if (enable)
> > > > +		new = pci_command & ~PCI_COMMAND_INTX_DISABLE;
> > > > +	else
> > > > +		new = pci_command | PCI_COMMAND_INTX_DISABLE;
> > > > +
> > > > +	if (new != pci_command)
> > > 
> > > I would use positive conditionals as easy to read (yes, a couple
> > > of
> > > lines
> > > longer, but also a win is the indentation and avoiding an
> > > additional
> > > churn in
> > > the future in case we need to add something in this branch.
> > 
> > I can't follow. You mean:
> > 
> > if (new == pci_command)
> >     return;
> > 
> > ?
> > 
> > That's exactly the same level of indentation.
> 
> No, the body gets one level off.
> 
> > Plus, I just copied the code.
> > 
> > > > +		pci_write_config_word(pdev, PCI_COMMAND, new);
> 
> 	if (new == pci_command)
> 		return;
> 
> 	pci_write_config_word(pdev, PCI_COMMAND, new);
> 
> See the difference?
> Also, imaging adding a new code in your case:
> 
> 	if (new != pci_command)
> 		pci_write_config_word(pdev, PCI_COMMAND, new);
> 
> ==>
> 
> 	if (new != pci_command) {
> 		...foo...
> 		pci_write_config_word(pdev, PCI_COMMAND, new);
> 		...bar...
> 	}
> 
> And in mine:
> 
> 	if (new == pci_command)
> 		return;
> 
> 	...foo...
> 	pci_write_config_word(pdev, PCI_COMMAND, new);
> 	...bar...
> 
> I hope it's clear now what I meant.

It is clear.. I'm not necessarily convinced that it's better to review
than just copying the pre-existing code, but if you really want it we
can do it I guess.

P.


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

end of thread, other threads:[~2024-10-14  9:12 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09  8:35 [RFC PATCH 00/13] Remove implicit devres from pci_intx() Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 01/13] PCI: Prepare removing " Philipp Stanner
2024-10-09  9:10   ` Damien Le Moal
2024-10-10 14:40   ` Andy Shevchenko
2024-10-11 12:16     ` Philipp Stanner
2024-10-11 13:50       ` Andy Shevchenko
2024-10-14  9:12         ` Philipp Stanner
2024-10-10 17:43   ` Alex Williamson
2024-10-11 12:03     ` Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 02/13] ALSA: hda: hda_intel: Use always-managed version of pcim_intx() Philipp Stanner
2024-10-10 14:46   ` Andy Shevchenko
2024-10-11 12:27     ` Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 03/13] drivers/xen: Use never-managed version of pci_intx() Philipp Stanner
2024-10-09  8:51   ` Juergen Gross
2024-10-09 10:50     ` Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 04/13] net/ethernet: " Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 05/13] net/ntb: " Philipp Stanner
2024-10-10  4:37   ` Shyam Sundar S K
2024-10-10  4:42   ` Shyam Sundar S K
2024-10-09  8:35 ` [RFC PATCH 06/13] misc: " Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 07/13] vfio/pci: " Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 08/13] PCI: MSI: " Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 09/13] ata: Use always-managed " Philipp Stanner
2024-10-09  8:51   ` Damien Le Moal
2024-10-09 10:55     ` Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 10/13] staging: rts5280: " Philipp Stanner
2024-10-09  9:38   ` Greg Kroah-Hartman
2024-10-09 19:41     ` Philipp Hortmann
2024-10-10  8:03       ` Philipp Stanner
2024-10-10  9:03         ` Greg Kroah-Hartman
2024-10-10  9:12           ` Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 11/13] wifi: qtnfmac: use always-managed version of pcim_intx() Philipp Stanner
2024-10-09  8:35 ` [RFC PATCH 12/13] HID: amd_sfh: Use " Philipp Stanner
2024-10-10  7:20   ` Basavaraj Natikar
2024-10-09  8:35 ` [RFC PATCH 13/13] Remove devres from pci_intx() Philipp Stanner
2024-10-10  8:50   ` Dan Carpenter
2024-10-10  9:11     ` Philipp Stanner
2024-10-10 17:43       ` Alex Williamson
2024-10-10 18:34         ` Dan Carpenter
2024-10-11 12:07         ` Philipp Stanner
2024-10-09 18:32 ` [RFC PATCH 00/13] Remove implicit " Heiner Kallweit
2024-10-10  8:09   ` Philipp Stanner
2024-10-10 14:50     ` Andy Shevchenko

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).