[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM2PR0301MB123215E8246483C89FBCB6C1ABAD0@DM2PR0301MB1232.namprd03.prod.outlook.com>
Date: Tue, 16 Feb 2016 22:48:12 +0000
From: Jake Oshins <jakeo@...rosoft.com>
To: Bjorn Helgaas <helgaas@...nel.org>
CC: "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
KY Srinivasan <kys@...rosoft.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"olaf@...fle.de" <olaf@...fle.de>,
"apw@...onical.com" <apw@...onical.com>,
"vkuznets@...hat.com" <vkuznets@...hat.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
Haiyang Zhang <haiyangz@...rosoft.com>,
"marc.zyngier@....com" <marc.zyngier@....com>,
Hadden Hoppert <haddenh@...rosoft.com>
Subject: RE: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end for
Hyper-V VMs
> -----Original Message-----
> From: Bjorn Helgaas [mailto:helgaas@...nel.org]
> Sent: Tuesday, February 16, 2016 2:44 PM
> To: Jake Oshins <jakeo@...rosoft.com>
> Cc: bhelgaas@...gle.com; linux-pci@...r.kernel.org;
> gregkh@...uxfoundation.org; KY Srinivasan <kys@...rosoft.com>; linux-
> kernel@...r.kernel.org; devel@...uxdriverproject.org; olaf@...fle.de;
> apw@...onical.com; vkuznets@...hat.com; tglx@...utronix.de; Haiyang
> Zhang <haiyangz@...rosoft.com>; marc.zyngier@....com; Hadden
> Hoppert <haddenh@...rosoft.com>
> Subject: Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI front-end
> for Hyper-V VMs
>
> On Tue, Feb 16, 2016 at 09:46:55PM +0000, Jake Oshins wrote:
> > > -----Original Message-----
> > > From: Bjorn Helgaas [mailto:helgaas@...nel.org]
> > > Sent: Tuesday, February 16, 2016 8:46 AM
> > > To: Jake Oshins <jakeo@...rosoft.com>
> > > Cc: bhelgaas@...gle.com; linux-pci@...r.kernel.org;
> > > gregkh@...uxfoundation.org; KY Srinivasan <kys@...rosoft.com>;
> > > linux- kernel@...r.kernel.org; devel@...uxdriverproject.org;
> > > olaf@...fle.de; apw@...onical.com; vkuznets@...hat.com;
> > > tglx@...utronix.de; Haiyang Zhang <haiyangz@...rosoft.com>;
> > > marc.zyngier@....com; Hadden Hoppert <haddenh@...rosoft.com>
> > > Subject: Re: [PATCH RESEND v2 3/3] PCI: hv: New paravirtual PCI
> > > front-end for Hyper-V VMs
> > >
> > > Hi Jake,
> > >
> > > Looks good to me overall; I marked a few nits below.
> > >
> > > The only real question I have is about domain number allocation.
> > > See the note below.
> > >
> > [snip]
> > > > +
> > > > + /*
> > > > + * The PCI bus "domain" is what is called "segment" in
> > > > + * ACPI and other specs. Pull it from the instance ID,
> > > > + * to get something unique. Bytes 8 and 9 are what is used
> > > > + * in Windows guests, so do the same thing for consistency.
> > > > + */
> > > > +
> > > > + hbus->sysdata.domain = hdev->dev_instance.b[9] |
> > > > + hdev->dev_instance.b[8] << 8;
> > >
> > > How do we know this is unique? We don't have any idea what the
> > > platform will put in _SEG, so I think there's a potential conflict
> > > here. The Intel VMD driver (arch/x86/pci/vmd.c) has a similar
> > > problem, and it looks for unused domain numbers starting at 0x10000
> > > (see vmd_find_free_domain()).
> > >
> >
> > Bjorn, thank you for your very thorough reviews. I deeply appreciate it. I
> checked the Hyper-V code and it currently does guarantee that these values
> are unique. When I resend the series, I'll add a comment to that effect. I'll
> also add a comment to Hyper-V that says that it has to stay that way.
>
> I'm not familiar with how Hyper-V works, but I guess you're saying that
> Hyper-V controls what the guest sees via _SEG as well as what it sees via the
> instance ID.
>
> Bjorn
Yes, exactly. To the point, the Hyper-V Generation 1 VM (which is an emulation of a 440BX/PIIX4 platform) has one root PCI bus with no _SEG object at all, which implies a value of zero. The Hyper-V Generation 2 VM (which doesn't emulate any existing machine) doesn't have any root PCI bus at all until a device is passed through and this driver is loaded.
-- Jake
Powered by blists - more mailing lists