Skip to contentSkip to conversation

pseries: Further updates

PATCH Applied David Gibson 2 participants 7 messages Aug 11, 2011 – Sep 2, 2011

lore
Share & tools
lore
#0 lore raw

cover pseries: Further updates

Hi Alex,

Here are a couple of extra pseries patches to add on to the ones you already have in your queue. One is trivial, the other adds a new feature.

#1 lore raw

PATCH 1/2 pseries: use macro for firmware filename

From: Nishanth Aravamudan <[email protected]>

For some time we've had a nicely defined macro with the filename for our firmware image. However we didn't actually use it in the place we're supposed to. This patch fixes it.

---
 hw/spapr.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/spapr.c +1 -1
index 7030c17..3f4433c 100644
@@ -435,7 +435,7 @@ static void ppc_spapr_init(ram_addr_t ram_size,
                     "%ldM guest RAM\n", MIN_RAM_SLOF);
             exit(1);
         }
-        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, "slof.bin");
+        filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, FW_FILE_NAME);
         fw_size = load_image_targphys(filename, 0, FW_MAX_SIZE);
         if (fw_size < 0) {
             hw_error("qemu: could not load LPAR rtas '%s'\n", filename);
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] pseries: use macro for firmware filename

Quoted 8 lines · David Gibson

From: Nishanth Aravamudan <[email protected]>

For some time we've had a nicely defined macro with the filename for our firmware image. However we didn't actually use it in the place we're supposed to. This patch fixes it.

Thanks, applied.

Alex

#3 lore raw

PATCH 2/2 pseries: Implement hcall-bulk hypervisor interface

In reply to David Gibson

This patch adds support for the H_REMOVE_BULK hypercall on the pseries machine. Strictly speaking this isn't necessarym since the kernel will only attempt to use this if hcall-bulk is advertised in the device tree, which previously it was not.

Adding this support may give a marginal performance increase, but more importantly it reduces the differences between the emulated machine and an existing PowerVM or kvm system, both of which already implement hcall-bulk.

---
 hw/spapr.c       |    2 +-
 hw/spapr_hcall.c |  122 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 111 insertions(+), 13 deletions(-)
hw/spapr.c +1 -1
index 3f4433c..0db1051 100644
@@ -72,7 +72,7 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
     uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size);
     uint32_t pft_size_prop[] = {0, cpu_to_be32(hash_shift)};
     char hypertas_prop[] = "hcall-pft\0hcall-term\0hcall-dabr\0hcall-interrupt"
-        "\0hcall-tce\0hcall-vio\0hcall-splpar";
+        "\0hcall-tce\0hcall-vio\0hcall-splpar\0hcall-bulk";
     uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)};
     int i;
     char *modelname;
hw/spapr_hcall.c +110 -12

150 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] pseries: Implement hcall-bulk hypervisor interface

Quoted 119 lines · David Gibson

This patch adds support for the H_REMOVE_BULK hypercall on the pseries machine. Strictly speaking this isn't necessarym since the kernel will only attempt to use this if hcall-bulk is advertised in the device tree, which previously it was not.

Adding this support may give a marginal performance increase, but more importantly it reduces the differences between the emulated machine and an existing PowerVM or kvm system, both of which already implement hcall-bulk.

---
hw/spapr.c | 2 +-
hw/spapr_hcall.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++-----

2 files changed, 111 insertions(+), 13 deletions(-)
hw/spapr.c +1 -1
index 3f4433c..0db1051 100644
@@ -72,7 +72,7 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
    uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size);
    uint32_t pft_size_prop[] = {0, cpu_to_be32(hash_shift)};
    char hypertas_prop[] = "hcall-pft\0hcall-term\0hcall-dabr\0hcall-interrupt"
-        "\0hcall-tce\0hcall-vio\0hcall-splpar";
+        "\0hcall-tce\0hcall-vio\0hcall-splpar\0hcall-bulk";
    uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)};
    int i;
    char *modelname;
