Skip to contentSkip to conversation

Pending pseries patches

PATCH In review David Gibson 5 participants 57 messages Nov 13, 2012 – Nov 25, 2012

lore
Share & tools
lore
#0 lore raw

cover Pending pseries patches

Here again is my current set of outstanding pseries patches, updated for current upstream. I don't think any of these has changed in substance since their last posting. As explained last time around, some of the From/Signed-off-by combinations are a bit odd, but I think as accurate reflection of the patch's history as is possible.

Please apply.

#1 lore raw

PATCH 1/12 pseries: Fix incorrect initialization of interrupt controller

Currently in the reset code for the XICS interrupt controller, we initialize the pending_priority field to 0 (most favored, by XICS convention). This is incorrect, since there is no pending interrupt, it should be set to least favored - 0xff. At the moment our XICS implementation doesn't get hurt by this edge case, but it does confuse the upcoming kernel XICS implementation.

---
 hw/xics.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xics.c +1 -1
index 1da3106..edf5833 100644
@@ -495,7 +495,7 @@ static void xics_reset(void *opaque)
 
     for (i = 0; i < icp->nr_servers; i++) {
         icp->ss[i].xirr = 0;
-        icp->ss[i].pending_priority = 0;
+        icp->ss[i].pending_priority = 0xff;
         icp->ss[i].mfrr = 0xff;
         /* Make all outputs are deasserted */
         qemu_set_irq(icp->ss[i].output, 0);
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/12 pseries: Use #define for XICS base irq number

In reply to David Gibson

From: Ben Herrenschmidt <[email protected]>

Currently the lowest "real" irq number for the XICS irq controller (as opposed to numbers reserved for IPIs and other special purposes) is hard coded as 16 in two places - in xics_system_init() and in spapr.c.

As well as being generally bad practice, we're going to need to change this number soon to fit in with the in-kernel XICS implementation. This patch adds a #define for this number to avoid future breakage.

---
 hw/spapr.c |    2 +-
 hw/xics.c  |    2 +-
 hw/xics.h  |    1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
hw/spapr.c +1 -1
index ad3f0ea..eafee03 100644
@@ -801,7 +801,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
 
     /* Set up Interrupt Controller */
     spapr->icp = xics_system_init(XICS_IRQS);
-    spapr->next_irq = 16;
+    spapr->next_irq = XICS_IRQ_BASE;
 
     /* Set up EPOW events infrastructure */
     spapr_events_init(spapr);
hw/xics.c +1 -1
index edf5833..b8887cd 100644
@@ -549,7 +549,7 @@ struct icp_state *xics_system_init(int nr_irqs)
 
     ics = g_malloc0(sizeof(*ics));
     ics->nr_irqs = nr_irqs;
-    ics->offset = 16;
+    ics->offset = XICS_IRQ_BASE;
     ics->irqs = g_malloc0(nr_irqs * sizeof(struct ics_irq_state));
 
     icp->ics = ics;
hw/xics.h +1 -0
index 6817268..c3bf008 100644
@@ -28,6 +28,7 @@
 #define __XICS_H__
 
 #define XICS_IPI        0x2
+#define XICS_IRQ_BASE   0x10
 
 struct icp_state;
 
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/12 pseries: Move XICS initialization before cpu initialization

In reply to David Gibson

From: Ben Herrenschmidt <[email protected]>

Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.

---
 hw/spapr.c |   12 +++++++-----
 hw/xics.c  |   52 +++++++++++++++++++++++-----------------------------
 hw/xics.h  |    3 ++-
 3 files changed, 32 insertions(+), 35 deletions(-)
hw/spapr.c +7 -5
index eafee03..dc2349c 100644
@@ -747,6 +747,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
         spapr->htab_shift++;
     }
 
+    /* Set up Interrupt Controller before we create the VCPUs */
+    spapr->icp = xics_system_init(smp_cpus * kvmppc_smt_threads() / smp_threads,
+                                  XICS_IRQS);
+    spapr->next_irq = XICS_IRQ_BASE;
+
     /* init CPUs */
     if (cpu_model == NULL) {
         cpu_model = kvm_enabled() ? "host" : "POWER7";
@@ -759,6 +764,8 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
         }
         env = &cpu->env;
 
+        xics_cpu_setup(spapr->icp, env);
+
         /* Set time-base frequency to 512 MHz */
         cpu_ppc_tb_init(env, TIMEBASE_FREQ);
 
@@ -798,11 +805,6 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
     }
     g_free(filename);
 
-
-    /* Set up Interrupt Controller */
-    spapr->icp = xics_system_init(XICS_IRQS);
-    spapr->next_irq = XICS_IRQ_BASE;
-
     /* Set up EPOW events infrastructure */
     spapr_events_init(spapr);
 
hw/xics.c +23 -29

65 lines not on this page · raw message

hw/xics.h +2 -1
index c3bf008..b43678a 100644
@@ -35,6 +35,7 @@ struct icp_state;
 qemu_irq xics_get_qirq(struct icp_state *icp, int irq);
 void xics_set_irq_type(struct icp_state *icp, int irq, bool lsi);
 
-struct icp_state *xics_system_init(int nr_irqs);
+struct icp_state *xics_system_init(int nr_servers, int nr_irqs);
+void xics_cpu_setup(struct icp_state *icp, CPUPPCState *env);
 
 #endif /* __XICS_H__ */
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [Qemu-devel] [PATCH 03/12] pseries: Move XICS initialization before cpu initialization

Quoted 9 lines · David Gibson

From: Ben Herrenschmidt <[email protected]>

Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.

Does this still hold true with the new in-kernel interrupt controller workflow?

Alex

Quoted 133 lines

---

hw/spapr.c |   12 +++++++-----
hw/xics.c  |   52 +++++++++++++++++++++++-----------------------------
hw/xics.h  |    3 ++-
3 files changed, 32 insertions(+), 35 deletions(-)
hw/spapr.c +7 -5
index eafee03..dc2349c 100644
@@ -747,6 +747,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
        spapr->htab_shift++;
    }
 
+    /* Set up Interrupt Controller before we create the VCPUs */
+    spapr->icp = xics_system_init(smp_cpus * kvmppc_smt_threads() / smp_threads,
+                                  XICS_IRQS);
+    spapr->next_irq = XICS_IRQ_BASE;
+
    /* init CPUs */
    if (cpu_model == NULL) {
        cpu_model = kvm_enabled() ? "host" : "POWER7";
@@ -759,6 +764,8 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
        }
        env = &cpu->env;
 
+        xics_cpu_setup(spapr->icp, env);
+
        /* Set time-base frequency to 512 MHz */
        cpu_ppc_tb_init(env, TIMEBASE_FREQ);
 
@@ -798,11 +805,6 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
    }
    g_free(filename);
 
-
-    /* Set up Interrupt Controller */
-    spapr->icp = xics_system_init(XICS_IRQS);
-    spapr->next_irq = XICS_IRQ_BASE;
-
    /* Set up EPOW events infrastructure */
    spapr_events_init(spapr);
 
hw/xics.c +23 -29
index b8887cd..f72dfae 100644
@@ -510,42 +510,36 @@ static void xics_reset(void *opaque)
    }
 }
 
-struct icp_state *xics_system_init(int nr_irqs)
+void xics_cpu_setup(struct icp_state *icp, CPUPPCState *env)
 {
-    CPUPPCState *env;
-    int max_server_num;
-    struct icp_state *icp;
-    struct ics_state *ics;
+    struct icp_server_state *ss = &icp->ss[env->cpu_index];
 
-    max_server_num = -1;
-    for (env = first_cpu; env != NULL; env = env->next_cpu) {
-        if (env->cpu_index > max_server_num) {
-            max_server_num = env->cpu_index;
-        }
-    }
+    assert(env->cpu_index < icp->nr_servers);
 
-    icp = g_malloc0(sizeof(*icp));
-    icp->nr_servers = max_server_num + 1;
-    icp->ss = g_malloc0(icp->nr_servers*sizeof(struct icp_server_state));
+    switch (PPC_INPUT(env)) {
+    case PPC_FLAGS_INPUT_POWER7:
+        ss->output = env->irq_inputs[POWER7_INPUT_INT];
+        break;
 
-    for (env = first_cpu; env != NULL; env = env->next_cpu) {
-        struct icp_server_state *ss = &icp->ss[env->cpu_index];
+    case PPC_FLAGS_INPUT_970:
+        ss->output = env->irq_inputs[PPC970_INPUT_INT];
+        break;
 
-        switch (PPC_INPUT(env)) {
-        case PPC_FLAGS_INPUT_POWER7:
-            ss->output = env->irq_inputs[POWER7_INPUT_INT];
-            break;
+    default:
+        fprintf(stderr, "XICS interrupt controller does not support this CPU "
+                "bus model\n");
+        abort();
+    }
+}
 
-        case PPC_FLAGS_INPUT_970:
-            ss->output = env->irq_inputs[PPC970_INPUT_INT];
-            break;
+struct icp_state *xics_system_init(int nr_servers, int nr_irqs)
+{
+    struct icp_state *icp;
+    struct ics_state *ics;
 
-        default:
-            hw_error("XICS interrupt model does not support this CPU bus "
-                     "model\n");
-            exit(1);
-        }
-    }
+    icp = g_malloc0(sizeof(*icp));
+    icp->nr_servers = nr_servers;
+    icp->ss = g_malloc0(icp->nr_servers*sizeof(struct icp_server_state));
 
    ics = g_malloc0(sizeof(*ics));
    ics->nr_irqs = nr_irqs;
hw/xics.h +2 -1
index c3bf008..b43678a 100644
@@ -35,6 +35,7 @@ struct icp_state;
 qemu_irq xics_get_qirq(struct icp_state *icp, int irq);
 void xics_set_irq_type(struct icp_state *icp, int irq, bool lsi);
 
-struct icp_state *xics_system_init(int nr_irqs);
+struct icp_state *xics_system_init(int nr_servers, int nr_irqs);
+void xics_cpu_setup(struct icp_state *icp, CPUPPCState *env);
 
 #endif /* __XICS_H__ */
Signature · 1 line
1.7.10.4
#5 lore raw

Re: [Qemu-devel] [PATCH 03/12] pseries: Move XICS initialization before cpu initialization

Quoted 9 lines · Alexander Graf
Quoted 7 lines

Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.

Does this still hold true with the new in-kernel interrupt controller workflow?

We need to look into this. The in-kernel ICPs will still certainly be created early along with the VCPUs, however we might be able to delay the creation of the qemu emulation when not using the former.

Cheers,
Ben.

#6 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 03/12] pseries: Move XICS initialization before cpu initialization

Quoted 9 lines · Benjamin Herrenschmidt
Quoted 8 lines · Alexander Graf
Quoted 7 lines

Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.

Quoted 5 lines
Quoted 1 line

Does this still hold true with the new in-kernel interrupt controller workflow?

We need to look into this. The in-kernel ICPs will still certainly be created early along with the VCPUs, however we might be able to delay the creation of the qemu emulation when not using the former.

I'd really prefer not to have two different initialization orders in qemu though. I think we'll want the ICP initialization first for CPU hotplug one day anyway.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 03/12] pseries: Move XICS initialization before cpu initialization

