Skip to content

Commit 1e6c50a

Browse files
committed
Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-5.1-20200720' into staging
ppc patch queue 20200720 Here are some assorted fixes for qemu-5.1: * SLOF update with improved TPM handling, and fix for possible stack overflows on many-vcpu machines * Fix for NUMA distances on NVLink2 attached GPU memory nodes * Fixes to fail more gracefully on attempting to plug unsupported PCI bridge types * Don't allow pnv-psi device to be user created # gpg: Signature made Mon 20 Jul 2020 06:29:21 BST # gpg: using RSA key 75F46586AE61A66CC44E87DC6C38CACA20D9B392 # gpg: Good signature from "David Gibson <[email protected]>" [full] # gpg: aka "David Gibson (Red Hat) <[email protected]>" [full] # gpg: aka "David Gibson (ozlabs.org) <[email protected]>" [full] # gpg: aka "David Gibson (kernel.org) <[email protected]>" [unknown] # Primary key fingerprint: 75F4 6586 AE61 A66C C44E 87DC 6C38 CACA 20D9 B392 * remotes/dgibson/tags/ppc-for-5.1-20200720: pseries: Update SLOF firmware image spapr: Add a new level of NUMA for GPUs spapr_pci: Robustify support of PCI bridges ppc/pnv: Make PSI device types not user creatable Signed-off-by: Peter Maydell <[email protected]>
2 parents 873ec69 + b25fbd6 commit 1e6c50a

File tree

9 files changed

+90
-7
lines changed

9 files changed

+90
-7
lines changed

hw/ppc/pnv_psi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ static void pnv_psi_class_init(ObjectClass *klass, void *data)
929929
dc->desc = "PowerNV PSI Controller";
930930
device_class_set_props(dc, pnv_psi_properties);
931931
dc->reset = pnv_psi_reset;
932+
dc->user_creatable = false;
932933
}
933934

934935
static const TypeInfo pnv_psi_info = {

hw/ppc/spapr.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,16 @@ static int spapr_dt_rng(void *fdt)
890890
static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)
891891
{
892892
MachineState *ms = MACHINE(spapr);
893+
SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(ms);
893894
int rtas;
894895
GString *hypertas = g_string_sized_new(256);
895896
GString *qemu_hypertas = g_string_sized_new(256);
896-
uint32_t refpoints[] = { cpu_to_be32(0x4), cpu_to_be32(0x4) };
897+
uint32_t refpoints[] = {
898+
cpu_to_be32(0x4),
899+
cpu_to_be32(0x4),
900+
cpu_to_be32(0x2),
901+
};
902+
uint32_t nr_refpoints = ARRAY_SIZE(refpoints);
897903
uint64_t max_device_addr = MACHINE(spapr)->device_memory->base +
898904
memory_region_size(&MACHINE(spapr)->device_memory->mr);
899905
uint32_t lrdr_capacity[] = {
@@ -945,8 +951,12 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)
945951
qemu_hypertas->str, qemu_hypertas->len));
946952
g_string_free(qemu_hypertas, TRUE);
947953

954+
if (smc->pre_5_1_assoc_refpoints) {
955+
nr_refpoints = 2;
956+
}
957+
948958
_FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points",
949-
refpoints, sizeof(refpoints)));
959+
refpoints, nr_refpoints * sizeof(refpoints[0])));
950960

951961
_FDT(fdt_setprop(fdt, rtas, "ibm,max-associativity-domains",
952962
maxdomains, sizeof(maxdomains)));
@@ -4584,9 +4594,16 @@ DEFINE_SPAPR_MACHINE(5_1, "5.1", true);
45844594
*/
45854595
static void spapr_machine_5_0_class_options(MachineClass *mc)
45864596
{
4597+
SpaprMachineClass *smc = SPAPR_MACHINE_CLASS(mc);
4598+
static GlobalProperty compat[] = {
4599+
{ TYPE_SPAPR_PCI_HOST_BRIDGE, "pre-5.1-associativity", "on" },
4600+
};
4601+
45874602
spapr_machine_5_1_class_options(mc);
45884603
compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len);
4604+
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
45894605
mc->numa_mem_supported = true;
4606+
smc->pre_5_1_assoc_refpoints = true;
45904607
}
45914608

45924609
DEFINE_SPAPR_MACHINE(5_0, "5.0", false);

hw/ppc/spapr_pci.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,57 @@ static void spapr_pci_bridge_plug(SpaprPhbState *phb,
14801480
add_drcs(phb, bus);
14811481
}
14821482

