Skip to contentSkip to conversation

Conditional MSI support for sata_nv

PATCH Applied Tony Vroon 3 participants 4 messages Aug 5, 2009 – Aug 12, 2009 libata

lore
Share & tools
lore

Tony Vroon

author
#0 lore raw

PATCH v3 1/1 Conditional MSI support for sata_nv

At least the nVidia MCP55 controller quite happily supports MSI. This adds an option to use it. It is disabled by default. As per feedback by Robert Hancock, it will honour the user request as the kernel will not enable MSI where the controller or the specific system configuration do not support it.

Cc Robert Hancock <[email protected]>
drivers/ata/sata_nv.c +8 -0
index b2d11f3..4598f19 100644
@@ -602,6 +602,7 @@ MODULE_VERSION(DRV_VERSION);
 
 static int adma_enabled;
 static int swncq_enabled = 1;
+static int msi_enabled;
 
 static void nv_adma_register_mode(struct ata_port *ap)
 {
@@ -2459,6 +2460,12 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	} else if (type == SWNCQ)
 		nv_swncq_host_init(host);
 
+	if (msi_enabled) {
+		dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n");
+		pci_enable_msi(pdev);
+	}
+
 	pci_set_master(pdev);
 	return ata_host_activate(host, pdev->irq, ipriv->irq_handler,
 				 IRQF_SHARED, ipriv->sht);
@@ -2558,4 +2565,6 @@ module_param_named(adma, adma_enabled, bool, 0444);
 MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)");
 module_param_named(swncq, swncq_enabled, bool, 0444);
 MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)");
+module_param_named(msi, msi_enabled, bool, 0444);
+MODULE_PARM_DESC(msi, "Enable use of MSI (Default: false)");
 
Applied
#1 lore raw
Quoted 32 lines · Tony Vroon

At least the nVidia MCP55 controller quite happily supports MSI.
This adds an option to use it. It is disabled by default.
As per feedback by Robert Hancock, it will honour the user request as the kernel will not enable MSI where the controller or the specific system configuration do not support it.

Cc Robert Hancock <[email protected]>
drivers/ata/sata_nv.c +6 -0
index b2d11f3..4598f19 100644
@@ -602,6 +602,7 @@ MODULE_VERSION(DRV_VERSION);
 
 static int adma_enabled;
 static int swncq_enabled = 1;
+static int msi_enabled;
 
 static void nv_adma_register_mode(struct ata_port *ap)
 {
@@ -2459,6 +2460,12 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	} else if (type == SWNCQ)
 		nv_swncq_host_init(host);
 
+	if (msi_enabled) {
+		dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n");
+		pci_enable_msi(pdev);
+	}
+
 	pci_set_master(pdev);
 	return ata_host_activate(host, pdev->irq, ipriv->irq_handler,
 				 IRQF_SHARED, ipriv->sht);

drivers/ata/sata_nv.c module_param_named(adma, adma_enabled, bool, 0444); · line 2567

Quoted 3 lines
drivers/ata/sata_nv.c +0 -0
@@ -2558,4 +2565,6 @@ module_param_named(adma, adma_enabled, bool, 0444);
 MODULE_PARM_DESC(adma, "Enable use of ADMA (Default: false)");
 module_param_named(swncq, swncq_enabled, bool, 0444);
 MODULE_PARM_DESC(swncq, "Enable use of SWNCQ (Default: true)");

applied

#2 lore raw
In reply to Tony Vroon

Hello,

drivers/ata/sata_nv.c static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · line 2467

Quoted 7 lines · Tony Vroon

At least the nVidia MCP55 controller quite happily supports MSI.

drivers/ata/sata_nv.c +6 -0
+static int msi_enabled;
+       if (msi_enabled) {
+               dev_printk(KERN_NOTICE, &pdev->dev, "Using MSI\n");
+               pci_enable_msi(pdev);
+       }
+

I just saw this patch, didn't check the full sources.

Shouldn't there be a matching "if (msi_enabled)
pci_disabling_msi(pdev);" somewhere else?

Regards,

Leon.

author
#3 lore raw
Quoted 2 lines · Leon Woestenberg

Shouldn't there be a matching "if (msi_enabled)
pci_disabling_msi(pdev);" somewhere else?

Hello there Leon,

Actually that is taken care of through other means. Please see Tejun Heo's confirmation of this in the "v2" thread for this patch.

Quoted 2 lines

Regards,
Leon.

Regards,
Tony V.