Quoted 12 lines · David Gibson
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Alexander Graf
Quoted 7 lines

Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.

Does this still hold true with the new in-kernel interrupt controller workflow?

Quoted 7 lines
Quoted 3 lines

We need to look into this. The in-kernel ICPs will still certainly be created early along with the VCPUs, however we might be able to delay the creation of the qemu emulation when not using the former.

I'd really prefer not to have two different initialization orders in qemu though. I think we'll want the ICP initialization first for CPU hotplug one day anyway.

I'd just leave this patch out until you have an implementation of the new in-kernel interrupt controller model as discussed during KVM Forum. If it still makes sense by then, we can always apply it along with it :). You most likely want to reshuffle code by then anyway, so this patch would just be needless churn.

Alex

#8 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 03/12] pseries: Move XICS initialization before cpu initialization

Quoted 23 lines · Alexander Graf
Quoted 12 lines · David Gibson
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Alexander Graf
Quoted 7 lines

Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.

Does this still hold true with the new in-kernel interrupt controller workflow?

Quoted 7 lines
Quoted 3 lines

We need to look into this. The in-kernel ICPs will still certainly be created early along with the VCPUs, however we might be able to delay the creation of the qemu emulation when not using the former.

I'd really prefer not to have two different initialization orders in qemu though. I think we'll want the ICP initialization first for CPU hotplug one day anyway.

Quoted 5 lines

I'd just leave this patch out until you have an implementation of the new in-kernel interrupt controller model as discussed during KVM Forum. If it still makes sense by then, we can always apply it along with it :). You most likely want to reshuffle code by then anyway, so this patch would just be needless churn.

Ok.

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

PATCH 4/12 pseries: Return the token when we register an RTAS call

In reply to David Gibson

From: Michael Ellerman <[email protected]>

The kernel will soon be able to service some RTAS calls. However the choice of tokens will still be up to userspace. To support this have spapr_rtas_register() return the token that is allocated for an RTAS call, that allows the calling code to tell the kernel what the token value is.

---
 hw/spapr.h      |    2 +-
 hw/spapr_rtas.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
hw/spapr.h +1 -1
index efe7f57..971a50a 100644
@@ -320,7 +320,7 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val)
 typedef void (*spapr_rtas_fn)(sPAPREnvironment *spapr, uint32_t token,
                               uint32_t nargs, target_ulong args,
                               uint32_t nret, target_ulong rets);
-void spapr_rtas_register(const char *name, spapr_rtas_fn fn);
+int spapr_rtas_register(const char *name, spapr_rtas_fn fn);
 target_ulong spapr_rtas_call(sPAPREnvironment *spapr,
                              uint32_t token, uint32_t nargs, target_ulong args,
                              uint32_t nret, target_ulong rets);
hw/spapr_rtas.c +2 -2
index 6d5c48a..45294e8 100644
@@ -242,7 +242,7 @@ target_ulong spapr_rtas_call(sPAPREnvironment *spapr,
     return H_PARAMETER;
 }
 
-void spapr_rtas_register(const char *name, spapr_rtas_fn fn)
+int spapr_rtas_register(const char *name, spapr_rtas_fn fn)
 {
     int i;
 
@@ -258,7 +258,7 @@ void spapr_rtas_register(const char *name, spapr_rtas_fn fn)
     rtas_next->name = name;
     rtas_next->fn = fn;
 
-    rtas_next++;
+    return (rtas_next++ - rtas_table) + TOKEN_BASE;
 }
 
 int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
Signature · 1 line
1.7.10.4
#10 lore raw

PATCH 5/12 pseries: Allow RTAS tokens without a qemu handler

In reply to David Gibson

From: Ben Herrenschmidt <[email protected]>

Kernel-based RTAS calls will not have a qemu handler, but will still be registered in qemu in order to be assigned a token number and appear in the device-tree.

Let's test for the name being NULL rather than the handler when deciding to skip an entry while building the device-tree

---
 hw/spapr_rtas.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_rtas.c +1 -1
