[Qemu-devel] [PATCH] ppc/xics/spapr: Fix H_IPOLL implementation

Cédric Le Goater posted 1 patch 5 years, 1 month ago
Test asan failed
Test docker-clang@ubuntu passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190314063855.27890-1-clg@kaod.org
Maintainers: David Gibson <david@gibson.dropbear.id.au>
hw/intc/xics_spapr.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
[Qemu-devel] [PATCH] ppc/xics/spapr: Fix H_IPOLL implementation
Posted by Cédric Le Goater 5 years, 1 month ago
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

H_IPOLL takes the CPU# of the processor to poll as an argument,
it doesn't operate on self.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/intc/xics_spapr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 607e1c167ba2..9d2b8adef7c5 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -95,8 +95,15 @@ static target_ulong h_eoi(PowerPCCPU *cpu, SpaprMachineState *spapr,
 static target_ulong h_ipoll(PowerPCCPU *cpu, SpaprMachineState *spapr,
                             target_ulong opcode, target_ulong *args)
 {
+    ICPState *icp = xics_icp_get(XICS_FABRIC(spapr), args[0]);
     uint32_t mfrr;
-    uint32_t xirr = icp_ipoll(spapr_cpu_state(cpu)->icp, &mfrr);
+    uint32_t xirr;
+
+    if (!icp) {
+        return H_PARAMETER;
+    }
+
+    xirr = icp_ipoll(icp, &mfrr);
 
     args[0] = xirr;
     args[1] = mfrr;
-- 
2.20.1


Re: [Qemu-devel] [PATCH] ppc/xics/spapr: Fix H_IPOLL implementation
Posted by Greg Kurz 5 years, 1 month ago
On Thu, 14 Mar 2019 07:38:55 +0100
Cédric Le Goater <clg@kaod.org> wrote:

> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> H_IPOLL takes the CPU# of the processor to poll as an argument,
> it doesn't operate on self.
> 

True.

> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  hw/intc/xics_spapr.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
> index 607e1c167ba2..9d2b8adef7c5 100644
> --- a/hw/intc/xics_spapr.c
> +++ b/hw/intc/xics_spapr.c
> @@ -95,8 +95,15 @@ static target_ulong h_eoi(PowerPCCPU *cpu, SpaprMachineState *spapr,
>  static target_ulong h_ipoll(PowerPCCPU *cpu, SpaprMachineState *spapr,
>                              target_ulong opcode, target_ulong *args)
>  {
> +    ICPState *icp = xics_icp_get(XICS_FABRIC(spapr), args[0]);
>      uint32_t mfrr;
> -    uint32_t xirr = icp_ipoll(spapr_cpu_state(cpu)->icp, &mfrr);
> +    uint32_t xirr;
> +
> +    if (!icp) {
> +        return H_PARAMETER;
> +    }
> +
> +    xirr = icp_ipoll(icp, &mfrr);
>  
>      args[0] = xirr;
>      args[1] = mfrr;


Re: [Qemu-devel] [PATCH] ppc/xics/spapr: Fix H_IPOLL implementation
Posted by David Gibson 5 years, 1 month ago
On Thu, Mar 14, 2019 at 07:53:15AM +0100, Greg Kurz wrote:
> On Thu, 14 Mar 2019 07:38:55 +0100
> Cédric Le Goater <clg@kaod.org> wrote:
> 
> > From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > 
> > H_IPOLL takes the CPU# of the processor to poll as an argument,
> > it doesn't operate on self.
> > 
> 
> True.

Applied to ppc-for-4.0.

> 
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Signed-off-by: Cédric Le Goater <clg@kaod.org>
> > ---
> 
> Reviewed-by: Greg Kurz <groug@kaod.org>
> 
> >  hw/intc/xics_spapr.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
> > index 607e1c167ba2..9d2b8adef7c5 100644
> > --- a/hw/intc/xics_spapr.c
> > +++ b/hw/intc/xics_spapr.c
> > @@ -95,8 +95,15 @@ static target_ulong h_eoi(PowerPCCPU *cpu, SpaprMachineState *spapr,
> >  static target_ulong h_ipoll(PowerPCCPU *cpu, SpaprMachineState *spapr,
> >                              target_ulong opcode, target_ulong *args)
> >  {
> > +    ICPState *icp = xics_icp_get(XICS_FABRIC(spapr), args[0]);
> >      uint32_t mfrr;
> > -    uint32_t xirr = icp_ipoll(spapr_cpu_state(cpu)->icp, &mfrr);
> > +    uint32_t xirr;
> > +
> > +    if (!icp) {
> > +        return H_PARAMETER;
> > +    }
> > +
> > +    xirr = icp_ipoll(icp, &mfrr);
> >  
> >      args[0] = xirr;
> >      args[1] = mfrr;
> 

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