Date: Tue, 7 Apr 2009 09:21:13 -0400 From: John Baldwin <jhb@freebsd.org> To: Sergey Babkin <babkin@verizon.net> Cc: freebsd-hackers@freebsd.org, Ivan Voras <ivoras@freebsd.org> Subject: Re: Patch for MS Hyper V (virtualization) Message-ID: <200904070921.14294.jhb@freebsd.org> In-Reply-To: <49DAC4A1.589A5FE@verizon.net> References: <1366225354.253456.1238948619308.JavaMail.root@vms124.mailsrvcs.net> <200904061342.22000.jhb@freebsd.org> <49DAC4A1.589A5FE@verizon.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 06 April 2009 11:12:33 pm Sergey Babkin wrote: > John Baldwin wrote: > >=20 > > On Monday 06 April 2009 1:07:38 pm Ivan Voras wrote: > > > 2009/4/6 John Baldwin <jhb@freebsd.org>: > > > > On Sunday 05 April 2009 12:23:39 pm Sergey Babkin wrote: > > > > > > > Hmm, the problem is we need to be able to write to BARs to size the= m.=20 =D0=B1 Any > > OS > > > > needs to be able to do this to know what address space regions are= =20 being > > > > decoded by devices. =D0=B1 We can't avoid writing to BARs. > > > > > > I have only vague idea what BARs are and if it's the correct diagnosis > > > in this case, but the fact is that other operating systems (Windows, > > > Linux tested) work, so either there is a way around it or the original > > > premise is wrong-ish. > >=20 > > Every OS writes to BARs to size them during boot. It's the defined=20 procedure > > for sizing them. A BAR is a base address register, and it is how a PCI > > device gets memory and I/O port resources. OS (or BIOS) writes a start= ing > > address into the register to tell the PCI device where a given > > resource "starts". >=20 > The OS doesn't have to write to the BAR if BIOS has already > done it. And the BIOS in the Hyper-V VM is obviously special, > so it doesn't trip on iself.=20 Yes it does because we don't know how _big_ the BAR is. The OS has to know= if=20 the device is decoding 1MB or 64KB because we need to reserve the entire=20 window to prevent any other devices from using it. We don't just write the= =20 existing value, we write all 1's to it and read it back. The lower N=20 bits "stick" at zero and we use that to figure out the BAR's size. See=20 pci_add_map() in sys/dev/pci/pci.c > Anyway, as far as I can tell, it's only the base register of=20 > the simulated DEC21140 device that has this issue, so it's=20 > quite possible that the bug is in that device's simulator.=20 >=20 > I've attached a modified patch that checks conservatively for this > precise situation, so it should not break compatibility with > anything else. I've tested it on Hyper-V. Can you test unmodified FreeBSD 8 on Hyper-V? It has an extra fix relative= to=20 7 to disable decoding via the PCI command register while sizing BARs that m= ay=20 address this. =2D-=20 John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904070921.14294.jhb>