Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20160711' int…
…o staging Last round of s390x patches for 2.7: - A large update of the s390x PCI code, bringing it in line with the architecture - Fixes and improvements in the ipl (boot) code - Refactoring in the css code # gpg: Signature made Mon 11 Jul 2016 09:04:51 BST # gpg: using RSA key 0xDECF6B93C6F02FAF # gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>" # gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>" # Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0 18CE DECF 6B93 C6F0 2FAF * remotes/cohuck/tags/s390x-20160711: (25 commits) s390x/pci: make hot-unplug handler smoother s390x/pci: replace fid with idx in msg data of msix s390x/pci: fix stpcifc_service_call s390x/pci: refactor list_pci s390x/pci: refactor s390_pci_find_dev_by_idx s390x/pci: add checkings in CLP_SET_PCI_FN s390x/pci: enable zpci hot-plug/hot-unplug s390x/pci: enable uid-checking s390x/pci: introduce S390PCIBusDevice qdev s390x/pci: introduce S390PCIIOMMU s390x/pci: introduce S390PCIBus s390x/pci: enforce zPCI state checking s390x/pci: refactor s390_pci_find_dev_by_fh s390x/pci: unify FH_ macros s390x/pci: write fid in CLP_QUERY_PCI_FN s390x/pci: acceleration for getting S390pciState s390x/pci: fix failures of dma map/unmap s390x/css: Unplug handler of virtual css bridge s390x/css: Factor out virtual css bridge and bus s390x/css: use define for "virtual-css-bridge" literal ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
- Loading branch information
Showing
23 changed files
with
1,249 additions
and
456 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Common device infrastructure for devices in the virtual css | ||
* | ||
* Copyright 2016 IBM Corp. | ||
* Author(s): Jing Liu <liujbjl@linux.vnet.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2 or (at | ||
* your option) any later version. See the COPYING file in the top-level | ||
* directory. | ||
*/ | ||
#include "qemu/osdep.h" | ||
#include "ccw-device.h" | ||
|
||
static const TypeInfo ccw_device_info = { | ||
.name = TYPE_CCW_DEVICE, | ||
.parent = TYPE_DEVICE, | ||
.instance_size = sizeof(CcwDevice), | ||
.class_size = sizeof(CCWDeviceClass), | ||
.abstract = true, | ||
}; | ||
|
||
static void ccw_device_register(void) | ||
{ | ||
type_register_static(&ccw_device_info); | ||
} | ||
|
||
type_init(ccw_device_register) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Common device infrastructure for devices in the virtual css | ||
* | ||
* Copyright 2016 IBM Corp. | ||
* Author(s): Jing Liu <liujbjl@linux.vnet.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2 or (at | ||
* your option) any later version. See the COPYING file in the top-level | ||
* directory. | ||
*/ | ||
|
||
#ifndef HW_S390X_CCW_DEVICE_H | ||
#define HW_S390X_CCW_DEVICE_H | ||
#include "qom/object.h" | ||
#include "hw/qdev-core.h" | ||
#include "hw/s390x/css.h" | ||
|
||
typedef struct CcwDevice { | ||
DeviceState parent_obj; | ||
SubchDev *sch; | ||
/* <cssid>.<ssid>.<device number> */ | ||
CssDevId bus_id; | ||
} CcwDevice; | ||
|
||
typedef struct CCWDeviceClass { | ||
DeviceClass parent_class; | ||
void (*unplug)(HotplugHandler *, DeviceState *, Error **); | ||
} CCWDeviceClass; | ||
|
||
static inline CcwDevice *to_ccw_dev_fast(DeviceState *d) | ||
{ | ||
return container_of(d, CcwDevice, parent_obj); | ||
} | ||
|
||
#define TYPE_CCW_DEVICE "ccw-device" | ||
|
||
#define CCW_DEVICE(obj) OBJECT_CHECK(CcwDevice, (obj), TYPE_CCW_DEVICE) | ||
#define CCW_DEVICE_GET_CLASS(obj) \ | ||
OBJECT_GET_CLASS(CCWDeviceClass, (obj), TYPE_CCW_DEVICE) | ||
#define CCW_DEVICE_CLASS(klass) \ | ||
OBJECT_CLASS_CHECK(CCWDeviceClass, (klass), TYPE_CCW_DEVICE) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* css bridge implementation | ||
* | ||
* Copyright 2012,2016 IBM Corp. | ||
* Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> | ||
* Pierre Morel <pmorel@linux.vnet.ibm.com> | ||
* | ||
* This work is licensed under the terms of the GNU GPL, version 2 or (at | ||
* your option) any later version. See the COPYING file in the top-level | ||
* directory. | ||
*/ | ||
#include "qemu/osdep.h" | ||
#include "qapi/error.h" | ||
#include "hw/hotplug.h" | ||
#include "hw/sysbus.h" | ||
#include "qemu/bitops.h" | ||
#include "hw/s390x/css.h" | ||
#include "ccw-device.h" | ||
#include "hw/s390x/css-bridge.h" | ||
|
||
/* | ||
* Invoke device-specific unplug handler, disable the subchannel | ||
* (including sending a channel report to the guest) and remove the | ||
* device from the virtual css bus. | ||
*/ | ||
static void ccw_device_unplug(HotplugHandler *hotplug_dev, | ||
DeviceState *dev, Error **errp) | ||
{ | ||
CcwDevice *ccw_dev = CCW_DEVICE(dev); | ||
CCWDeviceClass *k = CCW_DEVICE_GET_CLASS(ccw_dev); | ||
SubchDev *sch = ccw_dev->sch; | ||
Error *err = NULL; | ||
|
||
if (k->unplug) { | ||
k->unplug(hotplug_dev, dev, &err); | ||
if (err) { | ||
error_propagate(errp, err); | ||
return; | ||
} | ||
} | ||
|
||
/* | ||
* We should arrive here only for device_del, since we don't support | ||
* direct hot(un)plug of channels. | ||
*/ | ||
assert(sch != NULL); | ||
/* Subchannel is now disabled and no longer valid. */ | ||
sch->curr_status.pmcw.flags &= ~(PMCW_FLAGS_MASK_ENA | | ||
PMCW_FLAGS_MASK_DNV); | ||
|
||
css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid, 1, 0); | ||
|
||
object_unparent(OBJECT(dev)); | ||
} | ||
|
||
static void virtual_css_bus_reset(BusState *qbus) | ||
{ | ||
/* This should actually be modelled via the generic css */ | ||
css_reset(); | ||
} | ||
|
||
static void virtual_css_bus_class_init(ObjectClass *klass, void *data) | ||
{ | ||
BusClass *k = BUS_CLASS(klass); | ||
|
||
k->reset = virtual_css_bus_reset; | ||
} | ||
|
||
static const TypeInfo virtual_css_bus_info = { | ||
.name = TYPE_VIRTUAL_CSS_BUS, | ||
.parent = TYPE_BUS, | ||
.instance_size = sizeof(VirtualCssBus), | ||
.class_init = virtual_css_bus_class_init, | ||
}; | ||
|
||
VirtualCssBus *virtual_css_bus_init(void) | ||
{ | ||
VirtualCssBus *cbus; | ||
BusState *bus; | ||
DeviceState *dev; | ||
|
||
/* Create bridge device */ | ||
dev = qdev_create(NULL, TYPE_VIRTUAL_CSS_BRIDGE); | ||
qdev_init_nofail(dev); | ||
|
||
/* Create bus on bridge device */ | ||
bus = qbus_create(TYPE_VIRTUAL_CSS_BUS, dev, "virtual-css"); | ||
cbus = VIRTUAL_CSS_BUS(bus); | ||
|
||
/* Enable hotplugging */ | ||
qbus_set_hotplug_handler(bus, dev, &error_abort); | ||
|
||
return cbus; | ||
} | ||
|
||
/***************** Virtual-css Bus Bridge Device ********************/ | ||
|
||
static void virtual_css_bridge_class_init(ObjectClass *klass, void *data) | ||
{ | ||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); | ||
DeviceClass *dc = DEVICE_CLASS(klass); | ||
|
||
hc->unplug = ccw_device_unplug; | ||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); | ||
} | ||
|
||
static const TypeInfo virtual_css_bridge_info = { | ||
.name = TYPE_VIRTUAL_CSS_BRIDGE, | ||
.parent = TYPE_SYS_BUS_DEVICE, | ||
.instance_size = sizeof(SysBusDevice), | ||
.class_init = virtual_css_bridge_class_init, | ||
.interfaces = (InterfaceInfo[]) { | ||
{ TYPE_HOTPLUG_HANDLER }, | ||
{ } | ||
} | ||
}; | ||
|
||
static void virtual_css_register(void) | ||
{ | ||
type_register_static(&virtual_css_bridge_info); | ||
type_register_static(&virtual_css_bus_info); | ||
} | ||
|
||
type_init(virtual_css_register) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.