Skip to contentSkip to conversation

spapr: Small PAPR compliance fixes

PATCH Applied Sam Bobroff 3 participants 8 messages Jul 3, 2015 – Jul 20, 2015

lore
Share & tools
lore
#0 lore raw

cover spapr: Small PAPR compliance fixes

This patch set contains several small fixes to make QEMU more PAPR compliant.

Sam Bobroff (4):
spapr: Add /ibm,partition-name
spapr: Add /rtas/ibm,change-msix-capable
spapr: Make ibm,change-msi respect 3 return values
spapr: SPLPAR Characteristics

 hw/ppc/spapr.c      |  9 +++++++++
 hw/ppc/spapr_pci.c  |  4 +++-
 hw/ppc/spapr_rtas.c | 11 +++++++++--
 3 files changed, 21 insertions(+), 3 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/4 spapr: Add /ibm,partition-name

QEMU has a notion of the guest name, so if it's present we might as well put that into the device tree as /ibm,partition-name.

This is specificed by PAPR.

---
 hw/ppc/spapr.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/ppc/spapr.c +5 -0
index 0487f52..603f517 100644
@@ -384,6 +384,11 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
     _FDT((fdt_property_string(fdt, "vm,uuid", buf)));
     g_free(buf);
 
+    if (qemu_get_vm_name()) {
+        _FDT((fdt_property_string(fdt, "ibm,partition-name",
+                                  qemu_get_vm_name())));
+    }
+
     _FDT((fdt_property_cell(fdt, "#address-cells", 0x2)));
     _FDT((fdt_property_cell(fdt, "#size-cells", 0x2)));
 
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/4 spapr: Add /rtas/ibm,change-msix-capable

In reply to Sam Bobroff

QEMU is MSI-X capable and makes it available via ibm,change-msi, so we should indicate this by adding /rtas/ibm,change-msix-capable to the device tree.

This is specificed by PAPR.

---
 hw/ppc/spapr.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/ppc/spapr.c +4 -0
index 603f517..6801724 100644
@@ -543,6 +543,10 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
 
     _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MAX)));
 
+    if (msi_supported) {
+        _FDT((fdt_property(fdt, "ibm,change-msix-capable", NULL, 0)));
+    }
+
     /*
      * According to PAPR, rtas ibm,os-term does not guarantee a return
      * back to the guest cpu.
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/4 spapr: Make ibm, change-msi respect 3 return values

In reply to Sam Bobroff

Currently, rtas_ibm_change_msi() always returns four values even if less are specified.

Correct this by only returning the fourth parameter if it was requested.

This is specified by PAPR.

---
 hw/ppc/spapr_pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ppc/spapr_pci.c +3 -1
index 05f4fac..f422e3b 100644
@@ -360,7 +360,9 @@ out:
     rtas_st(rets, 0, RTAS_OUT_SUCCESS);
     rtas_st(rets, 1, req_num);
     rtas_st(rets, 2, ++seq_num);
-    rtas_st(rets, 3, ret_intr_type);
+    if (nret > 3) {
+        rtas_st(rets, 3, ret_intr_type);
+    }
 
     trace_spapr_pci_rtas_ibm_change_msi(config_addr, func, req_num, irq);
 }
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/4 spapr: SPLPAR Characteristics

In reply to Sam Bobroff

Improve the SPLPAR Characteristics information:

Add MaxPlatProcs: set to max_cpus, the maximum CPUs that could be addded to the system.
Add DesMem: set to the initial memory of the system. Add DesProcs: set to smp_cpus, the inital number of CPUs in the system.

These tokens and values are specified by PAPR.

---
 hw/ppc/spapr_rtas.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
hw/ppc/spapr_rtas.c +9 -2
index 0f1ae55..a08254b 100644
@@ -33,6 +33,7 @@
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
 #include "qapi-event.h"
+#include "hw/boards.h"
 
 #include <libfdt.h>
 
@@ -190,8 +191,14 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu,
 
     switch (parameter) {
     case RTAS_SYSPARM_SPLPAR_CHARACTERISTICS: {
-        char *param_val = g_strdup_printf("MaxEntCap=%d,MaxPlatProcs=%d",
-                                          max_cpus, smp_cpus);
+        char *param_val = g_strdup_printf("MaxEntCap=%d,"
+                                          "DesMem=%lu,"
+                                          "DesProcs=%d,"
+                                          "MaxPlatProcs=%d",
+                                          max_cpus,
+                                          current_machine->ram_size / 1024 / 1024,
+                                          smp_cpus,
+                                          max_cpus);
         rtas_st_buffer(buffer, length, (uint8_t *)param_val, strlen(param_val));
         g_free(param_val);
         break;
Signature · 1 line
2.1.4
#5 lore raw

Re: [Qemu-devel] [PATCH 4/4] spapr: SPLPAR Characteristics

Quoted 29 lines · Sam Bobroff

Improve the SPLPAR Characteristics information:

Add MaxPlatProcs: set to max_cpus, the maximum CPUs that could be addded to the system.
Add DesMem: set to the initial memory of the system. Add DesProcs: set to smp_cpus, the inital number of CPUs in the system.

These tokens and values are specified by PAPR.

---
 hw/ppc/spapr_rtas.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
hw/ppc/spapr_rtas.c +1 -0
index 0f1ae55..a08254b 100644
@@ -33,6 +33,7 @@
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
 #include "qapi-event.h"
+#include "hw/boards.h"
 
 #include <libfdt.h>
 
@@ -190,8 +191,14 @@ static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu,
 

hw/ppc/spapr_rtas.c static void rtas_ibm_get_system_parameter(PowerPCCPU *cpu, · line 199

Quoted 10 lines
hw/ppc/spapr_rtas.c +6 -2
     switch (parameter) {
     case RTAS_SYSPARM_SPLPAR_CHARACTERISTICS: {
-        char *param_val = g_strdup_printf("MaxEntCap=%d,MaxPlatProcs=%d",
-                                          max_cpus, smp_cpus);
+        char *param_val = g_strdup_printf("MaxEntCap=%d,"
+                                          "DesMem=%lu,"
+                                          "DesProcs=%d,"
+                                          "MaxPlatProcs=%d",
+                                          max_cpus,
+                                          current_machine->ram_size / 1024 / 1024,

May be you could use M_BYTE definition from qemu-common.h ?

Regards,
Bharata.

Applied
#6 lore raw
In reply to Sam Bobroff
Quoted 3 lines · Sam Bobroff

This patch set contains several small fixes to make QEMU more PAPR compliant.

Applied to spapr-next, thanks.

In future, please CC me on PAPR related patches - otherwise I'm likely to lose them in the flood of qemu-devel.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#7 lore raw
Quoted 9 lines · David Gibson
Quoted 3 lines · Sam Bobroff

This patch set contains several small fixes to make QEMU more PAPR compliant.

Applied to spapr-next, thanks.

In future, please CC me on PAPR related patches - otherwise I'm likely to lose them in the flood of qemu-devel.

Thanks!

And regarding the CC: yes, will do.

Cheers,
Sam.