Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2380492lqp; Sun, 24 Mar 2024 16:51:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlOx4O3QkL0wO3JoWZ5Gcw0JcZHMesjkUUGy4ZIHKGrl1wbqorU22NNwi2aEUgALhxnPPRt8W2yl0X7JhoqUmwIHFBVWjVi/a589S28Q== X-Google-Smtp-Source: AGHT+IHSsWhQ9mRaF9c68iZYLWQ284KUPE2tLX6+2ciP2DN2SIeMOuk6gqY8b9NTTjxo9OepOeUN X-Received: by 2002:a05:6870:5250:b0:229:f4b8:2dcf with SMTP id o16-20020a056870525000b00229f4b82dcfmr6092453oai.44.1711324313672; Sun, 24 Mar 2024 16:51:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324313; cv=pass; d=google.com; s=arc-20160816; b=sQ6HSrpVzBTB9Ty2ibRy819wa6BMwTxVp7fAn6jpm/3ugkwHEaugz7PKMHhr/m2XcB HLsumDVcmkIuRTcwgxveBESO5IkrLQMQqfIzr76s1B6jGRDroY00+NNh67zgFY/eOYxD /b44gxAIgDR0rD8PSYIRm3096+vcL99vJpxXMbRC44EKp9QDY0ugy+hsXCtFTqynupqu +kYi4F0+Uxjwe2xPBaL+i45dsRvXjz1r7T4YIVxMHpmPn1bUg8UjTQhXxAy+G4eMrL6E LMiLoCXX+wCbtsDNNGKpbHtLTjxRG6LNYVCHcnuX2PduLlhZ1nYZJmnZvrExbFDbPXlP vXHw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jyusTVGXcHvm1uKLW+eyrJ65QBNCmCz15/N6NeQVo2E=; fh=5jGsJgaEw6po3N4U8EOpndReOFvAiCcsSXr18UMgLA0=; b=wTKMTWm4RGgEectvd/mr+PNoFcyfuYaKkIA8yxp3a74yLf7rb004/4kZviMVthAf/g TyTPSi4FBEIDAiP6DAQeuE4kWcqZNlhyOqgJziztuQPJ1sBx9G6CWVfmEb6mGsK5RiF6 YabXQIiH0fWQskOR/XMlp7qxJIUHb/wuJTw0Wb4ENvmPiU3pDHrB+qIonvLvx5Y4MW7I 9ejHU3kXFf4TumTgoEccEKHucxnxhKgdNjbq+eL81THN87H56k//kOM0T//KPgsGcQaY kTVare2YQMjYl8QboE+E8TxyPCVxjsxyTYK6LWrCN6ruGWR4VuwuCGbJYbnFnCWT1SS3 L56w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RlKUOExk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b68-20020a62cf47000000b006ea93543065si4080963pfg.283.2024.03.24.16.51.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:51:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RlKUOExk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4BAA0B22385 for ; Sun, 24 Mar 2024 23:38:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2167177AB4; Sun, 24 Mar 2024 22:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RlKUOExk" 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 0A8FA177A93; Sun, 24 Mar 2024 22:39:46 +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=1711319986; cv=none; b=lp7Ms7MbwRWk5W+Vn3P5TYMXbbjGs/b+ijMnhPFLScsHYBveGuGATM3ez+A7WXiaoXpRXZE41oKzvCYb7K79R5uZEzq+HRdDDpjJKH0Xi7+oRwJ5hgySow1VL06PJJmouvAQHSw4ouHh/AInS6iULcq+zkrQMRVRxrbD7ISU7ic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319986; c=relaxed/simple; bh=c5vcWHI1lXaAgL3ymV8nfDcQqZ2uWduNr5eQVUN5HlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n4+S+zMiKdU/tnUgm3G5Sm5cLBXp6qVUoVoetM20uGd6J4lc3dA4Kmw5zBfSqV+/0ZpAB2vNm+YZHnUvOyxC2x/7aIeFfcDMaElXdbr59F/BISOlxlN0U2X17EfEQZr4XK3dy68Q+pvSJ+41HMIkLV7QyhTbQkOHlpyefY5DqRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RlKUOExk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4624C43390; Sun, 24 Mar 2024 22:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319985; bh=c5vcWHI1lXaAgL3ymV8nfDcQqZ2uWduNr5eQVUN5HlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RlKUOExkqtiuejUjLhyqdvLLXKEEgTdFP2OpDExslrTLI5psezsMnJlChP+nnIqh+ tZyUssVdAXzTIWzGE+VtPS+pvO94kwrT1Qhp8KazCB1MXNMj2saM5XUIn5cs9qXwhQ qgzcmBaENF7B0DvmfXHgbwIu/GpBu7iliq4Jvmwl/E77ayLtt0r/sX+bL0t5I7bB9Z o3Dg8WmFEDhvYoAMlf/n1GaRapID2KGKh4m0sbI7R+p8iZGfgV3JhwtKE++LqsK2LR slrHTvAa92/dxTeaPGtmdlCyTpzrgMjXk8BPtZpNDanwwoA7OgNnRBz2KiE1+lA8ve OANwureZH0afw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ethan Zhao , Bjorn Helgaas , Dan Carpenter , Haorong Ye , Lu Baolu , Joerg Roedel , Sasha Levin Subject: [PATCH 6.8 292/715] PCI: Make pci_dev_is_disconnected() helper public for other drivers Date: Sun, 24 Mar 2024 18:27:51 -0400 Message-ID: <20240324223455.1342824-293-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ethan Zhao [ Upstream commit 39714fd73c6b60a8d27bcc5b431afb0828bf4434 ] Make pci_dev_is_disconnected() public so that it can be called from Intel VT-d driver to quickly fix/workaround the surprise removal unplug hang issue for those ATS capable devices on PCIe switch downstream hotplug capable ports. Beside pci_device_is_present() function, this one has no config space space access, so is light enough to optimize the normal pure surprise removal and safe removal flow. Acked-by: Bjorn Helgaas Reviewed-by: Dan Carpenter Tested-by: Haorong Ye Signed-off-by: Ethan Zhao Link: https://lore.kernel.org/r/20240301080727.3529832-2-haifeng.zhao@linux.intel.com Signed-off-by: Lu Baolu Signed-off-by: Joerg Roedel Stable-dep-of: 4fc82cd907ac ("iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected") Signed-off-by: Sasha Levin --- drivers/pci/pci.h | 5 ----- include/linux/pci.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index e9750b1b19bad..bfc56f7bee1c9 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -368,11 +368,6 @@ static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused) return 0; } -static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) -{ - return dev->error_state == pci_channel_io_perm_failure; -} - /* pci_dev priv_flags */ #define PCI_DEV_ADDED 0 #define PCI_DPC_RECOVERED 1 diff --git a/include/linux/pci.h b/include/linux/pci.h index 7ab0d13672daf..213109d3c601d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2517,6 +2517,11 @@ static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev) return NULL; } +static inline bool pci_dev_is_disconnected(const struct pci_dev *dev) +{ + return dev->error_state == pci_channel_io_perm_failure; +} + void pci_request_acs(void); bool pci_acs_enabled(struct pci_dev *pdev, u16 acs_flags); bool pci_acs_path_enabled(struct pci_dev *start, -- 2.43.0