Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp189739lqc; Thu, 29 Feb 2024 14:27:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWk4IkFOoMKsHun0E23upqNIFntQyGvJTzeJ3EMKX8wx+RtYsqNSXuqYhsscpffiJCoIQLd7va7GnjKvqEtH3fnAVt56gFCTw3psoJXCA== X-Google-Smtp-Source: AGHT+IHiB/PgMtbZr0xE9RlVNKHEi8zLYJ+HmkPGPQa+Tu0xu89PTYL4sZxi0oDfGJMTpzBAxLQ3 X-Received: by 2002:a17:902:db0e:b0:1dc:524:6da4 with SMTP id m14-20020a170902db0e00b001dc05246da4mr3885511plx.8.1709245620984; Thu, 29 Feb 2024 14:27:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709245620; cv=pass; d=google.com; s=arc-20160816; b=rLa6EoRQyuEZWLIyrMQuZDdBdoTWfH1d26n92rhHBMD5zBo2haAm71lDMwSKboNP1D D95fmAMRjvWKLPJS9bBMEmVxznMWicM41Ewr7kiqt3OR/NB5BDJtxhjjA2ocWK5r/Avl gzzeoVy7Wdry+A8LPpw4aPok8jaBcWv/itHGv3DpqbNEVzDqu8EuHIh++AM7qyez8mUC hqmDsKK8Wdhqj2sT2UxyPnXp8NQRBSJpHvPYNJ9bg7p9d6VD8jS9U7HCo84katby6fBA PpRp8Tea3qy8TUdm5mIHU7QffocNHvjlrqOt+CN/00RlQzbXluEeWCG4KfWk1jjmDsgQ wnog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=NMxz8PjD9LDSsCzh5p7+onCwuc7FZ3qRH9f0IRwS7UI=; fh=pAoIX0vk9K6lyXEUb/3yORoTya93tEdqFngnNZqSXPc=; b=YcYokNxo3FZWi/kzMk6NpF9b01+YCQKqZmKkoRrjaLMqhDoR/acEBQMvwYwHY+NLBV lepIOhQoqg+CRDPeTF0OgkQNHecUjVNLodjB1dbHmhAHLGdlZgCcuBK/qU7tgxNUUlHI 4wLSp70QDIU/wULp9lcWMZkJHrMounYQiGS0hDyIVJgcaOMijnHtZZg8rfofe4b+4gdQ iH9rXYsNLMXDa7kiFBDBsrxpMEpZVtl9pUNlGV9iBzerK+xZklL/WyDvP+S20I22Lr+F WnSj3sLwmfGCYCVWo73Pr+l6QuTbp9udcMBoNFJV4Y2NsgBOLnmm/XNUL+xeK2RSOUP1 QMzw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="nbB6/SOP"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87642-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87642-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 u23-20020a1709026e1700b001dc4aa1df33si2027645plk.635.2024.02.29.14.27.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 14:27:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87642-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="nbB6/SOP"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87642-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87642-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 A6749284A17 for ; Thu, 29 Feb 2024 22:27:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8ED4F74C0E; Thu, 29 Feb 2024 22:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nbB6/SOP" 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 A8CEB74BFB; Thu, 29 Feb 2024 22:26:45 +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=1709245606; cv=none; b=Sy7YFdL1ymDgZUE/KeH+GcZ0MYkGlsxioNXL5NV+Gx7HhpQL1RAnYG8InTHt4KbzOPA5MIc74SAUtZMsWs8yAoqXR4TQGY66AAe4r75PCHhTLAuOWczMvGBzbAPSejXE6Csg6m8elirjXOBmcgQOsuzvUsNL0OraVH2B+E751P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709245606; c=relaxed/simple; bh=1tNC4l313xd0L6tRSMFRxmtHbYEFy9bxXy8SJFsh0UE=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=rzkzI0tpeczAzEP+Dp0CCWUbN2htGpp/1QNQrCQ4LdkORwgiQmASSwcIt5q0MBQJKdDLKOp/EvI/2+mbDCHOOsGmIGanHk9T3uVXvaEJym7onjihluk38mt2NL4CtPEIKEJ7/axBb5TiiTwkZbUdPQRkJ0HaAGhOzJ+u3RP8dAo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nbB6/SOP; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93635C433C7; Thu, 29 Feb 2024 22:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709245605; bh=1tNC4l313xd0L6tRSMFRxmtHbYEFy9bxXy8SJFsh0UE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=nbB6/SOPGuSR5Uq8/jDpZtP+7ohJ5qqrgyC6xIoRbV29VxsnGlS7mV5pJHWnIx2im 2fCrmtwL82I5S9EKjlSjFlbvtbq5FdA0RwEqjz5otqAvgoCCdrQlEzh1jSmcmcRYIp oRQ+VPljuLi/syNiImnsJjVzs/mxdAtLo/CbVZ9nAOroMrMqudhcVHiwOwTfhPfWdq phQZMNX6+GDIbeAI1o7Bg/NqJO/lZsDxWopkNr82qAYtG+FGWPVwXIvWionzR7mRSs 5a6giZubMilwUnukErXOYsKV940sLWiIvSsJPtChTiV73YjZKPnDn4kjxC9PgzCrQY ZtpxVuAiegJRQ== Date: Thu, 29 Feb 2024 16:26:44 -0600 From: Bjorn Helgaas To: Ethan Zhao Cc: baolu.lu@linux.intel.com, bhelgaas@google.com, robin.murphy@arm.com, jgg@ziepe.ca, kevin.tian@intel.com, dwmw2@infradead.org, will@kernel.org, lukas@wunner.de, yi.l.liu@intel.com, dan.carpenter@linaro.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Haorong Ye Subject: Re: [PATCH v13 1/3] PCI: make pci_dev_is_disconnected() helper public for other drivers Message-ID: <20240229222644.GA367986@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240222090251.2849702-2-haifeng.zhao@linux.intel.com> On Thu, Feb 22, 2024 at 04:02:49AM -0500, Ethan Zhao wrote: > 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 > Signed-off-by: Ethan Zhao Acked-by: Bjorn Helgaas > --- > 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 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 > 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, > -- > 2.31.1 >