Skip to contentSkip to conversation

spapr: populate ibm,loc-code

PATCH Superseded Nikunj A Dadhania 4 participants 11 messages Mar 27, 2015 – Apr 1, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spapr: populate ibm,loc-code

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

---

Changelog
v1:
* Dropped is_vfio patch and using TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE to recognise vfio devices
* Removed wrapper for hcall
* Added sPAPRPHBClass::get_loc_code

 hw/ppc/spapr_hcall.c        |  1 +
 hw/ppc/spapr_pci.c          | 38 +++++++++++++++++++++++++++++++++
 hw/ppc/spapr_pci_vfio.c     | 51 +++++++++++++++++++++++++++++++++++++++++++++
 include/hw/pci-host/spapr.h |  1 +
 include/hw/ppc/spapr.h      |  8 ++++++-
 5 files changed, 98 insertions(+), 1 deletion(-)
hw/ppc/spapr_hcall.c +1 -0
index 4f76f1c..b394681 100644
@@ -1010,6 +1010,7 @@ static void hypercall_register_types(void)
 
     /* ibm,client-architecture-support support */
     spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support);
+    spapr_register_hypercall(KVMPPC_H_GET_LOC_CODE, phb_get_loc_code);
 }
 
 type_init(hypercall_register_types)
hw/ppc/spapr_pci.c +38 -0
index 05f4fac..c2ee476 100644
@@ -248,6 +248,44 @@ static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix,
     }
 }
 
+target_ulong phb_get_loc_code(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                              target_ulong opcode, target_ulong *args)
+{
+    sPAPRPHBState *sphb = NULL;
+    sPAPRPHBClass *spc = NULL;
+    char *buf = NULL, path[PATH_MAX];
+    PCIDevice *pdev;
+    target_ulong buid = args[0];
+    target_ulong config_addr = args[1];
+    target_ulong loc_code = args[2];
+    target_ulong size = args[3];
+
+    sphb = find_phb(spapr, buid);
+    pdev = find_dev(spapr, buid, config_addr);
+
+    if (!sphb || !pdev) {
+        return H_PARAMETER;
+    }
+
+    spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb);
+    if (spc->get_loc_code && spc->get_loc_code(sphb, pdev, &buf)) {
+        cpu_physical_memory_write(loc_code, buf, strlen(buf));
+        g_free(buf);
+        return H_SUCCESS;
+    }
+
+    /*
+     * For non-vfio devices and failures make up the location code out
+     * of the name, slot and function.
+     *
+     *       qemu_<name>:<slot>.<fn>
+     */
+    snprintf(path, sizeof(path), "qemu_%s:%02d.%1d", pdev->name,
+             PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+    cpu_physical_memory_write(loc_code, path, size);
+    return H_SUCCESS;
+}
+
 static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
                                 uint32_t token, uint32_t nargs,
                                 target_ulong args, uint32_t nret,
hw/ppc/spapr_pci_vfio.c +51 -0

63 lines not on this page · raw message

include/hw/pci-host/spapr.h +1 -0
index 895d273..1ff50b4 100644
@@ -53,6 +53,7 @@ struct sPAPRPHBClass {
     int (*eeh_get_state)(sPAPRPHBState *sphb, int *state);
     int (*eeh_reset)(sPAPRPHBState *sphb, int option);
     int (*eeh_configure)(sPAPRPHBState *sphb);
+    int (*get_loc_code)(sPAPRPHBState *sphb,  PCIDevice *pdev, char **loc_code);
 };
 
 typedef struct spapr_pci_msi {
include/hw/ppc/spapr.h +7 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE
 
 extern sPAPREnvironment *spapr;
 
@@ -522,6 +525,9 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
                       sPAPRTCETable *tcet);
 void spapr_pci_switch_vga(bool big_endian);
 
+target_ulong phb_get_loc_code(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                              target_ulong opcode, target_ulong *args);
+
 #define TYPE_SPAPR_RTC "spapr-rtc"
 
 void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns);
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 72 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

---

