From: "NickCheng" <nick.cheng@areca.com.tw>
To: <linux-scsi@vger.kernel.org>
Cc: linux-kernel@vger.kernel.org, jejb@kernel.org,
黃清隆 <ching2048@areca.com.tw>
Subject: [PATCH 3/5] arcmsr: Support MSI and MSI-X
Date: Wed, 6 Feb 2013 16:36:20 +0800 [thread overview]
Message-ID: <36B5BA6F44054F4BB50AD4A0405CDD3B@arecaaebe11fae> (raw)
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
From: Nick Cheng <nick.cheng@areca.com.tw>
Support MSI or MSI-X for whole series of RAID controllers. Meanwhile correct the register access as iowrite32/ioread32
Signed-off-by: Nick Cheng <nick.cheng@areca.com.tw>
---
[-- Attachment #2: patch3 --]
[-- Type: application/octet-stream, Size: 4025 bytes --]
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c 2013-02-06 16:28:14.038731412 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c 2013-02-06 16:28:24.508982584 +0800
@@ -805,8 +805,9 @@ static int arcmsr_probe(struct pci_dev *
{
struct Scsi_Host *host;
struct AdapterControlBlock *acb;
- uint8_t bus,dev_fun;
- int error;
+ uint8_t bus, dev_fun;
+ struct msix_entry entries[ARCMST_NUM_MSIX_VECTORS];
+ int error, i, j;
error = pci_enable_device(pdev);
if (error)
return -ENODEV;
@@ -863,10 +864,46 @@ static int arcmsr_probe(struct pci_dev *
error = scsi_add_host(host, &pdev->dev);
if (error)
goto RAID_controller_stop;
- error = request_irq(pdev->irq, arcmsr_do_interrupt,
- IRQF_SHARED, "arcmsr", acb);
- if (error)
- goto scsi_host_remove;
+ if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
+ if (!pci_enable_msix(pdev, entries, ARCMST_NUM_MSIX_VECTORS)) {
+ for (i = 0; i < ARCMST_NUM_MSIX_VECTORS; i++) {
+ entries[i].entry = i;
+ if (request_irq(entries[i].vector,
+ arcmsr_do_interrupt, 0, "arcmsr",
+ acb)) {
+ for (j = 0 ; j < i ; j++)
+ free_irq(entries[i].vector,
+ acb);
+ goto scsi_host_remove;
+ }
+ acb->entries[i] = entries[i];
+ }
+ acb->acb_flags |= ACB_F_MSIX_ENABLED;
+ } else {
+ if (request_irq(pdev->irq, arcmsr_do_interrupt,
+ IRQF_SHARED, "arcmsr", acb)) {
+ printk("arcmsr%d: request_irq = %d failed!\n",
+ acb->host->host_no, pdev->irq);
+ goto scsi_host_remove;
+ }
+ }
+ } else if (pci_find_capability(pdev, PCI_CAP_ID_MSI)) {
+ if (!pci_enable_msi(pdev))
+ acb->acb_flags |= ACB_F_MSI_ENABLED;
+ if (request_irq(pdev->irq, arcmsr_do_interrupt,
+ IRQF_SHARED, "arcmsr", acb)) {
+ pr_warn("arcmsr%d: request_irq =%d failed!\n",
+ acb->host->host_no, pdev->irq);
+ goto scsi_host_remove;
+ }
+ } else {
+ if (request_irq(pdev->irq, arcmsr_do_interrupt,
+ IRQF_SHARED, "arcmsr", acb)) {
+ pr_warn("arcmsr%d: request_irq = %d failed!\n",
+ acb->host->host_no, pdev->irq);
+ goto scsi_host_remove;
+ }
+ }
host->irq = pdev->irq;
scsi_scan_host(host);
INIT_WORK(&acb->arcmsr_do_message_isr_bh,
@@ -886,6 +923,11 @@ static int arcmsr_probe(struct pci_dev *
return 0;
out_free_sysfs:
scsi_host_remove:
+ if (acb->acb_flags & ACB_F_MSI_ENABLED) {
+ pci_disable_msi(pdev);
+ } else if (acb->acb_flags & ACB_F_MSIX_ENABLED) {
+ pci_disable_msix(pdev);
+ }
scsi_remove_host(host);
RAID_controller_stop:
arcmsr_stop_adapter_bgrb(acb);
@@ -1098,11 +1140,11 @@ arcmsr_report_ccb_state(struct AdapterCo
default:
pr_notice("arcmsr%d: scsi id = %d lun = %d"
"isr get command error done, but got unknown"
- "DeviceStatus = 0x%x\n"
- , acb->host->host_no
- , id
- , lun
- , ccb->arcmsr_cdb.DeviceStatus);
+ "DeviceStatus = 0x%x\n"
+ , acb->host->host_no
+ , id
+ , lun
+ , ccb->arcmsr_cdb.DeviceStatus);
acb->devstate[id][lun] = ARECA_RAID_GONE;
ccb->pcmd->result = DID_NO_CONNECT << 16;
arcmsr_ccb_complete(ccb);
@@ -1124,7 +1166,7 @@ struct CommandControlBlock *pCCB, bool e
lun = abortcmd->device->lun;
abortcmd->result |= DID_ABORT << 16;
arcmsr_ccb_complete(pCCB);
- pr_notice("arcmsr%d: pCCB ='0x%p' isr"
+ pr_notice("arcmsr%d: pCCB = '0x%p' isr"
"got aborted command\n",
acb->host->host_no, pCCB);
}
@@ -1134,12 +1176,12 @@ struct CommandControlBlock *pCCB, bool e
"done acb = '0x%p'"
"ccb = '0x%p' ccbacb = '0x%p' startdone = 0x%x"
"ccboutstandingcount = %d\n"
- , acb->host->host_no
- , acb
- , pCCB
- , pCCB->acb
- , pCCB->startdone
- , atomic_read(&acb->ccboutstandingcount));
+ , acb->host->host_no
+ , acb
+ , pCCB
+ , pCCB->acb
+ , pCCB->startdone
+ , atomic_read(&acb->ccboutstandingcount));
return;
}
arcmsr_report_ccb_state(acb, pCCB, error);
next reply other threads:[~2013-02-06 8:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-06 8:36 NickCheng [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-02-08 6:04 NickCheng
2013-02-08 6:02 NickCheng
2012-12-04 11:59 NickCheng
2012-11-16 11:55 NickCheng
2012-11-15 7:25 NickCheng
2012-10-12 9:08 NickCheng
2012-10-03 12:40 NickCheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36B5BA6F44054F4BB50AD4A0405CDD3B@arecaaebe11fae \
--to=nick.cheng@areca.com.tw \
--cc=ching2048@areca.com.tw \
--cc=jejb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®