From d601fac478eee7391f3e7005a9321fbf38d74809 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 25 Apr 2012 17:55:41 +0000 Subject: pseries: Implement automatic PAPR VIO address allocation PAPR virtual IO (VIO) devices require a unique, but otherwise arbitrary, "address" used as a token to the hypercalls which manipulate them. Currently the pseries machine code does an ok job of allocating these addresses when the legacy -net nic / -serial and so forth options are used but will fail to allocate them properly when using -device. Specifically, you can use -device if all addresses are explicitly assigned. Without explicit assignment, only one VIO device of each type (network, console, SCSI) will be assigned properly, any further ones will attempt to take the same address leading to a fatal error. This patch fixes the situation by adding a proper address allocator to the VIO "bus" code. This is used both by -device and the legacy options and default devices. Addresses can still be explicitly assigned with -device options if desired. This patch changes the (guest visible) numbering of VIO devices, but since their addresses are discovered using the device tree and already differ from the numbering found on existing PowerVM systems, this does not break compatibility. Signed-off-by: David Gibson Signed-off-by: Alexander Graf --- hw/spapr_vty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'hw/spapr_vty.c') diff --git a/hw/spapr_vty.c b/hw/spapr_vty.c index a30c040b97..c9674f36a6 100644 --- a/hw/spapr_vty.c +++ b/hw/spapr_vty.c @@ -123,18 +123,17 @@ static target_ulong h_get_term_char(CPUPPCState *env, sPAPREnvironment *spapr, return H_SUCCESS; } -void spapr_vty_create(VIOsPAPRBus *bus, uint32_t reg, CharDriverState *chardev) +void spapr_vty_create(VIOsPAPRBus *bus, CharDriverState *chardev) { DeviceState *dev; dev = qdev_create(&bus->bus, "spapr-vty"); - qdev_prop_set_uint32(dev, "reg", reg); qdev_prop_set_chr(dev, "chardev", chardev); qdev_init_nofail(dev); } static Property spapr_vty_properties[] = { - DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev, SPAPR_VTY_BASE_ADDRESS, 0), + DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev, 0), DEFINE_PROP_CHR("chardev", VIOsPAPRVTYDevice, chardev), DEFINE_PROP_END_OF_LIST(), }; -- cgit v1.2.3