From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA89720B0B; Tue, 16 Jan 2024 19:45:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434354; cv=none; b=jVS6az3OeJY4GShrTuyWlDBxyIMECVHwQXaHJVc46qRt+fuIWnULOhy0NDJIrbIjG8bDgx6xXiFaaUfG10uJsAxL7lZrKY4w+74Yx1aiZDWO7Q5VUM13tIWyS0zVztEE4SgawxkCBu9rfRy8rkqYIRYZjCRyGGllU9dP8OA7vyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434354; c=relaxed/simple; bh=2l1/t2huU0cRtfDarNnua2zZSVcUyQHdUjA5wHdluPw=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:X-stable: X-Patchwork-Hint:X-stable-base:Content-Transfer-Encoding; b=S2zp9fd8wS2IKZ1r6otfpAZswPg0Sy7tmx0ySUx6Z03iHuQnvyMZhG1ydbAus+xB+XNbqg8ceN3svg/njxU8lIQRF8TJtstR1xIdLRAqikIJDfqC8xXka6+rtE77ZEcDQLcwR+Zil1qTA4AUPPJ/po5SPs+R7bGCmLHAqo6ZqrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dtYF/fpi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dtYF/fpi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA612C43390; Tue, 16 Jan 2024 19:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705434353; bh=2l1/t2huU0cRtfDarNnua2zZSVcUyQHdUjA5wHdluPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dtYF/fpiDxqWsRHu4+T7M6lNktrxPmACdpDml0oBKUN3Yjz8bJ4SoDk+Hk9SH1cKU VllOrOoX5hz3+l5RacD2PlSuHi2Bzu0lSilZn4JbgwmfHJoi7/vQ9hj+58tTb39ifC veVO0+pmucNM9CCvJ8jJdlMuefqmhBc+mn+AaaSRF/cyUpRwHC0FALEXE1utjKYrEy 8nVd4IrGZnMQJYyt0Pb6VcWMc9hHOKwh4UdUzUgPwCBWsev1vctPUfYCvjH2B2lWmQ uaG7UiAskRroxITLK/dfB8bV1hEe83fC0YmrnsiR65n8nvuhQf0kMRn8UrZ9zGSgxr GMXpEVHi85piQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yihang Li , Xiang Chen , "Martin K . Petersen" , Sasha Levin , jejb@linux.ibm.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 074/108] scsi: hisi_sas: Set .phy_attached before notifing phyup event HISI_PHYE_PHY_UP_PM Date: Tue, 16 Jan 2024 14:39:40 -0500 Message-ID: <20240116194225.250921-74-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116194225.250921-1-sashal@kernel.org> References: <20240116194225.250921-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7 Content-Transfer-Encoding: 8bit From: Yihang Li [ Upstream commit ce26497c745d0541aec930d5211b431a1c26af97 ] Currently in directly attached scenario, the phyup event HISI_PHYE_PHY_UP_PM is notified before .phy_attached is set - this may cause the phyup work hisi_sas_bytes_dmaed() execution failed and the attached device will not be found. To fix it, set .phy_attached before notifing phyup event. Signed-off-by: Yihang Li Signed-off-by: Xiang Chen Link: https://lore.kernel.org/r/1702525516-51258-2-git-send-email-chenxiang66@hisilicon.com Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index d8437a98037b..f3eb5cd52602 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1605,6 +1605,11 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) } phy->port_id = port_id; + spin_lock(&phy->lock); + /* Delete timer and set phy_attached atomically */ + del_timer(&phy->timer); + phy->phy_attached = 1; + spin_unlock(&phy->lock); /* * Call pm_runtime_get_noresume() which pairs with @@ -1618,11 +1623,6 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) res = IRQ_HANDLED; - spin_lock(&phy->lock); - /* Delete timer and set phy_attached atomically */ - del_timer(&phy->timer); - phy->phy_attached = 1; - spin_unlock(&phy->lock); end: if (phy->reset_completion) complete(phy->reset_completion); -- 2.43.0