Changelog
v1:
* Dropped is_vfio patch and using TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE to recognise vfio devices
* Removed wrapper for hcall
* Added sPAPRPHBClass::get_loc_code

  hw/ppc/spapr_hcall.c        |  1 +
  hw/ppc/spapr_pci.c          | 38 +++++++++++++++++++++++++++++++++
  hw/ppc/spapr_pci_vfio.c     | 51 +++++++++++++++++++++++++++++++++++++++++++++
  include/hw/pci-host/spapr.h |  1 +
  include/hw/ppc/spapr.h      |  8 ++++++-
  5 files changed, 98 insertions(+), 1 deletion(-)
hw/ppc/spapr_hcall.c +1 -0
index 4f76f1c..b394681 100644
@@ -1010,6 +1010,7 @@ static void hypercall_register_types(void)
 
      /* ibm,client-architecture-support support */
      spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support);
+    spapr_register_hypercall(KVMPPC_H_GET_LOC_CODE, phb_get_loc_code);
  }
 
  type_init(hypercall_register_types)
hw/ppc/spapr_pci.c +25 -0
index 05f4fac..c2ee476 100644
@@ -248,6 +248,44 @@ static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix,
      }
  }
 
+target_ulong phb_get_loc_code(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                              target_ulong opcode, target_ulong *args)
+{
+    sPAPRPHBState *sphb = NULL;
+    sPAPRPHBClass *spc = NULL;
+    char *buf = NULL, path[PATH_MAX];
+    PCIDevice *pdev;
+    target_ulong buid = args[0];
+    target_ulong config_addr = args[1];
+    target_ulong loc_code = args[2];
+    target_ulong size = args[3];
+
+    sphb = find_phb(spapr, buid);
+    pdev = find_dev(spapr, buid, config_addr);
+
+    if (!sphb || !pdev) {
+        return H_PARAMETER;
+    }
+
+    spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb);
+    if (spc->get_loc_code && spc->get_loc_code(sphb, pdev, &buf)) {
+        cpu_physical_memory_write(loc_code, buf, strlen(buf));
+        g_free(buf);
+        return H_SUCCESS;
+    }

hw/ppc/spapr_pci.c static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix, · line 285

Quoted 10 lines
hw/ppc/spapr_pci.c +10 -0
+
+    /*
+     * For non-vfio devices and failures make up the location code out
+     * of the name, slot and function.
+     *
+     *       qemu_<name>:<slot>.<fn>
+     */
+    snprintf(path, sizeof(path), "qemu_%s:%02d.%1d", pdev->name,
+             PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+    cpu_physical_memory_write(loc_code, path, size);

Move the chunk above to a sPAPRPHBState::get_loc_code. And I'd add PHB's @index in the device name to make it unique across the guest.

Quoted 11 lines
hw/ppc/spapr_pci.c +3 -0
+    return H_SUCCESS;
+}
+
  static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
                                  uint32_t token, uint32_t nargs,
                                  target_ulong args, uint32_t nret,
hw/ppc/spapr_pci_vfio.c +0 -0
index 99a1be5..bfdfa67 100644

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 174

Quoted 4 lines
hw/ppc/spapr_pci_vfio.c +1 -0
@@ -171,6 +171,56 @@ static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option)
      return RTAS_OUT_SUCCESS;
  }
 
+static bool spapr_phb_vfio_get_devspec(PCIDevice *pdev, char **value)

s/value/devspec/ ?

Quoted 7 lines
hw/ppc/spapr_pci_vfio.c +7 -0
+{
+    char *host;
+    char path[PATH_MAX];
+    struct stat st;
+
+    host = object_property_get_str(OBJECT(pdev), "host", NULL);
+    if (!host) {

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 191

Quoted 10 lines
hw/ppc/spapr_pci_vfio.c +10 -0
+        return false;
+    }
+
+    snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/devspec", host);
+    g_free(host);
+    if (stat(path, &st) < 0) {
+        return false;
+    }
+
+    return g_file_get_contents(path, value, NULL, NULL);

g_file_get_contents() is expected to return FALSE if the file is missing so stat() seems redundant here.

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 203

Quoted 12 lines
hw/ppc/spapr_pci_vfio.c +12 -0
+}
+
+static int spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev,
+                                        char **loc_code)
+{
+    sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb);
+    char path[PATH_MAX], *buf = NULL;
+    struct stat st;
+
+    /* Non VFIO devices */
+    if (!svphb) {
+        return false;

The function returns int, not bool. s/false/-1/ and s/true/0/ please.

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 207

Quoted 4 lines
hw/ppc/spapr_pci_vfio.c +4 -0
+    }
+
+    /* We have a vfio host bridge lets get the path. */
+    if (!spapr_phb_vfio_get_devspec(pdev, &buf)) {

s/buf/devspec/

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 214

Quoted 7 lines
hw/ppc/spapr_pci_vfio.c +7 -0
+        return false;
+    }
+
+    snprintf(path, sizeof(path), "/proc/device-tree%s/ibm,loc-code", buf);
+    g_free(buf);
+    if (stat(path, &st) < 0) {
+            return false;

Just return what stat() returned.

Quoted 37 lines
hw/ppc/spapr_pci_vfio.c +10 -0
+    }
+
+    /* A valid file, now read the loc-code */
+    if (g_file_get_contents(path, loc_code, NULL, NULL)) {
+        return true;
+    }
+    return false;
+}
+
  static int spapr_phb_vfio_eeh_configure(sPAPRPHBState *sphb)
  {
      sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb);
@@ -199,6 +249,7 @@ static void spapr_phb_vfio_class_init(ObjectClass *klass, void *data)
      spc->eeh_get_state = spapr_phb_vfio_eeh_get_state;
      spc->eeh_reset = spapr_phb_vfio_eeh_reset;
      spc->eeh_configure = spapr_phb_vfio_eeh_configure;
+    spc->get_loc_code = spapr_phb_vfio_get_loc_code;
  }
 
  static const TypeInfo spapr_phb_vfio_info = {
include/hw/pci-host/spapr.h +1 -0
index 895d273..1ff50b4 100644
@@ -53,6 +53,7 @@ struct sPAPRPHBClass {
      int (*eeh_get_state)(sPAPRPHBState *sphb, int *state);
      int (*eeh_reset)(sPAPRPHBState *sphb, int option);
      int (*eeh_configure)(sPAPRPHBState *sphb);
+    int (*get_loc_code)(sPAPRPHBState *sphb,  PCIDevice *pdev, char **loc_code);
  };
 
  typedef struct spapr_pci_msi {
include/hw/ppc/spapr.h +0 -0
index af71e8b..95157ac 100644

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 8 lines
include/hw/ppc/spapr.h +4 -1
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Quoted 14 lines
include/hw/ppc/spapr.h +3 -0
  extern sPAPREnvironment *spapr;
 
@@ -522,6 +525,9 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
                        sPAPRTCETable *tcet);
  void spapr_pci_switch_vga(bool big_endian);
 
+target_ulong phb_get_loc_code(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                              target_ulong opcode, target_ulong *args);
+
  #define TYPE_SPAPR_RTC "spapr-rtc"
 
  void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns);
Signature · 1 line
Alexey
#2 lore raw
Quoted 12 lines · Alexey Kardashevskiy
Quoted 11 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 18 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Quoted 4 lines

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug). That removes the need for the hcall entirely.

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
#3 lore raw
Quoted 32 lines · David Gibson
Quoted 12 lines · Alexey Kardashevskiy
Quoted 11 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 18 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Quoted 8 lines
Quoted 4 lines

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug). That removes the need for the hcall entirely.

There was a strong opposition to PCI scan done by QEMU (although it was ok if PCI hotplug does some resource assignment in QEMU). Has this changed?

I added Michael in cc: and hope Alexander may enlighten us on this topic...

Signature · 1 line
Alexey
#10 lore raw
In reply to Alexey Kardashevskiy
Quoted 79 lines · Alexey Kardashevskiy
Quoted 78 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

---

