Skip to contentSkip to conversation

crypto/cavium MSI-X fixups

PATCH New Christoph Hellwig 5 participants 10 messages Feb 15, 2017 – Feb 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi George,

your commit "crypto: cavium - Add Support for Octeon-tx CPT Engine" add a new caller to pci_enable_msix. This API has long been deprecated so this series switches it to use pci_alloc_irq_vectors instead.

Can you please test it and make sure it goes in before the end of the merge window so that no more users of the old API hit mainline?

#1 lore raw

PATCH 1/3 crypto: cavium: remove dead MSI-X related define

---
 drivers/crypto/cavium/cpt/cpt_common.h | 2 --
 1 file changed, 2 deletions(-)
drivers/crypto/cavium/cpt/cpt_common.h +0 -2
index ede612f306d3..225078d03773 100644
@@ -20,12 +20,10 @@
 #define CPT_81XX_PCI_VF_DEVICE_ID 0xa041
 
 /* flags to indicate the features supported */
-#define CPT_FLAG_MSIX_ENABLED BIT(0)
 #define CPT_FLAG_SRIOV_ENABLED BIT(1)
 #define CPT_FLAG_VF_DRIVER BIT(2)
 #define CPT_FLAG_DEVICE_READY BIT(3)
 
-#define cpt_msix_enabled(cpt) ((cpt)->flags & CPT_FLAG_MSIX_ENABLED)
 #define cpt_sriov_enabled(cpt) ((cpt)->flags & CPT_FLAG_SRIOV_ENABLED)
 #define cpt_vf_driver(cpt) ((cpt)->flags & CPT_FLAG_VF_DRIVER)
 #define cpt_device_ready(cpt) ((cpt)->flags & CPT_FLAG_DEVICE_READY)
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/3 crypto: cavium/cptpf: switch to pci_alloc_irq_vectors

In reply to Christoph Hellwig

pci_enable_msix has been long deprecated, but this driver adds a new instance. Convert it to pci_alloc_irq_vectors and greatly simplify the code.

---
 drivers/crypto/cavium/cpt/cptpf.h      |  5 ---
 drivers/crypto/cavium/cpt/cptpf_main.c | 58 ++++++----------------------------
 2 files changed, 10 insertions(+), 53 deletions(-)
