Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Tue, Sep 22, 2015 at 01:17:03PM -0700, Ed Swierk wrote: > RFC. Tested with 3.14.51 and Xen 4.5.1. I'll make a proper patch against a > more current kernel if we decide this is heading in the right direction. CC-ing David as well > > > xen/mcfg: Notify Xen of PCI MMCONFIG area before

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Ed Swierk
On Tue, Sep 22, 2015 at 5:35 AM, Ed Swierk wrote: > So if the contract is that Dom0 tells Xen about mmcfgs before the > devices they cover, then Linux ought to call pci_mmcfg_reserved from > (or immediately after) both pci_mmcfg_early_init() and >

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Tue, Sep 22, 2015 at 06:26:11AM -0700, Ed Swierk wrote: > On Tue, Sep 22, 2015 at 5:35 AM, Ed Swierk wrote: > > So if the contract is that Dom0 tells Xen about mmcfgs before the > > devices they cover, then Linux ought to call pci_mmcfg_reserved from > > (or

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 15:26, wrote: > On Tue, Sep 22, 2015 at 5:35 AM, Ed Swierk wrote: >> So if the contract is that Dom0 tells Xen about mmcfgs before the >> devices they cover, then Linux ought to call pci_mmcfg_reserved from >> (or

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Mon, Sep 21, 2015 at 11:23:03PM -0600, Jan Beulich wrote: > >>> Konrad Rzeszutek Wilk 09/21/15 8:06 PM >>> > >- Never figured out how much data we should save in the Xen's > >struct pci_device to see if we are 'stale'. Looking back I think > >we just need to do the

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 15:39, wrote: > On Tue, Sep 22, 2015 at 06:26:11AM -0700, Ed Swierk wrote: >> Any other ideas? > > I like it - as it will update it right away. However we would need some > extra smarts in Xen to reconfigure its view of the PCI device now that the >

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 16:33, wrote: > On Tue, Sep 22, 2015 at 08:12:56AM -0600, Jan Beulich wrote: >> >>> On 22.09.15 at 16:09, wrote: >> > On Tue, Sep 22, 2015 at 07:57:29AM -0600, Jan Beulich wrote: >> >> >>> On 22.09.15 at 15:36,

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 16:37, wrote: > On Tue, Sep 22, 2015 at 08:11:41AM -0600, Jan Beulich wrote: >> >>> On 22.09.15 at 16:03, wrote: >> > On Tue, Sep 22, 2015 at 07:52:19AM -0600, Jan Beulich wrote: >> >> >>> On 22.09.15 at 15:39,

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 15:36, wrote: > The best I could come up with is to do two loops: > 1) for 0:0:0 -> ff:ff:ff call PHYSDEVOP_pci_device_remove > (so blow away what Xen has for its PCI devices.. except for the AMD > IOMMU) > 2) list_for_each_pci_device

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 16:09, wrote: > On Tue, Sep 22, 2015 at 07:57:29AM -0600, Jan Beulich wrote: >> >>> On 22.09.15 at 15:36, wrote: >> > The best I could come up with is to do two loops: >> > 1) for 0:0:0 -> ff:ff:ff call

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 16:03, wrote: > On Tue, Sep 22, 2015 at 07:52:19AM -0600, Jan Beulich wrote: >> >>> On 22.09.15 at 15:39, wrote: >> > On Tue, Sep 22, 2015 at 06:26:11AM -0700, Ed Swierk wrote: >> >> Any other ideas? >> > >> > I like it - as it

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Ed Swierk
On Mon, Sep 21, 2015 at 10:21 PM, Jan Beulich wrote: > I don't follow: Surely Dom0 first establishes MCFG areas to be used, and > only then scans the buses for devices, resulting in them to be reported to > the hypervisor? That seems like a reasonable expectation, but while

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Jan Beulich
>>> On 22.09.15 at 14:35, wrote: > On Mon, Sep 21, 2015 at 10:21 PM, Jan Beulich wrote: >> I don't follow: Surely Dom0 first establishes MCFG areas to be used, and >> only then scans the buses for devices, resulting in them to be reported to >> the

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Tue, Sep 22, 2015 at 07:52:19AM -0600, Jan Beulich wrote: > >>> On 22.09.15 at 15:39, wrote: > > On Tue, Sep 22, 2015 at 06:26:11AM -0700, Ed Swierk wrote: > >> Any other ideas? > > > > I like it - as it will update it right away. However we would need some > > extra

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Tue, Sep 22, 2015 at 07:57:29AM -0600, Jan Beulich wrote: > >>> On 22.09.15 at 15:36, wrote: > > The best I could come up with is to do two loops: > > 1) for 0:0:0 -> ff:ff:ff call PHYSDEVOP_pci_device_remove > > (so blow away what Xen has for its PCI devices..

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Tue, Sep 22, 2015 at 08:12:56AM -0600, Jan Beulich wrote: > >>> On 22.09.15 at 16:09, wrote: > > On Tue, Sep 22, 2015 at 07:57:29AM -0600, Jan Beulich wrote: > >> >>> On 22.09.15 at 15:36, wrote: > >> > The best I could come up with is to do two

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-22 Thread Konrad Rzeszutek Wilk
On Tue, Sep 22, 2015 at 08:11:41AM -0600, Jan Beulich wrote: > >>> On 22.09.15 at 16:03, wrote: > > On Tue, Sep 22, 2015 at 07:52:19AM -0600, Jan Beulich wrote: > >> >>> On 22.09.15 at 15:39, wrote: > >> > On Tue, Sep 22, 2015 at 06:26:11AM -0700,

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-21 Thread Jan Beulich
>>> Ed Swierk 09/21/15 6:01 PM >>> >The fundamental problem is that Xen tries to access extended config >space in pci_add_device(), before the Dom0 finally figures out where >MMCONFIG area is and makes the pci_mmcfg_reserved hypercall. The only >robust solution seems

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-21 Thread Jan Beulich
>>> Konrad Rzeszutek Wilk 09/21/15 8:06 PM >>> >- Never figured out how much data we should save in the Xen's >struct pci_device to see if we are 'stale'. Looking back I think >we just need to do the interogation of the PCI capabilities and see >if they have somehow

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-21 Thread Ed Swierk
After testing this change on different platforms, I'm finding some complications. As I understand it, the BIOS is supposed to mark the MMCONFIG area reserved in the E820 table no matter what. And if the ACPI DSDT includes an MCFG record, then it should also include a PNP0C0x record for the

Re: [Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-21 Thread Konrad Rzeszutek Wilk
On Mon, Sep 21, 2015 at 08:58:44AM -0700, Ed Swierk wrote: > After testing this change on different platforms, I'm finding some > complications. > > As I understand it, the BIOS is supposed to mark the MMCONFIG area > reserved in the E820 table no matter what. And if the ACPI DSDT > includes an

[Xen-devel] [PATCH] xen/mcfg: Call PHYSDEVOP_pci_mmcfg_reserved before PCI enumeration

2015-09-15 Thread Ed Swierk
On systems where the ACPI DSDT advertises the PCI MMCONFIG area but the E820 table does not reserve it, it's up to Dom0 to inform Xen via PHYSDEVOP_pci_mmcfg_reserved. This needs to happen before Xen tries to access extended capabilities like SRIOV in pci_add_device(), which is triggered when