s390x/css: provide a dev_path for css devices
We need to implement the get_dev_path method for the css bus, or else we might end up with two different devices having the same qdev_path. This was noticed when adding two scsi_hd controllers: The SCSIBus code will produce a non-unique dev_path for vmstate usage if the parent bus does not provide the get_dev_path method. We simply use the device's bus id, as this is unique and we won't have any deeper hierarchy from a channel subsystem perspective anyway. Note that we need to disable this for older machine versions, as this changes the migration format. Reported-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Tested-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
727a0424dd
commit
2a79eb1a61
@ -59,11 +59,28 @@ static void virtual_css_bus_reset(BusState *qbus)
|
|||||||
css_reset();
|
css_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *virtual_css_bus_get_dev_path(DeviceState *dev)
|
||||||
|
{
|
||||||
|
CcwDevice *ccw_dev = CCW_DEVICE(dev);
|
||||||
|
SubchDev *sch = ccw_dev->sch;
|
||||||
|
VirtualCssBridge *bridge =
|
||||||
|
VIRTUAL_CSS_BRIDGE(qdev_get_parent_bus(dev)->parent);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We can't provide a dev path for backward compatibility on
|
||||||
|
* older machines, as it is visible in the migration stream.
|
||||||
|
*/
|
||||||
|
return bridge->css_dev_path ?
|
||||||
|
g_strdup_printf("/%02x.%1x.%04x", sch->cssid, sch->ssid, sch->devno) :
|
||||||
|
NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void virtual_css_bus_class_init(ObjectClass *klass, void *data)
|
static void virtual_css_bus_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
BusClass *k = BUS_CLASS(klass);
|
BusClass *k = BUS_CLASS(klass);
|
||||||
|
|
||||||
k->reset = virtual_css_bus_reset;
|
k->reset = virtual_css_bus_reset;
|
||||||
|
k->get_dev_path = virtual_css_bus_get_dev_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtual_css_bus_info = {
|
static const TypeInfo virtual_css_bus_info = {
|
||||||
@ -95,6 +112,12 @@ VirtualCssBus *virtual_css_bus_init(void)
|
|||||||
|
|
||||||
/***************** Virtual-css Bus Bridge Device ********************/
|
/***************** Virtual-css Bus Bridge Device ********************/
|
||||||
|
|
||||||
|
static Property virtual_css_bridge_properties[] = {
|
||||||
|
DEFINE_PROP_BOOL("css_dev_path", VirtualCssBridge, css_dev_path,
|
||||||
|
true),
|
||||||
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
|
static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||||
@ -102,12 +125,13 @@ static void virtual_css_bridge_class_init(ObjectClass *klass, void *data)
|
|||||||
|
|
||||||
hc->unplug = ccw_device_unplug;
|
hc->unplug = ccw_device_unplug;
|
||||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||||
|
dc->props = virtual_css_bridge_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo virtual_css_bridge_info = {
|
static const TypeInfo virtual_css_bridge_info = {
|
||||||
.name = TYPE_VIRTUAL_CSS_BRIDGE,
|
.name = TYPE_VIRTUAL_CSS_BRIDGE,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(SysBusDevice),
|
.instance_size = sizeof(VirtualCssBridge),
|
||||||
.class_init = virtual_css_bridge_class_init,
|
.class_init = virtual_css_bridge_class_init,
|
||||||
.interfaces = (InterfaceInfo[]) {
|
.interfaces = (InterfaceInfo[]) {
|
||||||
{ TYPE_HOTPLUG_HANDLER },
|
{ TYPE_HOTPLUG_HANDLER },
|
||||||
|
@ -322,6 +322,10 @@ static const TypeInfo ccw_machine_info = {
|
|||||||
.driver = TYPE_S390_IPL,\
|
.driver = TYPE_S390_IPL,\
|
||||||
.property = "iplbext_migration",\
|
.property = "iplbext_migration",\
|
||||||
.value = "off",\
|
.value = "off",\
|
||||||
|
}, {\
|
||||||
|
.driver = TYPE_VIRTUAL_CSS_BRIDGE,\
|
||||||
|
.property = "css_dev_path",\
|
||||||
|
.value = "off",\
|
||||||
},
|
},
|
||||||
|
|
||||||
#define CCW_COMPAT_2_5 \
|
#define CCW_COMPAT_2_5 \
|
||||||
|
@ -16,7 +16,14 @@
|
|||||||
#include "hw/qdev-core.h"
|
#include "hw/qdev-core.h"
|
||||||
|
|
||||||
/* virtual css bridge */
|
/* virtual css bridge */
|
||||||
|
typedef struct VirtualCssBridge {
|
||||||
|
SysBusDevice sysbus_dev;
|
||||||
|
bool css_dev_path;
|
||||||
|
} VirtualCssBridge;
|
||||||
|
|
||||||
#define TYPE_VIRTUAL_CSS_BRIDGE "virtual-css-bridge"
|
#define TYPE_VIRTUAL_CSS_BRIDGE "virtual-css-bridge"
|
||||||
|
#define VIRTUAL_CSS_BRIDGE(obj) \
|
||||||
|
OBJECT_CHECK(VirtualCssBridge, (obj), TYPE_VIRTUAL_CSS_BRIDGE)
|
||||||
|
|
||||||
/* virtual css bus type */
|
/* virtual css bus type */
|
||||||
typedef struct VirtualCssBus {
|
typedef struct VirtualCssBus {
|
||||||
|
Loading…
Reference in New Issue
Block a user