qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: Alistair Francis <alistair23@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Martin Galvan <martin.galvan@tallertechnologies.com>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Konstanty Bialkowski <konstanty@ieee.org>
Subject: Re: [Qemu-devel] [Patch v1 5/8] target_arm: Parameterise the irq lines for armv7m_init
Date: Tue, 16 Sep 2014 01:23:13 +1000	[thread overview]
Message-ID: <CAEgOgz60K4H-E-swhS3EDSmLXpRFqV63Oybe1wFg-fifdya_Pw@mail.gmail.com> (raw)
In-Reply-To: <04950a2323d1285e4f191a3bea769095f9621875.1410682231.git.alistair23@gmail.com>

On Sun, Sep 14, 2014 at 6:18 PM, Alistair Francis <alistair23@gmail.com> wrote:
> This patch allows the board to specifiy the number of NVIC interrupt
> lines when using armv7m_init.
>
> Signed-off-by: Alistair Francis <alistair23@gmail.com>
> ---
>  hw/arm/armv7m.c      | 7 ++++---
>  hw/arm/stellaris.c   | 4 +++-
>  include/hw/arm/arm.h | 2 +-
>  3 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
> index 5c1f7b3..5e684a0 100644
> --- a/hw/arm/armv7m.c
> +++ b/hw/arm/armv7m.c
> @@ -167,14 +167,14 @@ static void armv7m_reset(void *opaque)
>     Returns the NVIC array.  */
>
>  qemu_irq *armv7m_init(MemoryRegion *system_memory,
> -                      int flash_size, int sram_size,
> +                      int flash_size, int sram_size, int num_irq,

This will change slightly based on previous patch comment, but otherwise.

Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>

>                        const char *kernel_filename, const char *cpu_model)
>  {
>      ARMCPU *cpu;
>      CPUARMState *env;
>      DeviceState *nvic;
>      /* FIXME: make this local state.  */
> -    static qemu_irq pic[64];
> +    qemu_irq *pic = g_new(qemu_irq, num_irq);
>      int image_size;
>      uint64_t entry;
>      uint64_t lowaddr;
> @@ -207,11 +207,12 @@ qemu_irq *armv7m_init(MemoryRegion *system_memory,
>      armv7m_bitband_init();
>
>      nvic = qdev_create(NULL, "armv7m_nvic");
> +    qdev_prop_set_uint32(nvic, "num-irq", num_irq);

Curious, was this previously relying on the default for nvic being 64?
(hence this is appearing as purely additive).

Regards,
Peter

>      env->nvic = nvic;
>      qdev_init_nofail(nvic);
>      sysbus_connect_irq(SYS_BUS_DEVICE(nvic), 0,
>                         qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
> -    for (i = 0; i < 64; i++) {
> +    for (i = 0; i < num_irq; i++) {
>          pic[i] = qdev_get_gpio_in(nvic, i);
>      }
>
> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
> index 3c8e9d1..e4da1fb 100644
> --- a/hw/arm/stellaris.c
> +++ b/hw/arm/stellaris.c
> @@ -29,6 +29,8 @@
>  #define BP_OLED_SSI  0x02
>  #define BP_GAMEPAD   0x04
>
> +#define NUM_IRQ_LINES 64
> +
>  typedef const struct {
>      const char *name;
>      uint32_t did0;
> @@ -1238,7 +1240,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
>      memory_region_add_subregion(system_memory, 0x20000000, sram);
>
>      pic = armv7m_init(system_memory, flash_size, sram_size,
> -                      kernel_filename, cpu_model);
> +                      NUM_IRQ_LINES, kernel_filename, cpu_model);
>
>      if (board->dc1 & (1 << 16)) {
>          dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000,
> diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h
> index cefc9e6..3e7c463 100644
> --- a/include/hw/arm/arm.h
> +++ b/include/hw/arm/arm.h
> @@ -16,7 +16,7 @@
>
>  /* armv7m.c */
>  qemu_irq *armv7m_init(MemoryRegion *system_memory,
> -                      int flash_size, int sram_size,
> +                      int flash_size, int sram_size, int num_irq,
>                        const char *kernel_filename, const char *cpu_model);
>
>  /* arm_boot.c */
> --
> 1.9.1
>
>

  reply	other threads:[~2014-09-15 15:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14  8:18 [Qemu-devel] [Patch v1 0/8] Netduino 2 Machine Model Alistair Francis
2014-09-14  8:18 ` [Qemu-devel] [Patch v1 1/8] stm32f205_timer: Add the stm32f205 Timer Alistair Francis
2014-09-15 15:01   ` Peter Crosthwaite
2014-09-19  2:00     ` Alistair Francis
2014-09-14  8:18 ` [Qemu-devel] [Patch v1 2/8] stm32f205_USART: Add the stm32f205 USART Controller Alistair Francis
2014-09-15 15:11   ` Peter Crosthwaite
2014-09-19  2:22     ` Alistair Francis
2014-09-14  8:18 ` [Qemu-devel] [Patch v1 3/8] stm32f205_SYSCFG: Add the stm32f205 SYSCFG Alistair Francis
2014-09-14  8:18 ` [Qemu-devel] [Patch v1 4/8] target_arm: Remove memory region init from armv7m_init Alistair Francis
2014-09-15 15:20   ` Peter Crosthwaite
2014-09-15 15:36     ` Paolo Bonzini
2014-09-16  2:37     ` Alistair Francis
2014-09-14  8:18 ` [Qemu-devel] [Patch v1 5/8] target_arm: Parameterise the irq lines for armv7m_init Alistair Francis
2014-09-15 15:23   ` Peter Crosthwaite [this message]
2014-09-16  2:43     ` Alistair Francis
2014-09-14  8:19 ` [Qemu-devel] [Patch v1 6/8] target_arm: Change the reset values based on the ELF entry Alistair Francis
2014-09-15 15:27   ` Peter Crosthwaite
2014-09-16  2:40     ` Alistair Francis
2014-09-14  8:19 ` [Qemu-devel] [Patch v1 7/8] stm32f205: Add the stm32f205 SoC Alistair Francis
2014-09-14  8:19 ` [Qemu-devel] [Patch v1 8/8] netduino2: Add the Netduino 2 Machine Alistair Francis

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=CAEgOgz60K4H-E-swhS3EDSmLXpRFqV63Oybe1wFg-fifdya_Pw@mail.gmail.com \
    --to=peter.crosthwaite@xilinx.com \
    --cc=alistair23@gmail.com \
    --cc=konstanty@ieee.org \
    --cc=martin.galvan@tallertechnologies.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).