diff mbox

[11/12] spapr_events: event-scan RTAS interface

Message ID 1408407718-10835-12-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Aug. 19, 2014, 12:21 a.m. UTC
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

We don't actually rely on this interface to surface hotplug events, and
instead rely on the similar-but-interrupt-driven check-exception RTAS
interface used for EPOW events. However, the existence of this interface
is needed to ensure guest kernels initialize the event-reporting
interfaces which will in turn be used by userspace tools to handle these
events, so we implement this interface as a stub.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/ppc/spapr.c         | 1 +
 hw/ppc/spapr_events.c  | 9 +++++++++
 include/hw/ppc/spapr.h | 2 ++
 3 files changed, 12 insertions(+)

Comments

Alexey Kardashevskiy Aug. 26, 2014, 9:30 a.m. UTC | #1
On 08/19/2014 10:21 AM, Michael Roth wrote:
> From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> 
> We don't actually rely on this interface to surface hotplug events, and
> instead rely on the similar-but-interrupt-driven check-exception RTAS
> interface used for EPOW events. However, the existence of this interface
> is needed to ensure guest kernels initialize the event-reporting
> interfaces which will in turn be used by userspace tools to handle these
> events, so we implement this interface as a stub.
> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  hw/ppc/spapr.c         | 1 +
>  hw/ppc/spapr_events.c  | 9 +++++++++
>  include/hw/ppc/spapr.h | 2 ++
>  3 files changed, 12 insertions(+)
> 
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index 825fd31..c65b13a 100644
> --- a/hw/ppc/spapr.c
> +++ b/hw/ppc/spapr.c
> @@ -702,6 +702,7 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
>          refpoints, sizeof(refpoints))));
>  
>      _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MAX)));
> +    _FDT((fdt_property_cell(fdt, "rtas-event-scan-rate", RTAS_EVENT_SCAN_RATE)));
>  
>      /*
>       * According to PAPR, rtas ibm,os-term, does not gaurantee a return
> diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
> index c0be0e5..bb80080 100644
> --- a/hw/ppc/spapr_events.c
> +++ b/hw/ppc/spapr_events.c
> @@ -449,6 +449,14 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>      }
>  }
>  
> +static void event_scan(PowerPCCPU *cpu, sPAPREnvironment *spapr,
> +                            uint32_t token, uint32_t nargs,
> +                            target_ulong args,
> +                            uint32_t nret, target_ulong rets)
> +{
> +    rtas_st(rets, 0, 1); /* no error events found */


rtas_st(rets, 0, RTAS_OUT_SUCCESS);



> +}
> +
>  void spapr_events_init(sPAPREnvironment *spapr)
>  {
>      spapr->check_exception_irq = xics_alloc(spapr->icp, 0, 0, false);
> @@ -456,4 +464,5 @@ void spapr_events_init(sPAPREnvironment *spapr)
>      qemu_register_powerdown_notifier(&spapr->epow_notifier);
>      spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception",
>                          check_exception);
> +    spapr_rtas_register(RTAS_EVENT_SCAN, "event-scan", event_scan);
>  }
> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
> index 5382bf1..aab627f 100644
> --- a/include/hw/ppc/spapr.h
> +++ b/include/hw/ppc/spapr.h
> @@ -484,6 +484,8 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>  
>  #define RTAS_ERROR_LOG_MAX      2048
>  
> +#define RTAS_EVENT_SCAN_RATE    1

1 second? 1ms? 1 minute? :) Worth mentioning in the commit log.


> +
>  typedef struct sPAPRTCETable sPAPRTCETable;
>  
>  #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
>
Tyrel Datwyler Aug. 29, 2014, 6:43 p.m. UTC | #2
On 08/26/2014 02:30 AM, Alexey Kardashevskiy wrote:
> On 08/19/2014 10:21 AM, Michael Roth wrote:
>> From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
>>
>> We don't actually rely on this interface to surface hotplug events, and
>> instead rely on the similar-but-interrupt-driven check-exception RTAS
>> interface used for EPOW events. However, the existence of this interface
>> is needed to ensure guest kernels initialize the event-reporting
>> interfaces which will in turn be used by userspace tools to handle these
>> events, so we implement this interface as a stub.
>>
>> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
>> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
>> ---
>>  hw/ppc/spapr.c         | 1 +
>>  hw/ppc/spapr_events.c  | 9 +++++++++
>>  include/hw/ppc/spapr.h | 2 ++
>>  3 files changed, 12 insertions(+)
>>
>> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
>> index 825fd31..c65b13a 100644
>> --- a/hw/ppc/spapr.c
>> +++ b/hw/ppc/spapr.c
>> @@ -702,6 +702,7 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base,
>>          refpoints, sizeof(refpoints))));
>>  
>>      _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MAX)));
>> +    _FDT((fdt_property_cell(fdt, "rtas-event-scan-rate", RTAS_EVENT_SCAN_RATE)));
>>  
>>      /*
>>       * According to PAPR, rtas ibm,os-term, does not gaurantee a return
>> diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
>> index c0be0e5..bb80080 100644
>> --- a/hw/ppc/spapr_events.c
>> +++ b/hw/ppc/spapr_events.c
>> @@ -449,6 +449,14 @@ static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>>      }
>>  }
>>  
>> +static void event_scan(PowerPCCPU *cpu, sPAPREnvironment *spapr,
>> +                            uint32_t token, uint32_t nargs,
>> +                            target_ulong args,
>> +                            uint32_t nret, target_ulong rets)
>> +{
>> +    rtas_st(rets, 0, 1); /* no error events found */
> 
> 
> rtas_st(rets, 0, RTAS_OUT_SUCCESS);
> 
> 
> 
>> +}
>> +
>>  void spapr_events_init(sPAPREnvironment *spapr)
>>  {
>>      spapr->check_exception_irq = xics_alloc(spapr->icp, 0, 0, false);
>> @@ -456,4 +464,5 @@ void spapr_events_init(sPAPREnvironment *spapr)
>>      qemu_register_powerdown_notifier(&spapr->epow_notifier);
>>      spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception",
>>                          check_exception);
>> +    spapr_rtas_register(RTAS_EVENT_SCAN, "event-scan", event_scan);
>>  }
>> diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
>> index 5382bf1..aab627f 100644
>> --- a/include/hw/ppc/spapr.h
>> +++ b/include/hw/ppc/spapr.h
>> @@ -484,6 +484,8 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
>>  
>>  #define RTAS_ERROR_LOG_MAX      2048
>>  
>> +#define RTAS_EVENT_SCAN_RATE    1
> 
> 1 second? 1ms? 1 minute? :) Worth mentioning in the commit log.

As per PAPR 7.3.3.1 the rate is per minute.

-Tyrel

> 
> 
>> +
>>  typedef struct sPAPRTCETable sPAPRTCETable;
>>  
>>  #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
>>
> 
>
diff mbox

Patch

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 825fd31..c65b13a 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -702,6 +702,7 @@  static void *spapr_create_fdt_skel(hwaddr initrd_base,
         refpoints, sizeof(refpoints))));
 
     _FDT((fdt_property_cell(fdt, "rtas-error-log-max", RTAS_ERROR_LOG_MAX)));
+    _FDT((fdt_property_cell(fdt, "rtas-event-scan-rate", RTAS_EVENT_SCAN_RATE)));
 
     /*
      * According to PAPR, rtas ibm,os-term, does not gaurantee a return
diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c
index c0be0e5..bb80080 100644
--- a/hw/ppc/spapr_events.c
+++ b/hw/ppc/spapr_events.c
@@ -449,6 +449,14 @@  static void check_exception(PowerPCCPU *cpu, sPAPREnvironment *spapr,
     }
 }
 
+static void event_scan(PowerPCCPU *cpu, sPAPREnvironment *spapr,
+                            uint32_t token, uint32_t nargs,
+                            target_ulong args,
+                            uint32_t nret, target_ulong rets)
+{
+    rtas_st(rets, 0, 1); /* no error events found */
+}
+
 void spapr_events_init(sPAPREnvironment *spapr)
 {
     spapr->check_exception_irq = xics_alloc(spapr->icp, 0, 0, false);
@@ -456,4 +464,5 @@  void spapr_events_init(sPAPREnvironment *spapr)
     qemu_register_powerdown_notifier(&spapr->epow_notifier);
     spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception",
                         check_exception);
+    spapr_rtas_register(RTAS_EVENT_SCAN, "event-scan", event_scan);
 }
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 5382bf1..aab627f 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -484,6 +484,8 @@  int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
 
 #define RTAS_ERROR_LOG_MAX      2048
 
+#define RTAS_EVENT_SCAN_RATE    1
+
 typedef struct sPAPRTCETable sPAPRTCETable;
 
 #define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"