hw/spapr_hcall.c +53 -12
index 0c61c10..9ac42ee 100644
@@ -174,20 +174,25 @@ static target_ulong h_enter(CPUState *env, sPAPREnvironment *spapr,
    return H_SUCCESS;
 }
 
-static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr,
-                             target_ulong opcode, target_ulong *args)
+enum {
+    REMOVE_SUCCESS = 0,
+    REMOVE_NOT_FOUND = 1,
+    REMOVE_PARM = 2,
+    REMOVE_HW = 3,
+};
+
+static target_ulong remove_hpte(CPUState *env, target_ulong ptex, target_ulong avpn,
+                                target_ulong flags,
+                                target_ulong *vp, target_ulong *rp)
 {
-    target_ulong flags = args[0];
-    target_ulong pte_index = args[1];
-    target_ulong avpn = args[2];
    uint8_t *hpte;
    target_ulong v, r, rb;
 
-    if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {
-        return H_PARAMETER;
+    if ((ptex * HASH_PTE_SIZE_64) & ~env->htab_mask) {
+        return REMOVE_PARM;
    }
 
-    hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64);
+    hpte = env->external_htab + (ptex * HASH_PTE_SIZE_64);
    while (!lock_hpte(hpte, HPTE_V_HVLOCK)) {
        /* We have no real concurrency in qemu soft-emulation, so we
         * will never actually have a contested lock */
@@ -202,14 +207,104 @@ static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr,
        ((flags & H_ANDCOND) && (v & avpn) != 0)) {
        stq_p(hpte, v & ~HPTE_V_HVLOCK);
        assert(!(ldq_p(hpte) & HPTE_V_HVLOCK));
-        return H_NOT_FOUND;
+        return REMOVE_NOT_FOUND;
    }
-    args[0] = v & ~HPTE_V_HVLOCK;
-    args[1] = r;
+    *vp = v & ~HPTE_V_HVLOCK;
+    *rp = r;
    stq_p(hpte, 0);
-    rb = compute_tlbie_rb(v, r, pte_index);
+    rb = compute_tlbie_rb(v, r, ptex);
    ppc_tlb_invalidate_one(env, rb);
    assert(!(ldq_p(hpte) & HPTE_V_HVLOCK));
+    return REMOVE_SUCCESS;
+}
+
+static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr,
+                             target_ulong opcode, target_ulong *args)
+{
+    target_ulong flags = args[0];
+    target_ulong pte_index = args[1];
+    target_ulong avpn = args[2];
+    int ret;
+
+    ret = remove_hpte(env, pte_index, avpn, flags,
+                      &args[0], &args[1]);
+
+    switch (ret) {
+    case REMOVE_SUCCESS:
+        return H_SUCCESS;
+        
+    case REMOVE_NOT_FOUND:
+        return H_NOT_FOUND;
+
+    case REMOVE_PARM:
+        return H_PARAMETER;
+
+    case REMOVE_HW:
+        return H_HARDWARE;
+    }
+
+    assert(0);
+}
+
+#define H_BULK_REMOVE_TYPE             0xc000000000000000ULL
+#define   H_BULK_REMOVE_REQUEST        0x4000000000000000ULL
+#define   H_BULK_REMOVE_RESPONSE       0x8000000000000000ULL
+#define   H_BULK_REMOVE_END            0xc000000000000000ULL
+#define H_BULK_REMOVE_CODE             0x3000000000000000ULL

hw/spapr_hcall.c static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr, · line 263

