lkml.org 
[lkml]   [2022]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V5] PCI: loongson: Skip scanning unavailable child devices
Hi, Peibao,


> -----原始邮件-----
> 发件人: "Liu Peibao" <liupeibao@loongson.cn>
> 发送时间:2022-11-14 15:43:46 (星期一)
> 收件人: "Bjorn Helgaas" <bhelgaas@google.com>, "Rob Herring" <robh+dt@kernel.org>, "Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>, "Lorenzo Pieralisi" <lpieralisi@kernel.org>, "Krzysztof Wilczyński" <kw@linux.com>, "Jiaxun Yang" <jiaxun.yang@flygoat.com>, "Christophe JAILLET" <christophe.jaillet@wanadoo.fr>
> 抄送: "Huacai Chen" <chenhuacai@loongson.cn>, "Jianmin Lv" <lvjianmin@loongson.cn>, "Yinbo Zhu" <zhuyinbo@loongson.cn>, wanghongliang <wanghongliang@loongson.cn>, "Liu Peibao" <liupeibao@loongson.cn>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
> 主题: [PATCH V5] PCI: loongson: Skip scanning unavailable child devices
>
> The PCI Controller of 2K1000 could not mask devices by setting vender ID or
I think this patch is needed by both LS2K500 and LS2K1000, so replace 2K1000 with "LS2K" or "Loongson-2K" or "LS2K500/LS2K1000" maybe better. If new version is needed, please change this, thanks.

Huacai

> device ID in configuration space header as invalid values. When there are
> pins shareable between the platform device and the on chip PCI device, if
> the platform device is preferred, we should not scan this PCI device. In
> the above scene, add `status = "disabled"` property in DT node of this PCI
> device.
>
> Before this patch, to solve the above problem, we treat the on chip PCI
> devices as platform devices with fixed address assigned by the BIOS. When
> there is device not preferred, add the `status = "disabled"` property in DT
> node. In kernel, the PCI host bridge only scans slot 9/A/B/C/D/E that are
> bridges. Overall, this looks not much elegant.
>
> Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
> ---
> V4 -> V5: make the issue we are facing clear in commit log.
> V3 -> V4: 1. get rid of the masklist and search the status property
> directly.
> 2. check the status property only when accessing the vendor ID.
> V2 -> V3: 1. use list_for_each_entry() for more clearly.
> 2. fix wrong use of sizeof().
> V1 -> V2: use existing property "status" instead of adding new property.
>
> drivers/pci/controller/pci-loongson.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controller/pci-loongson.c
> index 05c50408f13b..efca0b3b5a29 100644
> --- a/drivers/pci/controller/pci-loongson.c
> +++ b/drivers/pci/controller/pci-loongson.c
> @@ -194,6 +194,17 @@ static void __iomem *pci_loongson_map_bus(struct pci_bus *bus,
> return NULL;
> }
>
> +#ifdef CONFIG_OF
> + /* Don't access disabled devices. */
> + if (pci_is_root_bus(bus) && where == PCI_VENDOR_ID) {
> + struct device_node *dn;
> +
> + dn = of_pci_find_child_device(bus->dev.of_node, devfn);
> + if (dn && !of_device_is_available(dn))
> + return NULL;
> + }
> +#endif
> +
> /* CFG0 can only access standard space */
> if (where < PCI_CFG_SPACE_SIZE && priv->cfg0_base)
> return cfg0_map(priv, bus, devfn, where);
> --
> 2.20.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.
\
 
 \ /
  Last update: 2022-11-14 09:17    [W:0.088 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site