* [Qemu-devel] [PATCH 0/2] sun4u: generate correct fw paths for cmd646 IDE and virtio-blk-pci devices
@ 2018-08-30 6:11 Mark Cave-Ayland
2018-08-30 6:11 ` [Qemu-devel] [PATCH 1/2] sabre: generate correct fw path for sabre PCI host bridge Mark Cave-Ayland
2018-08-30 6:11 ` [Qemu-devel] [PATCH 2/2] sun4u: implement custom FWPathProvider Mark Cave-Ayland
0 siblings, 2 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2018-08-30 6:11 UTC (permalink / raw)
To: qemu-devel, atar4qemu
This patchset is the QEMU counterpart to the patches posted on the OpenBIOS
list at https://mail.coreboot.org/pipermail/openbios/2018-August/010422.html
which generate correct fw paths for the sun4u machine.
With these patches applied QEMU generates the correct fw paths for both the
in-built cmd646 IDE and virtio-blk-pci devices enabling support for bootindex
and most importantly with an updated OpenBIOS, allowing boot from
virtio-pci-blk devices.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Mark Cave-Ayland (2):
sabre: generate correct fw path for sabre PCI host bridge
sun4u: implement custom FWPathProvider
hw/pci-host/sabre.c | 12 +++++++++++
hw/sparc64/sun4u.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+)
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 1/2] sabre: generate correct fw path for sabre PCI host bridge
2018-08-30 6:11 [Qemu-devel] [PATCH 0/2] sun4u: generate correct fw paths for cmd646 IDE and virtio-blk-pci devices Mark Cave-Ayland
@ 2018-08-30 6:11 ` Mark Cave-Ayland
2018-08-30 6:11 ` [Qemu-devel] [PATCH 2/2] sun4u: implement custom FWPathProvider Mark Cave-Ayland
1 sibling, 0 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2018-08-30 6:11 UTC (permalink / raw)
To: qemu-devel, atar4qemu
Set the fw_name property to "pci" and also set an explicit OFW address
using the value of the special_base property.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/pci-host/sabre.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/pci-host/sabre.c b/hw/pci-host/sabre.c
index e2f4ee480e..e33bd46967 100644
--- a/hw/pci-host/sabre.c
+++ b/hw/pci-host/sabre.c
@@ -496,6 +496,15 @@ static const TypeInfo sabre_pci_info = {
},
};
+static char *sabre_ofw_unit_address(const SysBusDevice *dev)
+{
+ SabreState *s = SABRE_DEVICE(dev);
+
+ return g_strdup_printf("%x,%x",
+ (uint32_t)((s->special_base >> 32) & 0xffffffff),
+ (uint32_t)(s->special_base & 0xffffffff));
+}
+
static Property sabre_properties[] = {
DEFINE_PROP_UINT64("special-base", SabreState, special_base, 0),
DEFINE_PROP_UINT64("mem-base", SabreState, mem_base, 0),
@@ -505,11 +514,14 @@ static Property sabre_properties[] = {
static void sabre_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
dc->realize = sabre_realize;
dc->reset = sabre_reset;
dc->props = sabre_properties;
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+ dc->fw_name = "pci";
+ sbc->explicit_ofw_unit_address = sabre_ofw_unit_address;
}
static const TypeInfo sabre_info = {
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Qemu-devel] [PATCH 2/2] sun4u: implement custom FWPathProvider
2018-08-30 6:11 [Qemu-devel] [PATCH 0/2] sun4u: generate correct fw paths for cmd646 IDE and virtio-blk-pci devices Mark Cave-Ayland
2018-08-30 6:11 ` [Qemu-devel] [PATCH 1/2] sabre: generate correct fw path for sabre PCI host bridge Mark Cave-Ayland
@ 2018-08-30 6:11 ` Mark Cave-Ayland
1 sibling, 0 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2018-08-30 6:11 UTC (permalink / raw)
To: qemu-devel, atar4qemu
This enables the correct generation of bootdevice fw paths for in-built IDE
and virtio-pci-blk devices suitable for OpenBIOS.
Note we also set the MachineClass ignore_boot_device_suffixes property to true
to allow the correct customisation of the disk node names as required.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/sparc64/sun4u.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index d16843b30e..f76b19e4e9 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -51,6 +51,7 @@
#include "hw/ide.h"
#include "hw/ide/pci.h"
#include "hw/loader.h"
+#include "hw/fw-path-provider.h"
#include "elf.h"
#include "trace.h"
@@ -693,6 +694,56 @@ enum {
sun4v_id = 64,
};
+/*
+ * Implementation of an interface to adjust firmware path
+ * for the bootindex property handling.
+ */
+static char *sun4u_fw_dev_path(FWPathProvider *p, BusState *bus,
+ DeviceState *dev)
+{
+ PCIDevice *pci;
+ IDEBus *ide_bus;
+ IDEState *ide_s;
+ int bus_id;
+
+ if (!strcmp(object_get_typename(OBJECT(dev)), "pbm-bridge")) {
+ pci = PCI_DEVICE(dev);
+
+ if (PCI_FUNC(pci->devfn)) {
+ return g_strdup_printf("pci@%x,%x", PCI_SLOT(pci->devfn),
+ PCI_FUNC(pci->devfn));
+ } else {
+ return g_strdup_printf("pci@%x", PCI_SLOT(pci->devfn));
+ }
+ }
+
+ if (!strcmp(object_get_typename(OBJECT(dev)), "ide-drive")) {
+ ide_bus = IDE_BUS(qdev_get_parent_bus(dev));
+ ide_s = idebus_active_if(ide_bus);
+ bus_id = ide_bus->bus_id;
+
+ if (ide_s->drive_kind == IDE_CD) {
+ return g_strdup_printf("ide@%x/cdrom", bus_id);
+ }
+
+ return g_strdup_printf("ide@%x/disk", bus_id);
+ }
+
+ if (!strcmp(object_get_typename(OBJECT(dev)), "ide-hd")) {
+ return g_strdup("disk");
+ }
+
+ if (!strcmp(object_get_typename(OBJECT(dev)), "ide-cd")) {
+ return g_strdup("cdrom");
+ }
+
+ if (!strcmp(object_get_typename(OBJECT(dev)), "virtio-blk-device")) {
+ return g_strdup("disk");
+ }
+
+ return NULL;
+}
+
static const struct hwdef hwdefs[] = {
/* Sun4u generic PC-like machine */
{
@@ -723,6 +774,7 @@ static void sun4v_init(MachineState *machine)
static void sun4u_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc);
mc->desc = "Sun4u platform";
mc->init = sun4u_init;
@@ -731,12 +783,18 @@ static void sun4u_class_init(ObjectClass *oc, void *data)
mc->is_default = 1;
mc->default_boot_order = "c";
mc->default_cpu_type = SPARC_CPU_TYPE_NAME("TI-UltraSparc-IIi");
+ mc->ignore_boot_device_suffixes = true;
+ fwc->get_dev_path = sun4u_fw_dev_path;
}
static const TypeInfo sun4u_type = {
.name = MACHINE_TYPE_NAME("sun4u"),
.parent = TYPE_MACHINE,
.class_init = sun4u_class_init,
+ .interfaces = (InterfaceInfo[]) {
+ { TYPE_FW_PATH_PROVIDER },
+ { }
+ },
};
static void sun4v_class_init(ObjectClass *oc, void *data)
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-08-30 6:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 6:11 [Qemu-devel] [PATCH 0/2] sun4u: generate correct fw paths for cmd646 IDE and virtio-blk-pci devices Mark Cave-Ayland
2018-08-30 6:11 ` [Qemu-devel] [PATCH 1/2] sabre: generate correct fw path for sabre PCI host bridge Mark Cave-Ayland
2018-08-30 6:11 ` [Qemu-devel] [PATCH 2/2] sun4u: implement custom FWPathProvider Mark Cave-Ayland
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.