qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Marcel Apfelbaum <marcel@redhat.com>,
	qemu devel list <qemu-devel@nongnu.org>,
	edk2-devel list <edk2-devel@lists.sourceforge.net>,
	Marcel Apfelbaum <marcel.a@redhat.com>,
	Michael Tsirkin <mtsirkin@redhat.com>,
	"Gabriel L. Somlo (CMU)" <somlo@cmu.edu>
Subject: Re: [Qemu-devel] PXB fixes for QEMU, and extra root buses for OVMF
Date: Wed, 10 Jun 2015 14:05:58 +0200	[thread overview]
Message-ID: <55782826.3050409@redhat.com> (raw)
In-Reply-To: <557825C0.50603@redhat.com>

On 06/10/15 13:55, Marcel Apfelbaum wrote:
> On 06/10/2015 02:04 PM, Laszlo Ersek wrote:
>> On 06/10/15 11:09, Marcel Apfelbaum wrote:
>>> On 06/06/2015 02:45 AM, Laszlo Ersek wrote:
>>
>>>> (7) At least one issue remains to be solved (designed) in QEMU, for
>>>> both
>>>>       SeaBIOS's and OVMF's sake: booting off devices that are
>>>> located on
>>>>       the PXB. The problem is with the "bootorder" fw_cfg file.
>>>> Consider
>>>>       the following example:
>>>>
>>>>         /pci@i0cf8/scsi@3/channel@0/disk@0,0
>>>>         /pci/pci-bridge@0/ethernet@2/ethernet-phy@0
>>>>
>>>>       which is generated for the options
>>>>
>>>>         -device virtio-scsi-pci,id=scsi0 \
>>>>         -device scsi-cd,bus=scsi0.0,drive=cdrom,bootindex=0 \
>>>>         \
>>>>         -device pxb,id=bridge1,bus_nr=4 \
>>>>         -device
>>>> e1000,netdev=netdev0,bus=bridge1,addr=2,romfile=,bootindex=1
>>>>
>>>>       While the first entry is recognized by both SeaBIOS and OVMF, the
>>>>       second entry (generated for the NIC hanging off the PXB, see
>>>> above)
>>>>       is recognized by neither. (I tested OVMF, and investigated the
>>>>       SeaBIOS source, for this claim.)
>>>>
>>>>       For the SeaBIOS explanation, grep the source code for
>>>> FW_PCI_DOMAIN.
>>> Thanks for bringing it to my attention.
>>>
>>>>
>>>>       The OVMF explanation is that OVMF simply rejects the initial
>>>>       OpenFirmware device path node "/pci" with a controlled parse
>>>> error
>>>>       (as opposed to the "/pci@i0cf8" node, which it recognizes and
>>>>       translates to UEFI in combination with the rest of that OFW
>>>> device
>>>>       path).
>>>>
>>>>       The "/pci" node comes from QEMU's sysbus_get_fw_dev_path()
>>>> function,
>>>>       file "hw/core/sysbus.c", where *neither* of the (s->num_mmio) and
>>>>       (s->num_pio) branches apply. (The (s->num_pio) branch applies for
>>>>       the first entry, ie. "/pci@i0cf8".)
>>>>
>>>>       Something has to be invented here to clue in both firmwares as to
>>>>       the root bus number (here bus_nr=4), in a format that is
>>>> compliant
>>>>       with the "OpenFirmware unit address" concept. (Note that
>>>>       "/pci-bridge@0" only gives away the slot number *on* the extra
>>>> root
>>>>       bus, not the number of the root bus itself.) For example:
>>>>
>>>>         /pci@rootbus4/pci-bridge@0/ethernet@2/ethernet-phy@0
>>>>
>>>>       would be acceptable. However, I don't know how to implement
>>>> this in
>>>>       sysbus_get_fw_dev_path().
>>> I'll look into it. What is the OpenFirmware unit address" concept ? :)
>>
>> Okay, I looked it up again (also rechecked the OVMF parser code) -- in
>> fact the example I gave would not be preferable.
>>
>> * Background:
>>
>> For the specification, please see "3.2.1.1 Node names" in
>>
>>    IEEE Standard for Boot (Initialization Configuration)
>>    Firmware: Core Requirements and Practices
>>
>> The notation is
>>
>>    driver-name@unit-address:device-arguments
>>
>> It says (excerpt):
>>
>>    The /driver name/ field is a sequence of between one and 31 letters,
>>    digits, and punctuation characters from the set “, . _ + - ”.
>>    Uppercase and lowercase characters are distinct. [...]
>>
>>    [...]
>>
>>    The /unit address/ field is the text representation of the physical
>>    address of the device within the address space defined by its parent
>>    node. The form of the text representation is bus-dependent.
>>
>> Please see the TranslatePciOfwNodes() function in OVMF, for the
>> "PCI-like" OFW device paths that OVMF currently recognizes -- just
>> scroll through the function to see the comments:
>>
>> https://github.com/tianocore/edk2/blob/master/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c#L582
>>
>>
>> * Therefore, the only kind of /unit address/ that OVMF has faced,
>> exposed by QEMU, is "comma separated list of hexadecimal integers". OVMF
>> uses the helper function ParseUnitAddressHexList() to parse them. (It is
>> defined in the same file linked above.)
>>
>> It would be preferable to stick with this assumption. Therefore, let me
>> revise my earlier recommendation, and ask for:
>>
>>    /pxb@4/pci-bridge@0/ethernet@2/ethernet-phy@0
>>         ^
>>         bus_nr (hex, without 0x prefix)
>>
>> instead. Providing "pxb" as /driver name/ in the very first OFW node
>> would be sufficient for OVMF (and I guess for SeaBIOS too) to recognize
>> the extra root bus. The single hex integer in the /unit address/ of the
>> first node would identify bus_nr. The rest of the nodes in the OFW
>> devpath are already recognized by OVMF.
>>
>> An alternative would be simply
>>
>>    /pci@4
>>
>> (quoting just the first node), because I can still tell apart the
>> numeric ("4") /unit address/ from the "i0cf8" one that identifies the
>> main root bus.
>>
>> Summary: either of the following would be okay:
>>
>>    /pxb@4
>>    /pci@4
> Thanks a lot for the pointer. I prefer the latest.

Indeed, the current initial node that is produced for the nonzero root
buses is "/pci", so the "only" part you need to append to them is
"@bus_nr". :)

Thanks!
Laszlo

> I'll get to it.
> 
> Thanks,
> Marcel
> 
>>
>> Thanks
>> Laszlo
>>
> 

      reply	other threads:[~2015-06-10 12:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-05 23:45 [Qemu-devel] PXB fixes for QEMU, and extra root buses for OVMF Laszlo Ersek
2015-06-05 23:46 ` [Qemu-devel] [PATCH 0/4] PXB tweaks and fixes Laszlo Ersek
2015-06-05 23:46   ` [Qemu-devel] [PATCH 1/4] i386/acpi-build: more traditional _UID and _HID for PXB root buses Laszlo Ersek
2015-06-10  9:16     ` Marcel Apfelbaum
2015-06-05 23:46   ` [Qemu-devel] [PATCH 2/4] i386/acpi-build: fix PXB workarounds for unsupported BIOSes Laszlo Ersek
2015-06-10  9:17     ` Marcel Apfelbaum
2015-06-05 23:46   ` [Qemu-devel] [PATCH 3/4] hw/pci: allow the caller of pci_bar_address() to ignore command register Laszlo Ersek
2015-06-05 23:46   ` [Qemu-devel] [PATCH 4/4] i386/acpi-build: build_crs(): fetch BAR from PCI config space directly Laszlo Ersek
2015-06-07  9:23     ` Michael S. Tsirkin
2015-06-08  7:56       ` Laszlo Ersek
2015-06-08  9:40         ` Michael S. Tsirkin
2015-06-09 20:34       ` Laszlo Ersek
2015-06-10 10:06         ` Marcel Apfelbaum
2015-06-10 11:07           ` Laszlo Ersek
2015-06-10 16:21             ` Michael S. Tsirkin
2015-06-10 16:19         ` Michael S. Tsirkin
2015-06-10  9:09 ` [Qemu-devel] PXB fixes for QEMU, and extra root buses for OVMF Marcel Apfelbaum
2015-06-10 11:04   ` Laszlo Ersek
2015-06-10 11:55     ` Marcel Apfelbaum
2015-06-10 12:05       ` Laszlo Ersek [this message]

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=55782826.3050409@redhat.com \
    --to=lersek@redhat.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=marcel.a@redhat.com \
    --cc=marcel@redhat.com \
    --cc=mtsirkin@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=somlo@cmu.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).