public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lu Baolu <baolu.lu@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Ethan Zhao <haifeng.zhao@linux.intel.com>,
	Eric Badger <ebadger@purestorage.com>,
	iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 1/8] PCI: Make pci_dev_is_disconnected() helper public for other drivers
Date: Tue,  5 Mar 2024 20:21:14 +0800	[thread overview]
Message-ID: <20240305122121.211482-2-baolu.lu@linux.intel.com> (raw)
In-Reply-To: <20240305122121.211482-1-baolu.lu@linux.intel.com>

From: Ethan Zhao <haifeng.zhao@linux.intel.com>

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 <bhelgaas@google.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Tested-by: Haorong Ye <yehaorong@bytedance.com>
Signed-off-by: Ethan Zhao <haifeng.zhao@linux.intel.com>
Link: https://lore.kernel.org/r/20240301080727.3529832-2-haifeng.zhao@linux.intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
 include/linux/pci.h | 5 +++++
 drivers/pci/pci.h   | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 7ab0d13672da..213109d3c601 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,
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index e9750b1b19ba..bfc56f7bee1c 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
-- 
2.34.1


  reply	other threads:[~2024-03-05 12:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 12:21 [PATCH 0/8] [PULL REQUEST] iommu/vt-d: Fixes for iommu next Lu Baolu
2024-03-05 12:21 ` Lu Baolu [this message]
2024-03-05 12:21 ` [PATCH 2/8] iommu/vt-d: Don't issue ATS Invalidation request when device is disconnected Lu Baolu
2024-03-05 12:21 ` [PATCH 3/8] iommu/vt-d: Improve ITE fault handling if target device isn't present Lu Baolu
2024-03-05 12:21 ` [PATCH 4/8] iommu: Add static iommu_ops->release_domain Lu Baolu
2024-03-05 12:21 ` [PATCH 5/8] iommu/vt-d: Fix NULL domain on device release Lu Baolu
2024-03-05 12:21 ` [PATCH 6/8] iommu/vt-d: Setup scalable mode context entry in probe path Lu Baolu
2024-03-05 12:21 ` [PATCH 7/8] iommu/vt-d: Remove scalable mode context entry setup from attach_dev Lu Baolu
2024-03-05 12:21 ` [PATCH 8/8] iommu/vt-d: Remove scalabe mode in domain_context_clear_one() Lu Baolu
2024-03-06 16:36 ` [PATCH 0/8] [PULL REQUEST] iommu/vt-d: Fixes for iommu next Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240305122121.211482-2-baolu.lu@linux.intel.com \
    --to=baolu.lu@linux.intel.com \
    --cc=ebadger@purestorage.com \
    --cc=haifeng.zhao@linux.intel.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox