[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] PCI passthrough to QEMU traditional stubdom not working when option ROM present



>>> On 24.10.16 at 15:01, <eshelton@xxxxxxxxx> wrote:
> On Mon, Oct 24, 2016 at 8:47 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>>>>> On 24.10.16 at 14:30, <eshelton@xxxxxxxxx> wrote:
>>> As best as I can tell, the current code already writes out the proper
>>> value for sizing ("pci_write_long(d, reg, ~0)" in the above code
>>> snippet).
>>
>> No - for sizing a ROM BAR, only the address portion is supposed to
>> be written with all 1s as per the PCI spec. In particular it should be
>> quite clear that writing the enable bit with 1 is a bad thing when the
>> address portion is also written with all 1s.
>>
>> I'd like to note though that as of commit d2bd05d88d ("xen-pciback:
>> return proper values during BAR sizing") the handling there is more
>> relaxed - previously writes of 0xFFFFFFFE were the only ones
>> considered to be sizing ones.
> 
> Rev 2.2 of the PCI spec, at 6.2.5.2, states that "configuration
> software can determine how much address space the device requires by
> writing a value of all 1' to the address portion of the register."
> Does the "address portion" refer to the upper 21 bits (meaning we
> should write 0xFFFFF800) or the upper 31 bits (meaning we should write
> 0xFFFFFFFE)?

Clearly the upper 21 bits.

>  4.4.14 pciback code appears to expect the latter, and
> with the newer more relaxed pciback code it doesn't matter.  For
> purposes of fixing this bug in Xen, which do you consider to be the
> "correct" sizing write value for QEMU to be writing out when it sizes
> the expansion ROM?

0xFFFFF800 | (<read-val> & 0x7FE)

Which then obviously won't work with older pciback (as much as ~0
didn't work, so that's no regression). It may be worth considering to
make another attempt with 0xFFFFFFFE if after the first write the
originally read value gets read back again.

And btw - is it really qemu that does this? I didn't think it would be
a user space app doing any such sizing; I thought this would get
done elsewhere in stubdom/mini-os.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.