Commit 8bfaa25f authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20151021-v2' into staging



More s390x patches. The first ones are fixes: A regression, missed
compat and a missed part of the SIMD support. The others contain
optimizations and cleanup.

# gpg: Signature made Wed 21 Oct 2015 11:24:48 BST using RSA key ID C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"

* remotes/cohuck/tags/s390x-20151021-v2:
  s390x/cmma: clean up cmma reset
  s390x: reset crypto only on clear reset and QEMU reset
  s390x: machine reset function with new ipl cpu handling
  s390x/ipl: we always have an ipl device
  s390x: unify device reset during subsystem_reset()
  s390x: flagify mcic values
  s390x/kvm: Fix vector validity bit in device machine checks
  s390x/virtio-ccw: fix 2.4 virtio compat
  util/qemu-config: fix missing machine command line options

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 426c0df9 1cd4e0f6
Loading
Loading
Loading
Loading
+26 −27
Original line number Diff line number Diff line
@@ -95,6 +95,11 @@ static const VMStateDescription vmstate_ipl = {
     }
};

static S390IPLState *get_ipl_device(void)
{
    return S390_IPL(object_resolve_path_type("", TYPE_S390_IPL, NULL));
}

static uint64_t bios_translate_addr(void *opaque, uint64_t srcaddr)
{
    uint64_t dstaddr = *(uint64_t *) opaque;
@@ -218,7 +223,7 @@ static Property s390_ipl_properties[] = {
 * - -1 if no valid boot device was found
 * - ccw id of the boot device otherwise
 */
static uint64_t s390_update_iplstate(CPUS390XState *env, S390IPLState *ipl)
static uint64_t s390_update_iplstate(S390IPLState *ipl)
{
    DeviceState *dev_st;

@@ -251,25 +256,19 @@ out:
    return (uint32_t) (ipl->cssid << 24 | ipl->ssid << 16 | ipl->devno);
}

int s390_ipl_update_diag308(IplParameterBlock *iplb)
void s390_ipl_update_diag308(IplParameterBlock *iplb)
{
    S390IPLState *ipl;
    S390IPLState *ipl = get_ipl_device();

    ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL));
    if (ipl) {
    ipl->iplb = *iplb;
    ipl->iplb_valid = true;
        return 0;
    }
    return -1;
}

