Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: Honor firmware's device disabled status
@ 2023-02-10 16:43 Rob Herring
  2023-02-11  2:39 ` 周彬彬
  2023-02-13 21:28 ` Bjorn Helgaas
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring @ 2023-02-10 16:43 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Liu Peibao, Binbin Zhou, Huacai Chen, linux-pci, linux-kernel

If a device has a firmware node (DT/ACPI), and the device is marked
disabled, that is currently ignored. Add a check for this condition
and bail out creating the pci_dev.

This assumes the config space for the device can still be accessed
because they already have by this point in order to identify the device.

Cc: Liu Peibao <liupeibao@loongson.cn>
Cc: Binbin Zhou <zhoubinbin@loongson.cn>
Cc: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Rob Herring <robh@kernel.org>
---
Please test if this works for Loongson.
---
 drivers/pci/probe.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 1779582fb500..b1d80c1d7a69 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1841,6 +1841,8 @@ int pci_setup_device(struct pci_dev *dev)
 
 	pci_set_of_node(dev);
 	pci_set_acpi_fwnode(dev);
+	if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode))
+		return -ENODEV;
 
 	pci_dev_assign_slot(dev);
 
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: Honor firmware's device disabled status
  2023-02-10 16:43 [PATCH] PCI: Honor firmware's device disabled status Rob Herring
@ 2023-02-11  2:39 ` 周彬彬
  2023-02-13 21:28 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: 周彬彬 @ 2023-02-11  2:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bjorn Helgaas, Liu Peibao, Huacai Chen, linux-pci, linux-kernel




> -----原始邮件-----
> 发件人: "Rob Herring" <robh@kernel.org>
> 发送时间:2023-02-11 00:43:51 (星期六)
> 收件人: "Bjorn Helgaas" <bhelgaas@google.com>
> 抄送: "Liu Peibao" <liupeibao@loongson.cn>, "Binbin Zhou" <zhoubinbin@loongson.cn>, "Huacai Chen" <chenhuacai@loongson.cn>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
> 主题: [PATCH] PCI: Honor firmware's device disabled status
> 
> If a device has a firmware node (DT/ACPI), and the device is marked
> disabled, that is currently ignored. Add a check for this condition
> and bail out creating the pci_dev.
> 
> This assumes the config space for the device can still be accessed
> because they already have by this point in order to identify the device.
> 
> Cc: Liu Peibao <liupeibao@loongson.cn>
> Cc: Binbin Zhou <zhoubinbin@loongson.cn>
> Cc: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Rob Herring <robh@kernel.org>

Tested-by: Binbin Zhou <zhoubinbin@loongson.cn>

> ---
> Please test if this works for Loongson.
> ---
>  drivers/pci/probe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 1779582fb500..b1d80c1d7a69 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1841,6 +1841,8 @@ int pci_setup_device(struct pci_dev *dev)
>  
>  	pci_set_of_node(dev);
>  	pci_set_acpi_fwnode(dev);
> +	if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode))
> +		return -ENODEV;
>  
>  	pci_dev_assign_slot(dev);
>  
> -- 
> 2.39.1


本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。 
This email and its attachments contain confidential information from Loongson Technology , which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this email in error, please notify the sender by phone or email immediately and delete it. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: Honor firmware's device disabled status
  2023-02-10 16:43 [PATCH] PCI: Honor firmware's device disabled status Rob Herring
  2023-02-11  2:39 ` 周彬彬
@ 2023-02-13 21:28 ` Bjorn Helgaas
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2023-02-13 21:28 UTC (permalink / raw)
  To: Rob Herring
  Cc: Bjorn Helgaas, Liu Peibao, Binbin Zhou, Huacai Chen, linux-pci,
	linux-kernel

On Fri, Feb 10, 2023 at 10:43:51AM -0600, Rob Herring wrote:
> If a device has a firmware node (DT/ACPI), and the device is marked
> disabled, that is currently ignored. Add a check for this condition
> and bail out creating the pci_dev.
> 
> This assumes the config space for the device can still be accessed
> because they already have by this point in order to identify the device.
> 
> Cc: Liu Peibao <liupeibao@loongson.cn>
> Cc: Binbin Zhou <zhoubinbin@loongson.cn>
> Cc: Huacai Chen <chenhuacai@loongson.cn>
> Signed-off-by: Rob Herring <robh@kernel.org>

Applied with Binbin's tested-by to pci/enumeration for v6.3, thanks!

> ---
> Please test if this works for Loongson.
> ---
>  drivers/pci/probe.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 1779582fb500..b1d80c1d7a69 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -1841,6 +1841,8 @@ int pci_setup_device(struct pci_dev *dev)
>  
>  	pci_set_of_node(dev);
>  	pci_set_acpi_fwnode(dev);
> +	if (dev->dev.fwnode && !fwnode_device_is_available(dev->dev.fwnode))
> +		return -ENODEV;
>  
>  	pci_dev_assign_slot(dev);
>  
> -- 
> 2.39.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-13 21:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-10 16:43 [PATCH] PCI: Honor firmware's device disabled status Rob Herring
2023-02-11  2:39 ` 周彬彬
2023-02-13 21:28 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox