We identify devices by their Open Firmware device paths. The path component for the logical unit on a bus is incorrect: bootprio_find_scsi_device() and bootprio_find_usb() format target (a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal. Bootorder list entries with target, lun > 9 aren't found (lucky case), or attributed to the wrong logical unit (unlucky case).
The relevant spec[*] agrees with QEMU (and OVMF, for that matter). Change %d to %x.
No actual impact on USB, because QEMU only uses LUN 0 there.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096560
[*] Open Firmware Recommended Practice: SCSI-3 Parallel Interface, Version 1, Section 3.1 Physical Address Formats and Representations http://www.openfirmware.org/1275/practice/spi/spi1_0.ps IEEE Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices, IEEE Std 1275-1994, Annex E SCSI host adapter package class, section E.2.1 Physical address formats and representations
Signed-off-by: Markus Armbruster armbru@redhat.com --- v3: * Fix bootprio_find_usb() as well [Kevin] * Also point to IEEE 1275 Annex E in commit message v2: * Fix the link to the spec (d'oh) * While we're linking, link to RHBZ
src/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/boot.c b/src/boot.c index 5837ad0..34088c8 100644 --- a/src/boot.c +++ b/src/boot.c @@ -145,7 +145,7 @@ int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun) // Find scsi drive - for example: /pci@i0cf8/scsi@5/channel@0/disk@1,0 char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "*", pci); - snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%d,%d", target, lun); + snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%x,%x", target, lun); return find_prio(desc); }
@@ -224,7 +224,7 @@ int bootprio_find_usb(struct usbdevice_s *usbdev, int lun) char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "usb", usbdev->hub->cntl->pci); p = build_usb_path(p, desc+sizeof(desc)-p, usbdev->hub); - snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%d" + snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%x" , usbdev->port+1, lun); int ret = find_prio(desc); if (ret >= 0)
On 08/15/14 08:58, Markus Armbruster wrote:
We identify devices by their Open Firmware device paths. The path component for the logical unit on a bus is incorrect: bootprio_find_scsi_device() and bootprio_find_usb() format target (a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal. Bootorder list entries with target, lun > 9 aren't found (lucky case), or attributed to the wrong logical unit (unlucky case).
The relevant spec[*] agrees with QEMU (and OVMF, for that matter). Change %d to %x.
No actual impact on USB, because QEMU only uses LUN 0 there.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096560
[*] Open Firmware Recommended Practice: SCSI-3 Parallel Interface, Version 1, Section 3.1 Physical Address Formats and Representations http://www.openfirmware.org/1275/practice/spi/spi1_0.ps IEEE Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices, IEEE Std 1275-1994, Annex E SCSI host adapter package class, section E.2.1 Physical address formats and representations
Signed-off-by: Markus Armbruster armbru@redhat.com
v3:
- Fix bootprio_find_usb() as well [Kevin]
- Also point to IEEE 1275 Annex E in commit message
v2:
- Fix the link to the spec (d'oh)
- While we're linking, link to RHBZ
src/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/boot.c b/src/boot.c index 5837ad0..34088c8 100644 --- a/src/boot.c +++ b/src/boot.c @@ -145,7 +145,7 @@ int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun) // Find scsi drive - for example: /pci@i0cf8/scsi@5/channel@0/disk@1,0 char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "*", pci);
- snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%d,%d", target, lun);
- snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%x,%x", target, lun); return find_prio(desc);
}
@@ -224,7 +224,7 @@ int bootprio_find_usb(struct usbdevice_s *usbdev, int lun) char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "usb", usbdev->hub->cntl->pci); p = build_usb_path(p, desc+sizeof(desc)-p, usbdev->hub);
- snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%d"
- snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%x" , usbdev->port+1, lun); int ret = find_prio(desc); if (ret >= 0)
We had discussed bootprio_find_usb() too on IRC; I thought you were going to send a separate patch for that. But it's OK this way as well, obviously.
Reviewed-by: Laszlo Ersek lersek@redhat.com
Laszlo Ersek lersek@redhat.com writes:
On 08/15/14 08:58, Markus Armbruster wrote:
We identify devices by their Open Firmware device paths. The path component for the logical unit on a bus is incorrect: bootprio_find_scsi_device() and bootprio_find_usb() format target (a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal. Bootorder list entries with target, lun > 9 aren't found (lucky case), or attributed to the wrong logical unit (unlucky case).
The relevant spec[*] agrees with QEMU (and OVMF, for that matter). Change %d to %x.
No actual impact on USB, because QEMU only uses LUN 0 there.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1096560
[*] Open Firmware Recommended Practice: SCSI-3 Parallel Interface, Version 1, Section 3.1 Physical Address Formats and Representations http://www.openfirmware.org/1275/practice/spi/spi1_0.ps IEEE Standard for Boot (Initialization Configuration) Firmware: Core Requirements and Practices, IEEE Std 1275-1994, Annex E SCSI host adapter package class, section E.2.1 Physical address formats and representations
Signed-off-by: Markus Armbruster armbru@redhat.com
v3:
- Fix bootprio_find_usb() as well [Kevin]
- Also point to IEEE 1275 Annex E in commit message
v2:
- Fix the link to the spec (d'oh)
- While we're linking, link to RHBZ
src/boot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/boot.c b/src/boot.c index 5837ad0..34088c8 100644 --- a/src/boot.c +++ b/src/boot.c @@ -145,7 +145,7 @@ int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun) // Find scsi drive - for example: /pci@i0cf8/scsi@5/channel@0/disk@1,0 char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "*", pci);
- snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%d,%d", target, lun);
- snprintf(p, desc+sizeof(desc)-p, "/*@0/*@%x,%x", target, lun); return find_prio(desc);
}
@@ -224,7 +224,7 @@ int bootprio_find_usb(struct usbdevice_s *usbdev, int lun) char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "usb", usbdev->hub->cntl->pci); p = build_usb_path(p, desc+sizeof(desc)-p, usbdev->hub);
- snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%d"
- snprintf(p, desc+sizeof(desc)-p, "/storage@%x/*@0/*@0,%x" , usbdev->port+1, lun); int ret = find_prio(desc); if (ret >= 0)
We had discussed bootprio_find_usb() too on IRC; I thought you were going to send a separate patch for that. But it's OK this way as well, obviously.
Stupid misunderstanding on my part. I saw only the port number mismatch, and that needs fixing in QEMU. I missed the lun mismatch.
Reviewed-by: Laszlo Ersek lersek@redhat.com
Thanks!
On Fri, Aug 15, 2014 at 08:58:17AM +0200, Markus Armbruster wrote:
We identify devices by their Open Firmware device paths. The path component for the logical unit on a bus is incorrect: bootprio_find_scsi_device() and bootprio_find_usb() format target (a.k.a. SCSI ID) and lun in decimal, while QEMU uses hexadecimal. Bootorder list entries with target, lun > 9 aren't found (lucky case), or attributed to the wrong logical unit (unlucky case).
The relevant spec[*] agrees with QEMU (and OVMF, for that matter). Change %d to %x.
Thanks. I committed this patch.
-Kevin
Il 15/08/2014 08:58, Markus Armbruster ha scritto:
No actual impact on USB, because QEMU only uses LUN 0 there.
With usb-bot, you can actually add multiple LUNs to QEMU, up to LUN 15. (USB Attached SCSI supports LUNs up to 255). Still it's a very rare case.
Paolo
Paolo Bonzini pbonzini@redhat.com writes:
Il 15/08/2014 08:58, Markus Armbruster ha scritto:
No actual impact on USB, because QEMU only uses LUN 0 there.
With usb-bot, you can actually add multiple LUNs to QEMU, up to LUN 15.
You're right; I forgot about the newer device.
(USB Attached SCSI supports LUNs up to 255). Still it's a very rare case.
Right again. This is usb-uas.