Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2568059lqp; Mon, 25 Mar 2024 02:56:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtstk5q2svDpfJlJYXSm1SPwLeGlWtcKMarvKw5DM2NzeGFHW8YB63Ugr8XPAniQr7hHzRzXxuT3eDaBe0Z5UEjyOgQARiJLlOxu8Ydg== X-Google-Smtp-Source: AGHT+IHI1rOed77whG+dr7lg62vNXIArPztobMSTFcFGgJQcobiA0vAHFUO0BPEzagBJNlMPO4lI X-Received: by 2002:a05:6808:3a4:b0:3c3:cf2b:9347 with SMTP id n4-20020a05680803a400b003c3cf2b9347mr2325394oie.3.1711360609260; Mon, 25 Mar 2024 02:56:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711360609; cv=pass; d=google.com; s=arc-20160816; b=IKCNTrURiMdXsWNbjECxjVXLdg9m9ZPFqEdzeHrm/j7kQCvVf08UdBo5EKhqdfkyiP H6BU33J9PwDTSx6ei0uFSKB+W/NP3RudGB5Mll5NKS9F8Qo5HB/Is6Py1g1FfCrNR2LQ bGyQEfiIzJbOd/ZnGRL3LNDUmSQliWBqqMvf2+u6iXG9rGXA264Y+n+YOtrYVz4SPn4m 0YvYoxcgoF9VQ6AVcES/Zgwwil+wdm2YSIrHIMoyIpyVnWXiSgDNK51tdckMRktBz2pG QSuboDW9pq2KAokS2bUC6e/1R9VJYVrl1SBk79z2ROA6UwV5FeVHcBOJLFcu5NTNmQ6I 5Gbg== 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=cU1cm66B7FOlGAhinaV4c5iLbfexzbxGrGP3dhsNbbM=; fh=5jGsJgaEw6po3N4U8EOpndReOFvAiCcsSXr18UMgLA0=; b=PZfdIkVZRlkQGgiNYZHZmz8LzmrTSHGqKDOSly5E0bSxnpYhEM7MQQ/L9zi01BYYPb ra3b1NsxS5PaKf6DQj7e4FgLCjbKNArREI7cUat/mlXi4/AxIV5sT+sUTywJNg0JsbGU CoECFOEdI8qCdwJo2fc0hYrEtue9jAvf8ESNOzDYWQb/FTCzJgHHswxSIYAF3K+D0QPl N42M73LYO6Z9wPJaCmzVyaxpwLUc3SACD0zoAffvEaJkoKU4sZIQ37jB1wAMbSbOPzea sctEVnH+8LgpmxLJDPLTeOby2wmQ2YDT8w2hRx0gbx0cHqPYmdt3hli7nympEApvbCsV IxIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ot5afAK3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115921-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 9-20020a630209000000b005dcae4c1ff8si7194536pgc.131.2024.03.25.02.56.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 02:56:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115921-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ot5afAK3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115921-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115921-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6E2022A4BD7 for ; Mon, 25 Mar 2024 09:47:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FFF62666BC; Mon, 25 Mar 2024 03:03:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ot5afAK3" 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 8DCBB148FE7; Sun, 24 Mar 2024 23:15:16 +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=1711322116; cv=none; b=t7+fGtfhwY0iyuDCtpJ6VMCTYFZm8nnRS0HphMIFyNcP9zOwGNxCi+nnIcB34JVIy/tUPjMfiGboLaMZPSY/0CRm4DfZ/k7i2hKwhPYbecFXaybXYspiopf1sWaqqkea9EFMI24Bem+gdb8hZf4dPRlmnawpkPX7gsKrF9P3YIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322116; c=relaxed/simple; bh=fX6AZ+UGxnxJZMDeWsDLp4MrCDnpwCiiPlfQdIChI+0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U3/cj0zxeObYLZZA3tWOWHEphz2gneTWz9mErUDoyKrfu8b319AxGdVyBZR8QmK2kXZiHo1PvCmQkYtHCGmQs6hYdrh4vUVxyp2rRQioeeeHNxmWd4CMaecbhBhfiTSJCVYi27BzHEBvJ9BdkCxvG8KixVW4+3YYOsZQGPQXwyM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ot5afAK3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AC06C433F1; Sun, 24 Mar 2024 23:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322116; bh=fX6AZ+UGxnxJZMDeWsDLp4MrCDnpwCiiPlfQdIChI+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ot5afAK3BvbRPMuPd2JwU9n0WQr/I3R1DpQgghZP+OmoGZHaoRYpOyuM3Q+MOeiIi H/1ZulEvXKDGB9CfqMOqDg++gTTWWBYymLGLhGL7UnECvysj1KotTldRcG1fYrwvP5 JKrvHWNMO8e6blzTTvJ7WxUmqjKSmU8c2kJ5cTawo0aYbiMBuVK764m6ExiInyG3T1 72QPJkAaTAFVPqZTIcszZJjgVxa3pcN0RUWlC1XO0VGin+qhLyuwiUJptncUtDRT1H Jj20yTHYoF0GJCMlQ+wqc6j43n28tYRFdKt8jfRjZvnlv/pkuLtjahNrRK+WDOkz/x 1d6GnWCkQw2aA== 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.1 191/451] PCI: Make pci_dev_is_disconnected() helper public for other drivers Date: Sun, 24 Mar 2024 19:07:47 -0400 Message-ID: <20240324231207.1351418-192-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 e1d02b7c60294..9950deeb047a7 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -357,11 +357,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 eccaf1abea79d..f5d89a4b811f1 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2355,6 +2355,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