Message ID | 20230210164351.2687475-1-robh@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1062058wrn; Fri, 10 Feb 2023 08:56:16 -0800 (PST) X-Google-Smtp-Source: AK7set9IHHStT8oFJOj+IIBvzfVFKjQxKsv6MOby4fBTSMqNkaq095lfTUEsyyZMbbm0XQ+yWNca X-Received: by 2002:a17:907:2149:b0:8af:2ab2:1f99 with SMTP id rk9-20020a170907214900b008af2ab21f99mr8387856ejb.26.1676048176147; Fri, 10 Feb 2023 08:56:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676048176; cv=none; d=google.com; s=arc-20160816; b=k3g2ZNKJKLa5RQKGma08M38PDsx9motOZ0Jx/e/BNJX6vv/zgfRxzKrKC6Rm5+dkg3 SY91+8F48NgEk4lMYFPEaDsXvOSbJFM8R0eDC4MMFR6z8WOFFiF2dAx9+qAMOHVrDju7 DvsHSXpEXXIhj3eFWuD95TowO/GMRTf3vim8ChEJiXxEutmyVEGMTXvO8Rc+k/5s4Qi1 bnG7NmmPWeptwILrdUcQTr/ZP9l1j1TCYkC0Ptq4jUdKvILaoFwsdTuxZeW+fMdwq7N/ XNpwsTiHWPu6lPvQOjNX3jq4VrAkMtbObJWp3Qw9RaBTkkfvKqwfiLP+wa0i4ZfSrghC 6QQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=H1p0XOr+4ghGyvYRD6ntCMDoZebCtt1fvqKIgO3rBgI=; b=T5gn63m0JIGGaGiyjnUETO8UZ0E2JfvvfceULoBxo7Wo57wAnANEJbKhWAVIwcHOx+ f4os9/+pBpcJvRb23nUi1D/Vz+q219fjVJtbE91RnKHP2A47TJiWdSO9X0/KI/Vch1Jy D/dz9NaJ5U4YQzloktRfNt7OYOxApOqFdEFMZ3wNyQdzo/wzQTH2v8GRNYvbKiJy6NcD JITwI2ETlq96ZsDX2xcaCk20NBd9QlFC2rm59sjjcb5CrvVMRMQOa7jbaNq5HiL29yGb ytewQfkqaIza/BwFFujso63F65XgeI0YEG7YENn4aMDQNqotTc+kLDxOYqwe8RL/09CZ rIhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id uh29-20020a170906b39d00b008af39395a6esi5743327ejc.942.2023.02.10.08.55.53; Fri, 10 Feb 2023 08:56:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232579AbjBJQoS (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Fri, 10 Feb 2023 11:44:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbjBJQoR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Feb 2023 11:44:17 -0500 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754AE212A9; Fri, 10 Feb 2023 08:44:16 -0800 (PST) Received: by mail-ot1-f45.google.com with SMTP id p24-20020a056830131800b0068d4b30536aso1687563otq.9; Fri, 10 Feb 2023 08:44:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=H1p0XOr+4ghGyvYRD6ntCMDoZebCtt1fvqKIgO3rBgI=; b=o1YwOMP3FYQ317ssGGMJ0vf2/7+FMyh61bushlhROaGckuJW/TZWjHYbU5DDVoiL7s kODrsRli1XiPXpj/YAykJg5PP1f1m+LvyV/ESV25UQrAPHCQpfhqzwVflEkQyzCoZc4u UNsTQ0H2VKKlEPTp0AXFmDTLoETvo89IVbNZ7xgbHL9ubtWEceuQf5xnvfsZ89/dnA0y cS0V6A0+R0aY4FzWDkkx0/ZYleQ82XLjGp2WqDy7YoJNeEqFlNkygkbIhh2Io6s4aSI/ +mTVJ/jYKTKGYs1ieSquLsQH3tllYdCwenGOW6gy3MIBl80AkqQmM1IpoW0faPZ+HpRF E1Tw== X-Gm-Message-State: AO0yUKXuc1h2hEEw7NlwUEIifg7UdHGUV/milKOjpCJFzKTlih4GVaI+ K7ikH80+knWrLPtPZ6nLrH/p12nWkw== X-Received: by 2002:a9d:2c5:0:b0:685:e5d3:63c5 with SMTP id 63-20020a9d02c5000000b00685e5d363c5mr9458814otl.12.1676047455679; Fri, 10 Feb 2023 08:44:15 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id n14-20020a9d64ce000000b0066b9a6bf3bcsm2156896otl.12.2023.02.10.08.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 08:44:15 -0800 (PST) Received: (nullmailer pid 2687907 invoked by uid 1000); Fri, 10 Feb 2023 16:44:14 -0000 From: Rob Herring <robh@kernel.org> To: Bjorn Helgaas <bhelgaas@google.com> Cc: 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 Subject: [PATCH] PCI: Honor firmware's device disabled status Date: Fri, 10 Feb 2023 10:43:51 -0600 Message-Id: <20230210164351.2687475-1-robh@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757463892760302035?= X-GMAIL-MSGID: =?utf-8?q?1757463892760302035?= |
Series |
PCI: Honor firmware's device disabled status
|
|
Commit Message
Rob Herring
Feb. 10, 2023, 4:43 p.m. UTC
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(+)
Comments
> -----原始邮件----- > 发件人: "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.
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 >
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);