linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jiaxun Yang" <jiaxun.yang@flygoat.com>
To: "Bjorn Helgaas" <helgaas@kernel.org>,
	"Liu Peibao" <liupeibao@loongson.cn>
Cc: "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>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Huacai Chen" <chenhuacai@loongson.cn>,
	"Jianmin Lv" <lvjianmin@loongson.cn>,
	"Yinbo Zhu" <zhuyinbo@loongson.cn>,
	linux-pci <linux-pci@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V4] PCI: loongson: Skip scanning unavailable child devices
Date: Thu, 10 Nov 2022 23:00:45 +0000	[thread overview]
Message-ID: <e2323333-522c-4127-aaf0-90539fbd0cf4@app.fastmail.com> (raw)
In-Reply-To: <20221110210731.GA672063@bhelgaas>



在2022年11月10日十一月 下午9:07,Bjorn Helgaas写道:
> On Tue, Nov 08, 2022 at 02:42:40PM +0800, Liu Peibao wrote:
>> The PCI Controller of 2k1000 could not mask devices by setting vender ID or
>> device ID in configuration space header as invalid values. When there are
>> pins shareable between the platform device and 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.
>> 
>> Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
>> ---
>> 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
>
> Looks nice and simple, thanks for trying this out.

Should we make this into common PCI code?
I guess Loongson won’t be the last platform having such problem.


>
>>  	/* 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
>>

-- 
- Jiaxun

  reply	other threads:[~2022-11-10 23:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  6:42 [PATCH V4] PCI: loongson: Skip scanning unavailable child devices Liu Peibao
2022-11-10 21:07 ` Bjorn Helgaas
2022-11-10 23:00   ` Jiaxun Yang [this message]
2022-11-10 23:13     ` Bjorn Helgaas
2022-11-11 16:06       ` Jiaxun Yang
2022-11-14  4:03         ` Liu Peibao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2323333-522c-4127-aaf0-90539fbd0cf4@app.fastmail.com \
    --to=jiaxun.yang@flygoat.com \
    --cc=bhelgaas@google.com \
    --cc=chenhuacai@loongson.cn \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=helgaas@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liupeibao@loongson.cn \
    --cc=lpieralisi@kernel.org \
    --cc=lvjianmin@loongson.cn \
    --cc=robh+dt@kernel.org \
    --cc=zhuyinbo@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).