index 45294e8..e618c2d 100644
@@ -301,7 +301,7 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
     for (i = 0; i < TOKEN_MAX; i++) {
         struct rtas_call *call = &rtas_table[i];
 
-        if (!call->fn) {
+        if (!call->name) {
             continue;
         }
 
Signature · 1 line
1.7.10.4
#11 lore raw

PATCH 6/12 pseries: Add tracepoints to the XICS interrupt controller

In reply to David Gibson

This patch adds tracing / debugging calls to the XICS interrupt controller implementation used on the pseries machine.

---
 hw/xics.c    |   23 ++++++++++++++++++++---
 trace-events |   13 +++++++++++++
 2 files changed, 33 insertions(+), 3 deletions(-)
hw/xics.c +20 -3
index f72dfae..87aea0f 100644
@@ -26,6 +26,7 @@
  */
 
 #include "hw.h"
+#include "trace.h"
 #include "hw/spapr.h"
 #include "hw/xics.h"
 
@@ -66,6 +67,8 @@ static void icp_check_ipi(struct icp_state *icp, int server)
         return;
     }
 
+    trace_xics_icp_check_ipi(server, ss->mfrr);
+
     if (XISR(ss)) {
         ics_reject(icp->ics, XISR(ss));
     }
@@ -120,11 +123,13 @@ static void icp_set_mfrr(struct icp_state *icp, int server, uint8_t mfrr)
 
 static uint32_t icp_accept(struct icp_server_state *ss)
 {
-    uint32_t xirr;
+    uint32_t xirr = ss->xirr;
 
     qemu_irq_lower(ss->output);
-    xirr = ss->xirr;
     ss->xirr = ss->pending_priority << 24;
+
+    trace_xics_icp_accept(xirr, ss->xirr);
+
     return xirr;
 }
 
@@ -134,6 +139,7 @@ static void icp_eoi(struct icp_state *icp, int server, uint32_t xirr)
 
     /* Send EOI -> ICS */
     ss->xirr = (ss->xirr & ~CPPR_MASK) | (xirr & CPPR_MASK);
+    trace_xics_icp_eoi(server, xirr, ss->xirr);
     ics_eoi(icp->ics, xirr & XISR_MASK);
     if (!XISR(ss)) {
         icp_resend(icp, server);
@@ -144,6 +150,8 @@ static void icp_irq(struct icp_state *icp, int server, int nr, uint8_t priority)
 {
     struct icp_server_state *ss = icp->ss + server;
 
+    trace_xics_icp_irq(server, nr, priority);
+
     if ((priority >= CPPR(ss))
         || (XISR(ss) && (ss->pending_priority <= priority))) {
         ics_reject(icp->ics, nr);
@@ -153,6 +161,7 @@ static void icp_irq(struct icp_state *icp, int server, int nr, uint8_t priority)
         }
         ss->xirr = (ss->xirr & ~XISR_MASK) | (nr & XISR_MASK);
         ss->pending_priority = priority;
+        trace_xics_icp_raise(ss->xirr, ss->pending_priority);
         qemu_irq_raise(ss->output);
     }
 }
@@ -217,10 +226,12 @@ static void set_irq_msi(struct ics_state *ics, int srcno, int val)
 {
     struct ics_irq_state *irq = ics->irqs + srcno;
 
+    trace_xics_set_irq_msi(srcno, srcno + ics->offset);
+
     if (val) {
         if (irq->priority == 0xff) {
             irq->status |= XICS_STATUS_MASKED_PENDING;
-            /* masked pending */ ;
+            trace_xics_masked_pending();
         } else  {
             icp_irq(ics->icp, irq->server, srcno + ics->offset, irq->priority);
         }
@@ -231,6 +242,7 @@ static void set_irq_lsi(struct ics_state *ics, int srcno, int val)
 {
     struct ics_irq_state *irq = ics->irqs + srcno;
 
+    trace_xics_set_irq_lsi(srcno, srcno + ics->offset);
     if (val) {
         irq->status |= XICS_STATUS_ASSERTED;
     } else {
@@ -279,6 +291,8 @@ static void ics_write_xive(struct ics_state *ics, int nr, int server,
     irq->priority = priority;
     irq->saved_priority = saved_priority;
 
+    trace_xics_ics_write_xive(nr, srcno, server, priority);
+
     if (irq->lsi) {
         write_xive_lsi(ics, srcno);
     } else {
@@ -290,6 +304,7 @@ static void ics_reject(struct ics_state *ics, int nr)
 {
     struct ics_irq_state *irq = ics->irqs + nr - ics->offset;
 
+    trace_xics_ics_reject(nr, nr - ics->offset);
     irq->status |= XICS_STATUS_REJECTED; /* Irrelevant but harmless for LSI */
     irq->status &= ~XICS_STATUS_SENT; /* Irrelevant but harmless for MSI */
 }
@@ -315,6 +330,8 @@ static void ics_eoi(struct ics_state *ics, int nr)
     int srcno = nr - ics->offset;
     struct ics_irq_state *irq = ics->irqs + srcno;
 
+    trace_xics_ics_eoi(nr);
+
     if (irq->lsi) {
         irq->status &= ~XICS_STATUS_SENT;
     }
trace-events +13 -0
index b84d631..5bf01f9 100644
@@ -1020,3 +1020,16 @@ spapr_pci_rtas_ibm_change_msi(unsigned func, unsigned req) "func %u, requested %
 spapr_pci_rtas_ibm_query_interrupt_source_number(unsigned ioa, unsigned intr) "queries for #%u, IRQ%u"
 spapr_pci_msi_write(uint64_t addr, uint64_t data, uint32_t dt_irq) "@%"PRIx64"<=%"PRIx64" IRQ %u"
 spapr_pci_lsi_set(const char *busname, int pin, uint32_t irq) "%s PIN%d IRQ %u"
+
+# hw/xics.c
+xics_icp_check_ipi(int server, uint8_t mfrr) "CPU %d can take IPI mfrr=%#x"
+xics_icp_accept(uint32_t old_xirr, uint32_t new_xirr) "icp_accept: XIRR %#"PRIx32"->%#"PRIx32
+xics_icp_eoi(int server, uint32_t xirr, uint32_t new_xirr) "icp_eoi: server %d given XIRR %#"PRIx32" new XIRR %#"PRIx32
+xics_icp_irq(int server, int nr, uint8_t priority) "cpu %d trying to deliver irq %#"PRIx32" priority %#x"
+xics_icp_raise(uint32_t xirr, uint8_t pending_priority) "raising IRQ new XIRR=%#x new pending priority=%#x"
+xics_set_irq_msi(int srcno, int nr) "set_irq_msi: srcno %d [irq %#x]"
+xics_masked_pending(void) "set_irq_msi: masked pending"
+xics_set_irq_lsi(int srcno, int nr) "set_irq_lsi: srcno %d [irq %#x]"
+xics_ics_write_xive(int nr, int srcno, int server, uint8_t priority) "ics_write_xive: irq %#x [src %d] server %#x prio %#x"
+xics_ics_reject(int nr, int srcno) "reject irq %#x [src %d]"
+xics_ics_eoi(int nr) "ics_eoi: irq %#x"
\ No newline at end of file
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 7/12 pseries: Split xics irq configuration from state information

In reply to David Gibson

Currently the XICS irq controller code has a per-irq state structure which amongst other things includes whether the interrupt is level or message triggered - this is configured by the platform code, and is not directly visible to the guest. This leads to a slightly awkward construct at reset time where we need to reset everything in the state structure _except_ the lsi/msi flag, which needs to retain the information given at platform init time.

More importantly this flag will make matching the qemu state to the KVM state for the upcoming in-kernel XICS implementation more awkward. This patch, therefore, removes this flag from the per-irq state structure, instead adding a parallel array giving the lsi/msi configuration per irq.

---
 hw/xics.c |   20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
hw/xics.c +8 -12
index 87aea0f..d6f2179 100644
@@ -179,13 +179,13 @@ struct ics_irq_state {
 #define XICS_STATUS_REJECTED           0x4
 #define XICS_STATUS_MASKED_PENDING     0x8
     uint8_t status;
-    bool lsi;
 };
 
 struct ics_state {
     int nr_irqs;
     int offset;
     qemu_irq *qirqs;
+    bool *islsi;
     struct ics_irq_state *irqs;
     struct icp_state *icp;
 };
@@ -254,9 +254,8 @@ static void set_irq_lsi(struct ics_state *ics, int srcno, int val)
 static void ics_set_irq(void *opaque, int srcno, int val)
 {
     struct ics_state *ics = (struct ics_state *)opaque;
-    struct ics_irq_state *irq = ics->irqs + srcno;
 
-    if (irq->lsi) {
+    if (ics->islsi[srcno]) {
         set_irq_lsi(ics, srcno, val);
     } else {
         set_irq_msi(ics, srcno, val);
@@ -293,7 +292,7 @@ static void ics_write_xive(struct ics_state *ics, int nr, int server,
 
     trace_xics_ics_write_xive(nr, srcno, server, priority);
 
-    if (irq->lsi) {
+    if (ics->islsi[srcno]) {
         write_xive_lsi(ics, srcno);
     } else {
         write_xive_msi(ics, srcno);
@@ -314,10 +313,8 @@ static void ics_resend(struct ics_state *ics)
     int i;
 
     for (i = 0; i < ics->nr_irqs; i++) {
-        struct ics_irq_state *irq = ics->irqs + i;
-
         /* FIXME: filter by server#? */
-        if (irq->lsi) {
+        if (ics->islsi[i]) {
             resend_lsi(ics, i);
         } else {
             resend_msi(ics, i);
@@ -332,7 +329,7 @@ static void ics_eoi(struct ics_state *ics, int nr)
 
     trace_xics_ics_eoi(nr);
 
-    if (irq->lsi) {
+    if (ics->islsi[srcno]) {
         irq->status &= ~XICS_STATUS_SENT;
     }
 }
@@ -354,7 +351,7 @@ void xics_set_irq_type(struct icp_state *icp, int irq, bool lsi)
 {
     assert(ics_valid_irq(icp->ics, irq));
 
-    icp->ics->irqs[irq - icp->ics->offset].lsi = lsi;
+    icp->ics->islsi[irq - icp->ics->offset] = lsi;
 }
 
 static target_ulong h_cppr(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -518,10 +515,8 @@ static void xics_reset(void *opaque)
         qemu_set_irq(icp->ss[i].output, 0);
     }
 
+    memset(ics->irqs, 0, sizeof(struct ics_irq_state) * ics->nr_irqs);
     for (i = 0; i < ics->nr_irqs; i++) {
-        /* Reset everything *except* the type */
-        ics->irqs[i].server = 0;
-        ics->irqs[i].status = 0;
         ics->irqs[i].priority = 0xff;
         ics->irqs[i].saved_priority = 0xff;
     }
@@ -562,6 +557,7 @@ struct icp_state *xics_system_init(int nr_servers, int nr_irqs)
     ics->nr_irqs = nr_irqs;
     ics->offset = XICS_IRQ_BASE;
     ics->irqs = g_malloc0(nr_irqs * sizeof(struct ics_irq_state));
+    ics->islsi = g_malloc0(nr_irqs * sizeof(bool));
 
     icp->ics = ics;
     ics->icp = icp;
Signature · 1 line
1.7.10.4
#13 lore raw

PATCH 8/12 target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

In reply to David Gibson

Currently the ppcemb_tlb_t struct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr. That works reasonably for now, but is troublesome for saving the state, which we'll want to do in future. hwaddr is a large enough type to contain a physical address for any supported machine - and can thus, in theory at least, vary depending on what machines are enabled other than the one we're actually using right now (though in fact it doesn't for ppc). This makes it unsuitable for describing in vmstate.

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

---
 target-ppc/cpu.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/cpu.h +1 -1
index 5f1dc8b..742d4f8 100644
@@ -355,7 +355,7 @@ struct ppc6xx_tlb_t {
 
 typedef struct ppcemb_tlb_t ppcemb_tlb_t;
 struct ppcemb_tlb_t {
-    hwaddr RPN;
+    uint64_t RPN;
     target_ulong EPN;
     target_ulong PID;
     target_ulong size;
Signature · 1 line
1.7.10.4
#14 lore raw

Re: [Qemu-devel] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 11 lines · David Gibson

Currently the ppcemb_tlb_t struct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr. That works reasonably for now, but is troublesome for saving the state, which we'll want to do in future. hwaddr is a large enough type to contain a physical address for any supported machine - and can thus, in theory at least, vary depending on what machines are enabled other than the one we're actually using right now (though in fact it doesn't for ppc). This makes it unsuitable for describing in vmstate.

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

Alex

Quoted 22 lines

---
target-ppc/cpu.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/cpu.h +1 -1
index 5f1dc8b..742d4f8 100644
@@ -355,7 +355,7 @@ struct ppc6xx_tlb_t {
 
 typedef struct ppcemb_tlb_t ppcemb_tlb_t;
 struct ppcemb_tlb_t {
-    hwaddr RPN;
+    uint64_t RPN;
    target_ulong EPN;
    target_ulong PID;
    target_ulong size;
Signature · 1 line
1.7.10.4
#15 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 12 lines · Alexander Graf
Quoted 9 lines · David Gibson

Currently the ppcemb_tlb_t struct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr. That works reasonably for now, but is troublesome for saving the state, which we'll want to do in future. hwaddr is a large enough type to contain a physical address for any supported machine - and can thus, in theory at least, vary depending on what machines are enabled other than the one we're actually using right now (though in fact it doesn't for ppc). This makes it unsuitable for describing in vmstate.

Quoted 4 lines
Quoted 2 lines

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 13 lines · David Gibson
Quoted 12 lines · Alexander Graf
Quoted 9 lines · David Gibson

Currently the ppcemb_tlb_t struct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr. That works reasonably for now, but is troublesome for saving the state, which we'll want to do in future. hwaddr is a large enough type to contain a physical address for any supported machine - and can thus, in theory at least, vary depending on what machines are enabled other than the one we're actually using right now (though in fact it doesn't for ppc). This makes it unsuitable for describing in vmstate.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

The reason I'm reluctant is that this is not the only case where we have an hwaddr field in the CPUState struct. Either we convert all the hwaddr fields that we potentially want to savevm/loadvm or we don't convert any :).

Alex

#17 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 10 lines · Alexander Graf
Quoted 9 lines · David Gibson
Quoted 5 lines · Alexander Graf
Quoted 2 lines · David Gibson

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

(previous discussion on this point:
https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg01456.html )

Quoted 1 line

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

That would be one approach. I'm a bit sceptical about putting hwaddr fields in CPU state, though -- it's suggestive that something's not modelled right. hwaddr is conceptually "big enough for the biggest bus in the system", and no single component should have internal state whose size depends on that.

-- PMM

#18 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 15 lines · Peter Maydell
Quoted 10 lines · Alexander Graf
Quoted 9 lines · David Gibson
Quoted 5 lines · Alexander Graf
Quoted 2 lines · David Gibson

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

(previous discussion on this point:
https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg01456.html )

Quoted 7 lines
Quoted 1 line

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

That would be one approach. I'm a bit sceptical about putting hwaddr fields in CPU state, though -- it's suggestive that something's not modelled right. hwaddr is conceptually "big enough for the biggest bus in the system", and no single component should have internal state whose size depends on that.

*shrug* I'm more than happy to get a patch that just converts all the hwaddr fields in CPUState to uint64_t.

Alex

#19 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 18 lines · Alexander Graf
Quoted 15 lines · Peter Maydell
Quoted 10 lines · Alexander Graf
Quoted 9 lines · David Gibson
Quoted 5 lines · Alexander Graf
Quoted 2 lines · David Gibson

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

(previous discussion on this point:
https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg01456.html )

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

That would be one approach. I'm a bit sceptical about putting hwaddr fields in CPU state, though -- it's suggestive that something's not modelled right. hwaddr is conceptually "big enough for the biggest bus in the system", and no single component should have internal state whose size depends on that.

Right, that's the reason I was given for not adding VMSTATE helpers for hwaddr too.

But more directly, as long as hwaddr is a different type from uint64_t, to me that at least admits the possibility that it could be changed again some day. And if we're using a uint64_t based VMSTATE helper on a type that could change, that could go badly wrong. Basically it's a subtle and ungreppable dependency on the fact that a hwaddr is actually a uint64_t, which seems like a bad idea.

Quoted 2 lines

*shrug* I'm more than happy to get a patch that just converts all *the hwaddr fields in CPUState to uint64_t.

So.. does that mean you'll apply this one or not?

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 37 lines · David Gibson
Quoted 18 lines · Alexander Graf
Quoted 15 lines · Peter Maydell
Quoted 10 lines · Alexander Graf
Quoted 9 lines · David Gibson
Quoted 5 lines · Alexander Graf
Quoted 2 lines · David Gibson

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

(previous discussion on this point:
https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg01456.html )

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

That would be one approach. I'm a bit sceptical about putting hwaddr fields in CPU state, though -- it's suggestive that something's not modelled right. hwaddr is conceptually "big enough for the biggest bus in the system", and no single component should have internal state whose size depends on that.

Right, that's the reason I was given for not adding VMSTATE helpers for hwaddr too.

But more directly, as long as hwaddr is a different type from uint64_t, to me that at least admits the possibility that it could be changed again some day. And if we're using a uint64_t based VMSTATE helper on a type that could change, that could go badly wrong. Basically it's a subtle and ungreppable dependency on the fact that a hwaddr is actually a uint64_t, which seems like a bad idea.

Quoted 4 lines
Quoted 2 lines

*shrug* I'm more than happy to get a patch that just converts all *the hwaddr fields in CPUState to uint64_t.

So.. does that mean you'll apply this one or not?

It means I'll wait for one that converts more than just this one field :). According to the above rationale, there shouldn't be any hwaddr fields in CPUState, right?

Alex

#21 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 40 lines · Alexander Graf
Quoted 37 lines · David Gibson
Quoted 18 lines · Alexander Graf
Quoted 15 lines · Peter Maydell
Quoted 10 lines · Alexander Graf
Quoted 9 lines · David Gibson
Quoted 5 lines · Alexander Graf
Quoted 2 lines · David Gibson

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

(previous discussion on this point:
https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg01456.html )

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

That would be one approach. I'm a bit sceptical about putting hwaddr fields in CPU state, though -- it's suggestive that something's not modelled right. hwaddr is conceptually "big enough for the biggest bus in the system", and no single component should have internal state whose size depends on that.

Right, that's the reason I was given for not adding VMSTATE helpers for hwaddr too.

But more directly, as long as hwaddr is a different type from uint64_t, to me that at least admits the possibility that it could be changed again some day. And if we're using a uint64_t based VMSTATE helper on a type that could change, that could go badly wrong. Basically it's a subtle and ungreppable dependency on the fact that a hwaddr is actually a uint64_t, which seems like a bad idea.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

*shrug* I'm more than happy to get a patch that just converts all *the hwaddr fields in CPUState to uint64_t.

So.. does that mean you'll apply this one or not?

It means I'll wait for one that converts more than just this one field :). According to the above rationale, there shouldn't be any hwaddr fields in CPUState, right?

Grah. Why is that qemu people always seem to insist on not fixing something that needs fixing unless everything else that needs fixing is done at the same time.

In any case, I don't think that's strictly correct. The point is that fields which represent architected CPU state should never be hwaddr, but it's at least possible that it could be appropriate for some anciliary data.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/12] target-ppc: Convert ppcemb_tlb_t to use fixed 64-bit RPN

Quoted 46 lines · David Gibson
Quoted 45 lines · Alexander Graf
Quoted 41 lines · David Gibson
Quoted 18 lines · Alexander Graf
Quoted 15 lines · Peter Maydell
Quoted 10 lines · Alexander Graf
Quoted 9 lines · David Gibson
Quoted 5 lines · Alexander Graf
Quoted 2 lines · David Gibson

This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.

hwaddr is always defined to 64bit by now.

I know, but there aren't state save helpers for hwaddr, and there are objections to creating them.

(previous discussion on this point:
https://lists.gnu.org/archive/html/qemu-devel/2012-10/msg01456.html )

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

Sure, but you can just use the 64bit save helpers now that hwaddr == uint64_t, no?

That would be one approach. I'm a bit sceptical about putting hwaddr fields in CPU state, though -- it's suggestive that something's not modelled right. hwaddr is conceptually "big enough for the biggest bus in the system", and no single component should have internal state whose size depends on that.

Right, that's the reason I was given for not adding VMSTATE helpers for hwaddr too.

But more directly, as long as hwaddr is a different type from uint64_t, to me that at least admits the possibility that it could be changed again some day. And if we're using a uint64_t based VMSTATE helper on a type that could change, that could go badly wrong. Basically it's a subtle and ungreppable dependency on the fact that a hwaddr is actually a uint64_t, which seems like a bad idea.

Quoted 2 lines

*shrug* I'm more than happy to get a patch that just converts all *the hwaddr fields in CPUState to uint64_t.

So.. does that mean you'll apply this one or not?

Quoted 7 lines
Quoted 3 lines

It means I'll wait for one that converts more than just this one field :). According to the above rationale, there shouldn't be any hwaddr fields in CPUState, right?

Grah. Why is that qemu people always seem to insist on not fixing something that needs fixing unless everything else that needs fixing is done at the same time.

Because that's the only way to keep the code consistent.

Quoted 5 lines

In any case, I don't think that's strictly correct. The point is that fields which represent architected CPU state should never be hwaddr, but it's at least possible that it could be appropriate for some anciliary data.

Yup. Please double-check all fields. I wouldn't be surprised if there are more fields that you would want to save/restore that are hwaddr.

Alex

Quoted 6 lines
Signature · 5 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
#23 lore raw

PATCH 9/12 pseries: Implement PAPR NVRAM

In reply to David Gibson

The PAPR specification requires a certain amount of NVRAM, accessed via RTAS, which we don't currently implement in qemu. This patch addresses this deficiency, implementing the NVRAM as a VIO device, with some glue to instantiate it automatically based on a machine option.

The machine option specifies a drive id, which is used to back the NVRAM, making it persistent. If nothing is specified, the driver instead simply allocates space for the NVRAM, which will not be persistent

---
 hw/ppc/Makefile.objs |    2 +-
 hw/spapr.c           |   33 +++++++++
 hw/spapr.h           |    2 +
 hw/spapr_nvram.c     |  196 ++++++++++++++++++++++++++++++++++++++++++++++++++
 qemu-config.c        |    4 ++
 5 files changed, 236 insertions(+), 1 deletion(-)
 create mode 100644 hw/spapr_nvram.c
hw/ppc/Makefile.objs +1 -1
index 8fe2123..4492127 100644
@@ -11,7 +11,7 @@ obj-y += ppc_newworld.o
 obj-$(CONFIG_PSERIES) += spapr.o spapr_hcall.o spapr_rtas.o spapr_vio.o
 obj-$(CONFIG_PSERIES) += xics.o spapr_vty.o spapr_llan.o spapr_vscsi.o
 obj-$(CONFIG_PSERIES) += spapr_pci.o pci-hotplug.o spapr_iommu.o
-obj-$(CONFIG_PSERIES) += spapr_events.o
+obj-$(CONFIG_PSERIES) += spapr_events.o spapr_nvram.o
 # PowerPC 4xx boards
 obj-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
 obj-y += ppc440_bamboo.o
hw/spapr.c +33 -0
index dc2349c..5d1401b 100644
@@ -657,6 +657,36 @@ static void spapr_cpu_reset(void *opaque)
         (spapr->htab_shift - 18);
 }
 
+static void spapr_create_nvram(sPAPREnvironment *spapr)
+{
+    QemuOpts *machine_opts;
+    DeviceState *dev;
+
+    dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
+
+    machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
+    if (machine_opts) {
+        const char *drivename;
+
+        drivename = qemu_opt_get(machine_opts, "nvram");
+        if (drivename) {
+            BlockDriverState *bs;
+
+            bs = bdrv_find(drivename);
+            if (!bs) {
+                fprintf(stderr, "No such block device \"%s\" for nvram\n",
+                        drivename);
+                exit(1);
+            }
+            qdev_prop_set_drive_nofail(dev, "drive", bs);
+        }
+    }
+
+    qdev_init_nofail(dev);
+
+    spapr->nvram = (struct sPAPRNVRAM *)dev;
+}
+
 /* Returns whether we want to use VGA or not */
 static int spapr_vga_init(PCIBus *pci_bus)
 {
@@ -820,6 +850,9 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)
         }
     }
 
+    /* We always have at least the nvram device on VIO */
+    spapr_create_nvram(spapr);
+
     /* Set up PCI */
     spapr_pci_rtas_init();
 
hw/spapr.h +2 -0
index 971a50a..600722f 100644
@@ -6,11 +6,13 @@
 
 struct VIOsPAPRBus;
 struct sPAPRPHBState;
+struct sPAPRNVRAM;
 struct icp_state;
 
 typedef struct sPAPREnvironment {
     struct VIOsPAPRBus *vio_bus;
     QLIST_HEAD(, sPAPRPHBState) phbs;
+    struct sPAPRNVRAM *nvram;
     struct icp_state *icp;
 
     hwaddr ram_limit;
hw/spapr_nvram.c new file +196 -0

196 lines not on this page · raw message

qemu-config.c +4 -0
index 3154cac..4856327 100644
@@ -627,6 +627,10 @@ static QemuOptsList qemu_machine_opts = {
             .name = "usb",
             .type = QEMU_OPT_BOOL,
             .help = "Set on/off to enable/disable usb",
+        }, {
+            .name = "nvram",
+            .type = QEMU_OPT_STRING,
+            .help = "Drive backing persistent NVRAM",
         },
         { /* End of list */ }
     },
Signature · 1 line
1.7.10.4
#24 lore raw

PATCH 10/12 pseries: Update SLOF for NVRAM support

In reply to David Gibson

Now that we have implemented PAPR compatible NVRAM interfaces in qemu, this updates the SLOF firmware to actually initialize and use the NVRAM as a PAPR guest firmware is expected to do.

This SLOF update also includes an ugly but useful workaround for a bug in the SLES11 installer which caused it to fail under KVM.

---
 pc-bios/README   |    2 +-
 pc-bios/slof.bin |  Bin 878640 -> 880832 bytes
 roms/SLOF        |    2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
index 3037130..eff3de7 100644
@@ -17,7 +17,7 @@
 - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware
   implementation for certain IBM POWER hardware.  The sources are at
   https://github.com/dgibson/SLOF, and the image currently in qemu is
-  built from git tag qemu-slof-20120731.
+  built from git tag qemu-slof-20121018.
 
 - sgabios (the Serial Graphics Adapter option ROM) provides a means for
   legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
index 84ba6b83f3c7fe523cb0b0e73ae8522872d1feef..3410f4fff40ff4a93d8963bf63fd6c1439f8b19c 100644
GIT binary patch
roms/SLOF +1 -1
index f21f7a3..0ad10f2 160000
@@ -1 +1 @@
-Subproject commit f21f7a3f46b557eb5923f899ce8b4401b3cc6d91
+Subproject commit 0ad10f26c94a86a0c9c3970e53f9a9f6a744055d
Signature · 1 line
1.7.10.4
#25 lore raw

PATCH 11/12 pseries: Fix bug in PCI MSI allocation

In reply to David Gibson

From: Alexey Kardashevskiy <[email protected]>

In one of the recent reworks to the XICS code, a bug was introduced where we use the wrong sense and allocate level interrupts instead of message interrupts for PCI MSIs. This patch fixes it.

---
 hw/spapr_pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_pci.c +1 -1
index a08ed11..3c5b855 100644
@@ -351,7 +351,7 @@ static void rtas_ibm_change_msi(sPAPREnvironment *spapr,
 
     /* There is no cached config, allocate MSIs */
     if (!phb->msi_table[ndev].nvec) {
-        irq = spapr_allocate_irq_block(req_num, true);
+        irq = spapr_allocate_irq_block(req_num, false);
         if (irq < 0) {
             fprintf(stderr, "Cannot allocate MSIs for device#%d", ndev);
             rtas_st(rets, 0, -1); /* Hardware error */
Signature · 1 line
1.7.10.4
#26 lore raw

PATCH 12/12 pseries: Generate unique LIOBNs for PCI host bridges

In reply to David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

---
 hw/spapr_pci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/spapr_pci.c +2 -1
index 3c5b855..f6544d7 100644
@@ -521,6 +521,7 @@ static int spapr_phb_init(SysBusDevice *s)
     char *namebuf;
     int i;
     PCIBus *bus;
+    static int phbnum;
 
     sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid);
     namebuf = alloca(strlen(sphb->dtbusname) + 32);
@@ -572,7 +573,7 @@ static int spapr_phb_init(SysBusDevice *s)
                            PCI_DEVFN(0, 0), PCI_NUM_PINS);
     phb->bus = bus;
 
-    sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (pci_find_domain(bus) << 16);
+    sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (++phbnum << 16);
     sphb->dma_window_start = 0;
     sphb->dma_window_size = 0x40000000;
     sphb->dma = spapr_tce_new_dma_context(sphb->dma_liobn, sphb->dma_window_size);
Signature · 1 line
1.7.10.4
#27 lore raw

Re: [Qemu-devel] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 8 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

Quoted 5 lines

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Alex

Quoted 28 lines

---
hw/spapr_pci.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)
hw/spapr_pci.c +2 -1
index 3c5b855..f6544d7 100644
@@ -521,6 +521,7 @@ static int spapr_phb_init(SysBusDevice *s)
    char *namebuf;
    int i;
    PCIBus *bus;
+    static int phbnum;
 
    sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid);
    namebuf = alloca(strlen(sphb->dtbusname) + 32);
@@ -572,7 +573,7 @@ static int spapr_phb_init(SysBusDevice *s)
                           PCI_DEVFN(0, 0), PCI_NUM_PINS);
    phb->bus = bus;
 
-    sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (pci_find_domain(bus) << 16);
+    sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (++phbnum << 16);
    sphb->dma_window_start = 0;
    sphb->dma_window_size = 0x40000000;
    sphb->dma = spapr_tce_new_dma_context(sphb->dma_liobn, sphb->dma_window_size);
Signature · 1 line
1.7.10.4
#28 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 14 lines · Alexander Graf
Quoted 11 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 2 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers makes no sense on the qemu side, so I don't think increasing reliance on them by using them here is a good idea.

It would be conceptually nicer to derive the liobn from the buid, but that would rely on the buid's being unique in the low 32-bits, which is true in practice, but seems risky to rely on.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

Quoted 6 lines

makes no sense on the qemu side, so I don't think increasing reliance on them by using them here is a good idea.

It would be conceptually nicer to derive the liobn from the buid, but that would rely on the buid's being unique in the low 32-bits, which is true in practice, but seems risky to rely on.

Well, there has to be some uniqueness from the guest's POV already, no?

Alex

#30 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 21 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

For ACPI, domain number can go into _SEG method - this is what linux seems to use to assign domain numbers so if we do this things match.

Quoted 11 lines
Quoted 6 lines

makes no sense on the qemu side, so I don't think increasing reliance on them by using them here is a good idea.

It would be conceptually nicer to derive the liobn from the buid, but that would rely on the buid's being unique in the low 32-bits, which is true in practice, but seems risky to rely on.

Well, there has to be some uniqueness from the guest's POV already, no?

Alex

#31 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
Quoted 20 lines · Alexander Graf
Quoted 8 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

Quoted 5 lines

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

Quoted 3 lines

For ACPI, domain number can go into _SEG method - this is what linux seems to use to assign domain numbers so if we do this things match.

I don't follow.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 32 lines · David Gibson
Quoted 31 lines · Michael S. Tsirkin
Quoted 29 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

Quoted 7 lines
Quoted 3 lines

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 5 lines
Quoted 3 lines

For ACPI, domain number can go into _SEG method - this is what linux seems to use to assign domain numbers so if we do this things match.

I don't follow.

I'm saying this is not a PPC specific issue.

Quoted 5 lines
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
#33 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 37 lines · Michael S. Tsirkin
Quoted 36 lines · David Gibson
Quoted 34 lines · Michael S. Tsirkin
Quoted 21 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Quoted 8 lines
Quoted 3 lines

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 42 lines · David Gibson
Quoted 41 lines · Michael S. Tsirkin
Quoted 39 lines · David Gibson
Quoted 26 lines · Michael S. Tsirkin
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
Quoted 20 lines · Alexander Graf
Quoted 8 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

Quoted 5 lines

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

Quoted 7 lines
Quoted 4 lines

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature
so I don't see why it needs to be made very easy to use. With an appropriate error message it should not be
too hard for users to figure it out.

Quoted 5 lines
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
#35 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 48 lines · Michael S. Tsirkin
Quoted 47 lines · David Gibson
Quoted 45 lines · Michael S. Tsirkin
Quoted 32 lines · David Gibson
Quoted 31 lines · Michael S. Tsirkin
Quoted 29 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

Quoted 7 lines
Quoted 3 lines

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 5 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Quoted 3 lines

so I don't see why it needs to be made very easy to use. With an appropriate error message it should not be too hard for users to figure it out.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf
Quoted 21 lines · David Gibson
Quoted 10 lines · Alexander Graf
Quoted 8 lines · David Gibson

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

Quoted 8 lines
Quoted 5 lines

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

How do we assign PCI slot IDs today when all you do is a -device? This should probably follow the same scheme.

Alex

#37 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 43 lines · Alexander Graf
Quoted 42 lines · David Gibson
Quoted 41 lines · Michael S. Tsirkin
Quoted 40 lines · David Gibson
Quoted 30 lines · Michael S. Tsirkin
Quoted 29 lines · David Gibson
Quoted 28 lines · Michael S. Tsirkin
Quoted 16 lines · Alexander Graf
Quoted 14 lines · David Gibson
Quoted 13 lines · Alexander Graf
Quoted 11 lines · David Gibson

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Quoted 7 lines
Quoted 3 lines

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

If user wants to play with low level detail such as PHBs I don't see why it's not reasonable to require full specification.

Quoted 5 lines

How do we assign PCI slot IDs today when all you do is a -device? This should probably follow the same scheme.

Alex

What we do is find a first free slow. But it's exactly why I worry:
changing pci addresses between qemu releases has been a source of pain and compatibility hassles in the past.
The problem would be more manageable if you simply reserve some fixed addresses for internal use, like we reserve slots for VGA and IDE, though even that becomes a problem as we switch to q35.

Signature · 1 line
MST
#38 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 50 lines · Michael S. Tsirkin
Quoted 49 lines · Alexander Graf
Quoted 47 lines · David Gibson
Quoted 35 lines · Michael S. Tsirkin
Quoted 34 lines · David Gibson
Quoted 33 lines · Michael S. Tsirkin
Quoted 32 lines · David Gibson
Quoted 22 lines · Michael S. Tsirkin
Quoted 21 lines · Alexander Graf
Quoted 19 lines · David Gibson
Quoted 18 lines · Alexander Graf
Quoted 8 lines · David Gibson

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

Quoted 5 lines

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Quoted 6 lines
Quoted 3 lines
Quoted 2 lines

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Quoted 7 lines
Quoted 1 line

Yeah, I second Davids opinion here. We need to make this easy for users.

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges, each PHB can only support a small number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Quoted 16 lines

If user wants to play with low level detail such as PHBs I don't see why it's not reasonable to require full specification.

Quoted 5 lines

How do we assign PCI slot IDs today when all you do is a -device? This should probably follow the same scheme.

Alex

What we do is find a first free slow. But it's exactly why I worry:
changing pci addresses between qemu releases has been a source of pain and compatibility hassles in the past.
The problem would be more manageable if you simply reserve some fixed addresses for internal use, like we reserve slots for VGA and IDE, though even that becomes a problem as we switch to q35.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 53 lines · David Gibson
Quoted 52 lines · Michael S. Tsirkin
Quoted 50 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf
Quoted 21 lines · David Gibson
Quoted 10 lines · Alexander Graf
Quoted 8 lines · David Gibson

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on
pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we
derive these from the pci domain number, but the whole notion of
domain numbers on the qemu side is bogus and in any case they're not
actually uniquely allocated at this point.

Quoted 8 lines
Quoted 5 lines

This patch, therefore uses a simple sequence counter to generate
unique LIOBNs for PCI host bridges.

Signed-off-by: Alexey Kardashevskiy<[email protected]>
Signed-off-by: David Gibson<[email protected]>

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

Quoted 8 lines
Quoted 5 lines

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges,

Actually qemu does emulate p2p bridges.

Quoted 3 lines

each PHB can only support a small
number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Each PHB can support up to 32 slots right? This seems ample for a typical use. If you want many tens of devices you need to supply addresses manually, this looks reasonable to me.

Allocating PHBs on the fly seems unencessarily tricky.

Quoted 22 lines
Quoted 16 lines

If user wants to play with low level detail such as PHBs I don't see why it's not reasonable to require full specification.

Quoted 5 lines

How do we assign PCI slot IDs today when all you do is a -device? This should probably follow the same scheme.

Alex

What we do is find a first free slow. But it's exactly why I worry:
changing pci addresses between qemu releases has been a source of pain and compatibility hassles in the past.
The problem would be more manageable if you simply reserve some fixed addresses for internal use, like we reserve slots for VGA and IDE, though even that becomes a problem as we switch to q35.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 69 lines · Michael S. Tsirkin
Quoted 53 lines · David Gibson
Quoted 52 lines · Michael S. Tsirkin
Quoted 50 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf
Quoted 21 lines · David Gibson
Quoted 18 lines · Alexander Graf

On 13.11.2012, at 03:47, David Gibson wrote:

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on
pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we
derive these from the pci domain number, but the whole notion of
domain numbers on the qemu side is bogus and in any case they're not
actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate
unique LIOBNs for PCI host bridges.

Signed-off-by: Alexey Kardashevskiy<[email protected]>
Signed-off-by: David Gibson<[email protected]>
I don't really like the idea of having a global variable just
because our domain ID generation seems to not work as
expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

Quoted 8 lines
Quoted 5 lines

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges,

Actually qemu does emulate p2p bridges.

Quoted 3 lines

each PHB can only support a small
number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Quoted 5 lines

Each PHB can support up to 32 slots right? This seems ample for a typical use. If you want many tens of devices you need to supply addresses manually, this looks reasonable to me.

Allocating PHBs on the fly seems unencessarily tricky.

IIRC it's required for fault isolation.

Alex

Quoted 23 lines
Quoted 23 lines
Quoted 17 lines

If user wants to play with low level detail such as PHBs I don't see why it's not reasonable to require full specification.

Quoted 5 lines

How do we assign PCI slot IDs today when all you do is a -device? This should probably follow the same scheme.

Alex

What we do is find a first free slow. But it's exactly why I worry:
changing pci addresses between qemu releases has been a source of pain and compatibility hassles in the past.
The problem would be more manageable if you simply reserve some fixed addresses for internal use, like we reserve slots for VGA and IDE, though even that becomes a problem as we switch to q35.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 77 lines · Alexander Graf
Quoted 73 lines · Michael S. Tsirkin
Quoted 53 lines · David Gibson
Quoted 52 lines · Michael S. Tsirkin
Quoted 50 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf
Quoted 21 lines · David Gibson

On Mon, Nov 19, 2012 at 05:34:12PM +0100, Alexander Graf wrote:
On 13.11.2012, at 03:47, David Gibson wrote:

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on
pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we
derive these from the pci domain number, but the whole notion of
domain numbers on the qemu side is bogus and in any case they're not
actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate
unique LIOBNs for PCI host bridges.

Signed-off-by: Alexey Kardashevskiy<[email protected]>
Signed-off-by: David Gibson<[email protected]>
I don't really like the idea of having a global variable just
because our domain ID generation seems to not work as
expected. Michael, any comments here?
Well, the patch I sent which changed domain id generation was
ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

Quoted 8 lines
Quoted 5 lines

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges,

Actually qemu does emulate p2p bridges.

Quoted 3 lines

each PHB can only support a small
number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Each PHB can support up to 32 slots right? This seems ample for a typical use. If you want many tens of devices you need to supply addresses manually, this looks reasonable to me.

Quoted 5 lines
Quoted 1 line

Allocating PHBs on the fly seems unencessarily tricky.

IIRC it's required for fault isolation.

Alex

IIUC separate physical PHBs might help fault isolation of assigned devices.
OTOH I don't see why we need to emulate PHBs for this.

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 17 lines

If user wants to play with low level detail such as PHBs I don't see why it's not reasonable to require full specification.

Quoted 5 lines

How do we assign PCI slot IDs today when all you do is a -device? This should probably follow the same scheme.

Alex

What we do is find a first free slow. But it's exactly why I worry:
changing pci addresses between qemu releases has been a source of pain and compatibility hassles in the past.
The problem would be more manageable if you simply reserve some fixed addresses for internal use, like we reserve slots for VGA and IDE, though even that becomes a problem as we switch to q35.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

In reply to Michael S. Tsirkin
Quoted 69 lines · Michael S. Tsirkin
Quoted 53 lines · David Gibson
Quoted 52 lines · Michael S. Tsirkin
Quoted 50 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf
Quoted 21 lines · David Gibson
Quoted 18 lines · Alexander Graf

On 13.11.2012, at 03:47, David Gibson wrote:

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on
pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we
derive these from the pci domain number, but the whole notion of
domain numbers on the qemu side is bogus and in any case they're not
actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate
unique LIOBNs for PCI host bridges.

Signed-off-by: Alexey Kardashevskiy<[email protected]>
Signed-off-by: David Gibson<[email protected]>
I don't really like the idea of having a global variable just
because our domain ID generation seems to not work as
expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

Quoted 8 lines
Quoted 5 lines

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges,

Actually qemu does emulate p2p bridges.

Quoted 3 lines

each PHB can only support a small
number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Quoted 5 lines

Each PHB can support up to 32 slots right? This seems ample for a typical use. If you want many tens of devices you need to supply addresses manually, this looks reasonable to me.

Allocating PHBs on the fly seems unencessarily tricky.

I still think you're thinking far too much in terms of x86-like guests. But, I guess, emulated PCI devices will be pretty rare, since they're so slow anyway.

But, what Alex was getting at is another factor I forgot. Because of the way the PAPR PCI paravirtualized interfaces work, host devices which are in different "partitionable endpoints" (roughly the minimum granularity for safe isolation) must appear in different virtual PHBs in the guest. So if we pass through a lot of PCI devices, we will almost certainly need a lot of guest PHBs.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 74 lines · David Gibson
Quoted 73 lines · Michael S. Tsirkin
Quoted 53 lines · David Gibson
Quoted 52 lines · Michael S. Tsirkin
Quoted 50 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf
Quoted 21 lines · David Gibson

On Mon, Nov 19, 2012 at 05:34:12PM +0100, Alexander Graf wrote:
On 13.11.2012, at 03:47, David Gibson wrote:

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on
pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we
derive these from the pci domain number, but the whole notion of
domain numbers on the qemu side is bogus and in any case they're not
actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate
unique LIOBNs for PCI host bridges.

Signed-off-by: Alexey Kardashevskiy<[email protected]>
Signed-off-by: David Gibson<[email protected]>
I don't really like the idea of having a global variable just
because our domain ID generation seems to not work as
expected. Michael, any comments here?
Well, the patch I sent which changed domain id generation was
ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

Quoted 8 lines
Quoted 5 lines

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges,

Actually qemu does emulate p2p bridges.

Quoted 3 lines

each PHB can only support a small
number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Each PHB can support up to 32 slots right? This seems ample for a typical use. If you want many tens of devices you need to supply addresses manually, this looks reasonable to me.

Quoted 5 lines
Quoted 1 line

Allocating PHBs on the fly seems unencessarily tricky.

I still think you're thinking far too much in terms of x86-like guests. But, I guess, emulated PCI devices will be pretty rare, since they're so slow anyway.

They are not very slow. My point is the reverse. Device assignment is pretty rare, assigning multiple devices even more rare. It should work but I don't see why we should increase maintainance burden to save the user ruynning qemu from CLI the trouble of specifying a single extra property in this advanced case.

Quoted 6 lines

But, what Alex was getting at is another factor I forgot. Because of the way the PAPR PCI paravirtualized interfaces work, host devices which are in different "partitionable endpoints" (roughly the minimum granularity for safe isolation) must appear in different virtual PHBs in the guest. So if we pass through a lot of PCI devices, we will almost certainly need a lot of guest PHBs.

One further point: physical systems normally don't let you hotplug PHBs. So if for non hotplug you auto-add PHBs, you end up treating hotplug and non hotplug devices differently from UI point of view this is nasty.

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Quoted 5 lines
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
#44 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 81 lines · Michael S. Tsirkin
Quoted 74 lines · David Gibson
Quoted 73 lines · Michael S. Tsirkin
Quoted 53 lines · David Gibson
Quoted 52 lines · Michael S. Tsirkin
Quoted 50 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 39 lines · Michael S. Tsirkin
Quoted 38 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 25 lines · David Gibson
Quoted 24 lines · Michael S. Tsirkin
Quoted 23 lines · Alexander Graf

On 19.11.2012, at 23:51, David Gibson wrote:

On Mon, Nov 19, 2012 at 05:34:12PM +0100, Alexander Graf wrote:
On 13.11.2012, at 03:47, David Gibson wrote:

From: Alexey Kardashevskiy<[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on
pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we
derive these from the pci domain number, but the whole notion of
domain numbers on the qemu side is bogus and in any case they're not
actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate
unique LIOBNs for PCI host bridges.

Signed-off-by: Alexey Kardashevskiy<[email protected]>
Signed-off-by: David Gibson<[email protected]>
I don't really like the idea of having a global variable just
because our domain ID generation seems to not work as
expected. Michael, any comments here?
Well, the patch I sent which changed domain id generation was
ignored. In any case, as I said, the whole concept of domain numbers

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Yeah, I second Davids opinion here. We need to make this easy for users.

Quoted 8 lines
Quoted 5 lines

I think users don't normally create PHBs. They request a disk, a network device, a pass-through device ... In this case if this requires more PHBs create them internally but I imagine this doesn't require any allocation scheme - simply set some address
for virtual devices, some other one for assigned devices ... no?

No. One PHB for passthrough and one for emulated is the minimum. Since we don't emulated p2p bridges,

Actually qemu does emulate p2p bridges.

Quoted 3 lines

each PHB can only support a small
number of PCI devices, so if enough PCI devices are requested, we will still need to create - and assign numbers to - additional PHBs.

Each PHB can support up to 32 slots right? This seems ample for a typical use. If you want many tens of devices you need to supply addresses manually, this looks reasonable to me.

Quoted 5 lines
Quoted 1 line

Allocating PHBs on the fly seems unencessarily tricky.

I still think you're thinking far too much in terms of x86-like guests. But, I guess, emulated PCI devices will be pretty rare, since they're so slow anyway.

Quoted 5 lines

They are not very slow. My point is the reverse. Device assignment is pretty rare, assigning multiple devices even more rare. It should work but I don't see why we should increase maintainance burden to save the user ruynning qemu from CLI the trouble of specifying a single extra property in this advanced case.

You're still in x86-land. It's rare there, but PCI assignment is absolutely routine on partitioned Power systems.

Quoted 8 lines
Quoted 6 lines

But, what Alex was getting at is another factor I forgot. Because of the way the PAPR PCI paravirtualized interfaces work, host devices which are in different "partitionable endpoints" (roughly the minimum granularity for safe isolation) must appear in different virtual PHBs in the guest. So if we pass through a lot of PCI devices, we will almost certainly need a lot of guest PHBs.

One further point: physical systems normally don't let you hotplug PHBs.

No, but the PAPR interface is already para-virtualized, so that's not really a limitation. I haven't looked at the hotplug interfaces recently (implementing hotplug is a project for next year) - but I think it actually typically operates by hotplugging (virtual) PHBs.

Quoted 7 lines

So if for non hotplug you auto-add PHBs, you end up treating hotplug and non hotplug devices differently from UI point of view this is nasty.

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

Quoted 5 lines
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
#46 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Quoted 5 lines

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

I think it's reasonable to require to be able to specify it. If you don't, it's fine to base on device order IMHO. But you have to have the ability to specify it by hand if your management tool of choice actually wants reproducible results.

Alex

#47 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 14 lines · Alexander Graf
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Quoted 8 lines
Quoted 5 lines

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

I think it's reasonable to require to be able to specify it. If you don't, it's fine to base on device order IMHO.

Let me clarify why it's not fine. My understanding is these addresses do not change across reboots on real hardware. On the other hand order of initialization can change because of internal changes in qemu; thus shut down and start guest under another qemu version changes addresses.

So it's a bug. No?

Quoted 5 lines

But you have to have the ability to specify it by hand if your management tool of choice actually wants reproducible results.

Alex

How do you know whether your guest relies on reproducible results? You typically don't. Imagine a guest which does rely on this. Then:

What I propose: user runs qemu with many PHBs but with no iobns, gets error 'initialization failed. please add iobn=XXXX where XXXX is a unique
number 1 to 64K.'

What you propose: user runs qemu with many PHBs but with no iobns, guest fails to boot or behaves incorrectly.

I think as a user I prefer the first type of failure. No?

Signature · 1 line
MST
#48 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 41 lines · Michael S. Tsirkin
Quoted 14 lines · Alexander Graf
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Quoted 8 lines
Quoted 5 lines

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

I think it's reasonable to require to be able to specify it. If you don't, it's fine to base on device order IMHO.

Let me clarify why it's not fine. My understanding is these addresses do not change across reboots on real hardware. On the other hand order of initialization can change because of internal changes in qemu; thus shut down and start guest under another qemu version changes addresses.

So it's a bug. No?

Quoted 5 lines

But you have to have the ability to specify it by hand if your management tool of choice actually wants reproducible results.

Alex

How do you know whether your guest relies on reproducible results? You typically don't. Imagine a guest which does rely on this. Then:

Quoted 8 lines

What I propose: user runs qemu with many PHBs but with no iobns, gets error 'initialization failed. please add iobn=XXXX where XXXX is a unique number 1 to 64K.'

What you propose: user runs qemu with many PHBs but with no iobns, guest fails to boot or behaves incorrectly.

I think as a user I prefer the first type of failure. No?

I tend to disagree. The device creation logic should stay identical with the same versioned machine. So if I use -M pc-0.12, I am guaranteed that QEMU's internal semantics on which device goes where does not change.

For unstable machine types (which -M pseries is, same as -M pc), we don't guarantee that the guest view stays stable across version updates FWIW. So if we want to give the user a stable view of the world, we would need to create a -M pseries-1.3 which then would always keep the same device creation order.

It's the same for x86, no?

Alex

#49 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 51 lines · Alexander Graf
Quoted 48 lines · Michael S. Tsirkin
Quoted 14 lines · Alexander Graf
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Quoted 8 lines
Quoted 5 lines

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

I think it's reasonable to require to be able to specify it. If you don't, it's fine to base on device order IMHO.

Let me clarify why it's not fine. My understanding is these addresses do not change across reboots on real hardware. On the other hand order of initialization can change because of internal changes in qemu; thus shut down and start guest under another qemu version changes addresses.

So it's a bug. No?

Quoted 5 lines

But you have to have the ability to specify it by hand if your management tool of choice actually wants reproducible results.

Alex

How do you know whether your guest relies on reproducible results? You typically don't. Imagine a guest which does rely on this. Then:

What I propose: user runs qemu with many PHBs but with no iobns, gets error 'initialization failed. please add iobn=XXXX where XXXX is a unique number 1 to 64K.'

What you propose: user runs qemu with many PHBs but with no iobns, guest fails to boot or behaves incorrectly.

Quoted 6 lines
Quoted 1 line

I think as a user I prefer the first type of failure. No?

I tend to disagree. The device creation logic should stay identical with the same versioned machine. So if I use -M pc-0.12, I am guaranteed that QEMU's internal semantics on which device goes where does not change.

This is exactly why you should not rely on device initialization order for your address allocator - it is not guaranteed to be consistent.

Quoted 10 lines

For unstable machine types (which -M pseries is, same as -M pc), we don't guarantee that the guest view stays stable across version updates FWIW. So if we want to give the user a stable view of the world, we would need to create a -M pseries-1.3 which then would always keep the same device creation order.

It's the same for x86, no?

Alex

Same for x86 in that we broke guests in the past by changing order, and the lesson is to always require full specification if possible. Only reason we keep pci slot allocation around is for backward compatibility.

Signature · 1 line
MST
#50 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 72 lines · Michael S. Tsirkin
Quoted 51 lines · Alexander Graf
Quoted 48 lines · Michael S. Tsirkin
Quoted 14 lines · Alexander Graf
Quoted 11 lines · Michael S. Tsirkin
Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Quoted 8 lines
Quoted 5 lines

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

I think it's reasonable to require to be able to specify it. If you don't, it's fine to base on device order IMHO.

Let me clarify why it's not fine. My understanding is these addresses do not change across reboots on real hardware. On the other hand order of initialization can change because of internal changes in qemu; thus shut down and start guest under another qemu version changes addresses.

So it's a bug. No?

Quoted 5 lines

But you have to have the ability to specify it by hand if your management tool of choice actually wants reproducible results.

Alex

How do you know whether your guest relies on reproducible results? You typically don't. Imagine a guest which does rely on this. Then:

What I propose: user runs qemu with many PHBs but with no iobns, gets error 'initialization failed. please add iobn=XXXX where XXXX is a unique number 1 to 64K.'

What you propose: user runs qemu with many PHBs but with no iobns, guest fails to boot or behaves incorrectly.

Quoted 6 lines
Quoted 1 line

I think as a user I prefer the first type of failure. No?

I tend to disagree. The device creation logic should stay identical with the same versioned machine. So if I use -M pc-0.12, I am guaranteed that QEMU's internal semantics on which device goes where does not change.

This is exactly why you should not rely on device initialization order for your address allocator - it is not guaranteed to be consistent.

Quoted 9 lines

For unstable machine types (which -M pseries is, same as -M pc), we don't guarantee that the guest view stays stable across version updates FWIW. So if we want to give the user a stable view of the world, we would need to create a -M pseries-1.3 which then would always keep the same device creation order.

It's the same for x86, no?

Quoted 6 lines
Quoted 1 line

Alex

Same for x86 in that we broke guests in the past by changing order, and the lesson is to always require full specification if possible. Only reason we keep pci slot allocation around is for backward compatibility.

Yeah, that's why I would expect libvirt for example to always pass in pci slot ids manually for example. But if you want a convenience QEMU command line, that is not guaranteed to be identical across different versions.

So IMHO it's fine to have a fuzzy non-consistent fallback as long as it's possible to specify the consistent variant. I guess that's a matter of taste really :).

Alex

#51 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

In reply to Michael S. Tsirkin
Quoted 21 lines · Michael S. Tsirkin
Quoted 20 lines · Alexander Graf
Quoted 16 lines · Michael S. Tsirkin
Quoted 9 lines · David Gibson
Quoted 4 lines

Look, even if solution using a required property is less elegant for CLI use, it will work, won't it?
So how about we merge it so that things work, and then we can discuss a patch on top that auto-generates this property?

Well, there you have a point. And actually I've realised there are other things we need to assign uniquely for each PHB and don't yet (IO window addresses). So I need to look at a wider rework of this, which I'll start on next week.

Fine. Basically my point is it's typically a mistake to make some userspace visible parameter depend on order of initialization of devices in qemu. I don't insist on making users fully specify such parameters but it is one way to do this.

Quoted 5 lines
Quoted 2 lines

I think it's reasonable to require to be able to specify it. If you don't, it's fine to base on device order IMHO.

Let me clarify why it's not fine. My understanding is these addresses do not change across reboots on real hardware.

Well, the BUID would be expected to remain the same. The others probably remain stable across reboots in practice, but I don't think there's any reason they need to - the kernel will get the LIOBN and window addresses from the device tree afresh on every boot.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

In reply to David Gibson
Quoted 52 lines · David Gibson
Quoted 51 lines · Michael S. Tsirkin
Quoted 49 lines · David Gibson
Quoted 37 lines · Michael S. Tsirkin
Quoted 36 lines · David Gibson
Quoted 34 lines · Michael S. Tsirkin
Quoted 21 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

This is user visible, right?
So IMHO we should have the user specify LIOBN through a property, rather than assign what's essentially a random value.

Quoted 8 lines
Quoted 3 lines

Well, I can implement an override through a property, which could be useful in some circumstances. But we still need to have qemu generate unique defaults, rather than forcing it to be specified in every case.

I don't see why.
And if you want automatic defaults then they need to be generated in a way that does not depend on implementation detail such as order of device initialization.

Because requiring explicit unique liobns to be supplied whenever there is more than one PHB is horrible for usability.

Quoted 6 lines
Quoted 2 lines

We should make simple things simple and complex things possible. More than one PHB seems like an advanced feature

Not for pseries. On real hardware of this type, dozens of PHBs is routine. Plus, vfio passthrough is coming, we need at minimum one PHB for emulated devices and one for passthrough devices.

Then by default you probably want to both create the PHB and assign the device to it automatically. Such an automatically created PHB can have address assigned by default by setting a property.

Quoted 9 lines
Quoted 3 lines

so I don't see why it needs to be made very easy to use. With an appropriate error message it should not be too hard for users to figure it out.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

In reply to Alexander Graf
Quoted 33 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

Quoted 3 lines

makes no sense on the qemu side, so I don't think increasing reliance on them by using them here is a good idea.

Quoted 6 lines
Quoted 3 lines

It would be conceptually nicer to derive the liobn from the buid, but that would rely on the buid's being unique in the low 32-bits, which is true in practice, but seems risky to rely on.

Well, there has to be some uniqueness from the guest's POV already, no?

Yes, the BUIDs are unique, but they are 64-bit, whereas the LIOBN is only 32-bit.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 38 lines · David Gibson
Quoted 37 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

Quoted 6 lines

makes no sense on the qemu side, so I don't think increasing reliance on them by using them here is a good idea.

It would be conceptually nicer to derive the liobn from the buid, but that would rely on the buid's being unique in the low 32-bits, which is true in practice, but seems risky to rely on.

Quoted 5 lines
Quoted 2 lines

Well, there has to be some uniqueness from the guest's POV already, no?

Yes, the BUIDs are unique, but they are 64-bit, whereas the LIOBN is only 32-bit.

Tricky. Michael, any ideas?

Alex

Quoted 6 lines
Signature · 5 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
#55 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 12/12] pseries: Generate unique LIOBNs for PCI host bridges

Quoted 45 lines · Alexander Graf
Quoted 41 lines · David Gibson
Quoted 39 lines · Alexander Graf
Quoted 18 lines · David Gibson
Quoted 17 lines · Alexander Graf
Quoted 13 lines · David Gibson

From: Alexey Kardashevskiy <[email protected]>

In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.

This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.

Quoted 6 lines
Quoted 3 lines

I don't really like the idea of having a global variable just because our domain ID generation seems to not work as expected. Michael, any comments here?

Well, the patch I sent which changed domain id generation was ignored. In any case, as I said, the whole concept of domain numbers

Michael?

Quoted 6 lines

makes no sense on the qemu side, so I don't think increasing reliance on them by using them here is a good idea.

It would be conceptually nicer to derive the liobn from the buid, but that would rely on the buid's being unique in the low 32-bits, which is true in practice, but seems risky to rely on.

Well, there has to be some uniqueness from the guest's POV already, no?

Quoted 6 lines
Quoted 2 lines

Yes, the BUIDs are unique, but they are 64-bit, whereas the LIOBN is only 32-bit.

Tricky. Michael, any ideas?

Alex

Whatever scheme we come up with, becomes part of guest ABI that we have to maintain.
So rather than maintain it, I think it's easiest to require full specification from users, and verify uniqueness.

Quoted 6 lines
Quoted 6 lines
Signature · 5 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
#56 lore raw
In reply to David Gibson
Quoted 7 lines · David Gibson

Here again is my current set of outstanding pseries patches, updated for current upstream. I don't think any of these has changed in substance since their last posting. As explained last time around, some of the From/Signed-off-by combinations are a bit odd, but I think as accurate reflection of the patch's history as is possible.

Please apply.

Thanks, applied all except for: 3,8,12 to ppc-next. Is any of these patches urgent for the 1.3 release?

Alex