From patchwork Wed Nov 11 12:00:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 7595521 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 79C50BF90C for ; Wed, 11 Nov 2015 12:08:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8226720760 for ; Wed, 11 Nov 2015 12:07:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63DDC2073F for ; Wed, 11 Nov 2015 12:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752562AbbKKMHx (ORCPT ); Wed, 11 Nov 2015 07:07:53 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33236 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752754AbbKKMB7 (ORCPT ); Wed, 11 Nov 2015 07:01:59 -0500 Received: by pabfh17 with SMTP id fh17so29728956pab.0 for ; Wed, 11 Nov 2015 04:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=avagotech.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fSaJ/EcMRpkQFjWwP2yeegFgDkHmXGySEpgvtWJ+GUU=; b=Y9n++zSI3gsGaOsSN/PHG4Rq1+9Lq6MzLvl6pzLkuLfPoVtwCuj1GjJZiSePhp8nzI tM/GoUeZTU3MsNg2bbtxpsSKhMmxKst6oThbR6O2mlsZal3C4KNYMXUuI7zwWfgiO/pU LL/EWcdPSgp4VQ1B8omQ9CZ9nCd7JAZxex3HE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fSaJ/EcMRpkQFjWwP2yeegFgDkHmXGySEpgvtWJ+GUU=; b=Elv/VmnMK/2WbkdnDOoCylaxDgCKZ52F9Nb6c3q3QBSJ7tTAJinK0ehEkW825DwJ5Y C8PgFTwQLgmRjWsEDllbcWJC2/i8Zpvc+STZ8NkLmfBQNuVaeIj+1tincCQcs7S/zazz 4DlIlD4XtmbrNX31A5mVumes/h+hZOnY+5gtZFLG5ihGtEv5kXtYQeiFNZbbOCShzWIa BikBiNZgoH7L8XM2euf5FbovYGi8W3oRSfT7jHTGvRW5/abGkKKD33Rf1cWRrgAEyuTI HMX5zDzFQnkBeHvfJXEGqBCksDxTfOcRedu59kGY7r6MXLyTAkEtY0+CcWwd/bTMQEGX /hnA== X-Gm-Message-State: ALoCoQleAMjBI1Ci4uefHECmlerT2kbpl24RYlaaVPmtPVsBusYiG5QBGWYg7cc/qv1di5VreTf0 X-Received: by 10.66.122.5 with SMTP id lo5mr85992pab.22.1447243318380; Wed, 11 Nov 2015 04:01:58 -0800 (PST) Received: from host1.lsi.com ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id zi1sm9180851pbc.10.2015.11.11.04.01.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Nov 2015 04:01:57 -0800 (PST) From: Sreekanth Reddy X-Google-Original-From: Sreekanth Reddy To: jejb@kernel.org Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org, JBottomley@Parallels.com, Sathya.Prakash@avagotech.com, kashyap.desai@avagotech.com, linux-kernel@vger.kernel.org, hch@infradead.org, chaitra.basappa@avagotech.com, suganath-prabu.subramani@avagotech.com, Sreekanth Reddy , Sreekanth Reddy Subject: [PATCH RESEND 10/25] mpt3sas: Manage MSIX vectors according to HBA device type Date: Wed, 11 Nov 2015 17:30:26 +0530 Message-Id: <1447243241-10912-11-git-send-email-Sreekanth.Reddy@avagotech.com> X-Mailer: git-send-email 2.0.2 In-Reply-To: <1447243241-10912-1-git-send-email-Sreekanth.Reddy@avagotech.com> References: <1447243241-10912-1-git-send-email-Sreekanth.Reddy@avagotech.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sreekanth Reddy 1. Don't enable MSI-X vector for SAS2008 B0 controller, 2. Enable only single MSI-X vectors for below HBA's a. SAS2004 b. SAS2008 c. SAS2008_1 d. SAS2008_2 e. SAS2008_3 f. SAS2116_1 g. SAS2116_2 3. Enable Combined Reply Post Queue Support (i.e. 96 MSI-X vector) for only Gen3 Invader/Fury C0 and above revision HBA's 4. Enable Combined Reply Post Queue Support (i.e. 96 MSI-X vector) for all Intruder and Cutlass HBA's Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpt3sas/mpt3sas_base.c | 39 +++++++++++++++++++----------------- drivers/scsi/mpt3sas/mpt3sas_base.h | 3 +++ drivers/scsi/mpt3sas/mpt3sas_scsih.c | 7 +++++++ 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 62dc312..2b33e48 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1712,6 +1712,14 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) int base; u16 message_control; + /* Check whether controller SAS2008 B0 controller, + * if it is SAS2008 B0 controller use IO-APIC instead of MSIX + */ + if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 && + ioc->pdev->revision == SAS2_PCI_DEVICE_B0_REVISION) { + return -EINVAL; + } + base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX); if (!base) { dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n", @@ -1720,9 +1728,19 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc) } /* get msix vector count */ - - pci_read_config_word(ioc->pdev, base + 2, &message_control); - ioc->msix_vector_count = (message_control & 0x3FF) + 1; + /* NUMA_IO not supported for older controllers */ + if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2004 || + ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 || + ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_1 || + ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_2 || + ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_3 || + ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_1 || + ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_2) + ioc->msix_vector_count = 1; + else { + pci_read_config_word(ioc->pdev, base + 2, &message_control); + ioc->msix_vector_count = (message_control & 0x3FF) + 1; + } dinitprintk(ioc, pr_info(MPT3SAS_FMT "msix is supported, vector_count(%d)\n", ioc->name, ioc->msix_vector_count)); @@ -4979,7 +4997,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) { int r, i; int cpu_id, last_cpu_id = 0; - u8 revision; dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, __func__)); @@ -4999,20 +5016,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc) goto out_free_resources; } - /* Check whether the controller revision is C0 or above. - * only C0 and above revision controllers support 96 MSI-X vectors. - */ - revision = ioc->pdev->revision; - - if ((ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3004 || - ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3008 || - ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_1 || - ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_2 || - ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_5 || - ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_6) && - (revision >= 0x02)) - ioc->msix96_vector = 1; - ioc->rdpq_array_enable_assigned = 0; ioc->dma_mask = 0; r = mpt3sas_base_map_resources(ioc); diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 4c9a154..08f46a7 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -142,6 +142,9 @@ #define MPT_TARGET_FLAGS_DELETED 0x04 #define MPT_TARGET_FASTPATH_IO 0x08 +#define SAS2_PCI_DEVICE_B0_REVISION (0x01) +#define SAS3_PCI_DEVICE_C0_REVISION (0x02) + /* * Intel HBA branding */ diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 80469d0..2b51a41 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -7938,6 +7938,13 @@ _scsih_determine_hba_mpi_version(struct MPT3SAS_ADAPTER *ioc) { case MPI25_MFGPAGE_DEVID_SAS3108_5: case MPI25_MFGPAGE_DEVID_SAS3108_6: ioc->hba_mpi_version_belonged = MPI25_VERSION; + + /* Check whether the controller revision is C0 or above. + * only C0 and above revision controllers support 96 MSI-X + * vectors. + */ + if (ioc->pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION) + ioc->msix96_vector = 1; break; } }