drivers/crypto/cavium/cpt/cptpf.h +0 -5
index 8a2a8e538da4..c0556c5f63c9 100644
@@ -51,11 +51,6 @@ struct cpt_device {
 	struct cpt_vf_info vfinfo[CPT_MAX_VF_NUM]; /* Per VF info */
 
 	void __iomem *reg_base; /* Register start address */
-	/* MSI-X */
-	u8 num_vec;
-	bool msix_enabled;
-	struct msix_entry msix_entries[CPT_PF_MSIX_VECTORS];
-	bool irq_allocated[CPT_PF_MSIX_VECTORS];
 	struct pci_dev *pdev; /* pci device handle */
 
 	struct microcode mcode[CPT_MAX_CORE_GROUPS];
drivers/crypto/cavium/cpt/cptpf_main.c +10 -48

94 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/3 crypto: cavium/cptvf: switch to pci_alloc_irq_vectors

In reply to Christoph Hellwig

pci_enable_msix has been long deprecated, but this driver adds a new instance. Convert it to pci_alloc_irq_vectors and greatly simplify the code, and make sure the prope code properly unwinds.

---
 drivers/crypto/cavium/cpt/cptvf.h      |   3 -
 drivers/crypto/cavium/cpt/cptvf_main.c | 203 +++++++++++----------------------
 2 files changed, 65 insertions(+), 141 deletions(-)
drivers/crypto/cavium/cpt/cptvf.h +0 -3
index 1cc04aa611e4..0a835a07d4f2 100644
@@ -107,9 +107,6 @@ struct cpt_vf {
 	void __iomem *reg_base; /* Register start address */
 	void *wqe_info;	/* BH worker info */
 	/* MSI-X */
-	bool msix_enabled;
-	struct msix_entry msix_entries[CPT_VF_MSIX_VECTORS];
-	bool irq_allocated[CPT_VF_MSIX_VECTORS];
 	cpumask_var_t affinity_mask[CPT_VF_MSIX_VECTORS];
 	/* Command and Pending queues */
 	u32 qsize;
drivers/crypto/cavium/cpt/cptvf_main.c +65 -138

277 lines not on this page · raw message

Signature · 1 line
2.11.0
#4 lore raw
In reply to Christoph Hellwig

Hi Christoph,

Quoted 8 lines · Christoph Hellwig

Hi George,

your commit "crypto: cavium - Add Support for Octeon-tx CPT Engine" add a new caller to pci_enable_msix. This API has long been deprecated so this series switches it to use pci_alloc_irq_vectors instead.

Can you please test it and make sure it goes in before the end of the merge window so that no more users of the old API hit mainline?

Yes the changes works well.

for the series.

Quoted 1 line
#5 lore raw

Herbert,

any comment? I'd really like to avoid introducing new pci_enable_msix users in this merge window..

Quoted 10 lines · George Cherian

Hi Christoph,

Quoted 6 lines · Christoph Hellwig

Hi George,

your commit "crypto: cavium - Add Support for Octeon-tx CPT Engine" add a new caller to pci_enable_msix. This API has long been deprecated so this series switches it to use pci_alloc_irq_vectors instead.

Quoted 8 lines
Quoted 2 lines

Can you please test it and make sure it goes in before the end of the merge window so that no more users of the old API hit mainline?

Yes the changes works well.

for the series.

Quoted 1 line

---end quoted text---

#6 lore raw
Quoted 4 lines · Christoph Hellwig

Herbert,

any comment? I'd really like to avoid introducing new pci_enable_msix users in this merge window..

Hi Cristoph,

With respect to pci_enable_msix(), what do you recommend as a replacement? For the crypto/cavium driver, you recommend pci_alloc_irq_vectors(), which works well if the required MSI-X indexes are contiguous starting at zero. What would be used for a device that has 184 MSI-X, but only a sparse subset (fewer than half) of these are required for the driver operation. It would waste system resources to use an API that forces us to allocate 184 when only 80 are required.

Currently pci_enable_msix() allows an arbitrary set of MSI-X to be requested, which exactly fits the requirements of our (non crypto/cavium) hardware.

Thanks in advance for any insight you can provide, David Daney

Quoted 22 lines · George Cherian
Quoted 10 lines

Hi Christoph,

Quoted 6 lines · Christoph Hellwig

Hi George,

your commit "crypto: cavium - Add Support for Octeon-tx CPT Engine" add a new caller to pci_enable_msix. This API has long been deprecated so this series switches it to use pci_alloc_irq_vectors instead.

Quoted 8 lines
Quoted 2 lines

Can you please test it and make sure it goes in before the end of the merge window so that no more users of the old API hit mainline?

Yes the changes works well.

for the series.

Quoted 1 line

---end quoted text---

#7 lore raw
Quoted 1 line · David Daney

With respect to pci_enable_msix(), what do you recommend as a replacement?

pci_alloc_irq_vectors. In fact I have a tree ready for after -rc1 that removes pci_enable_msix() entirely.

Quoted 6 lines

For the crypto/cavium driver, you recommend pci_alloc_irq_vectors(), which works well if the required MSI-X indexes are contiguous starting at zero. What would be used for a device that has 184 MSI-X, but only a sparse subset (fewer than half) of these are required for the driver operation. It would waste system resources to use an API that forces us to allocate 184 when only 80 are required.

Currently we don't have a good API for that. I've not been through all users of pci_enable_msix_{range,exact} yet, but so far I've only found one user not using all vectors from 0 to some limit. Depending how many such users we have and how they'll look I will have to look into an API to support that use case.

#8 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · David Daney

With respect to pci_enable_msix(), what do you recommend as a replacement?

pci_alloc_irq_vectors. In fact I have a tree ready for after -rc1 that removes pci_enable_msix() entirely.

I would like to see something that handles the case of this driver that I am attempting to get merged:

https://lkml.org/lkml/2017/2/15/1209

Quoted 8 lines
Quoted 7 lines

For the crypto/cavium driver, you recommend pci_alloc_irq_vectors(), which works well if the required MSI-X indexes are contiguous starting at zero. What would be used for a device that has 184 MSI-X, but only a sparse subset (fewer than half) of these are required for the driver operation. It would waste system resources to use an API that forces us to allocate 184 when only 80 are required.

Quoted 6 lines

Currently we don't have a good API for that. I've not been through all users of pci_enable_msix_{range,exact} yet, but so far I've only found one user not using all vectors from 0 to some limit. Depending how many such users we have and how they'll look I will have to look into an API to support that use case.

See the patch above for the case that doesn't use 0..UPPER_LIMIT

David Daney

maintainer
#9 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

Hi George,

your commit "crypto: cavium - Add Support for Octeon-tx CPT Engine" add a new caller to pci_enable_msix. This API has long been deprecated so this series switches it to use pci_alloc_irq_vectors instead.

Can you please test it and make sure it goes in before the end of the merge window so that no more users of the old API hit mainline?

All applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt