qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH v6 3/3] sPAPR: Support EEH RTAS services


From: Alexander Graf
Subject: Re: [Qemu-ppc] [PATCH v6 3/3] sPAPR: Support EEH RTAS services
Date: Thu, 22 May 2014 12:03:11 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.5.0


On 22.05.14 10:26, Gavin Shan wrote:
The patch registers EEH RTAS services, which are emulated with the
help of vfio_eeh_handler() that was introduced in the previous
patch.

Signed-off-by: Gavin Shan <address@hidden>
---
  hw/ppc/spapr_pci.c | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 228 insertions(+)

diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c
index a9f307a..d82e954 100644
--- a/hw/ppc/spapr_pci.c
+++ b/hw/ppc/spapr_pci.c
@@ -22,6 +22,7 @@
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   * THE SOFTWARE.
   */
+#include <linux/vfio.h>
  #include "hw/hw.h"
  #include "hw/pci/pci.h"
  #include "hw/pci/msi.h"
@@ -29,6 +30,7 @@
  #include "hw/pci/pci_host.h"
  #include "hw/ppc/spapr.h"
  #include "hw/pci-host/spapr.h"
+#include "hw/misc/vfio.h"
  #include "exec/address-spaces.h"
  #include <libfdt.h>
  #include "trace.h"
@@ -422,6 +424,219 @@ static void 
rtas_ibm_query_interrupt_source_number(PowerPCCPU *cpu,
      rtas_st(rets, 2, 1);/* 0 == level; 1 == edge */
  }
+static void rtas_ibm_set_eeh_option(PowerPCCPU *cpu,
+                                    sPAPREnvironment *spapr,
+                                    uint32_t token, uint32_t nargs,
+                                    target_ulong args, uint32_t nret,
+                                    target_ulong rets)
+{
+    struct vfio_eeh_pe_set_option option;
+    uint32_t addr;
+    uint64_t buid = ((uint64_t)rtas_ld(args, 1) << 32) | rtas_ld(args, 2);
+    sPAPRPHBState *sphb = spapr_find_phb(spapr, buid);
+    int32_t ret;
+
+    if (!sphb || !sphb->parent_obj.bus) {
+        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+        return;
+    }
+
+    if ((nargs != 4) || (nret != 1)) {
+        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+        return;
+    }
+
+    addr = rtas_ld(args, 0);
+    option.argsz = sizeof(option);
+    option.option = rtas_ld(args, 3);
+    if (option.option > 3) {
+        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
+        return;
+    }
+
+    ret = vfio_eeh_handler(VFIO_EEH_PE_SET_OPTION, &option,
+                           sphb->parent_obj.bus, addr);

There is no reason EEH would be tied to VFIO. We could just as well emulate EEH. I guess what you really want here is to find the device the guest is trying to access and then call a function in its class to handle that particular eeh event.


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]