From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, patches@linaro.org,
Alistair Francis <alistair23@gmail.com>,
Michael Davidsaver <mdavidsaver@gmail.com>
Subject: Re: [PATCH 02/11] armv7m: Move NVICState struct definition into header
Date: Tue, 28 Feb 2017 13:58:16 +0000 [thread overview]
Message-ID: <87innu2z9j.fsf@linaro.org> (raw)
In-Reply-To: <1487604965-23220-3-git-send-email-peter.maydell@linaro.org>
Peter Maydell <peter.maydell@linaro.org> writes:
> Move the NVICState struct definition into a header, so we can
> embed it into other QOM objects like SoCs.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> include/hw/arm/armv7m_nvic.h | 66 ++++++++++++++++++++++++++++++++++++++++++++
> hw/intc/armv7m_nvic.c | 49 +-------------------------------
> 2 files changed, 67 insertions(+), 48 deletions(-)
> create mode 100644 include/hw/arm/armv7m_nvic.h
>
> diff --git a/include/hw/arm/armv7m_nvic.h b/include/hw/arm/armv7m_nvic.h
> new file mode 100644
> index 0000000..39b94ee
> --- /dev/null
> +++ b/include/hw/arm/armv7m_nvic.h
> @@ -0,0 +1,66 @@
> +/*
> + * ARMv7M NVIC object
> + *
> + * Copyright (c) 2017 Linaro Ltd
> + * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * This code is licensed under the GPL version 2 or later.
> + */
> +
> +#ifndef HW_ARM_ARMV7M_NVIC_H
> +#define HW_ARM_ARMV7M_NVIC_H
> +
> +#include "target/arm/cpu.h"
> +#include "hw/sysbus.h"
> +
> +#define TYPE_NVIC "armv7m_nvic"
> +
> +#define NVIC(obj) \
> + OBJECT_CHECK(NVICState, (obj), TYPE_NVIC)
> +
> +/* Highest permitted number of exceptions (architectural limit) */
> +#define NVIC_MAX_VECTORS 512
> +
> +typedef struct VecInfo {
> + /* Exception priorities can range from -3 to 255; only the unmodifiable
> + * priority values for RESET, NMI and HardFault can be negative.
> + */
> + int16_t prio;
> + uint8_t enabled;
> + uint8_t pending;
> + uint8_t active;
> + uint8_t level; /* exceptions <=15 never set level */
> +} VecInfo;
> +
> +typedef struct NVICState {
> + /*< private >*/
> + SysBusDevice parent_obj;
> + /*< public >*/
> +
> + ARMCPU *cpu;
> +
> + VecInfo vectors[NVIC_MAX_VECTORS];
> + uint32_t prigroup;
> +
> + /* vectpending and exception_prio are both cached state that can
> + * be recalculated from the vectors[] array and the prigroup field.
> + */
> + unsigned int vectpending; /* highest prio pending enabled exception */
> + int exception_prio; /* group prio of the highest prio active exception */
> +
> + struct {
> + uint32_t control;
> + uint32_t reload;
> + int64_t tick;
> + QEMUTimer *timer;
> + } systick;
> +
> + MemoryRegion sysregmem;
> + MemoryRegion container;
> +
> + uint32_t num_irq;
> + qemu_irq excpout;
> + qemu_irq sysresetreq;
> +} NVICState;
> +
> +#endif
> diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
> index 76097b4..f2ada39 100644
> --- a/hw/intc/armv7m_nvic.c
> +++ b/hw/intc/armv7m_nvic.c
> @@ -17,6 +17,7 @@
> #include "hw/sysbus.h"
> #include "qemu/timer.h"
> #include "hw/arm/arm.h"
> +#include "hw/arm/armv7m_nvic.h"
> #include "target/arm/cpu.h"
> #include "exec/address-spaces.h"
> #include "qemu/log.h"
> @@ -47,7 +48,6 @@
> * "exception" more or less interchangeably.
> */
> #define NVIC_FIRST_IRQ 16
> -#define NVIC_MAX_VECTORS 512
> #define NVIC_MAX_IRQ (NVIC_MAX_VECTORS - NVIC_FIRST_IRQ)
>
> /* Effective running priority of the CPU when no exception is active
> @@ -55,53 +55,6 @@
> */
> #define NVIC_NOEXC_PRIO 0x100
>
> -typedef struct VecInfo {
> - /* Exception priorities can range from -3 to 255; only the unmodifiable
> - * priority values for RESET, NMI and HardFault can be negative.
> - */
> - int16_t prio;
> - uint8_t enabled;
> - uint8_t pending;
> - uint8_t active;
> - uint8_t level; /* exceptions <=15 never set level */
> -} VecInfo;
> -
> -typedef struct NVICState {
> - /*< private >*/
> - SysBusDevice parent_obj;
> - /*< public >*/
> -
> - ARMCPU *cpu;
> -
> - VecInfo vectors[NVIC_MAX_VECTORS];
> - uint32_t prigroup;
> -
> - /* vectpending and exception_prio are both cached state that can
> - * be recalculated from the vectors[] array and the prigroup field.
> - */
> - unsigned int vectpending; /* highest prio pending enabled exception */
> - int exception_prio; /* group prio of the highest prio active exception */
> -
> - struct {
> - uint32_t control;
> - uint32_t reload;
> - int64_t tick;
> - QEMUTimer *timer;
> - } systick;
> -
> - MemoryRegion sysregmem;
> - MemoryRegion container;
> -
> - uint32_t num_irq;
> - qemu_irq excpout;
> - qemu_irq sysresetreq;
> -} NVICState;
> -
> -#define TYPE_NVIC "armv7m_nvic"
> -
> -#define NVIC(obj) \
> - OBJECT_CHECK(NVICState, (obj), TYPE_NVIC)
> -
> static const uint8_t nvic_id[] = {
> 0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1
> };
--
Alex Bennée
WARNING: multiple messages have this Message-ID (diff)
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, patches@linaro.org,
Alistair Francis <alistair23@gmail.com>,
Michael Davidsaver <mdavidsaver@gmail.com>
Subject: Re: [Qemu-devel] [PATCH 02/11] armv7m: Move NVICState struct definition into header
Date: Tue, 28 Feb 2017 13:58:16 +0000 [thread overview]
Message-ID: <87innu2z9j.fsf@linaro.org> (raw)
In-Reply-To: <1487604965-23220-3-git-send-email-peter.maydell@linaro.org>
Peter Maydell <peter.maydell@linaro.org> writes:
> Move the NVICState struct definition into a header, so we can
> embed it into other QOM objects like SoCs.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> include/hw/arm/armv7m_nvic.h | 66 ++++++++++++++++++++++++++++++++++++++++++++
> hw/intc/armv7m_nvic.c | 49 +-------------------------------
> 2 files changed, 67 insertions(+), 48 deletions(-)
> create mode 100644 include/hw/arm/armv7m_nvic.h
>
> diff --git a/include/hw/arm/armv7m_nvic.h b/include/hw/arm/armv7m_nvic.h
> new file mode 100644
> index 0000000..39b94ee
> --- /dev/null
> +++ b/include/hw/arm/armv7m_nvic.h
> @@ -0,0 +1,66 @@
> +/*
> + * ARMv7M NVIC object
> + *
> + * Copyright (c) 2017 Linaro Ltd
> + * Written by Peter Maydell <peter.maydell@linaro.org>
> + *
> + * This code is licensed under the GPL version 2 or later.
> + */
> +
> +#ifndef HW_ARM_ARMV7M_NVIC_H
> +#define HW_ARM_ARMV7M_NVIC_H
> +
> +#include "target/arm/cpu.h"
> +#include "hw/sysbus.h"
> +
> +#define TYPE_NVIC "armv7m_nvic"
> +
> +#define NVIC(obj) \
> + OBJECT_CHECK(NVICState, (obj), TYPE_NVIC)
> +
> +/* Highest permitted number of exceptions (architectural limit) */
> +#define NVIC_MAX_VECTORS 512
> +
> +typedef struct VecInfo {
> + /* Exception priorities can range from -3 to 255; only the unmodifiable
> + * priority values for RESET, NMI and HardFault can be negative.
> + */
> + int16_t prio;
> + uint8_t enabled;
> + uint8_t pending;
> + uint8_t active;
> + uint8_t level; /* exceptions <=15 never set level */
> +} VecInfo;
> +
> +typedef struct NVICState {
> + /*< private >*/
> + SysBusDevice parent_obj;
> + /*< public >*/
> +
> + ARMCPU *cpu;
> +
> + VecInfo vectors[NVIC_MAX_VECTORS];
> + uint32_t prigroup;
> +
> + /* vectpending and exception_prio are both cached state that can
> + * be recalculated from the vectors[] array and the prigroup field.
> + */
> + unsigned int vectpending; /* highest prio pending enabled exception */
> + int exception_prio; /* group prio of the highest prio active exception */
> +
> + struct {
> + uint32_t control;
> + uint32_t reload;
> + int64_t tick;
> + QEMUTimer *timer;
> + } systick;
> +
> + MemoryRegion sysregmem;
> + MemoryRegion container;
> +
> + uint32_t num_irq;
> + qemu_irq excpout;
> + qemu_irq sysresetreq;
> +} NVICState;
> +
> +#endif
> diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
> index 76097b4..f2ada39 100644
> --- a/hw/intc/armv7m_nvic.c
> +++ b/hw/intc/armv7m_nvic.c
> @@ -17,6 +17,7 @@
> #include "hw/sysbus.h"
> #include "qemu/timer.h"
> #include "hw/arm/arm.h"
> +#include "hw/arm/armv7m_nvic.h"
> #include "target/arm/cpu.h"
> #include "exec/address-spaces.h"
> #include "qemu/log.h"
> @@ -47,7 +48,6 @@
> * "exception" more or less interchangeably.
> */
> #define NVIC_FIRST_IRQ 16
> -#define NVIC_MAX_VECTORS 512
> #define NVIC_MAX_IRQ (NVIC_MAX_VECTORS - NVIC_FIRST_IRQ)
>
> /* Effective running priority of the CPU when no exception is active
> @@ -55,53 +55,6 @@
> */
> #define NVIC_NOEXC_PRIO 0x100
>
> -typedef struct VecInfo {
> - /* Exception priorities can range from -3 to 255; only the unmodifiable
> - * priority values for RESET, NMI and HardFault can be negative.
> - */
> - int16_t prio;
> - uint8_t enabled;
> - uint8_t pending;
> - uint8_t active;
> - uint8_t level; /* exceptions <=15 never set level */
> -} VecInfo;
> -
> -typedef struct NVICState {
> - /*< private >*/
> - SysBusDevice parent_obj;
> - /*< public >*/
> -
> - ARMCPU *cpu;
> -
> - VecInfo vectors[NVIC_MAX_VECTORS];
> - uint32_t prigroup;
> -
> - /* vectpending and exception_prio are both cached state that can
> - * be recalculated from the vectors[] array and the prigroup field.
> - */
> - unsigned int vectpending; /* highest prio pending enabled exception */
> - int exception_prio; /* group prio of the highest prio active exception */
> -
> - struct {
> - uint32_t control;
> - uint32_t reload;
> - int64_t tick;
> - QEMUTimer *timer;
> - } systick;
> -
> - MemoryRegion sysregmem;
> - MemoryRegion container;
> -
> - uint32_t num_irq;
> - qemu_irq excpout;
> - qemu_irq sysresetreq;
> -} NVICState;
> -
> -#define TYPE_NVIC "armv7m_nvic"
> -
> -#define NVIC(obj) \
> - OBJECT_CHECK(NVICState, (obj), TYPE_NVIC)
> -
> static const uint8_t nvic_id[] = {
> 0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1
> };
--
Alex Bennée
next prev parent reply other threads:[~2017-02-28 13:58 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-20 15:35 [PATCH 00/11] ARMv7M: QOMify Peter Maydell
2017-02-20 15:35 ` [Qemu-devel] " Peter Maydell
2017-02-20 15:35 ` [PATCH 01/11] armv7m: Abstract out the "load kernel" code Peter Maydell
2017-02-20 15:35 ` [Qemu-devel] " Peter Maydell
2017-02-20 16:23 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-02-21 11:35 ` Alistair Francis
2017-02-21 11:35 ` [Qemu-devel] " Alistair Francis
2017-02-28 13:57 ` Alex Bennée
2017-02-28 13:57 ` [Qemu-devel] " Alex Bennée
2017-02-20 15:35 ` [PATCH 02/11] armv7m: Move NVICState struct definition into header Peter Maydell
2017-02-20 15:35 ` [Qemu-devel] " Peter Maydell
2017-02-20 16:24 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-02-28 13:58 ` Alex Bennée [this message]
2017-02-28 13:58 ` [Qemu-devel] " Alex Bennée
2017-02-20 15:35 ` [PATCH 03/11] armv7m: QOMify the armv7m container Peter Maydell
2017-02-20 15:35 ` [Qemu-devel] " Peter Maydell
2017-02-28 13:56 ` Alex Bennée
2017-02-28 13:56 ` [Qemu-devel] " Alex Bennée
2017-02-28 14:05 ` Peter Maydell
2017-02-28 14:05 ` [Qemu-devel] " Peter Maydell
2017-04-17 3:18 ` [Qemu-arm] " Philippe Mathieu-Daudé
2017-04-17 3:18 ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-04-17 3:59 ` Philippe Mathieu-Daudé
2017-04-17 3:59 ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-04-20 14:17 ` Peter Maydell
2017-04-20 14:17 ` [Qemu-devel] " Peter Maydell
2017-02-20 15:35 ` [PATCH 04/11] armv7m: Use QOMified armv7m object in armv7m_init() Peter Maydell
2017-02-20 15:35 ` [Qemu-devel] " Peter Maydell
2017-02-21 11:35 ` Alistair Francis
2017-02-21 11:35 ` [Qemu-devel] " Alistair Francis
2017-02-28 13:59 ` Alex Bennée
2017-02-28 13:59 ` [Qemu-devel] " Alex Bennée
2017-04-17 3:23 ` [Qemu-arm] " Philippe Mathieu-Daudé
2017-04-17 3:23 ` [Qemu-devel] " Philippe Mathieu-Daudé
2017-02-20 15:35 ` [PATCH 05/11] armv7m: Make ARMv7M object take memory region link Peter Maydell
2017-02-20 15:35 ` [Qemu-devel] " Peter Maydell
2017-02-28 14:02 ` Alex Bennée
2017-02-28 14:02 ` [Qemu-devel] " Alex Bennée
2017-02-20 15:36 ` [PATCH 06/11] armv7m: Make NVIC expose a memory region rather than mapping itself Peter Maydell
2017-02-20 15:36 ` [Qemu-devel] " Peter Maydell
2017-02-28 14:04 ` Alex Bennée
2017-02-28 14:04 ` [Qemu-devel] " Alex Bennée
2017-04-17 3:26 ` Philippe Mathieu-Daudé
2017-02-20 15:36 ` [PATCH 07/11] armv7m: Make bitband device take the address space to access Peter Maydell
2017-02-20 15:36 ` [Qemu-devel] " Peter Maydell
2017-02-28 14:06 ` Alex Bennée
2017-02-28 14:06 ` [Qemu-devel] " Alex Bennée
2017-02-20 15:36 ` [PATCH 08/11] armv7m: Don't put core v7M devices under CONFIG_STELLARIS Peter Maydell
2017-02-20 15:36 ` [Qemu-devel] " Peter Maydell
2017-02-20 16:40 ` Philippe Mathieu-Daudé
2017-02-28 14:06 ` Alex Bennée
2017-02-28 14:06 ` [Qemu-devel] " Alex Bennée
2017-02-20 15:36 ` [PATCH 09/11] armv7m: Split systick out from NVIC Peter Maydell
2017-02-20 15:36 ` [Qemu-devel] " Peter Maydell
2017-02-20 17:43 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-02-20 18:51 ` Peter Maydell
2017-02-20 18:51 ` [Qemu-devel] " Peter Maydell
2017-04-17 4:08 ` Philippe Mathieu-Daudé
2017-04-17 4:08 ` Philippe Mathieu-Daudé
2017-02-24 14:29 ` Alex Bennée
2017-02-24 14:29 ` [Qemu-devel] " Alex Bennée
2017-02-24 14:58 ` Peter Maydell
2017-02-24 14:58 ` [Qemu-devel] " Peter Maydell
2017-02-20 15:36 ` [PATCH 10/11] stm32f205: Create armv7m object without using armv7m_init() Peter Maydell
2017-02-20 15:36 ` [Qemu-devel] " Peter Maydell
2017-02-20 17:45 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-02-21 11:32 ` Alistair Francis
2017-02-21 11:32 ` [Qemu-devel] " Alistair Francis
2017-02-28 14:09 ` Alex Bennée
2017-02-28 14:09 ` [Qemu-devel] " Alex Bennée
2017-02-20 15:36 ` [PATCH 11/11] stm32f205: Rename 'nvic' local to 'armv7m' Peter Maydell
2017-02-20 15:36 ` [Qemu-devel] " Peter Maydell
2017-02-20 17:46 ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-02-21 11:34 ` Alistair Francis
2017-02-21 11:34 ` [Qemu-devel] " Alistair Francis
2017-02-28 14:10 ` Alex Bennée
2017-02-28 14:10 ` [Qemu-devel] " Alex Bennée
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=87innu2z9j.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=alistair23@gmail.com \
--cc=mdavidsaver@gmail.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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.