1483+
/* Returns non-zero if the value of "chassis_nr" is already in use */
1484+
static int check_chassis_nr(Object *obj, void *opaque)
1485+
{
1486+
int new_chassis_nr =
1487+
object_property_get_uint(opaque, "chassis_nr", &error_abort);
1488+
int chassis_nr =
1489+
object_property_get_uint(obj, "chassis_nr", NULL);
1490+
1491+
if (!object_dynamic_cast(obj, TYPE_PCI_BRIDGE)) {
1492+
return 0;
1493+
}
1494+
1495+
/* Skip unsupported bridge types */
1496+
if (!chassis_nr) {
1497+
return 0;
1498+
}
1499+
1500+
/* Skip self */
1501+
if (obj == opaque) {
1502+
return 0;
1503+
}
1504+
1505+
return chassis_nr == new_chassis_nr;
1506+
}
1507+
1508+
static bool bridge_has_valid_chassis_nr(Object *bridge, Error **errp)
1509+
{
1510+
int chassis_nr =
1511+
object_property_get_uint(bridge, "chassis_nr", NULL);
1512+
1513+
/*
1514+
* slotid_cap_init() already ensures that "chassis_nr" isn't null for
1515+
* standard PCI bridges, so this really tells if "chassis_nr" is present
1516+
* or not.
1517+
*/
1518+
if (!chassis_nr) {
1519+
error_setg(errp, "PCI Bridge lacks a \"chassis_nr\" property");
1520+
error_append_hint(errp, "Try -device pci-bridge instead.\n");
1521+
return false;
1522+
}
1523+
1524+
/* We want unique values for "chassis_nr" */
1525+
if (object_child_foreach_recursive(object_get_root(), check_chassis_nr,
1526+
bridge)) {
1527+
error_setg(errp, "Bridge chassis %d already in use", chassis_nr);
1528+
return false;
1529+
}
1530+
1531+
return true;
1532+
}
1533+
14831534
static void spapr_pci_plug(HotplugHandler *plug_handler,
14841535
DeviceState *plugged_dev, Error **errp)
14851536
{
@@ -1508,6 +1559,9 @@ static void spapr_pci_plug(HotplugHandler *plug_handler,
15081559
g_assert(drc);
15091560

15101561
if (pc->is_bridge) {
1562+
if (!bridge_has_valid_chassis_nr(OBJECT(plugged_dev), errp)) {
1563+
return;
1564+
}
15111565
spapr_pci_bridge_plug(phb, PCI_BRIDGE(plugged_dev));
15121566
}
15131567

@@ -2035,6 +2089,8 @@ static Property spapr_phb_properties[] = {
20352089
pcie_ecs, true),
20362090
DEFINE_PROP_UINT64("gpa", SpaprPhbState, nv2_gpa_win_addr, 0),
20372091
DEFINE_PROP_UINT64("atsd", SpaprPhbState, nv2_atsd_win_addr, 0),
2092+
DEFINE_PROP_BOOL("pre-5.1-associativity", SpaprPhbState,
2093+
pre_5_1_assoc, false),
20382094
DEFINE_PROP_END_OF_LIST(),
20392095
};
20402096

hw/ppc/spapr_pci_nvlink2.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt)
362362
&error_abort);
363363
uint32_t associativity[] = {
364364
cpu_to_be32(0x4),
365-
SPAPR_GPU_NUMA_ID,
366-
SPAPR_GPU_NUMA_ID,
367-
SPAPR_GPU_NUMA_ID,
365+
cpu_to_be32(nvslot->numa_id),
366+
cpu_to_be32(nvslot->numa_id),
367+
cpu_to_be32(nvslot->numa_id),
368368
cpu_to_be32(nvslot->numa_id)
369369
};
370370
uint64_t size = object_property_get_uint(nv_mrobj, "size", NULL);
@@ -375,6 +375,13 @@ void spapr_phb_nvgpu_ram_populate_dt(SpaprPhbState *sphb, void *fdt)
375375
_FDT(off);
376376
_FDT((fdt_setprop_string(fdt, off, "device_type", "memory")));
377377
_FDT((fdt_setprop(fdt, off, "reg", mem_reg, sizeof(mem_reg))));
378+
379+
if (sphb->pre_5_1_assoc) {
380+
associativity[1] = SPAPR_GPU_NUMA_ID;
381+
associativity[2] = SPAPR_GPU_NUMA_ID;
382+
associativity[3] = SPAPR_GPU_NUMA_ID;
383+
}
384+
378385
_FDT((fdt_setprop(fdt, off, "ibm,associativity", associativity,
379386
sizeof(associativity))));
380387

include/hw/pci-host/spapr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct SpaprPhbState {
9494
hwaddr nv2_gpa_win_addr;
9595
hwaddr nv2_atsd_win_addr;
9696
SpaprPhbPciNvGpuConfig *nvgpus;
97+
bool pre_5_1_assoc;
9798
};
9899

99100
#define SPAPR_PCI_MEM_WIN_BUS_OFFSET 0x80000000ULL

include/hw/ppc/spapr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct SpaprMachineClass {
129129
bool linux_pci_probe;
130130
bool smp_threads_vsmt; /* set VSMT to smp_threads by default */
131131
hwaddr rma_limit; /* clamp the RMA to this size */
132+
bool pre_5_1_assoc_refpoints;
132133

133134
void (*phb_placement)(SpaprMachineState *spapr, uint32_t index,
134135
uint64_t *buid, hwaddr *pio,

pc-bios/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
- SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware
1515
implementation for certain IBM POWER hardware. The sources are at
1616
https://github.com/aik/SLOF, and the image currently in qemu is
17-
built from git tag qemu-slof-20200327.
17+
built from git tag qemu-slof-20200717.
1818

1919
- sgabios (the Serial Graphics Adapter option ROM) provides a means for
2020
legacy x86 software to communicate with an attached serial console as

pc-bios/slof.bin

3.18 KB
Binary file not shown.

roms/SLOF

Submodule SLOF updated from 8e012d6 to e18ddad

0 commit comments

Comments
 (0)