From patchwork Mon Dec 20 14:11:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 12687945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD78AC433F5 for ; Mon, 20 Dec 2021 14:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233419AbhLTOEH (ORCPT ); Mon, 20 Dec 2021 09:04:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233400AbhLTOEG (ORCPT ); Mon, 20 Dec 2021 09:04:06 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E61EC061574 for ; Mon, 20 Dec 2021 06:04:06 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so9766635pjp.0 for ; Mon, 20 Dec 2021 06:04:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=SL8i7XmSZcKv1Hv6hamucXEmBU/IT42I6bam5bGlLD4=; b=Hy/t8mwCK/l+x4JK/BfQgMX1larR9n+XCBlb4s84/HSsyty6J6yC2GfjjFPF7aWOkT YhaxjtK//F3OdBnxAJKFMnZtzsnjwwQy5adoJmXGUsoQGwMNr6OtnH3BkWebKnRGSzcI 1d7S3U6Zl84HVEC6uSFxTYpxd8D64LVfgkxcs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=SL8i7XmSZcKv1Hv6hamucXEmBU/IT42I6bam5bGlLD4=; b=7gztMDVtD0YSekL3MKem2hooUN6HTX8MgwbPwkRGVejBD1I1l3AAjNZKUAKOWUOiKK NAYqokq03s8DIpAK5qFbhHysGJFmCkxPFgKLYy52hHlFmA7U22sQlEMYwIDIs0q6ewSX ZcWrj20vc8YuWP1ny5u+DIGwVsCJYMomCVH7qXZQ2omEtOpY1zwa5oGl7WF+chxTwhoA nuY152sXju5C/ayPwhHQe34AgziV9J7UePmyXf6rneI5/1jQiOXknBvu1FetwNI7jAY2 MKasy9YkuIaG0s3Hdd9bJpRMOWfQKHITGWGcOVAo7nymlg1okDc1MJcEgveIPNizODJM I7TQ== X-Gm-Message-State: AOAM531308QaGDIsaMA7utNrLhzA9NS3i6JUh/tpjIc/qrFVEKkygZ/t tQWMFdtHfSy/ef4TPj6ivrkbiX517+Rbl9BaVpdALHLSq0nGMC5vO5FxfD2YBjVlFvNmWu+V0JQ f1yvNOeHm+tX6TvbaxHVLzoCTYR5oF2n0vS1kM0RL4xZPlyPSa3K79w8JpPI1xyPBUTwYG5lIRV u2kcaHeJ20 X-Google-Smtp-Source: ABdhPJx7LpZkrRuWc/7OkjXozWtHNfa2iV/e4kz5R5PZHMJm2xoYNbWy9k4GAld8pGWUvUqaFBmhcQ== X-Received: by 2002:a17:902:7b8d:b0:143:95e3:7dc0 with SMTP id w13-20020a1709027b8d00b0014395e37dc0mr17145490pll.21.1640009045376; Mon, 20 Dec 2021 06:04:05 -0800 (PST) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b4sm5434180pjm.17.2021.12.20.06.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 06:04:04 -0800 (PST) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, mpi3mr-linuxdrv.pdl@broadcom.com, Sreekanth Reddy Subject: [PATCH 02/25] mpi3mr: replace spin_lock with spin_lock_irqsave Date: Mon, 20 Dec 2021 19:41:36 +0530 Message-Id: <20211220141159.16117-3-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220141159.16117-1-sreekanth.reddy@broadcom.com> References: <20211220141159.16117-1-sreekanth.reddy@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use spin_lock_irqsave instead of spin_lock while acquiring reply_free_queue_lock & sbq_lock locks. Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpi3mr/mpi3mr_fw.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index aa5d877..61dcacd 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -124,8 +124,9 @@ static void mpi3mr_repost_reply_buf(struct mpi3mr_ioc *mrioc, u64 reply_dma) { u32 old_idx = 0; + unsigned long flags; - spin_lock(&mrioc->reply_free_queue_lock); + spin_lock_irqsave(&mrioc->reply_free_queue_lock, flags); old_idx = mrioc->reply_free_queue_host_index; mrioc->reply_free_queue_host_index = ( (mrioc->reply_free_queue_host_index == @@ -134,15 +135,16 @@ static void mpi3mr_repost_reply_buf(struct mpi3mr_ioc *mrioc, mrioc->reply_free_q[old_idx] = cpu_to_le64(reply_dma); writel(mrioc->reply_free_queue_host_index, &mrioc->sysif_regs->reply_free_host_index); - spin_unlock(&mrioc->reply_free_queue_lock); + spin_unlock_irqrestore(&mrioc->reply_free_queue_lock, flags); } void mpi3mr_repost_sense_buf(struct mpi3mr_ioc *mrioc, u64 sense_buf_dma) { u32 old_idx = 0; + unsigned long flags; - spin_lock(&mrioc->sbq_lock); + spin_lock_irqsave(&mrioc->sbq_lock, flags); old_idx = mrioc->sbq_host_index; mrioc->sbq_host_index = ((mrioc->sbq_host_index == (mrioc->sense_buf_q_sz - 1)) ? 0 : @@ -150,7 +152,7 @@ void mpi3mr_repost_sense_buf(struct mpi3mr_ioc *mrioc, mrioc->sense_buf_q[old_idx] = cpu_to_le64(sense_buf_dma); writel(mrioc->sbq_host_index, &mrioc->sysif_regs->sense_buffer_free_host_index); - spin_unlock(&mrioc->sbq_lock); + spin_unlock_irqrestore(&mrioc->sbq_lock, flags); } static void mpi3mr_print_event_data(struct mpi3mr_ioc *mrioc,