From patchwork Fri Mar 27 11:55:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Saxena X-Patchwork-Id: 6106421 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 8565FBF90F for ; Fri, 27 Mar 2015 12:11:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CACE02038A for ; Fri, 27 Mar 2015 12:10:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6F5D203A1 for ; Fri, 27 Mar 2015 12:10:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837AbbC0MKz (ORCPT ); Fri, 27 Mar 2015 08:10:55 -0400 Received: from mail-bl2on0099.outbound.protection.outlook.com ([65.55.169.99]:56992 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752558AbbC0MKz (ORCPT ); Fri, 27 Mar 2015 08:10:55 -0400 X-Greylist: delayed 850 seconds by postgrey-1.27 at vger.kernel.org; Fri, 27 Mar 2015 08:10:54 EDT Received: from DM2PR07CA0018.namprd07.prod.outlook.com (10.141.52.146) by BLUPR07MB018.namprd07.prod.outlook.com (10.255.209.40) with Microsoft SMTP Server (TLS) id 15.1.112.16; Fri, 27 Mar 2015 11:56:42 +0000 Received: from BY2FFO11FD008.protection.gbl (2a01:111:f400:7c0c::187) by DM2PR07CA0018.outlook.office365.com (2a01:111:e400:2414::18) with Microsoft SMTP Server (TLS) id 15.1.125.19 via Frontend Transport; Fri, 27 Mar 2015 11:56:42 +0000 Received: from PALEXCH12.lsi.com ([192.19.192.197]) by BY2FFO11FD008.mail.protection.outlook.com ([10.1.14.159]) with Microsoft SMTP Server (TLS) id 15.1.130.10 via Frontend Transport; Fri, 27 Mar 2015 11:56:41 +0000 Received: from palmhbs0.lsi.com (128.94.222.181) by PALEXCH12-EXT.lsi.com (128.94.222.103) with Microsoft SMTP Server id 14.3.158.1; Fri, 27 Mar 2015 07:55:59 -0400 Received: from localhost (dhcp-135-24-192-130.lsi.com [135.24.192.130]) by palmhbs0.lsi.com (8.13.8/8.12.11) with ESMTP id t2RBvS3b032342; Fri, 27 Mar 2015 07:57:30 -0400 From: Message-ID: <201503271157.t2RBvS3b032342@palmhbs0.lsi.com> Date: Fri, 27 Mar 2015 17:25:57 +0530 To: Subject: [PATCH 5/5] megaraid_sas : Support for Avago's Single server High Availability product CC: , , , , , User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 130719310022137940; (f081dce6-2920-4dfc-23e8-08d07091c5e3); (f081dce6-2920-4dfc-23e8-08d07091c5e3) Received-SPF: PermError (protection.outlook.com: domain of avagotech.com used an invalid SPF mechanism) Authentication-Results: spf=permerror (sender IP is 192.19.192.197) smtp.mailfrom=Sumit.Saxena@avagotech.com; avagotech.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.19.192.197; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10009020)(6009001)(448002)(199003)(189002)(85326001)(57986006)(19580395003)(19580405001)(77156002)(83506001)(62966003)(86362001)(46102003)(76506005)(47776003)(46406003)(86152002)(229853001)(97756001)(2351001)(6550400002)(50986999)(106466001)(16796002)(54356999)(92566002)(50466002)(87936001)(23726002)(110136001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB018; H:PALEXCH12.lsi.com; FPR:; SPF:PermError; MLV:sfv; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB018; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002010)(5005006); SRVR:BLUPR07MB018; BCL:0; PCL:0; RULEID:(401004)(400005); SRVR:BLUPR07MB018; X-Forefront-PRVS: 0528942FD8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2015 11:56:41.7145 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.19.192.197]; Helo=[PALEXCH12.lsi.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB018 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This patch will add support for Single Server High Availability(SSHA) cluster support. Here is the short decsription of changes done to add support for SSHA- 1) Host will send system's Unique ID based on DMI_PRODUCT_UUID to firmware. 2) Toggle the devhandle in LDIO path for Remote LDs. Signed-off-by: Kashyap Desai Signed-off-by: Sumit Saxena --- drivers/scsi/megaraid/megaraid_sas.h | 17 +++++++++++++++-- drivers/scsi/megaraid/megaraid_sas_base.c | 15 ++++++++++++++- drivers/scsi/megaraid/megaraid_sas_fusion.c | 20 ++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 680d90b..225d806 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1272,8 +1272,10 @@ struct megasas_init_frame { u32 queue_info_new_phys_addr_hi; /*1Ch */ u32 queue_info_old_phys_addr_lo; /*20h */ u32 queue_info_old_phys_addr_hi; /*24h */ - - u32 reserved_4[6]; /*28h */ + u32 reserved_4[2]; /*28h */ + u32 system_info_lo; /*30h */ + u32 system_info_hi; /*34h */ + u32 reserved_5[2]; /*38h */ } __attribute__ ((packed)); @@ -1650,12 +1652,22 @@ struct megasas_irq_context { u32 MSIxIndex; }; +struct MR_DRV_SYSTEM_INFO { + u8 infoVersion; + u8 systemIdLength; + u16 reserved0; + u8 systemId[64]; + u8 reserved[1980]; +}; + struct megasas_instance { u32 *producer; dma_addr_t producer_h; u32 *consumer; dma_addr_t consumer_h; + struct MR_DRV_SYSTEM_INFO *system_info_buf; + dma_addr_t system_info_h; struct MR_LD_VF_AFFILIATION *vf_affiliation; dma_addr_t vf_affiliation_h; struct MR_LD_VF_AFFILIATION_111 *vf_affiliation_111; @@ -1770,6 +1782,7 @@ struct megasas_instance { u16 throttlequeuedepth; u8 mask_interrupts; u8 is_imr; + bool dev_handle; }; struct MR_LD_VF_MAP { u32 size; diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 7195f18..c614863 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -5245,6 +5245,13 @@ static int megasas_probe_one(struct pci_dev *pdev, break; } + instance->system_info_buf = pci_alloc_consistent(pdev, + sizeof(struct MR_DRV_SYSTEM_INFO), + &instance->system_info_h); + + if (!instance->system_info_buf) + dev_info(&instance->pdev->dev, "Can't allocate system info buffer\n"); + /* Crash dump feature related initialisation*/ instance->drv_buf_index = 0; instance->drv_buf_alloc = 0; @@ -5672,8 +5679,10 @@ megasas_resume(struct pci_dev *pdev) &instance->sriov_heartbeat_timer, megasas_sriov_heartbeat_handler, MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF); - else + else { instance->skip_heartbeat_timer_del = 1; + goto fail_init_mfi; + } } instance->instancet->enable_intr(instance); @@ -5837,6 +5846,10 @@ static void megasas_detach_one(struct pci_dev *pdev) pci_free_consistent(pdev, CRASH_DMA_BUF_SIZE, instance->crash_dump_buf, instance->crash_dump_h); + if (instance->system_info_buf) + pci_free_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO), + instance->system_info_buf, instance->system_info_h); + scsi_host_put(host); pci_disable_device(pdev); diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 03db473..103df1c 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -53,6 +53,7 @@ #include #include #include +#include #include "megaraid_sas_fusion.h" #include "megaraid_sas.h" @@ -609,6 +610,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) union MEGASAS_REQUEST_DESCRIPTOR_UNION req_desc; int i; struct megasas_header *frame_hdr; + const char *sys_info; fusion = instance->ctrl_context; @@ -671,6 +673,16 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) /* Convert capability to LE32 */ cpu_to_le32s((u32 *)&init_frame->driver_operations.mfi_capabilities); + sys_info = dmi_get_system_info(DMI_PRODUCT_UUID); + if (instance->system_info_buf && sys_info) { + memcpy(instance->system_info_buf->systemId, sys_info, + strlen(sys_info) > 64 ? 64 : strlen(sys_info)); + instance->system_info_buf->systemIdLength = + strlen(sys_info) > 64 ? 64 : strlen(sys_info); + init_frame->system_info_lo = instance->system_info_h; + init_frame->system_info_hi = 0; + } + init_frame->queue_info_new_phys_addr_hi = cpu_to_le32(upper_32_bits(ioc_init_handle)); init_frame->queue_info_new_phys_addr_lo = @@ -1602,6 +1614,14 @@ megasas_build_ldio_fusion(struct megasas_instance *instance, cmd->pd_r1_lb = io_info.pd_after_lb; } else scp->SCp.Status &= ~MEGASAS_LOAD_BALANCE_FLAG; + + if ((raidLUN[0] == 1) && + (local_map_ptr->raidMap.devHndlInfo[io_info.pd_after_lb].validHandles > 2)) { + instance->dev_handle = !(instance->dev_handle); + io_info.devHandle = + local_map_ptr->raidMap.devHndlInfo[io_info.pd_after_lb].devHandle[instance->dev_handle]; + } + cmd->request_desc->SCSIIO.DevHandle = io_info.devHandle; io_request->DevHandle = io_info.devHandle; /* populate the LUN field */