Changelog
v1:
* Dropped is_vfio patch and using TYPE_SPAPR_PCI_VFIO_HOST_BRIDGE to recognise vfio devices
* Removed wrapper for hcall
* Added sPAPRPHBClass::get_loc_code

  hw/ppc/spapr_hcall.c        |  1 +
  hw/ppc/spapr_pci.c          | 38 +++++++++++++++++++++++++++++++++
  hw/ppc/spapr_pci_vfio.c     | 51 +++++++++++++++++++++++++++++++++++++++++++++
  include/hw/pci-host/spapr.h |  1 +
  include/hw/ppc/spapr.h      |  8 ++++++-
  5 files changed, 98 insertions(+), 1 deletion(-)
hw/ppc/spapr_hcall.c +1 -0
index 4f76f1c..b394681 100644
@@ -1010,6 +1010,7 @@ static void hypercall_register_types(void)
 
      /* ibm,client-architecture-support support */
      spapr_register_hypercall(KVMPPC_H_CAS, h_client_architecture_support);
+    spapr_register_hypercall(KVMPPC_H_GET_LOC_CODE, phb_get_loc_code);
  }
 
  type_init(hypercall_register_types)
hw/ppc/spapr_pci.c +31 -0
index 05f4fac..c2ee476 100644
@@ -248,6 +248,44 @@ static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix,
      }
  }
 
+target_ulong phb_get_loc_code(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                              target_ulong opcode, target_ulong *args)
+{
+    sPAPRPHBState *sphb = NULL;
+    sPAPRPHBClass *spc = NULL;
+    char *buf = NULL, path[PATH_MAX];
+    PCIDevice *pdev;
+    target_ulong buid = args[0];
+    target_ulong config_addr = args[1];
+    target_ulong loc_code = args[2];
+    target_ulong size = args[3];
+
+    sphb = find_phb(spapr, buid);
+    pdev = find_dev(spapr, buid, config_addr);
+
+    if (!sphb || !pdev) {
+        return H_PARAMETER;
+    }
+
+    spc = SPAPR_PCI_HOST_BRIDGE_GET_CLASS(sphb);
+    if (spc->get_loc_code && spc->get_loc_code(sphb, pdev, &buf)) {
+        cpu_physical_memory_write(loc_code, buf, strlen(buf));
+        g_free(buf);
+        return H_SUCCESS;
+    }
+
+    /*
+     * For non-vfio devices and failures make up the location code out
+     * of the name, slot and function.
+     *
+     *       qemu_<name>:<slot>.<fn>
Quoted 8 lines

hw/ppc/spapr_pci.c static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix, · line 285

Quoted 4 lines
hw/ppc/spapr_pci.c +4 -0
+     */
+    snprintf(path, sizeof(path), "qemu_%s:%02d.%1d", pdev->name,
+             PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn));
+    cpu_physical_memory_write(loc_code, path, size);

Move the chunk above to a sPAPRPHBState::get_loc_code. And I'd add PHB's @index in the device name to make it unique across the guest.

Sure.

Quoted 16 lines
Quoted 16 lines
hw/ppc/spapr_pci.c +3 -0
+    return H_SUCCESS;
+}
+
  static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
                                  uint32_t token, uint32_t nargs,
                                  target_ulong args, uint32_t nret,
hw/ppc/spapr_pci_vfio.c +0 -0
index 99a1be5..bfdfa67 100644
@@ -171,6 +171,56 @@ static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option)
      return RTAS_OUT_SUCCESS;
  }
 
Quoted 3 lines

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 174

Quoted 1 line
hw/ppc/spapr_pci_vfio.c +1 -0
+static bool spapr_phb_vfio_get_devspec(PCIDevice *pdev, char **value)

s/value/devspec/ ?

Yes, should be value now.

Quoted 14 lines
Quoted 14 lines
hw/ppc/spapr_pci_vfio.c +13 -0
+{
+    char *host;
+    char path[PATH_MAX];
+    struct stat st;
+
+    host = object_property_get_str(OBJECT(pdev), "host", NULL);
+    if (!host) {
+        return false;
+    }
+
+    snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/devspec", host);
+    g_free(host);
+    if (stat(path, &st) < 0) {
Quoted 8 lines

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 191

Quoted 4 lines
hw/ppc/spapr_pci_vfio.c +4 -0
+        return false;
+    }
+
+    return g_file_get_contents(path, value, NULL, NULL);

g_file_get_contents() is expected to return FALSE if the file is missing so stat() seems redundant here.

Did not notive, will change it.

Quoted 17 lines
Quoted 4 lines
hw/ppc/spapr_pci_vfio.c +2 -0
+}
+

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 203

