Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2778749yba; Mon, 22 Apr 2019 12:48:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIvDOxqur6vdjWU3WPQLLyHVzqRfqVEKZY4UHTZxolWyiT+bWngNlsawepJD/VoLdZWy2M X-Received: by 2002:a62:e213:: with SMTP id a19mr21835371pfi.85.1555962518946; Mon, 22 Apr 2019 12:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555962518; cv=none; d=google.com; s=arc-20160816; b=yO6VqZSlgLOoGcSASYUbMAU+/QvWb2zijmh0L3AAOOhm49Z3nA7yMEGja6wdDTXQWx mTSQj2SJHAizQpVfIFX9y9z8tmbKNoIv5QKSPHtee11Ou+ylrNe1X15iyiWmrPScgc58 J8ybLrY60Xtr009gD/sbeqJ/3OMKrSuy3kwvfeidL+6PTbZVtN34Qzelp2hS6T/Z1DiH Q7rsx+SXDL9JDmGQBgl/CLAspJgbEU2qXj96cCtQweLl668+65UL/boFmXUoHyYGZRCv mjud6Qv1xOPanwi9j8LoRmiaedNoa4b2er9ykDS7VTCgmQ+L2KMaQHUupabMQTlpCb5T Ipsw== 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=Xal9oTdkDdmIIFEmNsn2SQJlAHbdM0eE11lOD43kfPs=; b=gqPXVt+t1BbOqmxzCRIuDh47OsZ2S57zZ4AmcQmi9VyLEeHLZTxrzQLe7E+HwSwhhA TQchf1KXcwL59Y9qD8eqInXmDRkfrCg9c8u1LQrQmM0jMt7xMKg6JQSbRPU4molibLe4 dLB4wooRPwYagCps7TEjzWKZio/b0LetJmw9X4WgW0ZZ0AMPvPfm9TkFCFkZgbfVxph7 lEjY7JfANKVPrqyoAIyeUKpJbfOFVQ6h9JRyIg2RopRw8bh4M4Ro3t8bdwnhcT+U9Lys 2szuAGXGQtGzDQaZotgH2QpCc7ljp2FfDsZVCn5frPcHORyE1pafXHq1ri0pF1HtOgx4 8shQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=upb+m9Zx; 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 g1si12792556pgq.268.2019.04.22.12.48.23; Mon, 22 Apr 2019 12:48:38 -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=upb+m9Zx; 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 S1730151AbfDVTrD (ORCPT + 99 others); Mon, 22 Apr 2019 15:47:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:49484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730120AbfDVTq5 (ORCPT ); Mon, 22 Apr 2019 15:46:57 -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 85F1E21902; Mon, 22 Apr 2019 19:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962416; bh=t3gCV20ZUlQnVbrpTeGE+GE+GW/w4xR6g03lr6zyncg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=upb+m9ZxcQq/Oz4dpdvutVNrpwfEao9YhkUw/qMpP86btBbXZAcnFq8cXhc8AIntU Jyz5EfS4Y/IJIA8M6sewIpF9jn4tQ9512sFjS9/qT9tjobqQriZ7yj1YwyRlrl+dYL t1o+1ZUSt5Vaa4EAZc9FnAowfGrfAAfgIJbJ8OY4= 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 4.19 50/68] scsi: aacraid: Insure we don't access PCIe space during AER/EEH Date: Mon, 22 Apr 2019 15:44:58 -0400 Message-Id: <20190422194516.11634-50-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-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 39eb415987fc..074760f21014 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -2639,9 +2639,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 3236240a4edd..b7588de4484e 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -673,7 +673,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) { @@ -773,7 +773,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