Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2994283yba; Mon, 22 Apr 2019 17:24:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJhVCCFF799NeyFd1mav64m+SjhBhSXqPQdqyqftGw0BOVfYYuCCcFMQI/mkA1ReaILdqI X-Received: by 2002:a65:6205:: with SMTP id d5mr21891194pgv.61.1555979040150; Mon, 22 Apr 2019 17:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555979040; cv=none; d=google.com; s=arc-20160816; b=AsKKn0Znca3dsg73qHNZso3k0SIJ4bO//pWCfbbRCLKO3ragv+DdX14yFvzRk4rQah ZNYmATRSTun1UtsyplTle49ybbzn7VsB0mVmDHUZvfBdgzmP8QNr/XsDN5IzI04KcITd ZGGKAm411Cpa203WOgioP1zROJW1LO/GPTmtca3fJS1KdRCwyru23XspqmWrVLdWyigK 6oReQBdTVsoP3SHLoedEpUywz3/T/ZR5GD1g4MSYrSgw6Kw+0lGDz7UpEivikuGbRREV lsB95ooGlil8DcKTPCHonOr9dwFXL6D28oXH7wCVVmphxP2gWqv64xDOQwYEbX+cB8MQ ntKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=obbyQgPOG212f+WtGMii/BGIgHCi0qAPQkzSzItspFw=; b=Q15UI+4WZkVaUbxCxOgTphbqwrcqPULTAzF9c7DxTIBcb2yg4OtFay1gFVHimIBavt M0bfhvcKwc7hGRv30W+Zj464SvWUWmvi45C0Pu9iyfzXUYpyxkGDZKskf8Pv+KaoMlQ5 G8NOHgxlZn+NLZ7Q10+10TRyIBEIsoU+dHW/0z5zQp7vJ3Hs8OVGUB9utCHJn8+ULkDr qaFlizc+QhsrFQvblBbCtNSoLIIVIUQIKWKpa6R1GlWMw+toHWs1KrDVVLgWBrLfv7k3 wxZx0xwf9yUPtjaZnGnFWdPEsmgyYklhREOcgWzOKeu/e1mCcErWKpNLtO/DAIdusANJ us2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uWAdDcOx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p61si14857448plb.428.2019.04.22.17.23.44; Mon, 22 Apr 2019 17:24:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uWAdDcOx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732399AbfDVUHg (ORCPT + 99 others); Mon, 22 Apr 2019 16:07:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:45048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728867AbfDVToI (ORCPT ); Mon, 22 Apr 2019 15:44:08 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 34551218EA; Mon, 22 Apr 2019 19:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962247; bh=5uEX26ZE7WH+wFv4Nv9saiO0kt6YeJU1atH9WFLnGsc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uWAdDcOxNTNaVNH26K8wGXEsVai9sEHAtyzEhBh40htMo5MGZ8+56ewCyNjPxUiTj zaSkQk5ikgxj+x12yGab33jjRZM0p1fx9Yhc3DcpGWUOx9VghqjiVHhqTwk63keGFn r/zGm9cCREzmciyh9RBmAANCksMsOpHk8wbFLlLs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dave Carroll , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 63/98] scsi: aacraid: Insure we don't access PCIe space during AER/EEH Date: Mon, 22 Apr 2019 15:41:30 -0400 Message-Id: <20190422194205.10404-63-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Carroll [ Upstream commit b6554cfe09e1f610aed7d57164ab7760be57acd9 ] There are a few windows during AER/EEH when we can access PCIe I/O mapped registers. This will harden the access to insure we do not allow PCIe access during errors Signed-off-by: Dave Carroll Reviewed-by: Sagar Biradar Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin (Microsoft) --- drivers/scsi/aacraid/aacraid.h | 7 ++++++- drivers/scsi/aacraid/commsup.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 3291d1c16864..8bd09b96ea18 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2640,9 +2640,14 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor) return capacity; } +static inline int aac_pci_offline(struct aac_dev *dev) +{ + return pci_channel_offline(dev->pdev) || dev->handle_pci_error; +} + static inline int aac_adapter_check_health(struct aac_dev *dev) { - if (unlikely(pci_channel_offline(dev->pdev))) + if (unlikely(aac_pci_offline(dev))) return -1; return (dev)->a_ops.adapter_check_health(dev); diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index a3adc954f40f..09367b8a3885 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -672,7 +672,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size, return -ETIMEDOUT; } - if (unlikely(pci_channel_offline(dev->pdev))) + if (unlikely(aac_pci_offline(dev))) return -EFAULT; if ((blink = aac_adapter_check_health(dev)) > 0) { @@ -772,7 +772,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, spin_unlock_irqrestore(&fibptr->event_lock, flags); - if (unlikely(pci_channel_offline(dev->pdev))) + if (unlikely(aac_pci_offline(dev))) return -EFAULT; fibptr->flags |= FIB_CONTEXT_FLAG_WAIT; -- 2.19.1