IplParameterBlock *s390_ipl_get_iplb(void)
{
    S390IPLState *ipl;
    S390IPLState *ipl = get_ipl_device();

    ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL));
    if (!ipl || !ipl->iplb_valid) {
    if (!ipl->iplb_valid) {
        return NULL;
    }
    return &ipl->iplb;
@@ -277,33 +276,33 @@ IplParameterBlock *s390_ipl_get_iplb(void)

void s390_reipl_request(void)
{
    S390IPLState *ipl;
    S390IPLState *ipl = get_ipl_device();

    ipl = S390_IPL(object_resolve_path(TYPE_S390_IPL, NULL));
    ipl->reipl_requested = true;
    qemu_system_reset_request();
}

void s390_ipl_prepare_cpu(S390CPU *cpu)
{
    S390IPLState *ipl = get_ipl_device();

    cpu->env.psw.addr = ipl->start_addr;
    cpu->env.psw.mask = IPL_PSW_MASK;

    if (!ipl->kernel || ipl->iplb_valid) {
        cpu->env.psw.addr = ipl->bios_start_addr;
        cpu->env.regs[7] = s390_update_iplstate(ipl);
    }
}

static void s390_ipl_reset(DeviceState *dev)
{
    S390IPLState *ipl = S390_IPL(dev);
    S390CPU *cpu = S390_CPU(qemu_get_cpu(0));
    CPUS390XState *env = &cpu->env;

    env->psw.addr = ipl->start_addr;
    env->psw.mask = IPL_PSW_MASK;

    if (!ipl->reipl_requested) {
        ipl->iplb_valid = false;
    }
    ipl->reipl_requested = false;

    if (!ipl->kernel || ipl->iplb_valid) {
        env->psw.addr = ipl->bios_start_addr;
        env->regs[7] = s390_update_iplstate(env, ipl);
    }

    s390_cpu_set_state(CPU_STATE_OPERATING, cpu);
}

static void s390_ipl_class_init(ObjectClass *klass, void *data)
+4 −1
Original line number Diff line number Diff line
@@ -12,13 +12,16 @@
#ifndef HW_S390_IPL_H
#define HW_S390_IPL_H

#include "cpu.h"

typedef struct IplParameterBlock {
      uint8_t  reserved1[110];
      uint16_t devno;
      uint8_t  reserved2[88];
} IplParameterBlock;

int s390_ipl_update_diag308(IplParameterBlock *iplb);
void s390_ipl_update_diag308(IplParameterBlock *iplb);
void s390_ipl_prepare_cpu(S390CPU *cpu);
IplParameterBlock *s390_ipl_get_iplb(void);
void s390_reipl_request(void);

+27 −17
Original line number Diff line number Diff line
@@ -35,26 +35,23 @@ typedef struct S390CcwMachineState {
    bool dea_key_wrap;
} S390CcwMachineState;

static const char *const reset_dev_types[] = {
    "virtual-css-bridge",
    "s390-sclp-event-facility",
    "s390-flic",
    "diag288",
};

void subsystem_reset(void)
{
    DeviceState *css, *sclp, *flic, *diag288;
    DeviceState *dev;
    int i;

    css = DEVICE(object_resolve_path_type("", "virtual-css-bridge", NULL));
    if (css) {
        qdev_reset_all(css);
    }
    sclp = DEVICE(object_resolve_path_type("",
                  "s390-sclp-event-facility", NULL));
    if (sclp) {
        qdev_reset_all(sclp);
    for (i = 0; i < ARRAY_SIZE(reset_dev_types); i++) {
        dev = DEVICE(object_resolve_path_type("", reset_dev_types[i], NULL));
        if (dev) {
            qdev_reset_all(dev);
        }
    flic = DEVICE(object_resolve_path_type("", "s390-flic", NULL));
    if (flic) {
        qdev_reset_all(flic);
    }
    diag288 = DEVICE(object_resolve_path_type("", "diag288", NULL));
    if (diag288) {
        qdev_reset_all(diag288);
    }
}

@@ -164,6 +161,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data)
    NMIClass *nc = NMI_CLASS(oc);

    mc->init = ccw_init;
    mc->reset = s390_machine_reset;
    mc->block_default_type = IF_VIRTIO;
    mc->no_cdrom = 1;
    mc->no_floppy = 1;
@@ -262,6 +260,18 @@ static const TypeInfo ccw_machine_info = {
            .driver   = "virtio-rng-ccw",\
            .property = "max_revision",\
            .value    = "0",\
        },{\
            .driver   = "virtio-net-ccw",\
            .property = "max_revision",\
            .value    = "0",\
        },{\
            .driver   = "virtio-scsi-ccw",\
            .property = "max_revision",\
            .value    = "0",\
        },{\
            .driver   = "vhost-scsi-ccw",\
            .property = "max_revision",\
            .value    = "0",\
        },

static void ccw_machine_2_4_class_init(ObjectClass *oc, void *data)
+15 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include "hw/s390x/s390_flic.h"
#include "hw/s390x/s390-virtio.h"
#include "hw/s390x/storage-keys.h"
#include "hw/s390x/ipl.h"
#include "cpu.h"

//#define DEBUG_S390
@@ -314,6 +315,19 @@ void s390_nmi(NMIState *n, int cpu_index, Error **errp)
    }
}

void s390_machine_reset(void)
{
    S390CPU *ipl_cpu = S390_CPU(qemu_get_cpu(0));

    qemu_devices_reset();
    s390_cmma_reset();
    s390_crypto_reset();

    /* all cpus are stopped - configure and start the ipl cpu only */
    s390_ipl_prepare_cpu(ipl_cpu);
    s390_cpu_set_state(CPU_STATE_OPERATING, ipl_cpu);
}

static void s390_machine_class_init(ObjectClass *oc, void *data)
{
    MachineClass *mc = MACHINE_CLASS(oc);
@@ -322,6 +336,7 @@ static void s390_machine_class_init(ObjectClass *oc, void *data)
    mc->alias = "s390";
    mc->desc = "VirtIO based S390 machine";
    mc->init = s390_init;
    mc->reset = s390_machine_reset;
    mc->block_default_type = IF_VIRTIO;
    mc->max_cpus = 255;
    mc->no_serial = 1;
+1 −0
Original line number Diff line number Diff line
@@ -27,5 +27,6 @@ void s390_init_ipl_dev(const char *kernel_filename,
                       bool enforce_bios);
void s390_create_virtio_net(BusState *bus, const char *name);
void s390_nmi(NMIState *n, int cpu_index, Error **errp);
void s390_machine_reset(void);
void s390_memory_init(ram_addr_t mem_size);
#endif
Loading