All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	x86@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	jailhouse-dev@googlegroups.com, linux-pci@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Benedikt Spranger <b.spranger@linutronix.de>
Subject: Re: [PATCH v2 2/6] PCI: Scan all functions when running over Jailhouse
Date: Wed, 28 Feb 2018 11:01:05 +0100	[thread overview]
Message-ID: <8adf7f98-3b05-2a76-48ec-111921219920@siemens.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1802280938380.1886@nanos.tec.linutronix.de>

On 2018-02-28 09:44, Thomas Gleixner wrote:
> On Wed, 28 Feb 2018, Jan Kiszka wrote:
> 
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Per PCIe r4.0, sec 7.5.1.1.9, multi-function devices are required to
>> have a function 0.  Therefore, Linux scans for devices at function 0
>> (devfn 0/8/16/...) and only scans for other functions if function 0
>> has its Multi-Function Device bit set or ARI or SR-IOV indicate
>> there are more functions.
>>
>> The Jailhouse hypervisor may pass individual functions of a
>> multi-function device to a guest without passing function 0, which
>> means a Linux guest won't find them.
>>
>> Change Linux PCI probing so it scans all function numbers when
>> running as a guest over Jailhouse.
> 
>>  void pcibios_scan_specific_bus(int busn)
>>  {
>> +	int stride = jailhouse_paravirt() ? 1 : 8;
>>  	int devfn;
>>  	u32 l;
>>  
>>  	if (pci_find_bus(0, busn))
>>  		return;
>>  
>> -	for (devfn = 0; devfn < 256; devfn += 8) {
>> +	for (devfn = 0; devfn < 256; devfn += stride) {
>>  		if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) &&
>>  		    l != 0x0000 && l != 0xffff) {
>>  			DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l);
> 
> Shouldn't that take the situation into account where the MFD bit is set on
> a regular devfn, i.e. (devfn % 8) == 0? In that case you'd scan the
> subfunctions twice.

Good point, and it also applies to pci_scan_child_bus_extend. Will add
some filters.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  parent reply	other threads:[~2018-02-28 10:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28  6:34 [PATCH v2 0/6] jailhouse: Enhance secondary Jailhouse guest support /wrt PCI Jan Kiszka
2018-02-28  6:34 ` [PATCH v2 1/6] jailhouse: Provide detection for non-x86 systems Jan Kiszka
2018-02-28  6:34 ` Jan Kiszka
2018-02-28  6:34 ` [PATCH v2 2/6] PCI: Scan all functions when running over Jailhouse Jan Kiszka
2018-02-28  6:34 ` Jan Kiszka
2018-02-28  8:44   ` Thomas Gleixner
2018-02-28 10:01     ` Jan Kiszka
2018-02-28 10:01     ` Jan Kiszka [this message]
2018-02-28  8:44   ` Thomas Gleixner
2018-02-28  6:34 ` [PATCH v2 3/6] x86/jailhouse: Enable PCI mmconfig access in inmates Jan Kiszka
2018-02-28  6:34 ` Jan Kiszka
2018-02-28  6:34 ` [PATCH v2 4/6] x86: Consolidate PCI_MMCONFIG configs Jan Kiszka
2018-02-28  6:34 ` Jan Kiszka
2018-02-28 15:45   ` Andy Shevchenko
2018-02-28 15:45   ` Andy Shevchenko
2018-02-28 18:22     ` Bjorn Helgaas
2018-02-28  6:34 ` [PATCH v2 5/6] x86/jailhouse: Allow to use PCI_MMCONFIG without ACPI Jan Kiszka
2018-02-28  6:34 ` Jan Kiszka
2018-02-28  6:34 ` [PATCH v2 6/6] MAINTAINERS: Add entry for Jailhouse Jan Kiszka
2018-02-28  6:34 ` Jan Kiszka

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=8adf7f98-3b05-2a76-48ec-111921219920@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=b.spranger@linutronix.de \
    --cc=bhelgaas@google.com \
    --cc=hpa@zytor.com \
    --cc=jailhouse-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.