Quoted 10 lines
hw/spapr_hcall.c +10 -0
+#define   H_BULK_REMOVE_SUCCESS        0x0000000000000000ULL
+#define   H_BULK_REMOVE_NOT_FOUND      0x1000000000000000ULL
+#define   H_BULK_REMOVE_PARM           0x2000000000000000ULL
+#define   H_BULK_REMOVE_HW             0x3000000000000000ULL
+#define H_BULK_REMOVE_RC               0x0c00000000000000ULL
+#define H_BULK_REMOVE_FLAGS            0x0300000000000000ULL
+#define   H_BULK_REMOVE_ABSOLUTE       0x0000000000000000ULL
+#define   H_BULK_REMOVE_ANDCOND        0x0100000000000000ULL
+#define   H_BULK_REMOVE_AVPN           0x0200000000000000ULL
+#define H_BULK_REMOVE_PTEX             0x00ffffffffffffffULL

indenting looks broken.

hw/spapr_hcall.c static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr, · line 272

Quoted 9 lines
hw/spapr_hcall.c +9 -0
+
+static target_ulong h_bulk_remove(CPUState *env, sPAPREnvironment *spapr,
+                                  target_ulong opcode, target_ulong *args)
+{
+    int i;
+
+    for (i = 0; i < 4; i++) {
+        target_ulong *tsh = &args[i*2];
+        target_ulong tsl = args[i*2 + 1];

Mind to replace all those magic numbers by something more verbose?

Alex

#5 lore raw

Re: [Qemu-devel] [PATCH 2/2] pseries: Implement hcall-bulk hypervisor interface

Quoted 1 line · Alexander Graf

On 11.08.2011, at 04:36, David Gibson wrote:

[snip]

Quoted 9 lines
Quoted 9 lines
(quoted diff) +9 -0
+#define H_BULK_REMOVE_TYPE             0xc000000000000000ULL
+#define   H_BULK_REMOVE_REQUEST        0x4000000000000000ULL
+#define   H_BULK_REMOVE_RESPONSE       0x8000000000000000ULL
+#define   H_BULK_REMOVE_END            0xc000000000000000ULL
+#define H_BULK_REMOVE_CODE             0x3000000000000000ULL
+#define   H_BULK_REMOVE_SUCCESS        0x0000000000000000ULL
+#define   H_BULK_REMOVE_NOT_FOUND      0x1000000000000000ULL
+#define   H_BULK_REMOVE_PARM           0x2000000000000000ULL
+#define   H_BULK_REMOVE_HW             0x3000000000000000ULL
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+#define H_BULK_REMOVE_RC               0x0c00000000000000ULL
+#define H_BULK_REMOVE_FLAGS            0x0300000000000000ULL
+#define   H_BULK_REMOVE_ABSOLUTE       0x0000000000000000ULL
+#define   H_BULK_REMOVE_ANDCOND        0x0100000000000000ULL
+#define   H_BULK_REMOVE_AVPN           0x0200000000000000ULL
+#define H_BULK_REMOVE_PTEX             0x00ffffffffffffffULL

indenting looks broken.

Nope, that's intended. The unindented ones are the field masks in the parameter, the intended ones are the defined values for the corresponding field.

Quoted 11 lines

Review

Quoted 9 lines
(quoted diff) +9 -0
+
+static target_ulong h_bulk_remove(CPUState *env, sPAPREnvironment *spapr,
+                                  target_ulong opcode, target_ulong *args)
+{
+    int i;
+
+    for (i = 0; i < 4; i++) {
+        target_ulong *tsh = &args[i*2];
+        target_ulong tsl = args[i*2 + 1];

Mind to replace all those magic numbers by something more verbose?

So, "all those" == 2. I can replace the 4 with something I guess, but changing the 2 would just be silly - that code is just taking the arguments a pair at a time.

Revised patch below.

Quoted 1 line

From e1da8cc05498d471908e8461346c403874496427 Mon Sep 17 00:00:00 2001

From: David Gibson <[email protected]>
Date: Mon, 8 Aug 2011 14:07:12 +1000
Subject: [PATCH] pseries: Implement hcall-bulk hypervisor interface

This patch adds support for the H_REMOVE_BULK hypercall on the pseries machine. Strictly speaking this isn't necessarym since the kernel will only attempt to use this if hcall-bulk is advertised in the device tree, which previously it was not.

Adding this support may give a marginal performance increase, but more importantly it reduces the differences between the emulated machine and an existing PowerVM or kvm system, both of which already implement hcall-bulk.

---
 hw/spapr.c       |    2 +-
 hw/spapr_hcall.c |  124 ++++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 113 insertions(+), 13 deletions(-)
hw/spapr.c +1 -1
index de45487..2e71b58 100644
@@ -72,7 +72,7 @@ static void *spapr_create_fdt_skel(const char *cpu_model,
     uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size);
     uint32_t pft_size_prop[] = {0, cpu_to_be32(hash_shift)};
     char hypertas_prop[] = "hcall-pft\0hcall-term\0hcall-dabr\0hcall-interrupt"
-        "\0hcall-tce\0hcall-vio\0hcall-splpar";
+        "\0hcall-tce\0hcall-vio\0hcall-splpar\0hcall-bulk";
     uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)};
     int i;
     char *modelname;
hw/spapr_hcall.c +112 -12

152 lines not on this page · raw message

Signature · 10 lines
1.7.5.4




-- 
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
#6 lore raw

Re: [Qemu-devel] [PATCH 2/2] pseries: Implement hcall-bulk hypervisor interface

Quoted 19 lines · David Gibson
Quoted 1 line · Alexander Graf

On 11.08.2011, at 04:36, David Gibson wrote:

[snip]

Quoted 8 lines
Quoted 8 lines
hw/spapr_hcall.c +8 -0
+#define H_BULK_REMOVE_TYPE             0xc000000000000000ULL
+#define   H_BULK_REMOVE_REQUEST        0x4000000000000000ULL
+#define   H_BULK_REMOVE_RESPONSE       0x8000000000000000ULL
+#define   H_BULK_REMOVE_END            0xc000000000000000ULL
+#define H_BULK_REMOVE_CODE             0x3000000000000000ULL
+#define   H_BULK_REMOVE_SUCCESS        0x0000000000000000ULL
+#define   H_BULK_REMOVE_NOT_FOUND      0x1000000000000000ULL
+#define   H_BULK_REMOVE_PARM           0x2000000000000000ULL
Quoted 8 lines

hw/spapr_hcall.c static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr, · line 263

Quoted 7 lines
hw/spapr_hcall.c +7 -0
+#define   H_BULK_REMOVE_HW             0x3000000000000000ULL
+#define H_BULK_REMOVE_RC               0x0c00000000000000ULL
+#define H_BULK_REMOVE_FLAGS            0x0300000000000000ULL
+#define   H_BULK_REMOVE_ABSOLUTE       0x0000000000000000ULL
+#define   H_BULK_REMOVE_ANDCOND        0x0100000000000000ULL
+#define   H_BULK_REMOVE_AVPN           0x0200000000000000ULL
+#define H_BULK_REMOVE_PTEX             0x00ffffffffffffffULL

indenting looks broken.

Quoted 3 lines

Nope, that's intended. The unindented ones are the field masks in the parameter, the intended ones are the defined values for the corresponding field.

Interesting :). Makes sense now that you explain it - looked awkward at first.

Quoted 10 lines
Quoted 10 lines

hw/spapr_hcall.c static target_ulong h_remove(CPUState *env, sPAPREnvironment *spapr, · line 274

Quoted 9 lines
hw/spapr_hcall.c +9 -0
+
+static target_ulong h_bulk_remove(CPUState *env, sPAPREnvironment *spapr,
+                                  target_ulong opcode, target_ulong *args)
+{
+    int i;
+
+    for (i = 0; i<  4; i++) {
+        target_ulong *tsh =&args[i*2];
+        target_ulong tsl = args[i*2 + 1];

Mind to replace all those magic numbers by something more verbose?

Quoted 3 lines

So, "all those" == 2. I can replace the 4 with something I guess, but changing the 2 would just be silly - that code is just taking the arguments a pair at a time.

Yup. Thanks! Applied.

Alex