From patchwork Sun Nov 26 05:31:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 747516 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="fZUjDeNX" Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D9ECE for ; Sat, 25 Nov 2023 21:30:53 -0800 (PST) Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-58ceabd7cdeso1715378eaf.3 for ; Sat, 25 Nov 2023 21:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1700976652; x=1701581452; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=0o97w/apf9FMudiVPsRkblL5mhd5TbaH+umllEFatXU=; b=fZUjDeNXsYNBlfjMrtTdXewd1yq42w5qlnB8LmCg7zwuc+A2WVHH9jNVceRpLZyRqW bzshJOUdQ2n8Y5mzUuIAMhOhovpWK96us/gFuJ+3ANIOGw9wAVSipbo5PDXnuhS04l7N JHkOrGYnk8LD6kS14rDiEqR0CiL+H0R8wZK64= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700976652; x=1701581452; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0o97w/apf9FMudiVPsRkblL5mhd5TbaH+umllEFatXU=; b=bSYVESECqox8A9X8nXCSnDMhP7GomM0LtOrpy8cm8LKCGf49JCU79wvtCVwhAwRw7k MZ/Di+LZwavAGvEv7Dmy2GMt33TSxwYsnf+oiFOoUAi/mgNP7e3sp0MUQU5/qVEF3DmA aSnpCwzUcMgdBD/wcuFl6uPhOBrMCVc49oMk6YpR6XTOVuWciHxOYS96z3RR/6GAkE1X T/N83OCoX3yw0VIYt3Eyc8HcaBqjASrlUhJs8ftOpuY4XQZ3z/1dCtYnfcNGyp34A/ch kUeXtEk5wEfX8cBmV4wiF1wP4nlCRHmW4TeIthRxBCuVxAT6hk6o6vG7SeDpBR0D0N6U Ehxw== X-Gm-Message-State: AOJu0Yx0K7UfJWWlOz/g92Q0IarBrLRXnBtx12nAW3Exak3jTFMSaHN8 24QflqLLfDlp6vONyfSgR3v+pQhEuxgy8I/oEsmk7UD/SqQGnYtVnmmfRa6WgcMe5dKB8xdjy/x dF9n8p3EC8Xe6GgPsSY4JLASwGDwz1Qa1L73X46zOtYik8ICsLC2ZdTjJuIGlI0hQBlptTfolkv ZQI4NQEgnODkZH3myfDg== X-Google-Smtp-Source: AGHT+IHecPuosQSwZzQvYcFR0SrjTVNgpbEHvbLHmY96arQfsY20sFM9X/RpeIiq6RaGCjXpogehFA== X-Received: by 2002:a05:6358:998a:b0:16d:e923:573 with SMTP id j10-20020a056358998a00b0016de9230573mr7692608rwb.15.1700976651816; Sat, 25 Nov 2023 21:30:51 -0800 (PST) Received: from dhcp-10-123-20-35.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s78-20020a632c51000000b00578b8fab907sm5516166pgs.73.2023.11.25.21.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 21:30:51 -0800 (PST) From: Chandrakanth patil To: linux-scsi@vger.kernel.org, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, ranjan.kumar@broadcom.com, prayas.patel@broadcom.com Cc: Chandrakanth patil , stable@vger.kernel.org Subject: [PATCH 1/4] mpi3mr: Refresh sdev queue depth after controller reset Date: Sun, 26 Nov 2023 11:01:31 +0530 Message-Id: <20231126053134.10133-2-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231126053134.10133-1-chandrakanth.patil@broadcom.com> References: <20231126053134.10133-1-chandrakanth.patil@broadcom.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After a controller reset, the firmware may modify the device queue depth. Therefore, update the device queue depth accordingly. Cc: # v5.15+ Signed-off-by: Sathya Prakash Signed-off-by: Chandrakanth patil --- drivers/scsi/mpi3mr/mpi3mr_os.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index 91a22e6e5c3f..561fe0857bc0 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -1070,8 +1070,14 @@ void mpi3mr_rfresh_tgtdevs(struct mpi3mr_ioc *mrioc) tgtdev = NULL; list_for_each_entry(tgtdev, &mrioc->tgtdev_list, list) { if ((tgtdev->dev_handle != MPI3MR_INVALID_DEV_HANDLE) && - !tgtdev->is_hidden && !tgtdev->host_exposed) - mpi3mr_report_tgtdev_to_host(mrioc, tgtdev->perst_id); + !tgtdev->is_hidden) { + if (!tgtdev->host_exposed) + mpi3mr_report_tgtdev_to_host(mrioc, + tgtdev->perst_id); + else if (tgtdev->starget) + starget_for_each_device(tgtdev->starget, + (void *)tgtdev, mpi3mr_update_sdev); + } } } From patchwork Sun Nov 26 05:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandrakanth Patil X-Patchwork-Id: 747515 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="g4zpum5Z" Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AFECDC for ; Sat, 25 Nov 2023 21:31:05 -0800 (PST) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-5c85e8fdd2dso29249577b3.2 for ; Sat, 25 Nov 2023 21:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1700976664; x=1701581464; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Pplkkx3QSqkMXfA3cR/+JosWlTFrJrbmsz6cfxprViQ=; b=g4zpum5ZAEJvoEtawfEuKIEOBcaikaMlU//NHLfzXcGb9ilvyYx64qo91OdPGWaWxn phLLVO2jGe7nkHSWBy5MF+PFRic5F6wmIfavM2GvDL7el2tsXh/PxWcGhtr9VGYL9+YM Yj6dJB+vRiyKqMPcdXxRgqTU0lRhKZESFcyqM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700976664; x=1701581464; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Pplkkx3QSqkMXfA3cR/+JosWlTFrJrbmsz6cfxprViQ=; b=QmiSMP/ZPIPXU6RUGaDE7RTNW5O+cIP+Yc/wTxQiNR6As0rBI7umJsAQHLnND0GzrC eUX+rAyzL5cUwzE4kcAhuaZrG5CyNCO1cKsdfY3I7ZW11e1nuCbRnLaJM/d8Mwt+TAl4 H7Ee+yR0QwC0i1R84ib/jfVvdr/hj0vFBlSP9Gv2h7K3FkPw/bxXrPjfO9aV6IC27Uh+ lZRbcKAZzE0hpykrhnbQbz1gZN5PYjybZXRyz0lMCzR1/X/CbGS8rOdR+SqN+HWuV+Oa Y85ZhCEg20iUuOPLRF0nXsbxUpOjNkztGYLJ6WMfbet/gH+hGNVz6su2iwKHq5aydFxK YxuQ== X-Gm-Message-State: AOJu0YzMRhpkrOj4KTCUnNd7xCd0HT7r9vXUHzGxzAAJvNjo/7VLPFcT 2EaRvfpjL9Ph2Cn0/CDEAYAUjBOOJZIGxjsujEouWSY3bOrfbCPeHcoiC0BJ5GCTplb5rBtAiad g7Egqjg8cWGeXDFzoQ42Po8sDrHcDzdiCcYd6bj+H0JU2L14OE0Gy+9N1jCcmdN4wB0SAVhPbtP /99fErNlsiPciN/Bhs/A== X-Google-Smtp-Source: AGHT+IE6yl2vfJyeaX1ogQweJkK2DJdS+QjzQvP43bpLT2g4XC8OUI0jQS03nFttip2jU4Ow7fOHsg== X-Received: by 2002:a81:9190:0:b0:5a8:e6f4:4b6c with SMTP id i138-20020a819190000000b005a8e6f44b6cmr8512052ywg.25.1700976663763; Sat, 25 Nov 2023 21:31:03 -0800 (PST) Received: from dhcp-10-123-20-35.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s78-20020a632c51000000b00578b8fab907sm5516166pgs.73.2023.11.25.21.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Nov 2023 21:31:03 -0800 (PST) From: Chandrakanth patil To: linux-scsi@vger.kernel.org, sathya.prakash@broadcom.com, sumit.saxena@broadcom.com, ranjan.kumar@broadcom.com, prayas.patel@broadcom.com Cc: Chandrakanth patil , stable@vger.kernel.org Subject: [PATCH 3/4] mpi3mr: Block PEL Enable Command on Controller Reset and Unrecoverable State Date: Sun, 26 Nov 2023 11:01:33 +0530 Message-Id: <20231126053134.10133-4-chandrakanth.patil@broadcom.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231126053134.10133-1-chandrakanth.patil@broadcom.com> References: <20231126053134.10133-1-chandrakanth.patil@broadcom.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If a controller reset is underway or the controller is in an unrecoverable state, the PEL enable management command will be returned as EAGAIN or EFAULT. Cc: # v6.1+ Signed-off-by: Sathya Prakash Signed-off-by: Chandrakanth patil --- drivers/scsi/mpi3mr/mpi3mr_app.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c index 08645a99ad6b..9dacbb8570c9 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_app.c +++ b/drivers/scsi/mpi3mr/mpi3mr_app.c @@ -223,6 +223,22 @@ static long mpi3mr_bsg_pel_enable(struct mpi3mr_ioc *mrioc, return rval; } + if (mrioc->unrecoverable) { + dprint_bsg_err(mrioc, "%s: unrecoverable controller\n", + __func__); + return -EFAULT; + } + + if (mrioc->reset_in_progress) { + dprint_bsg_err(mrioc, "%s: reset in progress\n", __func__); + return -EAGAIN; + } + + if (mrioc->stop_bsgs) { + dprint_bsg_err(mrioc, "%s: bsgs are blocked\n", __func__); + return -EAGAIN; + } + sg_copy_to_buffer(job->request_payload.sg_list, job->request_payload.sg_cnt, &pel_enable, sizeof(pel_enable));