Message ID | 20240129034924.817005-2-haifeng.zhao@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-42141-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp445474dyb; Mon, 29 Jan 2024 01:15:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFd2uqbpZt7n2/8F+1xuTKjojOnCPmm5J+D5dH6zcyt+TxtgFsYGSLRgRZjoahqr35VLCK9 X-Received: by 2002:a05:622a:101:b0:42a:4e08:8367 with SMTP id u1-20020a05622a010100b0042a4e088367mr5695644qtw.49.1706519709276; Mon, 29 Jan 2024 01:15:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706519709; cv=pass; d=google.com; s=arc-20160816; b=wkr51f5uFx/I/gQuT2MRmOZDdQZUAeqVvkk+HAkkxQmjIBh0vCbUE6NtABqA5KeKuP Dm94qG7V3XbY3EPoMIpvCrRZto/FpAP8mSDjQfl4fD6gVW7dSX4j7lA4IF6P2MhW2+bN KWE6PsHNBLj44J3NMagabNsogd9qvxXK3bEXEfcAWGY+t8uBrShvdjPCv/6wPC+YJnW7 99u1mE+6bFDJhQdddE7aYQOK4mcplXXDfxyqZfIQS3Ocix6Dfj4M9hl0mrgnt+deb5++ AyPRGHzCp5AcMq4DYaTS9MXHHmuei5kB8bmroFklFXilsed+ZeV4kwJpWMeyUBhpqtKp 7naw== 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=O6bbo7onAbs116pEZ/+qAXhovL9Sh1xKhmPONjyaMbM=; fh=JEThTfG+ZTt+DBlApihnVPN9UmE/ctZ0fI2V3ICmK2U=; b=NuC+MQAQISIz8qW1ly6lHwZ087qX2WnnpbtVpL+nQNUY7dWZ+D76WuSvZ3AVgMpFvm weh6r6LxXETSDoNnkb/0pDaHbUQ6F97QjEd40a8EcGxJGgEtAHRJuWXSIdbMVnrc7QnT 2a6mn3bY4wyNcuwvk29QtzHTmdqxPLXD3wpqIei8e2sAUEarkazLhfA0b7hcjtjdLgkF UDFpsTfMnpl8FtohTaHi9eyI6VomTqqYmLzvB0ZUy3sbFQNzNAhPi5lorV91QDbmwnpP y0pyE55jJhPehlpv7R2hjEd/8Onx4oyxv6ERcoLbed2LUFeYsiTzr7fK99wu+F2ZlfFH EyFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YkSWDpE9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-42141-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42141-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g22-20020ac85816000000b0042a9def3b7fsi2637570qtg.162.2024.01.29.01.15.09 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 01:15:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42141-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YkSWDpE9; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-42141-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42141-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id ACFC51C2283F for <ouuuleilei@gmail.com>; Mon, 29 Jan 2024 03:50:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C675C1DDD6; Mon, 29 Jan 2024 03:49:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YkSWDpE9" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) (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 3B01A12E5B; Mon, 29 Jan 2024 03:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706500179; cv=none; b=GFmAJEugr/Y4+HVtIDKtIaNV2YybXBJ+epojPOaAnEtH4DABSoGO5Ir07g+qlkO4xfjy9fRjesDa0hAtHON70ak5mghikCnvpbZDW/mM3xtmNymWzKan7yumP4uIwUC5KIOyuWWIr34GfgpuMYgpF0FE6lraOv6Xkdj8CEUQGXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706500179; c=relaxed/simple; bh=dEKy3mt/WPL6E30nghtcx9sbGmG9T5AiLwENf8K/kU4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=P1ad4bZ35DRyD2T0EmX/9PqhaaULnHPEgHnEv4BGJFXtyRsBdhQbd5fMdYRFO2rY24MPGszQEXDkBuMSbKUajjwVhK3sanbg7CytiS/hfX1DKuBtkr0XeVaGQQdoXCj9hj9tyRl8+1md2pPPn5aV+luFeKKXHAAylBJQo1Mhupw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YkSWDpE9; arc=none smtp.client-ip=134.134.136.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706500177; x=1738036177; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dEKy3mt/WPL6E30nghtcx9sbGmG9T5AiLwENf8K/kU4=; b=YkSWDpE9tyBGA5FfOKWzW1b5QzoNiyQOT66lNbAaAGItk52EOsOtc27a AMxDWBdsEq4/Lp0JFqv0buZioATFtDNWmSR4BSD3t3C2eYZyOx+rJP8UW UGuuzSTbHo9AO+aUbltn0K3N9c30awnkN+14SLE7qn9r+It68OCtwxP5T 51qmF8y0gy11xSXH/d+C8NXKclzY+l1OKb/griBzWcdIHp3AF1pEssiIM a0SUwSIV25B4HTw20S9K+s6FFuP0S4nVi/0IcJHBBAG1GOK5mlDNWBfMN MONTfTWebBaTd0NY4KI3LP8AwZ03NSDMR9oYxmNLGjLeTHH9tuDm4nDZf g==; X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="406566895" X-IronPort-AV: E=Sophos;i="6.05,226,1701158400"; d="scan'208";a="406566895" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2024 19:49:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10967"; a="960775187" X-IronPort-AV: E=Sophos;i="6.05,226,1701158400"; d="scan'208";a="960775187" Received: from unknown (HELO ply01-vm-store.amr.corp.intel.com) ([10.238.153.201]) by orsmga005.jf.intel.com with ESMTP; 28 Jan 2024 19:49:32 -0800 From: Ethan Zhao <haifeng.zhao@linux.intel.com> To: baolu.lu@linux.intel.com, bhelgaas@google.com, robin.murphy@arm.com, jgg@ziepe.ca Cc: kevin.tian@intel.com, dwmw2@infradead.org, will@kernel.org, lukas@wunner.de, yi.l.liu@intel.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Ethan Zhao <haifeng.zhao@linux.intel.com>, Haorong Ye <yehaorong@bytedance.com> Subject: [PATCH v12 1/5] PCI: make pci_dev_is_disconnected() helper public for other drivers Date: Sun, 28 Jan 2024 22:49:20 -0500 Message-Id: <20240129034924.817005-2-haifeng.zhao@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240129034924.817005-1-haifeng.zhao@linux.intel.com> References: <20240129034924.817005-1-haifeng.zhao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789414089800720542 X-GMAIL-MSGID: 1789415610893245031 |
Series |
[v12,1/5] PCI: make pci_dev_is_disconnected() helper public for other drivers
|
|
Commit Message
Ethan Zhao
Jan. 29, 2024, 3:49 a.m. UTC
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. Tested-by: Haorong Ye <yehaorong@bytedance.com> Signed-off-by: Ethan Zhao <haifeng.zhao@linux.intel.com> --- drivers/pci/pci.h | 5 ----- include/linux/pci.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
Comments
On 1/29/2024 4:50 PM, Tian, Kevin wrote: >> From: Ethan Zhao <haifeng.zhao@linux.intel.com> >> Sent: Monday, January 29, 2024 11:49 AM >> >> 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 > s/Beside/Unlike/ Beside means 'comparing with' here, perhaps it is not clear enough or there is syntax error if used here ? Thanks, Ethan > >> space access, so is light enough to optimize the normal pure surprise >> removal and safe removal flow. > somehow this paragraph belongs to the patch using it. The 1st paragraph > is sufficient for the reason of exposure.
On 1/29/2024 4:50 PM, Tian, Kevin wrote: >> From: Ethan Zhao <haifeng.zhao@linux.intel.com> >> Sent: Monday, January 29, 2024 11:49 AM >> >> 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 > s/Beside/Unlike/ > >> space access, so is light enough to optimize the normal pure surprise >> removal and safe removal flow. > somehow this paragraph belongs to the patch using it. The 1st paragraph > is sufficient for the reason of exposure. pci_device_is_present() is aleardy exported symbol, why not just use it ? Also try to make it clear, the difference and justification. Thanks, Ethan
> From: Ethan Zhao <haifeng.zhao@linux.intel.com> > Sent: Tuesday, January 30, 2024 1:26 PM > > On 1/29/2024 4:50 PM, Tian, Kevin wrote: > >> From: Ethan Zhao <haifeng.zhao@linux.intel.com> > >> Sent: Monday, January 29, 2024 11:49 AM > >> > >> 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 > > s/Beside/Unlike/ > > > >> space access, so is light enough to optimize the normal pure surprise > >> removal and safe removal flow. > > somehow this paragraph belongs to the patch using it. The 1st paragraph > > is sufficient for the reason of exposure. > > pci_device_is_present() is aleardy exported symbol, why not just use it ? > > Also try to make it clear, the difference and justification. > I misread it.
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 2336a8d1edab..94118c4cff54 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 add9368e6314..19dfe5f16fc9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2512,6 +2512,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,