The PCI_IRQ_AFFINITY flag prevents customers from
changing the smp_affinity and smp_affinity_list entries.

- add a module parameter to allow this flag to be turned
  off.

- to turn off PCI_IRQ_AFFINITY:
  flag hpsa_disable_irq_affinity=1

Reviewed-by: David Carroll <david.carr...@microsemi.com>
Reviewed-by: Scott Teel <scott.t...@microsemi.com>
Signed-off-by: Don Brace <don.br...@microsemi.com>
---
 drivers/scsi/hpsa.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index c9cccf35e9d7..0aa5aa66151f 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -87,6 +87,10 @@ static int hpsa_simple_mode;
 module_param(hpsa_simple_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(hpsa_simple_mode,
        "Use 'simple mode' rather than 'performant mode'");
+static bool hpsa_disable_irq_affinity;
+module_param(hpsa_disable_irq_affinity, bool, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(hpsa_disable_irq_affinity,
+       "Turn off managed irq affinity. Allows smp_affinity to be changed.");
 
 /* define the PCI info for the cards we can control */
 static const struct pci_device_id hpsa_pci_device_id[] = {
@@ -7389,7 +7393,7 @@ static void hpsa_setup_reply_map(struct ctlr_info *h)
  */
 static int hpsa_interrupt_mode(struct ctlr_info *h)
 {
-       unsigned int flags = PCI_IRQ_LEGACY;
+       unsigned int flags;
        int ret;
 
        /* Some boards advertise MSI but don't really support it */
@@ -7400,17 +7404,20 @@ static int hpsa_interrupt_mode(struct ctlr_info *h)
        case 0x40830E11:
                break;
        default:
+               flags = PCI_IRQ_MSIX;
+               if (!hpsa_disable_irq_affinity)
+                       flags |= PCI_IRQ_AFFINITY;
                ret = pci_alloc_irq_vectors(h->pdev, 1, MAX_REPLY_QUEUES,
-                               PCI_IRQ_MSIX | PCI_IRQ_AFFINITY);
+                               flags);
                if (ret > 0) {
                        h->msix_vectors = ret;
                        return 0;
                }
 
-               flags |= PCI_IRQ_MSI;
                break;
        }
 
+       flags = PCI_IRQ_LEGACY | PCI_IRQ_MSI;
        ret = pci_alloc_irq_vectors(h->pdev, 1, 1, flags);
        if (ret < 0)
                return ret;

Reply via email to