diff mbox

[v4,3/8] cpus: Add a macro to walk CPUs in reverse

Message ID 1433478358-993-4-git-send-email-bharata@linux.vnet.ibm.com
State New
Headers show

Commit Message

Bharata B Rao June 5, 2015, 4:25 a.m. UTC
Add CPU_FOREACH_REVERSE that walks CPUs in reverse.

Needed for PowerPC CPU device tree reorganization.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: Andreas Färber <afaerber@suse.de>
---
 include/qom/cpu.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andreas Färber June 5, 2015, 2:39 p.m. UTC | #1
Am 05.06.2015 um 13:25 schrieb Bharata B Rao:
> Add CPU_FOREACH_REVERSE that walks CPUs in reverse.
> 
> Needed for PowerPC CPU device tree reorganization.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> Cc: Andreas Färber <afaerber@suse.de>
> ---
>  include/qom/cpu.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 39f0f19..42f42f5 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -323,6 +323,8 @@ extern struct CPUTailQ cpus;
>  #define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node)
>  #define CPU_FOREACH_SAFE(cpu, next_cpu) \
>      QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu)
> +#define CPU_FOREACH_REVERSE(cpu) \
> +    QTAILQ_FOREACH_REVERSE(cpu, &cpus, CPUTailQ, node)
>  #define first_cpu QTAILQ_FIRST(&cpus)
>  
>  DECLARE_TLS(CPUState *, current_cpu);

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas
David Gibson June 15, 2015, 6:41 a.m. UTC | #2
On Fri, Jun 05, 2015 at 11:39:18PM +0900, Andreas Färber wrote:
> Am 05.06.2015 um 13:25 schrieb Bharata B Rao:
> > Add CPU_FOREACH_REVERSE that walks CPUs in reverse.
> > 
> > Needed for PowerPC CPU device tree reorganization.
> > 
> > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > Cc: Andreas Färber <afaerber@suse.de>
> > ---
> >  include/qom/cpu.h | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> > index 39f0f19..42f42f5 100644
> > --- a/include/qom/cpu.h
> > +++ b/include/qom/cpu.h
> > @@ -323,6 +323,8 @@ extern struct CPUTailQ cpus;
> >  #define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node)
> >  #define CPU_FOREACH_SAFE(cpu, next_cpu) \
> >      QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu)
> > +#define CPU_FOREACH_REVERSE(cpu) \
> > +    QTAILQ_FOREACH_REVERSE(cpu, &cpus, CPUTailQ, node)
> >  #define first_cpu QTAILQ_FIRST(&cpus)
> >  
> >  DECLARE_TLS(CPUState *, current_cpu);
> 
> Reviewed-by: Andreas Färber <afaerber@suse.de>

I'm hoping to merge the parts of this series that affect the spapr
code (most of it) shortly.  Should this patch go through another tree
though?
diff mbox

Patch

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 39f0f19..42f42f5 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -323,6 +323,8 @@  extern struct CPUTailQ cpus;
 #define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node)
 #define CPU_FOREACH_SAFE(cpu, next_cpu) \
     QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu)
+#define CPU_FOREACH_REVERSE(cpu) \
+    QTAILQ_FOREACH_REVERSE(cpu, &cpus, CPUTailQ, node)
 #define first_cpu QTAILQ_FIRST(&cpus)
 
 DECLARE_TLS(CPUState *, current_cpu);