[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [RFC PATCH 07/15] spapr: enable PHB hotplug for pseries-2.4
From: |
Michael Roth |
Subject: |
[Qemu-ppc] [RFC PATCH 07/15] spapr: enable PHB hotplug for pseries-2.4 |
Date: |
Wed, 29 Apr 2015 14:20:16 -0500 |
Introduce an sPAPRMachineClass sub-class of MachineClass to
handle sPAPR-specific machine configuration properties.
The 'dr_phb_enabled' field of that class can be set as
part of machine-specific init code, and is then propagated
to sPAPREnvironment to conditionally enable creation of DRC
objects and device-tree description to facilitate hotplug
of PHBs.
Since we can't migrate this state to older machine types,
default the option to false and only enable it for new
machine types.
Signed-off-by: Michael Roth <address@hidden>
---
hw/ppc/spapr.c | 24 ++++++++++++++++++++++++
include/hw/ppc/spapr.h | 1 +
2 files changed, 25 insertions(+)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 837b36d..c8ad5b0 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -90,11 +90,27 @@
#define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift))
+typedef struct sPAPRMachineClass sPAPRMachineClass;
typedef struct sPAPRMachineState sPAPRMachineState;
#define TYPE_SPAPR_MACHINE "spapr-machine"
#define SPAPR_MACHINE(obj) \
OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE)
+#define SPAPR_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(sPAPRMachineClass, obj, TYPE_SPAPR_MACHINE)
+#define SPAPR_MACHINE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(sPAPRMachineClass, klass, TYPE_SPAPR_MACHINE)
+
+/**
+ * sPAPRMachineClass:
+ */
+struct sPAPRMachineClass {
+ /*< private >*/
+ MachineClass parent_class;
+
+ /*< public >*/
+ bool dr_phb_enabled; /* enable dynamic-reconfig/hotplug of PHBs */
+};
/**
* sPAPRMachineState:
@@ -1374,6 +1390,7 @@ static SaveVMHandlers savevm_htab_handlers = {
/* pSeries LPAR / sPAPR hardware init */
static void ppc_spapr_init(MachineState *machine)
{
+ sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
ram_addr_t ram_size = machine->ram_size;
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = machine->kernel_filename;
@@ -1542,6 +1559,8 @@ static void ppc_spapr_init(MachineState *machine)
/* We always have at least the nvram device on VIO */
spapr_create_nvram(spapr);
+ spapr->dr_phb_enabled = smc->dr_phb_enabled;
+
/* Set up PCI */
spapr_pci_rtas_init();
@@ -1776,6 +1795,7 @@ static void spapr_nmi(NMIState *n, int cpu_index, Error
**errp)
static void spapr_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(oc);
FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc);
NMIClass *nc = NMI_CLASS(oc);
@@ -1787,6 +1807,7 @@ static void spapr_machine_class_init(ObjectClass *oc,
void *data)
mc->default_boot_order = NULL;
mc->kvm_type = spapr_kvm_type;
mc->has_dynamic_sysbus = true;
+ smc->dr_phb_enabled = false;
fwc->get_dev_path = spapr_get_fw_dev_path;
nc->nmi_monitor_handler = spapr_nmi;
@@ -1798,6 +1819,7 @@ static const TypeInfo spapr_machine_info = {
.abstract = true,
.instance_size = sizeof(sPAPRMachineState),
.instance_init = spapr_machine_initfn,
+ .class_size = sizeof(sPAPRMachineClass),
.class_init = spapr_machine_class_init,
.interfaces = (InterfaceInfo[]) {
{ TYPE_FW_PATH_PROVIDER },
@@ -1887,11 +1909,13 @@ static const TypeInfo spapr_machine_2_3_info = {
static void spapr_machine_2_4_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
+ sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(oc);
mc->name = "pseries-2.4";
mc->desc = "pSeries Logical Partition (PAPR compliant) v2.4";
mc->alias = "pseries";
mc->is_default = 1;
+ smc->dr_phb_enabled = true;
}
static const TypeInfo spapr_machine_2_4_info = {
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 3ea0c5b..be8973e 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -33,6 +33,7 @@ typedef struct sPAPREnvironment {
uint64_t rtc_offset; /* Now used only during incoming migration */
struct PPCTimebase tb;
bool has_graphics;
+ bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */
uint32_t check_exception_irq;
Notifier epow_notifier;
--
1.9.1
- Re: [Qemu-ppc] [RFC PATCH 02/15] qdev: store DeviceState's canonical path to use when unparenting, (continued)
- [Qemu-ppc] [RFC PATCH 05/15] spapr_pci: add PHB unrealize, Michael Roth, 2015/04/29
- [Qemu-ppc] [RFC PATCH 03/15] spapr_drc: pass object ownership to parent/owner, Michael Roth, 2015/04/29
- [Qemu-ppc] [RFC PATCH 04/15] spapr_iommu: pass object ownership to parent/owner, Michael Roth, 2015/04/29
- [Qemu-ppc] [RFC PATCH 06/15] spapr_pci: also use 'index' property as DRC index for PHBs, Michael Roth, 2015/04/29
- [Qemu-ppc] [RFC PATCH 07/15] spapr: enable PHB hotplug for pseries-2.4,
Michael Roth <=
- [Qemu-ppc] [RFC PATCH 08/15] spapr: create DR connectors for PHBs and register reset hooks, Michael Roth, 2015/04/29
- Re: [Qemu-ppc] [RFC PATCH 00/15] spapr: add support for PHB hotplug, Paolo Bonzini, 2015/04/30