Quoted 10 lines
hw/ppc/spapr_pci_vfio.c +10 -0
+static int spapr_phb_vfio_get_loc_code(sPAPRPHBState *sphb,  PCIDevice *pdev,
+                                        char **loc_code)
+{
+    sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb);
+    char path[PATH_MAX], *buf = NULL;
+    struct stat st;
+
+    /* Non VFIO devices */
+    if (!svphb) {
+        return false;

The function returns int, not bool. s/false/-1/ and s/true/0/ please.

Yep, will do that.

Quoted 17 lines

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 207

Quoted 5 lines
hw/ppc/spapr_pci_vfio.c +4 -0
+    }
+
+    /* We have a vfio host bridge lets get the path. */
+    if (!spapr_phb_vfio_get_devspec(pdev, &buf)) {

s/buf/devspec/

hw/ppc/spapr_pci_vfio.c static int spapr_phb_vfio_eeh_reset(sPAPRPHBState *sphb, int option) · line 214

Quoted 7 lines
hw/ppc/spapr_pci_vfio.c +7 -0
+        return false;
+    }
+
+    snprintf(path, sizeof(path), "/proc/device-tree%s/ibm,loc-code", buf);
+    g_free(buf);
+    if (stat(path, &st) < 0) {
+            return false;
Quoted 1 line

Just return what stat() returned.

Ok

Quoted 41 lines
Quoted 41 lines
hw/ppc/spapr_pci_vfio.c +10 -0
+    }
+
+    /* A valid file, now read the loc-code */
+    if (g_file_get_contents(path, loc_code, NULL, NULL)) {
+        return true;
+    }
+    return false;
+}
+
  static int spapr_phb_vfio_eeh_configure(sPAPRPHBState *sphb)
  {
      sPAPRPHBVFIOState *svphb = SPAPR_PCI_VFIO_HOST_BRIDGE(sphb);
@@ -199,6 +249,7 @@ static void spapr_phb_vfio_class_init(ObjectClass *klass, void *data)
      spc->eeh_get_state = spapr_phb_vfio_eeh_get_state;
      spc->eeh_reset = spapr_phb_vfio_eeh_reset;
      spc->eeh_configure = spapr_phb_vfio_eeh_configure;
+    spc->get_loc_code = spapr_phb_vfio_get_loc_code;
  }
 
  static const TypeInfo spapr_phb_vfio_info = {
include/hw/pci-host/spapr.h +1 -0
index 895d273..1ff50b4 100644
@@ -53,6 +53,7 @@ struct sPAPRPHBClass {
      int (*eeh_get_state)(sPAPRPHBState *sphb, int *state);
      int (*eeh_reset)(sPAPRPHBState *sphb, int option);
      int (*eeh_configure)(sPAPRPHBState *sphb);
+    int (*get_loc_code)(sPAPRPHBState *sphb,  PCIDevice *pdev, char **loc_code);
  };
 
  typedef struct spapr_pci_msi {
include/hw/ppc/spapr.h +0 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
Quoted 8 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 4 lines
include/hw/ppc/spapr.h +4 -0
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

They are in stages of review/re-write :(

Quoted 3 lines

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls?

No particular reason though. Let me look at doing it as rtas, does not make much difference

Quoted 12 lines

The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Quoted 7 lines
include/hw/ppc/spapr.h +0 -0
  extern sPAPREnvironment *spapr;
 
@@ -522,6 +525,9 @@ int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname,
                        sPAPRTCETable *tcet);
  void spapr_pci_switch_vga(bool big_endian);
 
Quoted 11 lines
Quoted 7 lines
include/hw/ppc/spapr.h +3 -0
+target_ulong phb_get_loc_code(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                              target_ulong opcode, target_ulong *args);
+
  #define TYPE_SPAPR_RTC "spapr-rtc"
 
  void spapr_rtc_read(DeviceState *dev, struct tm *tm, uint32_t *ns);
Signature · 1 line
Alexey

Thanks for the review.

Regards,
Nikunj

#6 lore raw
In reply to David Gibson
Quoted 32 lines · David Gibson
Quoted 12 lines · Alexey Kardashevskiy
Quoted 11 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 18 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Quoted 8 lines
Quoted 4 lines

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug).

For me it was a short term plan. IMHO, this cant be done in short time.

Quoted 7 lines

That removes the need for the hcall entirely.

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 v2] spapr: populate ibm, loc-code

Quoted 39 lines · Nikunj A Dadhania
Quoted 37 lines · David Gibson
Quoted 12 lines · Alexey Kardashevskiy
Quoted 11 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 22 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
 #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
 /* Client Architecture support */
 #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Quoted 5 lines
Quoted 3 lines

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug).

For me it was a short term plan.

Sorry, I meant PCI device enumeration removal from SLOF was a long term plan.

Quoted 9 lines

IMHO, this cant be done in short time.

Quoted 7 lines

That removes the need for the hcall entirely.

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2] spapr: populate ibm, loc-code

Quoted 41 lines · Nikunj A Dadhania
Quoted 39 lines · Nikunj A Dadhania
Quoted 37 lines · David Gibson
Quoted 12 lines · Alexey Kardashevskiy
Quoted 11 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 22 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug).

For me it was a short term plan.

Sorry, I meant PCI device enumeration removal from SLOF was a long term plan.

It does not have to be removal, rather adding a case if there are already devices present (or resources assigned) on a PHB in the device tree, then do not do scan, something like that.

Quoted 12 lines
Quoted 11 lines

IMHO, this cant be done in short time.

Quoted 7 lines

That removes the need for the hcall entirely.

--
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

Signature · 1 line
Alexey
#9 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH v2] spapr: populate ibm, loc-code

Quoted 48 lines · Alexey Kardashevskiy
Quoted 47 lines · Nikunj A Dadhania
Quoted 44 lines · Nikunj A Dadhania
Quoted 32 lines · David Gibson
Quoted 12 lines · Alexey Kardashevskiy
Quoted 11 lines · Nikunj A Dadhania

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 18 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Quoted 8 lines
Quoted 4 lines

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug).

For me it was a short term plan.

Quoted 7 lines
Quoted 2 lines

Sorry, I meant PCI device enumeration removal from SLOF was a long term plan.

It does not have to be removal, rather adding a case if there are already devices present (or resources assigned) on a PHB in the device tree, then do not do scan, something like that.

Right, it would require time to analyze impact both on Qemu and SLOF side. I havent looked at the qemu side of the things how easy/complicated it would be to do PCI scanning

Regards
Nikunj

#4 lore raw
In reply to Alexey Kardashevskiy

Quoting Alexey Kardashevskiy (2015-03-29 22:08:17)

Quoted 38 lines · David Gibson
Quoted 37 lines · Alexey Kardashevskiy
Quoted 12 lines · Nikunj A Dadhania
Quoted 11 lines

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 22 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Quoted 7 lines
Quoted 3 lines

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug). That removes the need for the hcall entirely.

There was a strong opposition to PCI scan done by QEMU (although it was ok if PCI hotplug does some resource assignment in QEMU). Has this changed?

Was this WRT to hotplug, or was there previous discussion?

As far as hotplug, the main question was handling actual BAR assignments in QEMU, rather than SLOF, for hotplugged devices. (since RPAPHP hotplug code expects those assignments to be handled by firmware and encoded in device-tree).

We've worked around that so far by avoiding BAR assignments completely...

To get rpaphp working again, since it was already broken for other reasons, we'll be adding code that allows it to handle BAR assignments in the kernel in cases where 'reg'/'assigned-resources' properties don't indicate that they've already been assigned by QEMU/firmware. Alex seemed okay with this approach when we discussed it during his IBM visit a few weeks ago.

So, I'd imagine we can take the same approach for offloading PCI DT node creation to QEMU: handle node creation, but don't do actual BAR assignments. Just let SLOF inherit whatever DT node we give it, and let it update 'reg'/'assigned-properties' and other properties as needed, but otherwise pass on what QEMU provides.

Quoted 7 lines

I added Michael in cc: and hope Alexander may enlighten us on this topic...

Signature · 1 line
Alexey
#5 lore raw
Quoted 61 lines · Michael Roth

Quoting Alexey Kardashevskiy (2015-03-29 22:08:17)

Quoted 38 lines · David Gibson
Quoted 37 lines · Alexey Kardashevskiy
Quoted 12 lines · Nikunj A Dadhania
Quoted 11 lines

Each hardware instance has a platform unique location code. The OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity.

Introduce an hcall to populate ibm,loc-code.
1) PCI passthru devices need to identify with its own ibm,loc-code available on the host.
2) Emulated devices encode as following: qemu_<name>:<slot>.<fn>

[snip]

Quoted 22 lines

include/hw/ppc/spapr.h typedef struct sPAPREnvironment { · line 316

Quoted 13 lines
include/hw/ppc/spapr.h +4 -1
index af71e8b..95157ac 100644
@@ -310,7 +310,10 @@ typedef struct sPAPREnvironment {
  #define KVMPPC_H_LOGICAL_MEMOP  (KVMPPC_HCALL_BASE + 0x1)
  /* Client Architecture support */
  #define KVMPPC_H_CAS            (KVMPPC_HCALL_BASE + 0x2)
-#define KVMPPC_HCALL_MAX        KVMPPC_H_CAS
+#define KVMPPC_H_RTAS_UPDATE    (KVMPPC_HCALL_BASE + 0x3)
+#define KVMPPC_H_REPORT_MC_ERR  (KVMPPC_HCALL_BASE + 0x4)
+#define KVMPPC_H_GET_LOC_CODE   (KVMPPC_HCALL_BASE + 0x5)
+#define KVMPPC_HCALL_MAX        KVMPPC_H_GET_LOC_CODE

Please add only relevant codes. And what happened to patches adding H_RTAS_UPDATE and H_REPORT_MC_ERR?

Also (it is probably a very stupid question but still :) ), why are all these callbacks - hypercalls, not RTAS calls? The hypercalls are numbered in sPAPR and we kind of stealing numbers from that space while we are allocating RTAS tokens ourselves and have more freedom.

Quoted 7 lines
Quoted 3 lines

Also, I thought the plan was to remove PCI device enumeration from SLOF and move it to qemu (since we need to partially do that for hotplug). That removes the need for the hcall entirely.

There was a strong opposition to PCI scan done by QEMU (although it was ok if PCI hotplug does some resource assignment in QEMU). Has this changed?

Was this WRT to hotplug, or was there previous discussion?

As far as hotplug, the main question was handling actual BAR assignments in QEMU, rather than SLOF, for hotplugged devices. (since RPAPHP hotplug code expects those assignments to be handled by firmware and encoded in device-tree).

We've worked around that so far by avoiding BAR assignments completely...

To get rpaphp working again, since it was already broken for other reasons, we'll be adding code that allows it to handle BAR assignments in the kernel in cases where 'reg'/'assigned-resources' properties don't indicate that they've already been assigned by QEMU/firmware. Alex seemed okay with this approach when we discussed it during his IBM visit a few weeks ago.

Quoted 3 lines

So, I'd imagine we can take the same approach for offloading PCI DT node creation to QEMU: handle node creation, but don't do actual BAR assignments.

Yes, thats what I have been playing with since yesterday. I am using following of your patches:

pci: make pci_bar useable outside pci.c
spapr_pci: enable basic hotplug operations

Quoted 3 lines

Just let SLOF inherit whatever DT node we give it, and let it update 'reg'/'assigned-properties' and other properties as needed, but otherwise pass on what QEMU provides.

I still need to pass the updated DT blob to SLOF.

Regards
Nikunj