All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeny Voevodin <e.voevodin@samsung.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Dmitry Solodkiy <d.solodkiy@samsung.com>,
	patches@linaro.org, qemu-devel@nongnu.org,
	Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH 02/13] hw/arm_gic: Move gic_get_current_cpu into arm_gic.c
Date: Thu, 05 Apr 2012 08:29:58 +0400	[thread overview]
Message-ID: <4F7D1FC6.8020309@samsung.com> (raw)
In-Reply-To: <1333553462-12633-3-git-send-email-peter.maydell@linaro.org>

On 04.04.2012 19:30, Peter Maydell wrote:
> Move the gic_get_current_cpu() function into arm_gic.c.
> There are only two implementations: (1) "get the index
> of the currently executing CPU", used by all multicore
> GICs, and (2) "always 0", used by all GICs instantiated
> with a single CPU interface (the Realview board GIC and
> the v7M NVIC). So we can move this into the main GIC
> source file.
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   hw/a15mpcore.c      |    8 --------
>   hw/a9mpcore.c       |    9 ---------
>   hw/arm11mpcore.c    |    6 ------
>   hw/arm_gic.c        |   20 +++++++++++++++-----
>   hw/armv7m_nvic.c    |    7 -------
>   hw/exynos4210_gic.c |    6 ------
>   hw/realview_gic.c   |    7 -------
>   7 files changed, 15 insertions(+), 48 deletions(-)
>
> diff --git a/hw/a15mpcore.c b/hw/a15mpcore.c
> index 67206ec..2e2ed42 100644
> --- a/hw/a15mpcore.c
> +++ b/hw/a15mpcore.c
> @@ -20,14 +20,6 @@
>
>   #include "sysbus.h"
>
> -/* Configuration for arm_gic.c:
> - * how to ID current CPU
> - */
> -static inline int gic_get_current_cpu(void)
> -{
> -  return cpu_single_env->cpu_index;
> -}
> -
>   #include "arm_gic.c"
>
>   /* A15MP private memory region.  */
> diff --git a/hw/a9mpcore.c b/hw/a9mpcore.c
> index 5bbe3c7..1d83c37 100644
> --- a/hw/a9mpcore.c
> +++ b/hw/a9mpcore.c
> @@ -10,15 +10,6 @@
>
>   #include "sysbus.h"
>
> -/* Configuration for arm_gic.c:
> - * how to ID current CPU
> - */
> -static inline int
> -gic_get_current_cpu(void)
> -{
> -  return cpu_single_env->cpu_index;
> -}
> -
>   #include "arm_gic.c"
>
>   /* A9MP private memory region.  */
> diff --git a/hw/arm11mpcore.c b/hw/arm11mpcore.c
> index 99c1826..c4829d8 100644
> --- a/hw/arm11mpcore.c
> +++ b/hw/arm11mpcore.c
> @@ -10,12 +10,6 @@
>   #include "sysbus.h"
>   #include "qemu-timer.h"
>
> -static inline int
> -gic_get_current_cpu(void)
> -{
> -  return cpu_single_env->cpu_index;
> -}
> -
>   #include "arm_gic.c"
>
>   /* MPCore private memory region.  */
> diff --git a/hw/arm_gic.c b/hw/arm_gic.c
> index f64a001..df1a34b 100644
> --- a/hw/arm_gic.c
> +++ b/hw/arm_gic.c
> @@ -126,6 +126,16 @@ typedef struct gic_state
>       uint32_t num_irq;
>   } gic_state;
>
> +static inline int gic_get_current_cpu(gic_state *s)
> +{
> +#if NCPU>  1
> +    if (s->num_cpu>  1) {
> +        return cpu_single_env->cpu_index;
> +    }
> +#endif
> +    return 0;
> +}
> +
>   /* TODO: Many places that call this routine could be optimized.  */
>   /* Update interrupt status after enabled or pending bits have been changed.  */
>   static void gic_update(gic_state *s)
> @@ -285,7 +295,7 @@ static uint32_t gic_dist_readb(void *opaque, target_phys_addr_t offset)
>       int cm;
>       int mask;
>
> -    cpu = gic_get_current_cpu();
> +    cpu = gic_get_current_cpu(s);
>       cm = 1<<  cpu;
>       if (offset<  0x100) {
>   #ifndef NVIC
> @@ -420,7 +430,7 @@ static void gic_dist_writeb(void *opaque, target_phys_addr_t offset,
>       int i;
>       int cpu;
>
> -    cpu = gic_get_current_cpu();
> +    cpu = gic_get_current_cpu(s);
>       if (offset<  0x100) {
>   #ifdef NVIC
>           goto bad_reg;
> @@ -582,7 +592,7 @@ static void gic_dist_writel(void *opaque, target_phys_addr_t offset,
>           int irq;
>           int mask;
>
> -        cpu = gic_get_current_cpu();
> +        cpu = gic_get_current_cpu(s);
>           irq = value&  0x3ff;
>           switch ((value>>  24)&  3) {
>           case 0:
> @@ -665,14 +675,14 @@ static uint64_t gic_thiscpu_read(void *opaque, target_phys_addr_t addr,
>                                    unsigned size)
>   {
>       gic_state *s = (gic_state *)opaque;
> -    return gic_cpu_read(s, gic_get_current_cpu(), addr);
> +    return gic_cpu_read(s, gic_get_current_cpu(s), addr);
>   }
>
>   static void gic_thiscpu_write(void *opaque, target_phys_addr_t addr,
>                                 uint64_t value, unsigned size)
>   {
>       gic_state *s = (gic_state *)opaque;
> -    gic_cpu_write(s, gic_get_current_cpu(), addr, value);
> +    gic_cpu_write(s, gic_get_current_cpu(s), addr, value);
>   }
>
>   /* Wrappers to read/write the GIC CPU interface for a specific CPU.
> diff --git a/hw/armv7m_nvic.c b/hw/armv7m_nvic.c
> index bdab709..99ed85b 100644
> --- a/hw/armv7m_nvic.c
> +++ b/hw/armv7m_nvic.c
> @@ -17,13 +17,6 @@
>
>   #define NVIC 1
>
> -/* Only a single "CPU" interface is present.  */
> -static inline int
> -gic_get_current_cpu(void)
> -{
> -    return 0;
> -}
> -
>   static uint32_t nvic_readl(void *opaque, uint32_t offset);
>   static void nvic_writel(void *opaque, uint32_t offset, uint32_t value);
>
> diff --git a/hw/exynos4210_gic.c b/hw/exynos4210_gic.c
> index 426f540..ff7ab84 100644
> --- a/hw/exynos4210_gic.c
> +++ b/hw/exynos4210_gic.c
> @@ -262,12 +262,6 @@ uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit)
>
>   /********* GIC part *********/
>
> -static inline int
> -gic_get_current_cpu(void)
> -{
> -    return cpu_single_env->cpu_index;
> -}
> -
>   #include "arm_gic.c"
>
>   typedef struct {
> diff --git a/hw/realview_gic.c b/hw/realview_gic.c
> index d114242..aa780fe 100644
> --- a/hw/realview_gic.c
> +++ b/hw/realview_gic.c
> @@ -9,13 +9,6 @@
>
>   #include "sysbus.h"
>
> -/* Only a single "CPU" interface is present.  */
> -static inline int
> -gic_get_current_cpu(void)
> -{
> -  return 0;
> -}
> -
>   #include "arm_gic.c"
>
>   typedef struct {

Reviewed-by: Evgeny Voevodin<e.voevodin@samsung.com>


-- 
Kind regards,
Evgeny Voevodin,
Leading Software Engineer,
ASWG, Moscow R&D center, Samsung Electronics
e-mail: e.voevodin@samsung.com

  reply	other threads:[~2012-04-05  4:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04 15:30 [Qemu-devel] [PATCH 00/13] Convert ARM GIC to sysbus device Peter Maydell
2012-04-04 15:30 ` [Qemu-devel] [PATCH 01/13] hw/arm_gic: Move NCPU definition to arm_gic.c Peter Maydell
2012-04-05  4:29   ` Evgeny Voevodin
2012-04-04 15:30 ` [Qemu-devel] [PATCH 02/13] hw/arm_gic: Move gic_get_current_cpu into arm_gic.c Peter Maydell
2012-04-05  4:29   ` Evgeny Voevodin [this message]
2012-04-04 15:30 ` [Qemu-devel] [PATCH 03/13] hw/arm_gic.c: Expose PPI inputs as gpio inputs Peter Maydell
2012-04-04 15:30 ` [Qemu-devel] [PATCH 04/13] arm_gic: Make the GIC its own sysbus device Peter Maydell
2012-04-05  4:30   ` Evgeny Voevodin
2012-04-04 15:30 ` [Qemu-devel] [PATCH 05/13] hw/a15mpcore: switch to using sysbus GIC Peter Maydell
2012-04-04 15:30 ` [Qemu-devel] [PATCH 06/13] hw/a9mpcore.c: Switch " Peter Maydell
2012-04-04 15:30 ` [Qemu-devel] [PATCH 07/13] hw/realview_gic: switch to " Peter Maydell
2012-04-04 15:30 ` [Qemu-devel] [PATCH 08/13] hw/exynos4210_gic.c: Convert to using " Peter Maydell
2012-04-05  4:30   ` Evgeny Voevodin
2012-04-04 15:30 ` [Qemu-devel] [PATCH 09/13] hw/arm11mpcore: Convert to using sysbus GIC device Peter Maydell
2012-04-04 15:30 ` [Qemu-devel] [PATCH 10/13] hw/arm_gic: Make gic_reset a sysbus reset function Peter Maydell
2012-04-04 15:31 ` [Qemu-devel] [PATCH 11/13] hw/arm_gic.c: Use NVIC instead of LEGACY_INCLUDED_GIC define Peter Maydell
2012-04-04 15:31 ` [Qemu-devel] [PATCH 12/13] hw/arm_gic.c: gic_set_pending_private() is NVIC only Peter Maydell
2012-04-04 15:31 ` [Qemu-devel] [PATCH 13/13] hw/arm_gic.c: Remove stray hardcoded tab Peter Maydell
2012-04-05  4:31 ` [Qemu-devel] [PATCH 00/13] Convert ARM GIC to sysbus device Evgeny Voevodin
2012-04-05 12:23 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F7D1FC6.8020309@samsung.com \
    --to=e.voevodin@samsung.com \
    --cc=d.solodkiy@samsung.com \
    --cc=patches@linaro.org \
    --cc=paul@codesourcery.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.