mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
Mostly bugfixes + Alexey's interface-based implementation
of the NMI monitor command. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJT/zeaAAoJEBvWZb6bTYby/QQP/0QjyI70Jri2/CyFQOVOEzau W79N1k7IjHaGQQau0Vu3GjhI0P7rhJ/xL789otr8f1oeBbM6c9n78mKf3sTXJ5RS u+7aVRyJtDYyzIc7FWigUiMUqaIXELHkv8FdA59F1eq0tvszjBi2xPf5RlRwq/9d vGD10ZubM/dY61lWUqxmgXp9gg/2Ewdm9vCZ7rBbzvAFg6ASreUXJ0/PUUU/lA6L 5JmfgQJg8ZtbEViTaVtEhpUlkOS6d0c6jnb8T1USLErwH/GUGS9AJba+/3WD+fKr Z37rZeB6Wl6bc0ZNjEliDSmcr+tetfz4A3j+mCUEksgnvL6o83bHkcIHPMDO9cvf lZ5csWiZaD7wqNUjI1pI4hpbKPPrsu+inypJnjmrd29roQ7tHsGzEIatN8922M3k PjnGL5VwQuFfKyndRJF8TfKKA465k+id2t6XSbEdU2m08thFDG2HZnGSCoDLs6Mz rEm4RK42AtdFdybrsirVofdKEJU5XmYRy612ZUSRd5Ki4PWk9UESMVvBrs0MZfep mVCak7tYKWHmll628xS+WM3qU8VyDpsQD5o8FuW6c1R9Rhs0VxJBcve4oapkm53P DXIYnFPImpmoEHltCOxx+07rf4g1O5O4r8gTdsE8xEjDBWelOUQWIuws25X+6tvW OZ7UglgB5bf0e3EIi0Ms =tbi2 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kvm/tags/for-upstream' into staging Mostly bugfixes + Alexey's interface-based implementation of the NMI monitor command. # gpg: Signature made Thu 28 Aug 2014 15:07:22 BST using RSA key ID 9B4D86F2 # gpg: Good signature from "Paolo Bonzini <pbonzini@redhat.com>" # gpg: aka "Paolo Bonzini <bonzini@gnu.org>" * remotes/kvm/tags/for-upstream: mc146818rtc: reinitialize irq_reinject_on_ack_count on reset target-i386: Add "tsc_adjust" CPU feature name target-i386: Add "mpx" CPU feature name vl: process -object after other backend options checkpatch.pl: adjust typedef definition to QEMU coding style x86: Clear MTRRs on vCPU reset x86: kvm: Add MTRR support for kvm_get|put_msrs() x86: Use common variable range MTRR counts target-i386: Don't forbid NX bit on PAE PDEs and PTEs spapr: Add support for new NMI interface s390x: Migrate to new NMI interface s390x: Convert QEMUMachine to MachineClass cpus: Define callback for QEMU "nmi" command kvm: run cpu state synchronization on target vcpu thread Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
38a01e55d2
22 changed files with 399 additions and 78 deletions
|
@ -4,6 +4,7 @@ common-obj-y += fw-path-provider.o
|
|||
# irq.o needed for qdev GPIO handling:
|
||||
common-obj-y += irq.o
|
||||
common-obj-y += hotplug.o
|
||||
common-obj-y += nmi.o
|
||||
|
||||
common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
|
||||
common-obj-$(CONFIG_XILINX_AXI) += stream.o
|
||||
|
|
84
hw/core/nmi.c
Normal file
84
hw/core/nmi.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* NMI monitor handler class and helpers.
|
||||
*
|
||||
* Copyright IBM Corp., 2014
|
||||
*
|
||||
* Author: Alexey Kardashevskiy <aik@ozlabs.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "hw/nmi.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
struct do_nmi_s {
|
||||
int cpu_index;
|
||||
Error *errp;
|
||||
bool handled;
|
||||
};
|
||||
|
||||
static void nmi_children(Object *o, struct do_nmi_s *ns);
|
||||
|
||||
static int do_nmi(Object *o, void *opaque)
|
||||
{
|
||||
struct do_nmi_s *ns = opaque;
|
||||
NMIState *n = (NMIState *) object_dynamic_cast(o, TYPE_NMI);
|
||||
|
||||
if (n) {
|
||||
NMIClass *nc = NMI_GET_CLASS(n);
|
||||
|
||||
ns->handled = true;
|
||||
nc->nmi_monitor_handler(n, ns->cpu_index, &ns->errp);
|
||||
if (ns->errp) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
nmi_children(o, ns);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void nmi_children(Object *o, struct do_nmi_s *ns)
|
||||
{
|
||||
object_child_foreach(o, do_nmi, ns);
|
||||
}
|
||||
|
||||
void nmi_monitor_handle(int cpu_index, Error **errp)
|
||||
{
|
||||
struct do_nmi_s ns = {
|
||||
.cpu_index = cpu_index,
|
||||
.errp = NULL,
|
||||
.handled = false
|
||||
};
|
||||
|
||||
nmi_children(object_get_root(), &ns);
|
||||
if (ns.handled) {
|
||||
error_propagate(errp, ns.errp);
|
||||
} else {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
static const TypeInfo nmi_info = {
|
||||
.name = TYPE_NMI,
|
||||
.parent = TYPE_INTERFACE,
|
||||
.class_size = sizeof(NMIClass),
|
||||
};
|
||||
|
||||
static void nmi_register_types(void)
|
||||
{
|
||||
type_register_static(&nmi_info);
|
||||
}
|
||||
|
||||
type_init(nmi_register_types)
|
|
@ -55,6 +55,7 @@
|
|||
#include "qemu/config-file.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "trace.h"
|
||||
#include "hw/nmi.h"
|
||||
|
||||
#include <libfdt.h>
|
||||
|
||||
|
@ -1576,10 +1577,28 @@ static void spapr_machine_initfn(Object *obj)
|
|||
spapr_get_kvm_type, spapr_set_kvm_type, NULL);
|
||||
}
|
||||
|
||||
static void ppc_cpu_do_nmi_on_cpu(void *arg)
|
||||
{
|
||||
CPUState *cs = arg;
|
||||
|
||||
cpu_synchronize_state(cs);
|
||||
ppc_cpu_do_system_reset(cs);
|
||||
}
|
||||
|
||||
static void spapr_nmi(NMIState *n, int cpu_index, Error **errp)
|
||||
{
|
||||
CPUState *cs;
|
||||
|
||||
CPU_FOREACH(cs) {
|
||||
async_run_on_cpu(cs, ppc_cpu_do_nmi_on_cpu, cs);
|
||||
}
|
||||
}
|
||||
|
||||
static void spapr_machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc);
|
||||
NMIClass *nc = NMI_CLASS(oc);
|
||||
|
||||
mc->name = "pseries";
|
||||
mc->desc = "pSeries Logical Partition (PAPR compliant)";
|
||||
|
@ -1593,6 +1612,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data)
|
|||
mc->kvm_type = spapr_kvm_type;
|
||||
|
||||
fwc->get_dev_path = spapr_get_fw_dev_path;
|
||||
nc->nmi_monitor_handler = spapr_nmi;
|
||||
}
|
||||
|
||||
static const TypeInfo spapr_machine_info = {
|
||||
|
@ -1603,6 +1623,7 @@ static const TypeInfo spapr_machine_info = {
|
|||
.class_init = spapr_machine_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_FW_PATH_PROVIDER },
|
||||
{ TYPE_NMI },
|
||||
{ }
|
||||
},
|
||||
};
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include "css.h"
|
||||
#include "virtio-ccw.h"
|
||||
|
||||
#define TYPE_S390_CCW_MACHINE "s390-ccw-machine"
|
||||
|
||||
void io_subsystem_reset(void)
|
||||
{
|
||||
DeviceState *css, *sclp, *flic;
|
||||
|
@ -134,24 +136,39 @@ static void ccw_init(MachineState *machine)
|
|||
s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
|
||||
}
|
||||
|
||||
static QEMUMachine ccw_machine = {
|
||||
.name = "s390-ccw-virtio",
|
||||
.alias = "s390-ccw",
|
||||
.desc = "VirtIO-ccw based S390 machine",
|
||||
.init = ccw_init,
|
||||
.block_default_type = IF_VIRTIO,
|
||||
.no_cdrom = 1,
|
||||
.no_floppy = 1,
|
||||
.no_serial = 1,
|
||||
.no_parallel = 1,
|
||||
.no_sdcard = 1,
|
||||
.use_sclp = 1,
|
||||
.max_cpus = 255,
|
||||
};
|
||||
|
||||
static void ccw_machine_init(void)
|
||||
static void ccw_machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
qemu_register_machine(&ccw_machine);
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
NMIClass *nc = NMI_CLASS(oc);
|
||||
|
||||
mc->name = "s390-ccw-virtio";
|
||||
mc->alias = "s390-ccw";
|
||||
mc->desc = "VirtIO-ccw based S390 machine";
|
||||
mc->init = ccw_init;
|
||||
mc->block_default_type = IF_VIRTIO;
|
||||
mc->no_cdrom = 1;
|
||||
mc->no_floppy = 1;
|
||||
mc->no_serial = 1;
|
||||
mc->no_parallel = 1;
|
||||
mc->no_sdcard = 1;
|
||||
mc->use_sclp = 1,
|
||||
mc->max_cpus = 255;
|
||||
nc->nmi_monitor_handler = s390_nmi;
|
||||
}
|
||||
|
||||
machine_init(ccw_machine_init)
|
||||
static const TypeInfo ccw_machine_info = {
|
||||
.name = TYPE_S390_CCW_MACHINE,
|
||||
.parent = TYPE_MACHINE,
|
||||
.class_init = ccw_machine_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_NMI },
|
||||
{ }
|
||||
},
|
||||
};
|
||||
|
||||
static void ccw_machine_register_types(void)
|
||||
{
|
||||
type_register_static(&ccw_machine_info);
|
||||
}
|
||||
|
||||
type_init(ccw_machine_register_types)
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
#define MAX_BLK_DEVS 10
|
||||
#define ZIPL_FILENAME "s390-zipl.rom"
|
||||
#define TYPE_S390_MACHINE "s390-machine"
|
||||
|
||||
static VirtIOS390Bus *s390_bus;
|
||||
static S390CPU **ipi_states;
|
||||
|
@ -279,25 +280,49 @@ static void s390_init(MachineState *machine)
|
|||
s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");
|
||||
}
|
||||
|
||||
static QEMUMachine s390_machine = {
|
||||
.name = "s390-virtio",
|
||||
.alias = "s390",
|
||||
.desc = "VirtIO based S390 machine",
|
||||
.init = s390_init,
|
||||
.block_default_type = IF_VIRTIO,
|
||||
.no_cdrom = 1,
|
||||
.no_floppy = 1,
|
||||
.no_serial = 1,
|
||||
.no_parallel = 1,
|
||||
.no_sdcard = 1,
|
||||
.use_virtcon = 1,
|
||||
.max_cpus = 255,
|
||||
.is_default = 1,
|
||||
};
|
||||
|
||||
static void s390_machine_init(void)
|
||||
void s390_nmi(NMIState *n, int cpu_index, Error **errp)
|
||||
{
|
||||
qemu_register_machine(&s390_machine);
|
||||
CPUState *cs = qemu_get_cpu(cpu_index);
|
||||
|
||||
if (s390_cpu_restart(S390_CPU(cs))) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
machine_init(s390_machine_init);
|
||||
static void s390_machine_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
NMIClass *nc = NMI_CLASS(oc);
|
||||
|
||||
mc->name = "s390-virtio";
|
||||
mc->alias = "s390";
|
||||
mc->desc = "VirtIO based S390 machine";
|
||||
mc->init = s390_init;
|
||||
mc->block_default_type = IF_VIRTIO;
|
||||
mc->max_cpus = 255;
|
||||
mc->no_serial = 1;
|
||||
mc->no_parallel = 1;
|
||||
mc->use_virtcon = 1;
|
||||
mc->no_floppy = 1;
|
||||
mc->no_cdrom = 1;
|
||||
mc->no_sdcard = 1;
|
||||
mc->is_default = 1;
|
||||
nc->nmi_monitor_handler = s390_nmi;
|
||||
}
|
||||
|
||||
static const TypeInfo s390_machine_info = {
|
||||
.name = TYPE_S390_MACHINE,
|
||||
.parent = TYPE_MACHINE,
|
||||
.class_init = s390_machine_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_NMI },
|
||||
{ }
|
||||
},
|
||||
};
|
||||
|
||||
static void s390_machine_register_types(void)
|
||||
{
|
||||
type_register_static(&s390_machine_info);
|
||||
}
|
||||
|
||||
type_init(s390_machine_register_types)
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef HW_S390_VIRTIO_H
|
||||
#define HW_S390_VIRTIO_H 1
|
||||
|
||||
#include "hw/nmi.h"
|
||||
|
||||
#define KVM_S390_VIRTIO_NOTIFY 0
|
||||
#define KVM_S390_VIRTIO_RESET 1
|
||||
#define KVM_S390_VIRTIO_SET_STATUS 2
|
||||
|
@ -26,4 +28,5 @@ void s390_init_ipl_dev(const char *kernel_filename,
|
|||
const char *initrd_filename,
|
||||
const char *firmware);
|
||||
void s390_create_virtio_net(BusState *bus, const char *name);
|
||||
void s390_nmi(NMIState *n, int cpu_index, Error **errp);
|
||||
#endif
|
||||
|
|
|
@ -792,6 +792,7 @@ static void rtc_reset(void *opaque)
|
|||
#ifdef TARGET_I386
|
||||
if (s->lost_tick_policy == LOST_TICK_POLICY_SLEW) {
|
||||
s->irq_coalesced = 0;
|
||||
s->irq_reinject_on_ack_count = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue