arm: add support for Calxeda Highbank SoC
Subsystems (3)
cover arm: add support for Calxeda Highbank SoC
This patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert ahci_reset to use AHCIState". Some of the patches are carried voer from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
Makefile.target | 1 + hw/a9mpcore.c | 7 +- hw/arm11mpcore.c | 14 ++-- hw/arm_gic.c | 57 +++++++------ hw/armv7m_nvic.c | 7 +- hw/highbank.c | 227 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 31 +++++++ hw/realview_gic.c | 3 +- target-arm/cpu.h | 3 +- target-arm/helper.c | 9 ++ target-arm/machine.c | 2 + 11 files changed, 320 insertions(+), 41 deletions(-)
PATCH 3/5 ahci: add support for non-PCI based controllers
From: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
hw/ide/ahci.c +31 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,33 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct PlatAHCIState { +SysBusDevice busdev; +AHCIState ahci; +}PlatAHCIState ; + +static int plat_ahci_init (SysBusDevice *dev) +{ +PlatAHCIState *s =FROM_SYSBUS (PlatAHCIState, dev); +ahci_init (&s->ahci, &dev->qdev,1 ); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo plat_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (PlatAHCIState), + .init = plat_ahci_init, +}; + +static void plat_ahci_register (void ) +{ +sysbus_register_withprop (&plat_ahci_info); +} + +device_init (plat_ahci_register);
Signature · 1 line
1.7.5.4
PATCH v5 1/5 Add xgmac ethernet model
In reply to Mark LangsdorfThis adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 424 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 425 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -340,6 +340,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +424 -0
424 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v5 2/5 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 256, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v4, v5
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs Added properties code to arm11mp
Changed error handling for too many interrupts Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192 Add a property defaulting to 96
Add a num_irq member in the gic state structure Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 7 +++-- hw/arm11mpcore.c | 14 +++++++----- hw/arm_gic.c | 57 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 7 ++--- hw/realview_gic.c | 3 +- 5 files changed, 48 insertions(+), 40 deletions(-)
hw/a9mpcore.c +4 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,7 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,256 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +8 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu,GIC_NIRQ ); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,12 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The MPCore TRM says the on-chip controller has 224 external +* IRQ lines (+ 32 internal). Some test chips only +* expose/report 32. More importantly Linux falls over if more +* than 32 are present! Set the default to 64 and let chips +* with more working lines set it higher */ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +32 -25
206 lines not on this page · raw message
hw/armv7m_nvic.c +3 -4
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -384,7 +381,9 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* 32 internal lines (16 used for system exceptions) plus 64 external +* interrupt lines. */ +gic_init (&s->gic,96 );memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s);vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);
hw/realview_gic.c +1 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,7 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v5 2/5] arm: make the number of GIC interrupts configurable
Quoted 9 lines · Mark Langsdorf
Increase the maximum number of GIC interrupts for a9mp and a11mp to 256, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
This commit message is a bit out of sync with the actual changes. The first line says "increase the maximum to 256", but actually the maximum has been set to 1020 (as you say later in the message).
hw/a9mpcore.c static SysBusDeviceInfo a9mp_priv_info = { · line 219
Quoted 5 lines
hw/a9mpcore.c +1
-0@@ -216,6 +216,7 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property[]) { DEFINE_PROP_UINT32("num-cpu", a9mp_priv_state, num_cpu, 1), + DEFINE_PROP_UINT32("num-irq", a9mp_priv_state, num_irq, 256),
The default should stay the same as the old hard-coded value, ie 96. (256 is the A9 hardware maximum. In theory we could stick a check in that the property was <256, but I don't think there's any point.) We can throw in this comment, mostly for consistency with the one in the 11MPCore sources (see below):
/* The Cortex-A9MP may have anything from 0 to 224 external interrupt IRQ
* lines (+ 32 internal). We default to 64+32, which is the number provided
* by the Cortex-A9MP test chip in the Realview PBX-A9 and Versatile
* Express A9 development boards. Other boards may differ and should set
* this property appropriately.
*/
hw/arm11mpcore.c static SysBusDeviceInfo mpcore_priv_info = { · line 224
Quoted 9 lines
hw/arm11mpcore.c +5
-0@@ -221,6 +217,12 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property[]) { DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1), + /* The MPCore TRM says the on-chip controller has 224 external + * IRQ lines (+ 32 internal). Some test chips only + * expose/report 32. More importantly Linux falls over if more + * than 32 are present! Set the default to 64 and let chips + * with more working lines set it higher */
Let's fix the inaccuracy in this comment while we're moving it around.
/* The ARM11 MPCore TRM says the on-chip controller may have anything
* from 0 to 224 external interrupt IRQ lines (+ 32 internal). We default
* to 32+32, which is the number provided by the ARM11 MPCore test
* chip in the Realview Versatile EB coretile. Other boards may have
* 11MPCores with different hardware config and should set this
* property appropriately -- some Linux kernels may not boot if the hardware
* has more IRQ lines than they expect.
*/
Quoted 9 lines
hw/arm_gic.c +0
-0@@ -11,6 +11,7 @@controller, MPCore distributed interrupt controller and ARMv7-M Nested Vectored Interrupt Controller. */
+#define
GIC_NIRQ1020
Having looked at the code that we get after this patch, I think it would be a good idea to rename this macro now:
/* Maximum possible number of interrupts (this limit is imposed by
* the GIC architecture)
*/
#define GIC_MAXIRQ 1020
(the renaming won't bloat the patch much as the macro's only used in half a dozen places).
I think that will help to avoid confusion in future about the difference between this and num_irq.
Quoted 8 lines
//#define
DEBUG_GIC#ifdef
DEBUG_GIChw/arm_gic.c +0
-0@@ -111,6 +112,7 @@ typedef struct gic_state struct gic_state *backref[NCPU];MemoryRegion cpuiomem[NCPU+1]; /* CPU interfaces */ #endif
+ intnum_irq;
It seems a little inconsistent that we use a uint32_t in the properties but a plain int in the gic_init() prototype and here. Does using uint32_t throughout cause any problems?
Quoted 7 lines
hw/arm_gic.c +0
-0@@ -295,7 +297,7 @@ static uint32_t gic_dist_readb(void *opaque, target_phys_addr_t offset)else
irq = (offset -0x180) * 8;
irq +=GIC_BASE_IRQ;
- if (irq >=GIC_NIRQ)
+ if (irq >=s->num_irq)
gotobad_reg;
If you like you can add the extra braces that will shut checkpatch up about these hunks, but I'm not going to insist on it. (I waver back and forth about how much I care about this particular CODING_STYLE shibboleth. This file is one of the older ones that was written before we decided we loved braces.)
hw/arm_gic.c static void gic_init(gic_state *s) · line 813
Quoted 6 lines
hw/arm_gic.c +1
-1@@ -808,7 +810,12 @@ static void gic_init(gic_state *s) #if NCPU > 1 s->num_cpu = num_cpu; #endif - qdev_init_gpio_in(&s->busdev.qdev, gic_set_irq, GIC_NIRQ - 32); + s->num_irq = num_irq;
For the benefit of M profile (see below for further explanation) this should be
s->num_irq = num_irq + GIC_BASE_IRQ;
hw/arm_gic.c static void gic_init(gic_state *s) · line 816
Quoted 3 lines
hw/arm_gic.c +3
-0+ if (s->num_irq > GIC_NIRQ) { + hw_error("device requested %u out of %u interrupt lines, failing\n", + num_irq, GIC_NIRQ);
"requested number of interrupt lines %d exceeds GIC maximum of %d"
(you can drop the "failing" bit because hw_error() prefixes the string with "hardware error" and we end up saying "Aborted", so the fact we're failing is pretty clear anyway :-))
hw/arm_gic.c static int armv7m_nvic_init(SysBusDevice *dev) · line 386
Quoted 8 lines
hw/arm_gic.c +3
-1@@ -384,7 +381,9 @@ static int armv7m_nvic_init(SysBusDevice *dev) { nvic_state *s= FROM_SYSBUSGIC(nvic_state, dev); - gic_init(&s->gic); + /* 32 internal lines (16 used for system exceptions) plus 64 external + * interrupt lines. */ + gic_init(&s->gic, 96);
This should have a property as well; the v7M architecture allows anything up to 496 external interrupts. The default for the property should be 64, meaning 64 external interrupts. (Not 96, because we'll add GIC_BASE_IRQ to it in gic_init().)
The reason for this GIC_BASE_IRQ addition is that the M profile specification doesn't consider the lines used for system exceptions to be interrupts (they don't appear in the enable/set/clear register interfaces, for example). Moreover, even where the architecture does consider exceptions+interrupts as a continuous set, it goes 0..15 [exceptions] and then 16 is external interrupt 0. The spacing of 32 is purely a QEMU internal thing for implementation convenience, so we want to hide it from the board-level users of armv7m_init() etc.
hw/arm_gic.c static int realview_gic_init(SysBusDevice *dev) · line 40
Quoted 5 lines
hw/arm_gic.c +0
-1@@ -37,7 +36,7 @@ static int realview_gic_init(SysBusDevice *dev) { RealViewGICState *s = FROM_SYSBUSGIC(RealViewGICState, dev); - gic_init(&s->gic);
You can add a comment here:
/* The GICs on the RealView boards have a fixed nonconfigurable
* number of interrupt lines, so we don't need to expose this as
* a qdev property.
*/
just to explain why this one's different to the others.
-- PMM
PATCH 4/5 arm: Add dummy support for co-processor 15's secure config register
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
--- target-arm/cpu.h | 3 ++- target-arm/helper.c | 9 +++++++++ target-arm/machine.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-)
target-arm/cpu.h +2 -1
@@ -116,6 +116,7 @@ typedef struct CPUARMState {uint32_t c1_sys;/* System control register. */ uint32_t c1_coproc;/* Coprocessor access register. */ uint32_t c1_xscaleauxcr;/* XScale auxiliary control register. */ +uint32_t c1_scr;/* secure config register. */ uint32_t c2_base0;/* MMU translation table base 0. */ uint32_t c2_base1;/* MMU translation table base 1. */ uint32_t c2_control;/* MMU translation table base control. */
@@ -452,7 +453,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 +#define CPU_SAVE_VERSION 6/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +9 -0
@@ -1412,6 +1412,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) } goto bad_reg;case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { + env->cp15.c1_scr = val; +break ; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
@@ -1880,6 +1885,10 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg; }case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { +return env->cp15.c1_scr; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
target-arm/machine.c +2 -0
@@ -26,6 +26,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c1_sys);qemu_put_be32 (f, env->cp15.c1_coproc);qemu_put_be32 (f, env->cp15.c1_xscaleauxcr); +qemu_put_be32 (f, env->cp15.c1_scr);qemu_put_be32 (f, env->cp15.c2_base0);qemu_put_be32 (f, env->cp15.c2_base1);qemu_put_be32 (f, env->cp15.c2_control);
@@ -143,6 +144,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c1_sys =qemu_get_be32 (f); env->cp15.c1_coproc =qemu_get_be32 (f); env->cp15.c1_xscaleauxcr =qemu_get_be32 (f); + env->cp15.c1_scr =qemu_get_be32 (f); env->cp15.c2_base0 =qemu_get_be32 (f); env->cp15.c2_base1 =qemu_get_be32 (f); env->cp15.c2_control =qemu_get_be32 (f);
Signature · 1 line
1.7.5.4
PATCH 5/5 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
--- Makefile.target | 1 + hw/highbank.c | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 228 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -339,6 +339,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +227 -0
227 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 3 lines · Mark Langsdorf
From: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
Is there a test kernel image/etc we can use to confirm that this all works?
hw/highbank.c line 2
Quoted 5 lines
hw/highbank.c new file +2
-0@@ -0,0 +1,227 @@ +/* +* Calxeda Highbank SoC emulation
Is it worth splitting the SoC emulation out from the board emulation, or is the expectation that the SoC will be used in this board and only this board?
hw/highbank.c line 8
Quoted 6 lines
hw/highbank.c new file +6
-0+* +* Copyright (c) 2010-2012 Calxeda +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation.
2-or-later, please.
Quoted 13 lines
hw/highbank.c new file +13
-0+* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +#include "sysbus.h" +#include "arm-misc.h"
hw/highbank.c line 31
Quoted 10 lines
hw/highbank.c new file +10
-0+#include "primecell.h" +#include "devices.h" +#include "loader.h" +#include "elf.h" +#include "net.h" +#include "sysemu.h" +#include "boards.h" +#include "sysbus.h" +#include "blockdev.h" +#include "exec-memory.h"
This looks like a lot of includes -- are they all required? (eg why elf.h?)
Quoted 7 lines
hw/highbank.c new file +7
-0+ +#define SMP_BOOT_ADDR 0 +#define NIRQ_GIC 160 + +/* Board init. */ +static void highbank_cpu_reset (void *opaque) +{
hw/highbank.c line 48
Quoted 10 lines
hw/highbank.c new file +10
-0+ CPUState *env = opaque; + + cpu_reset(env); + env->cp15.c15_config_base_address = 0xfff10000; + + /* Set entry point for secondary CPUs. This assumes we're using + the init code from arm_boot.c. Real hardware resets all CPUs + the same. */ + env->regs[15] = 0; +}
The env->regs[] bit at least shouldn't be needed -- see commit 6ed221b637 which consolidated it into arm_boot.c. Ditto the cpu_reset().
I think your attempt to set c15_config_base_address here may be being defeated by the cpu_reset() call in hw/arm_boot.c:do_cpu_reset(), but I haven't checked that.
Quoted 5 lines
hw/highbank.c new file +5
-0+static void hb_regs_write (void *opaque,target_phys_addr_t offset, + uint64_t value, unsigned size) +{ + uint32_t *regs = opaque; +
hw/highbank.c line 64
Quoted 10 lines
hw/highbank.c new file +10
-0+ if (offset == 0xf00) { + if (value == 1 || value == 2) { + qemu_system_reset_request(); + } else if (value == 3) { + qemu_system_shutdown_request(); + } + } + + regs[offset/4] = value; +}
Please make this a proper qdev device (it can stay in this file).
hw/highbank.c line 126
Quoted 7 lines
hw/highbank.c new file +7
-0+ /* Override default RAM size */ + if (ram_size == 0x8000000) { + if (sizeof(long) == 8) { + ram_size = 0xff900000; + } else { + ram_size = 0x80000000; + }
Yuck. Model behaviour shouldn't depend on properties of the host system like sizeof(long).
hw/highbank.c line 139
Quoted 13 lines
hw/highbank.c new file +13
-0+ } + sysmem = get_system_memory(); + dram = g_new(MemoryRegion, 1); + memory_region_init_ram(dram, "highbank.dram", ram_size); + /* SDRAM at address zero. */ + memory_region_add_subregion(sysmem, 0, dram); + + sysram = g_new(MemoryRegion, 1); + memory_region_init_ram(sysram, "highbank.sysram", 0x8000); + memory_region_add_subregion(sysmem, 0xfff88000, sysram); + if (load_image_targphys("sysram.bin", 0xfff88000, 0x8000) < 0) { + fprintf(stderr, "Unable to load sysram.bin\n"); + }
Is this for some sort of BIOS-image equivalent?
hw/highbank.c line 162
Quoted 3 lines
hw/highbank.c new file +3
-0+ dev = qdev_create(NULL, "sp804"); + qdev_prop_set_uint32(dev, "freq0", 150000000); + qdev_prop_set_uint32(dev, "freq1", 150000000);
So, er, we just committed a patch saying the timer frequency could go up to 1MHz, and this is rather more than that :-)
hw/highbank.c line 190
Quoted 4 lines
hw/highbank.c new file +4
-0+ qemu_check_nic_model(&nd_table[0], "xgmac"); + dev = qdev_create(NULL, "xgmac"); + qdev_set_nic_properties(dev, &nd_table[0]); + qdev_init_nofail(dev);
You need to guard the nic creation and wiring with
if (nd_table[0].vlan) {
....}
to catch the case where the user requested no NIC at all (ie the nd_table[] entry is unused).
(A command line with "-net user" and no other -net options will provoke this.)
hw/highbank.c line 215
Quoted 3 lines
hw/highbank.c new file +3
-0+static QEMUMachine highbank_machine = { + .name ="highbank" , + .desc ="highbank" ,
Can we have an actually descriptive description? :-)
-- PMM
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 6 lines · Peter Maydell
Quoted 3 lines · Mark Langsdorf
From: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
Is there a test kernel image/etc we can use to confirm that this all works?
The 3.2 kernel should have all the necessary support for Highbank.
Quoted 9 lines
hw/highbank.c line 2
Quoted 5 lines
hw/highbank.c new file +2
-0@@ -0,0 +1,227 @@ +/* +* Calxeda Highbank SoC emulation Is it worth splitting the SoC emulation out from the board emulation, or is the expectation that the SoC will be used in this board and only this board?
Rob and I expect that any board differences will be non-existent from QEMU's perspective.
Quoted 13 lines
Quoted 13 lines
hw/highbank.c new file +13
-0+ +#define SMP_BOOT_ADDR 0 +#define NIRQ_GIC 160 + +/* Board init. */ +static void highbank_cpu_reset (void *opaque) +{ +CPUState *env = opaque; + +cpu_reset (env); + env->cp15.c15_config_base_address =0xfff10000 ; + +/* Set entry point for secondary CPUs. This assumes we're using
Quoted 8 lines
hw/highbank.c line 48
Quoted 4 lines
hw/highbank.c new file +4
-0+the init code from arm_boot.c. Real hardware resets all CPUs +the same. */ + env->regs[15 ] =0 ; +}I think your attempt to set
c15_config_base_addresshere may be being defeated by thecpu_reset()call in hw/arm_boot.c:do_cpu_reset(), but I haven't checked that.
It works on our test boot.
Quoted 10 lines
hw/highbank.c line 126
Quoted 7 lines
hw/highbank.c new file +7
-0+/* Override default RAM size */ +if (ram_size ==0x8000000 ) { +if (sizeof (long ) ==8 ) { + ram_size =0xff900000 ; + }else { + ram_size =0x80000000 ; + }Yuck. Model behaviour shouldn't depend on properties of the host system like sizeof(long).
The board is populated with 4G of DRAM, which we'd like to support if the host can. Is there a better way to do that?
Quoted 14 lines
hw/highbank.c line 139
Quoted 13 lines
hw/highbank.c new file +13
-0+ } + sysmem =get_system_memory (); + dram =g_new (MemoryRegion,1 ); +memory_region_init_ram (dram,"highbank.dram" , ram_size); +/* SDRAM at address zero. */ +memory_region_add_subregion (sysmem,0 , dram); + + sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (load_image_targphys ("sysram.bin" ,0xfff88000 ,0x8000 ) <0 ) { +fprintf (stderr,"Unable to load sysram.bin\n" ); + }
Quoted 1 line
Is this for some sort of BIOS-image equivalent?
Yes, uboot and the like. It isn't necessary to boot the system, but it models the actual board a bit better.
Quoted 6 lines
hw/highbank.c line 162
Quoted 3 lines
hw/highbank.c new file +3
-0+ dev =qdev_create (NULL ,"sp804" ); +qdev_prop_set_uint32 (dev,"freq0" ,150000000 ); +qdev_prop_set_uint32 (dev,"freq1" ,150000000 );So, er, we just committed a patch saying the timer frequency could go up to 1MHz, and this is rather more than that :-)
You'd think I would have noticed.
The set frequencies patch doesn't check the maximum frequency, so the logic is good. I can send a small patch to update the documentation.
Quoted 4 lines
hw/highbank.c line 215
Quoted 2 lines
hw/highbank.c new file +2
-0+ .name = "highbank", + .desc = "highbank",Can we have an actually descriptive description? :-)
Sure. I'll update it and fix the other issues.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Mark Langsdorf
Quoted 8 lines · Peter Maydell
Quoted 7 lines
+ /* Override default RAM size */
+ if (ram_size==0x8000000) {
+ if (sizeof(long) == 8) {
+ ram_size =0xff900000;
+ } else {
+ ram_size =0x80000000;
+ }
Quoted 6 lines
Quoted 2 lines
Yuck. Model behaviour shouldn't depend on properties of the host system like sizeof(long).
The board is populated with 4G of DRAM, which we'd like to support if the host can. Is there a better way to do that?
Don't mess with the default, have the user specify a RAM size that makes sense for their host machine. It's not fantastic but it's what QEMU has at the moment.
I once tried to suggest a patchset which would allow boards to specify their min/max/default RAM sizes but it got shot down.
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
+ sysmem =
get_system_memory();
+ dram =g_new(MemoryRegion, 1);
+ memory_region_init_ram(dram, "highbank.dram",ram_size);
+ /* SDRAM at address zero. */
+ memory_region_add_subregion(sysmem, 0, dram);
+
+ sysram =g_new(MemoryRegion, 1);
+ memory_region_init_ram(sysram, "highbank.sysram",0x8000);
+ memory_region_add_subregion(sysmem,0xfff88000, sysram);
+ if (load_image_targphys("sysram.bin", 0xfff88000, 0x8000)< 0) {
+ fprintf(stderr, "Unable to load sysram.bin\n");
+ }
Quoted 4 lines
Quoted 1 line
Is this for some sort of BIOS-image equivalent?
Yes, uboot and the like. It isn't necessary to boot the system, but it models the actual board a bit better.
If it's not necessary, should we be failing if there isn't an image file present?
-- PMM
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 10 lines · Peter Maydell
Quoted 9 lines · Mark Langsdorf
Quoted 7 lines · Peter Maydell
Quoted 6 lines
hw/highbank.c new file +6
-0+ sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (load_image_targphys ("sysram.bin" ,0xfff88000 ,0x8000 ) <0 ) { +fprintf (stderr,"Unable to load sysram.bin\n" ); + }
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Is this for some sort of BIOS-image equivalent?
Yes, uboot and the like. It isn't necessary to boot the system, but it models the actual board a bit better.
If it's not necessary, should we be failing if there isn't an image file present?
Are we failing? We're printing out a warning message, but the boot goes on.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 11 lines · Mark Langsdorf
Quoted 7 lines · Peter Maydell
Quoted 3 lines · Mark Langsdorf
Quoted 3 lines
Quoted 3 lines
+ if (
load_image_targphys("sysram.bin", 0xfff88000, 0x8000)< 0) {
+ fprintf(stderr, "Unable to load sysram.bin\n");
+ }If it's not necessary, should we be failing if there isn't an image file present?
Are we failing? We're printing out a warning message, but the boot goes on.
Doh. Completely misread that bit of code :-)
-- PMM
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
In reply to Peter MaydellQuoted 11 lines · Peter Maydell
Quoted 10 lines · Mark Langsdorf
hw/highbank.c new file +10
-0+static void hb_regs_write (void *opaque,target_phys_addr_t offset, +uint64_t value,unsigned size) +{ +uint32_t *regs = opaque; + +if (offset ==0xf00 ) { +if (value ==1 || value ==2 ) { +qemu_system_reset_request (); + }else if (value ==3 ) { +qemu_system_shutdown_request ();
Quoted 8 lines
hw/highbank.c line 64
Quoted 5 lines
hw/highbank.c new file +5
-0+ } + } + + regs[offset/4 ] = value; +}Please make this a proper qdev device (it can stay in this file).
Assuming that I'm going to need save/restore support, what's the proper syntax for saving uint32_t *regs? All the uses I can find seem to be for an array of structs, not an array of ints, and I keep hoping there's a simpler way.
Thanks,
Mark Langsdorf
Calxeda, Inc,.
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 4 lines · Mark Langsdorf
Assuming that I'm going to need save/restore support, what's the proper syntax for saving
uint32_t*regs? All the uses I can find seem to be for an array of structs, not an array of ints, and I keep hoping there's a simpler way.
VMSTATE_UINT32_ARRAY is what you want. The VMSTATE_*_ARRAY macros all work the same way:
VMSTATE_UINT32_ARRAY(arrayname, structname, arraysize)
and there are plenty of examples in the tree if you grep for them.
You might also consider whether the hardware looks more like an array of 128 R/W registers, or like the versatile board registers modelled in hw/arm_sysreg.c. Not knowing this particular hardware I can't recommend one way or the other, but that is the alternative approach.
-- PMM
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfAm 05.01.2012 21:02, schrieb Mark Langsdorf:
Quoted 13 lines
From: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
Signed-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>---
hw/highbank.c new file +0
-0
hw/highbank.c line 139
Quoted 8 lines
hw/highbank.c new file +6
-0+ sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (load_image_targphys ("sysram.bin" ,0xfff88000 ,0x8000 ) <0 ) { +fprintf (stderr,"Unable to load sysram.bin\n" ); + }
This should be something like:
char* filename;
if (bios_name == NULL) {
bios_name = "sysram.bin";
}
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename != NULL) {
load_image_targpyhs(filename, ...);
g_free(filename);
}Not knowing ARM boot well myself, you might also want to check and use get_image_size(filename) rather than hardcoding 0x8000?
Also I'm wondering what the use case here is. I can imagine two scenarios:
1) User wants to boot a -bios, which in turn may at runtime search for a kernel on the emulated storage, like it would on real hardware. Then loading a too large or missing BIOS should fail.
2) User wants to boot a -kernel. Then this should probably not complain about issues with -bios at all, unless explicitly specified by the user.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfOn 01/06/2012 12:02 AM, Mark Langsdorf wrote:
Hello, Mark. According to technical specification on Calxeda website, highbank SoC has SD 3.0 host controller, are you planning to implement it in qemu? I'm asking because I recently have submitted a patch implementing SD 2.0 host controller, and it looks like these two specifications revisions are not very different from each other.
hw/highbank.c line 107
Quoted 3 lines
hw/highbank.c new file +3
-0+if (!cpu_model) { + cpu_model ="cortex-a9" ; + }
Google said there is only cortexA9-based Highbank SoC version, maybe you should just hardcode cpu model?
hw/highbank.c line 124
Quoted 5 lines
hw/highbank.c new file +5
-0+/* Override default RAM size */ +if (ram_size ==0x8000000 ) { +if (sizeof (long ) ==8 ) { + ram_size =0xff900000 ; + }else {
This value looks a bit strange, usually DRAM consists of several banks 512, 256 (or something like that) megabytes each, I couldn't find what DRAM configuration does the actual board have?
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 8 lines · Igor Mitsyanko
Quoted 3 lines · Mark Langsdorf
+ if (!cpu_model) {
+ cpu_model = "cortex-a9";
+ }Google said there is only cortexA9-based Highbank SoC version, maybe you should just hardcode cpu model?
This is just boilerplate code for any random ARM board at the moment:
it defaults the CPU but lets the user override. We should either make a decision to do something else for all boards, or follow the usual convention here; I'm happy to do the latter.
-- PMM
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Igor Mitsyanko
Quoted 3 lines · Mark Langsdorf
hw/highbank.c new file +3
-0+if (!cpu_model) { + cpu_model ="cortex-a9" ; + }
Quoted 8 lines
Quoted 2 lines
Google said there is only cortexA9-based Highbank SoC version, maybe you should just hardcode cpu model?
This is just boilerplate code for any random ARM board at the moment:
it defaults the CPU but lets the user override. We should either make a decision to do something else for all boards, or follow the usual convention here; I'm happy to do the latter.
Are you saying that it's a mistake that we hardcoded cpu model and memory size for Exynos boards in our patches? It makes sense to use documented values in emulation, many boards in qemu currently do this. And probably nothing even going to work with wrong cpu model, I though this command line option is mostly for x86 target.
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Am 06.01.2012 20:10, schrieb Igor Mitsyanko:
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Igor Mitsyanko
Quoted 8 lines · Mark Langsdorf
hw/highbank.c line 107
Quoted 3 lines
hw/highbank.c new file +3
-0+if (!cpu_model) { + cpu_model ="cortex-a9" ; + }Google said there is only cortexA9-based Highbank SoC version, maybe you should just hardcode cpu model?
Quoted 8 lines
Quoted 5 lines
This is just boilerplate code for any random ARM board at the moment:
it defaults the CPU but lets the user override. We should either make a decision to do something else for all boards, or follow the usual convention here; I'm happy to do the latter.Are you saying that it's a mistake that we hardcoded cpu model and memory size for Exynos boards in our patches?
No machine should silently change the user's -cpu to something else. Either error out or warn the user, or let them face the consequences of their parameters themselves.
Not sure how hardcoding the cpu_model would work with CPU features, would they be still included or stripped out before. Peter?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Quoted 2 lines · Andreas Färber
Not sure how hardcoding the
cpu_modelwould work with CPU features, would they be still included or stripped out before. Peter?
Interesting question. It's certainly more likely to work to have a board where the only tweak you made to the CPU was to disable Neon, say, but I'm not sure "likely to work" is a very firm criterion.
-- PMM
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Am 07.01.2012 04:14, schrieb Peter Maydell:
Quoted 7 lines · Andreas Färber
Quoted 2 lines
Not sure how hardcoding the
cpu_modelwould work with CPU features, would they be still included or stripped out before. Peter?Interesting question. It's certainly more likely to work to have a board where the only tweak you made to the CPU was to disable Neon, say, but I'm not sure "likely to work" is a very firm criterion.
What I meant was, if sometime we allow, e.g., '-cpu cortex-m4,+FPU', will cpu_model technically contain "cortex-m4" or "cortex-m4,+FPU"?
If the latter, then we should not hardcode cpu_model anywhere.
I'm sure we can always find a scenario that doesn't work, but the emulated instructions are rather unlikely to conflict with a machine-specific memory layout and device instantiation, given that the guest matches the emulated CPU features.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
In reply to Andreas FärberQuoted 18 lines · Andreas Färber
Am 06.01.2012 20:10, schrieb Igor Mitsyanko:
Quoted 17 lines · Peter Maydell
Quoted 15 lines · Igor Mitsyanko
Quoted 8 lines · Mark Langsdorf
hw/highbank.c line 107
Quoted 3 lines
hw/highbank.c new file +3
-0+if (!cpu_model) { + cpu_model ="cortex-a9" ; + }Google said there is only cortexA9-based Highbank SoC version, maybe you should just hardcode cpu model?
This is just boilerplate code for any random ARM board at the moment:
it defaults the CPU but lets the user override. We should either make a decision to do something else for all boards, or follow the usual convention here; I'm happy to do the latter.
Quoted 6 lines
Quoted 2 lines
Are you saying that it's a mistake that we hardcoded cpu model and memory size for Exynos boards in our patches?
No machine should silently change the user's -cpu to something else. Either error out or warn the user, or let them face the consequences of their parameters themselves.
Machines do not instantiate cpus, they instantiate SoC models, which are solid (not modular) devices with explicitly specified (in datasheet or elsewhere) cpu core and peripheral devices, and if someone creates Highbank SoC instance with Cortex-M4 CPU core then it's no longer a Highbank SoC. What I mean, peripheral devices on SoC are not configurable, you cannot add additional UART or I2C interface, why allow cpu model change?
Quoted 3 lines
Not sure how hardcoding the
cpu_modelwould work with CPU features, would they be still included or stripped out before. Peter?
What do you mean? All features are currently set during cpu_reset_model_id() as far as I know, it doesn't matter whether cpu_model was specified on command line or hardcoded into initialization code.
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
Am 07.01.2012 10:55, schrieb Igor Mitsyanko:
Quoted 20 lines · Andreas Färber
Quoted 19 lines
Am 06.01.2012 20:10, schrieb Igor Mitsyanko:
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Igor Mitsyanko
Quoted 9 lines · Mark Langsdorf
hw/highbank.c line 107
Quoted 3 lines
hw/highbank.c new file +3
-0+if (!cpu_model) { + cpu_model ="cortex-a9" ; + }Google said there is only cortexA9-based Highbank SoC version, maybe you
should just hardcode cpu model?This is just boilerplate code for any random ARM board at the moment:
it defaults the CPU but lets the user override. We should either make a decision to do something else for all boards, or follow the usual convention here; I'm happy to do the latter.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Are you saying that it's a mistake that we hardcoded cpu model and memory size for Exynos boards in our patches?
No machine should silently change the user's -cpu to something else. Either error out or warn the user, or let them face the consequences of their parameters themselves.
Machines do not instantiate cpus, they instantiate SoC models,
Currently, the machine does instantiate both CPU and devices, including those on the SoC.
Quoted 5 lines
which are
solid (not modular) devices with explicitly specified (in datasheet or elsewhere) cpu core and peripheral devices, and if someone creates Highbank SoC instance with Cortex-M4 CPU core then it's no longer a Highbank SoC.
I somewhat agree that changing the CPU of an SoC should not be allowed, if we make it easy enough to derive SoCs with another core. (You will find further discussions of child<> vs. link<> in the qemu-test thread, I think.)
Not having SoCs yet, -cpu roughly corresponds to exchanging device-compatible SoCs on the board. With machine and SoC both called Highbank here, that's kind of confusing.
One reason to allow -cpu (and -device) is to avoid for us getting swamped with machines.
Quoted 8 lines
Quoted 3 lines
Not sure how hardcoding the
cpu_modelwould work with CPU features, would they be still included or stripped out before. Peter?What do you mean? All features are currently set during
cpu_reset_model_id()as far as I know, it doesn't matter whethercpu_modelwas specified on command line or hardcoded into initialization code.
This again is referring to discussions of upcoming changes elsewhere.
Currently, ARM CPU reset derives CPU features from the CPUID in turn derived from the CPU name. Peter wants to allow turning ARM CPU features on and off like for i386, decoupling this from CPUID.
Of course we can always change things back and forth, but I usually prefer future-proof solutions. :)
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 5/5] arm: SoC model for Calxeda Highbank
In reply to Igor MitsyankoQuoted 8 lines · Igor Mitsyanko
On 01/06/2012 12:02 AM, Mark Langsdorf wrote:
Hello, Mark. According to technical specification on Calxeda website, highbank SoC has SD 3.0 host controller, are you planning to implement it in qemu? I'm asking because I recently have submitted a patch implementing SD 2.0 host controller, and it looks like these two specifications revisions are not very different from each other.
It's a standard SDHCI controller. There was a model submitted by Vincent Palatin a while back, but I didn't have much luck getting it working and haven't debugged it further.
SD3.0 vs 2.0 is probably not going to make a difference from a QEMU point of view.
Rob
Quoted 16 lines
hw/highbank.c line 107
Quoted 3 lines
hw/highbank.c new file +3
-0+if (!cpu_model) { + cpu_model ="cortex-a9" ; + }Google said there is only cortexA9-based Highbank SoC version, maybe you should just hardcode cpu model?
hw/highbank.c line 124
Quoted 5 lines
hw/highbank.c new file +5
-0+/* Override default RAM size */ +if (ram_size ==0x8000000 ) { +if (sizeof (long ) ==8 ) { + ram_size =0xff900000 ; + }else {This value looks a bit strange, usually DRAM consists of several banks 512, 256 (or something like that) megabytes each, I couldn't find what DRAM configuration does the actual board have?
v2 cover arm: add support for Calxeda Highbank SoC
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert ahci_reset to use AHCIState". Some of the patches are carried voer from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
Makefile.target | 1 + hw/a9mpcore.c | 13 ++- hw/arm11mpcore.c | 17 ++- hw/arm_gic.c | 68 +++++++------ hw/arm_timer.c | 3 - hw/armv7m_nvic.c | 30 +++++-- hw/highbank.c | 267 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 31 ++++++ hw/realview_gic.c | 7 +- target-arm/cpu.h | 3 +- target-arm/helper.c | 9 ++ target-arm/machine.c | 2 + 12 files changed, 399 insertions(+), 52 deletions(-)
PATCH v6 2/6 arm: make the number of GIC interrupts configurable
Increase the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 30 ++++++++++++++++++----- hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 48 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -7
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,34 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* 32 internal lines (16 used for system exceptions) plus 64 external +* interrupt lines. */ +gic_init (&s->gic,96 );memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s);vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines (with another 32 hidden internal exception lines). We +* default to 64+32 +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
PATCH v4 3/6 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
hw/ide/ahci.c +31 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,33 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct PlatAHCIState { +SysBusDevice busdev; +AHCIState ahci; +}PlatAHCIState ; + +static int plat_ahci_init (SysBusDevice *dev) +{ +PlatAHCIState *s =FROM_SYSBUS (PlatAHCIState, dev); +ahci_init (&s->ahci, &dev->qdev,1 ); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo plat_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (PlatAHCIState), + .init = plat_ahci_init, +}; + +static void plat_ahci_register (void ) +{ +sysbus_register_withprop (&plat_ahci_info); +} + +device_init (plat_ahci_register);
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v4 3/6] ahci: add support for non-PCI based controllers
Am 09.01.2012 17:59, schrieb Mark Langsdorf:
Quoted 9 lines
From: Rob Herring <[email protected]>
Add support for ahci on sysbus.
Signed-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>---
Changes from v3
Renamed plat-ahci to sysbus-ahci
The idea was to get rid of "plat" everywhere, not just in the qdev name. Maybe I'm biased because platt is the German adjective for flat.
Please call it sysbus/SysBus consistently.
Quoted 23 lines
Changes from v1, v2
Corrected indentation of PlatAHCIState members Madeplat_ahci_infointo a single structure, not a listhw/ide/ahci.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)hw/ide/ahci.c +1
-0@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h" @@ -1214,3 +1215,33 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } }
hw/ide/ahci.c void ahci_reset(void *opaque) · line 1227
Quoted 10 lines
hw/ide/ahci.c +10
-0+ +typedef struct PlatAHCIState { +SysBusDevice busdev; +AHCIState ahci; +}PlatAHCIState ; + +static int plat_ahci_init (SysBusDevice *dev) +{ +PlatAHCIState *s =FROM_SYSBUS (PlatAHCIState, dev); +ahci_init (&s->ahci, &dev->qdev,1 );
Maybe the number of ports (1) should be a qdev property?
hw/ide/ahci.c void ahci_reset(void *opaque) · line 1238
Quoted 11 lines
hw/ide/ahci.c +11
-0+ +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo plat_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (PlatAHCIState),
You should prepare a dummy VMStateDescription to mark it as unmigratable for now (cf. hw/ide/ich.c). Migration support is the upcoming series I recently cc'ed you on.
Otherwise looking good.
Andreas
Quoted 9 lines
hw/ide/ahci.c +9
-0+ .init = plat_ahci_init, +}; + +static void plat_ahci_register (void ) +{ +sysbus_register_withprop (&plat_ahci_info); +} + +device_init (plat_ahci_register);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
PATCH v2 4/6 arm: Add dummy support for co-processor 15's secure config register
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
--- target-arm/cpu.h | 3 ++- target-arm/helper.c | 9 +++++++++ target-arm/machine.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-)
target-arm/cpu.h +2 -1
@@ -116,6 +116,7 @@ typedef struct CPUARMState {uint32_t c1_sys;/* System control register. */ uint32_t c1_coproc;/* Coprocessor access register. */ uint32_t c1_xscaleauxcr;/* XScale auxiliary control register. */ +uint32_t c1_scr;/* secure config register. */ uint32_t c2_base0;/* MMU translation table base 0. */ uint32_t c2_base1;/* MMU translation table base 1. */ uint32_t c2_control;/* MMU translation table base control. */
@@ -452,7 +453,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 +#define CPU_SAVE_VERSION 6/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +9 -0
@@ -1440,6 +1440,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) } goto bad_reg;case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { + env->cp15.c1_scr = val; +break ; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
@@ -1908,6 +1913,10 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg; }case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { +return env->cp15.c1_scr; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
target-arm/machine.c +2 -0
@@ -26,6 +26,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c1_sys);qemu_put_be32 (f, env->cp15.c1_coproc);qemu_put_be32 (f, env->cp15.c1_xscaleauxcr); +qemu_put_be32 (f, env->cp15.c1_scr);qemu_put_be32 (f, env->cp15.c2_base0);qemu_put_be32 (f, env->cp15.c2_base1);qemu_put_be32 (f, env->cp15.c2_control);
@@ -143,6 +144,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c1_sys =qemu_get_be32 (f); env->cp15.c1_coproc =qemu_get_be32 (f); env->cp15.c1_xscaleauxcr =qemu_get_be32 (f); + env->cp15.c1_scr =qemu_get_be32 (f); env->cp15.c2_base0 =qemu_get_be32 (f); env->cp15.c2_base1 =qemu_get_be32 (f); env->cp15.c2_control =qemu_get_be32 (f);
Signature · 1 line
1.7.5.4
PATCH v2 5/6 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 268 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -339,6 +339,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +267 -0
267 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v2 6/6 arm: Remove incorrect and misleading comment in arm_timer
In reply to Mark Langsdorf--- hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH 6/6] arm: Remove incorrect and misleading comment in arm_timer
Am 09.01.2012 17:59, schrieb Mark Langsdorf:
Quoted 10 lines
Signed-off-by Mark Langsdorf <[email protected]>--- hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)hw/arm_timer.c +0
-0
hw/arm_timer.c static int sp804_init(SysBusDevice *dev) · line 276
Quoted 5 lines
hw/arm_timer.c +0
-2@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */
Wasn't this comment added by your "arm: Set frequencies for arm_timer"?
I didn't see a message indicating that series has been applied yet, so you should probably fix the comment in the original patch instead of in a follow-up patch. The point of adding the highbank emulation was to see if the patches are sufficient, no?
Else, the commit message does not indicate what is incorrect/misleading about it.
Andreas
Quoted 6 lines
hw/arm_timer.c +0
-1s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 6/6] arm: Remove incorrect and misleading comment in arm_timer
Quoted 19 lines · Andreas Färber
Am 09.01.2012 17:59, schrieb Mark Langsdorf:
Quoted 10 lines
Signed-off-by Mark Langsdorf <[email protected]>---
hw/arm_timer.c | 3 ---1 files changed, 0 insertions(+), 3 deletions(-)hw/arm_timer.c +0
-0hw/arm_timer.c static int sp804_init(SysBusDevice *dev) · line 276
Quoted 5 lines
hw/arm_timer.c +0
-2@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi = qemu_allocate_irqs(sp804_set_irq, s, 2); sysbus_init_irq(dev, &s->irq); - /* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ Wasn't this comment added by your "arm: Set frequencies for
arm_timer"?
Quoted 4 lines
I didn't see a message indicating that series has been applied yet, so you should probably fix the comment in the original patch instead of in a follow-up patch. The point of adding the highbank emulation was to see if the patches are sufficient, no?
It has been applied: commit 104a26a236.
-- PMM
Re: [Qemu-devel] [PATCH 6/6] arm: Remove incorrect and misleading comment in arm_timer
Am 10.01.2012 16:35, schrieb Peter Maydell:
Quoted 20 lines · Andreas Färber
Quoted 19 lines
Am 09.01.2012 17:59, schrieb Mark Langsdorf:
Quoted 10 lines
Signed-off-by Mark Langsdorf <[email protected]>--- hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)hw/arm_timer.c +0
-0hw/arm_timer.c static int sp804_init(SysBusDevice *dev) · line 276
Quoted 5 lines
hw/arm_timer.c +0
-2@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ Wasn't this comment added by your "arm: Set frequencies for
arm_timer"?
Quoted 6 lines
Quoted 4 lines
I didn't see a message indicating that series has been applied yet, so you should probably fix the comment in the original patch instead of in a follow-up patch. The point of adding the highbank emulation was to see if the patches are sufficient, no?
It has been applied: commit
104a26a236.
The v5 various ARM fixes series doesn't say so, only 3/7 v9 has such a notice. (Just like unthreaded patches a PULL and the original series do drift apart.)
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
PATCH v5 1/6 Add xgmac ethernet model
In reply to Mark LangsdorfThis adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 424 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 425 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -340,6 +340,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +424 -0
424 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v5 1/6] Add xgmac ethernet model
Quoted 11 lines · Mark Langsdorf
This adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handlingSigned-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
Quoted 12 lines
---
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Hi, this looks good to me, just one question. Do you really need the c_phyaddr member?
Cheers
v3 cover arm: add support for Calxeda Highbank SoC
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert ahci_reset to use AHCIState". Some of the patches are carried voer from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in=20 that series.
Makefile.target | 1 + hw/a9mpcore.c | 13 ++- hw/arm11mpcore.c | 17 ++- hw/arm_gic.c | 68 +++++++------ hw/arm_timer.c | 3 - hw/armv7m_nvic.c | 30 +++++-- hw/highbank.c | 267 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 44 ++++++++ hw/realview_gic.c | 7 +- target-arm/cpu.h | 3 +- target-arm/helper.c | 9 ++ target-arm/machine.c | 2 + 12 files changed, 412 insertions(+), 52 deletions(-)
PATCH v2 4/6 arm: Add dummy support for co-processor 15's secure config register
From: Rob Herring <[email protected]>
--- target-arm/cpu.h | 3 ++- target-arm/helper.c | 9 +++++++++ target-arm/machine.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-)
target-arm/cpu.h +2 -1
@@ -116,6 +116,7 @@ typedef struct CPUARMState {uint32_t c1_sys;/* System control register. */ uint32_t c1_coproc;/* Coprocessor access register. */ uint32_t c1_xscaleauxcr;/* XScale auxiliary control register. */ +uint32_t c1_scr;/* secure config register. */ uint32_t c2_base0;/* MMU translation table base 0. */ uint32_t c2_base1;/* MMU translation table base 1. */ uint32_t c2_control;/* MMU translation table base control. */
@@ -452,7 +453,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 +#define CPU_SAVE_VERSION 6/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +9 -0
@@ -1440,6 +1440,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) } goto bad_reg;case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { + env->cp15.c1_scr = val; +break ; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
@@ -1908,6 +1913,10 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg; }case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { +return env->cp15.c1_scr; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
target-arm/machine.c +2 -0
@@ -26,6 +26,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c1_sys);qemu_put_be32 (f, env->cp15.c1_coproc);qemu_put_be32 (f, env->cp15.c1_xscaleauxcr); +qemu_put_be32 (f, env->cp15.c1_scr);qemu_put_be32 (f, env->cp15.c2_base0);qemu_put_be32 (f, env->cp15.c2_base1);qemu_put_be32 (f, env->cp15.c2_control);
@@ -143,6 +144,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c1_sys =qemu_get_be32 (f); env->cp15.c1_coproc =qemu_get_be32 (f); env->cp15.c1_xscaleauxcr =qemu_get_be32 (f); + env->cp15.c1_scr =qemu_get_be32 (f); env->cp15.c2_base0 =qemu_get_be32 (f); env->cp15.c2_base1 =qemu_get_be32 (f); env->cp15.c2_control =qemu_get_be32 (f);
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH 4/6] arm: Add dummy support for co-processor 15's secure config register
Quoted 4 lines · Mark Langsdorf
From: Rob Herring <[email protected]>
Signed-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
-- PMM
PATCH v5 1/6 Add xgmac ethernet model
In reply to Mark LangsdorfThis adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 424 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 425 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -340,6 +340,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +424 -0
424 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v5 1/6] Add xgmac ethernet model
Quoted 11 lines · Mark Langsdorf
This adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handlingSigned-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
-- PMM
PATCH v2 5/6 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 267 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 268 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -339,6 +339,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +267 -0
267 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v2 5/6] arm: SoC model for Calxeda Highbank
hw/highbank.c line 104
Quoted 12 lines · Mark Langsdorf
From: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
hw/highbank.c new file +9
-0+static int highbank_regs_init (SysBusDevice *dev) +{ + highbank_regs_state *s = FROM_SYSBUS(highbank_regs_state, dev); + + s->iomem = g_new(MemoryRegion, 1); + s->regs[0x40] = 0x05F20121; + s->regs[0x41] = 0x2; + s->regs[0x42] = 0x05F30121; + s->regs[0x43] = 0x05F40121;
Do these reset to these values as well? (ie should they be in a reset function?)
Quoted 2 lines
+ memory_region_init_io(s->iomem,
&hb_mem_ops,s->regs, "highbank_regs",
+ 0x1000);
You also need
sysbus_init_mmio(dev, &s->iomem);
to expose the memory region.
Quoted 5 lines
+ dev =
qdev_create(NULL, "highbank-regs");
+ qdev_init_nofail(dev);
+ busdev =sysbus_from_qdev(dev);
+ s =FROM_SYSBUS(highbank_regs_state, busdev);
+ memory_region_add_subregion(sysmem,0xfff3c000,s->iomem);
...then you can just use sysbus_mmio_map() rather than fishing around in the internal state struct.
Quoted 6 lines
+ highbank_binfo.ram_size =
ram_size;
+ highbank_binfo.kernel_filename =kernel_filename;
+ highbank_binfo.kernel_cmdline =kernel_cmdline;
+ highbank_binfo.initrd_filename =initrd_filename;
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
+arm_load_kernel(env, &highbank_binfo);
Does your kernel really have the code at the start to cope with the secondary CPUs so it doesn't need the code in arm_boot.c? Most kernels don't (and so the board has to set .nb_cpus, .loader_start (and once the Samsung series lands, the field for where the secondary boot loader's "release cores now" flag is).
-- PMM
PATCH v6 2/6 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 30 ++++++++++++++++++----- hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 48 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -7
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,34 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* 32 internal lines (16 used for system exceptions) plus 64 external +* interrupt lines. */ +gic_init (&s->gic,96 );memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s);vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines (with another 32 hidden internal exception lines). We +* default to 64+32 +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v6 2/6] arm: make the number of GIC interrupts configurable
Quoted 7 lines · Mark Langsdorf
Increase the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and
"theoretical"
hw/a9mpcore.c static SysBusDeviceInfo a9mp_priv_info = { · line 221
Quoted 12 lines
update the save/restore code to only use the appropriate number for each SoC.
Signed-off-by Mark Langsdorf <[email protected]>hw/a9mpcore.c +3
-0@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property[]) { DEFINE_PROP_UINT32("num-cpu", a9mp_priv_state, num_cpu, 1), + /* The Cortex-A9MP may have anything from 0 to 224 external interrupt + * IRQ lines (with another 32 internal). We default to 64+32, which + * is the number provided by the Cortex-A9MP test chip in the
Patch has trailing space at the end of this line (my mailer has eaten it but it's in the original patch).
Quoted 9 lines
hw/a9mpcore.c +4
-0+* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ + DEFINE_PROP_UINT32("num-irq", a9mp_priv_state, num_irq, 96), DEFINE_PROP_END_OF_LIST(), } };
hw/a9mpcore.c static SysBusDeviceInfo mpcore_priv_info = { · line 226
Quoted 10 lines
hw/a9mpcore.c +7
-0@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property[]) { DEFINE_PROP_UINT32("num-cpu", mpcore_priv_state, num_cpu, 1), + /* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects.
Trailing space again.
hw/arm11mpcore.c static int armv7m_nvic_init(SysBusDevice *dev) · line 387
Quoted 13 lines
hw/arm11mpcore.c +4
-1+ DEFINE_PROP_UINT32("num-irq", mpcore_priv_state, num_irq, 64), DEFINE_PROP_END_OF_LIST(), } };@@ -384,16 +382,34 @@ static int armv7m_nvic_init(SysBusDevice *dev) { nvic_state *s= FROM_SYSBUSGIC(nvic_state, dev); - gic_init(&s->gic); + /* 32 internal lines (16 used for system exceptions) plus 64 external + * interrupt lines. */ + gic_init(&s->gic, 96);
s->num_irq, not hardcoded 96.
Also the comment needs rephrasing now:
/* Note that for M profile gic_init() takes the number of external
* interrupt lines only.
*/
Quoted 7 lines
hw/armv7m_nvic.c +1
-0memory_region_add_subregion(get_system_memory(), 0xe000e000, &s->gic.iomem); s->systick.timer = qemu_new_timer_ns(vm_clock, systick_timer_tick, s); vmstate_register(&dev->qdev, -1, &vmstate_nvic, s); return 0; } +static SysBusDeviceInfo armv7m_nvic_priv_info = {
hw/armv7m_nvic.c static int armv7m_nvic_init(SysBusDevice *dev) · line 404
Quoted 10 lines
hw/armv7m_nvic.c +10
-0+ .init = armv7m_nvic_init, + .qdev.name = "armv7m_nvic", + .qdev.size = sizeof(nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property[]) { + /* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines (with another 32 hidden internal exception lines). We +* default to 64+32 +* Other boards may differ and should set this property appropriately. +*/
This comment shouldn't talk about the 32 internal lines, as they are an implementation detail of arm_gic.c, not architectural (unlike the A profile GIC internal interrupt lines).
/* The ARM v7m may have anything from 0 to 496 external interrupt
* IRQ lines. We default to 64. Other boards may differ and should
* set this property appropriately.
*/
hw/armv7m_nvic.c static int armv7m_nvic_init(SysBusDevice *dev) · line 406
Quoted 2 lines
hw/armv7m_nvic.c +2
-0+ DEFINE_PROP_UINT32("num-irq", nvic_state, num_irq, 64), + DEFINE_PROP_END_OF_LIST(),
-- PMM
PATCH v2 6/6 arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfThe current comment says that the arm_timers are restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.
---
Changes from v1
Clarified the commit message
hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v2 6/6] arm: Remove incorrect comment in arm_timer
Quoted 4 lines · Mark Langsdorf
The current comment says that the
arm_timersare restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.Signed-off-by Mark Langsdorf <[email protected]>
Re: [Qemu-devel] [PATCH v2 6/6] arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfAm 10.01.2012 17:45, schrieb Mark Langsdorf:
Quoted 4 lines
The current comment says that the
arm_timersare restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.Signed-off-by Mark Langsdorf <[email protected]>
Thanks,
Andreas
Quoted 23 lines
---
Changes from v1
Clarified the commit messagehw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)hw/arm_timer.c +0
-3@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
PATCH v5 3/6 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct sysbus_ahci_state { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}sysbus_ahci_state ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +sysbus_ahci_state *s =FROM_SYSBUS (sysbus_ahci_state, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (sysbus_ahci_state), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , sysbus_ahci_state, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v5 3/6] ahci: add support for non-PCI based controllers
Am 10.01.2012 17:45, schrieb Mark Langsdorf:
Quoted 6 lines
From: Rob Herring <[email protected]>
Add support for ahci on sysbus.
Signed-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
Thanks,
Andreas
Quoted 73 lines
---
Changes from v4
replaced all references to Plat|plat_ withsysbus_made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Madeplat_ahci_infointo a single structure, not a listhw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)hw/ide/ahci.c +44
-0@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h" @@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct sysbus_ahci_state { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}sysbus_ahci_state ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +sysbus_ahci_state *s =FROM_SYSBUS (sysbus_ahci_state, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (sysbus_ahci_state), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , sysbus_ahci_state, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 6 lines · Mark Langsdorf
This patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert
ahci_resetto use AHCIState". Some of the patches are carried voer from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
PS: can you make sure all the patches in a series and the cover letter have the same vN prefix? I think these ones have got out of sync and it's a bit confusing.
-- PMM
v7 cover arm: add support for Calxeda Highbank SoC
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert ahci_reset to use AHCIState". Some of the patches are carried voer from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
The series patch number jumped from v3 to v7 to synchronize the revision numbers of the individual patches.
Makefile.target | 2 + hw/a9mpcore.c | 13 ++- hw/arm11mpcore.c | 17 ++- hw/arm_gic.c | 68 +++++---- hw/arm_timer.c | 3 - hw/armv7m_nvic.c | 30 +++- hw/highbank.c | 277 +++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 44 ++++++ hw/realview_gic.c | 7 +- hw/xgmac.c | 421 ++++++++++++++++++++++++++++++++++++++++++++++++++ target-arm/cpu.h | 3 +- target-arm/helper.c | 9 + target-arm/machine.c | 2 + 13 files changed, 844 insertions(+), 52 deletions(-)
PATCH v7 1/6 Add xgmac ethernet model
This adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v6
Skipped
Changes from v5
removed c_phyaddr
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -340,6 +340,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v7 2/6 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretical number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v6
Removed trailing whitespace
armv7m_nvic uses num_irq properly
Some comments changed
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 30 ++++++++++++++++++----- hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 48 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -7
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,34 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* note that for the M profile gic_init() takes the number of external +* interrupt lines only. +*/ +gic_init (&s->gic, s->num_irq);memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s);vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines. We default to 64 external and 32 internal +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v7 2/6] arm: make the number of GIC interrupts configurable
Am 10.01.2012 21:33, schrieb Mark Langsdorf:
Quoted 55 lines
Increase the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretical number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
Signed-off-by Mark Langsdorf <[email protected]>---
Changes from v6
Removed trailing whitespace
armv7m_nvicusesnum_irqproperly
Some comments changed
Changes from v5
Clarify the commit message
RenameGIC_NIRQtoGIC_MAXIRQand change usage slightly Makes num-irq touint32_tin all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specificGIC_NIRQ#defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add anum_irqmember in the gic state structure
Use thenum_irqvalue as appropriate
Addnum_irqargument togic_init()
Addnum_irqto various CPU calls togic_inithw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 30 ++++++++++++++++++----- hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 48 deletions(-)hw/armv7m_nvic.c +0
-0@@ -384,16 +382,34 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev);
hw/armv7m_nvic.c static int armv7m_nvic_init(SysBusDevice *dev) · line 392
Quoted 10 lines
hw/armv7m_nvic.c +4
-1-gic_init (&s->gic); +/* note that for the M profile gic_init() takes the number of external +* interrupt lines only. +*/ +gic_init (&s->gic, s->num_irq);memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s);vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);
This should probably be removed now that you register it through sysbus_register_withprop() below.
hw/armv7m_nvic.c static int armv7m_nvic_init(SysBusDevice *dev) · line 399
Quoted 8 lines
hw/armv7m_nvic.c +5
-0return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic,
Minor nit: Assignment is inconsistent - add a space here?
Quoted 16 lines
hw/armv7m_nvic.c +11
-1+ .qdev.props = (Property[]) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines. We default to 64 external and 32 internal +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }
Quoted 1 line
device_init(armv7m_nvic_register_devices)
I'm still wondering whether the num-irq property calls for a version bump somewhere. My thinking is no, since the SysBus device will not be user-created from the command line and therefore effectively has the same values as hardcoded before; but in that case we should assert this by setting .qdev.no_user = 1.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v7 2/6] arm: make the number of GIC interrupts configurable
Quoted 5 lines · Andreas Färber
Am 10.01.2012 21:33, schrieb Mark Langsdorf:
Quoted 1 line
vmstate_register(&dev->qdev, -1,
&vmstate_nvic, s);This should probably be removed now that you register it through
sysbus_register_withprop()below.
Oops, yes, missed that bit.
Quoted 5 lines
I'm still wondering whether the num-irq property calls for a version bump somewhere. My thinking is no, since the SysBus device will not be user-created from the command line and therefore effectively has the same values as hardcoded before; but in that case we should assert this by setting .qdev.no_user = 1.
I agree that we should probably set no_user=1 on more of the ARM internal devices than we currently do, but I think that's probably a separate issue rather than one we should deal with in this patch.
Re version-bump: my thinking was that one isn't required because the onus is on the user not to migrate between systems where the devices have had different qdev property values set. So as long as "no properties set to non default values" doesn't change then we're ok whether the user put the device on the command line or not. (In practice (a) any config with a user-created NVIC device is always broken because there's no way for the user to wire it up properly, and (b) another patch in this series is bumping the CPU state version number so migration is going to fail anyhow.)
-- PMM
PATCH v7 3/6 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v5, v6
Skipped
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct sysbus_ahci_state { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}sysbus_ahci_state ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +sysbus_ahci_state *s =FROM_SYSBUS (sysbus_ahci_state, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (sysbus_ahci_state), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , sysbus_ahci_state, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.5.4
PATCH v7 4/6 arm: Add dummy support for co-processor 15's secure config register
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
---
Changes from v1, v2, v3, v4, v5, v6
Skipped
target-arm/cpu.h | 3 ++- target-arm/helper.c | 9 +++++++++ target-arm/machine.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-)
target-arm/cpu.h +2 -1
@@ -116,6 +116,7 @@ typedef struct CPUARMState {uint32_t c1_sys;/* System control register. */ uint32_t c1_coproc;/* Coprocessor access register. */ uint32_t c1_xscaleauxcr;/* XScale auxiliary control register. */ +uint32_t c1_scr;/* secure config register. */ uint32_t c2_base0;/* MMU translation table base 0. */ uint32_t c2_base1;/* MMU translation table base 1. */ uint32_t c2_control;/* MMU translation table base control. */
@@ -452,7 +453,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 +#define CPU_SAVE_VERSION 6/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +9 -0
@@ -1440,6 +1440,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) } goto bad_reg;case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { + env->cp15.c1_scr = val; +break ; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
@@ -1908,6 +1913,10 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg; }case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { +return env->cp15.c1_scr; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
target-arm/machine.c +2 -0
@@ -26,6 +26,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c1_sys);qemu_put_be32 (f, env->cp15.c1_coproc);qemu_put_be32 (f, env->cp15.c1_xscaleauxcr); +qemu_put_be32 (f, env->cp15.c1_scr);qemu_put_be32 (f, env->cp15.c2_base0);qemu_put_be32 (f, env->cp15.c2_base1);qemu_put_be32 (f, env->cp15.c2_control);
@@ -143,6 +144,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c1_sys =qemu_get_be32 (f); env->cp15.c1_coproc =qemu_get_be32 (f); env->cp15.c1_xscaleauxcr =qemu_get_be32 (f); + env->cp15.c1_scr =qemu_get_be32 (f); env->cp15.c2_base0 =qemu_get_be32 (f); env->cp15.c2_base1 =qemu_get_be32 (f); env->cp15.c2_control =qemu_get_be32 (f);
Signature · 1 line
1.7.5.4
PATCH v7 5/6 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v3, v4, v5, v6
Skipped
Changes from v2
Created a reset function for highbank_regs
Handled creation of regs i/o memory region in a sensible manner Added code to boot secondary CPUs properly
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 278 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -339,6 +339,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v7 6/6 arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfThe current comment says that the arm_timers are restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.
---
Changes from v2, v3, v4, v5, v6
Skipped
Changes from v1
Clarified the commit message
hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.5.4
v8 cover arm: add support for Calxeda Highbank SoC
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert ahci_reset to use AHCIState". Some of the patches are carried voer from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
Makefile.target | 1 + hw/a9mpcore.c | 13 ++- hw/arm11mpcore.c | 17 ++- hw/arm_gic.c | 68 +++++++------ hw/arm_timer.c | 3 - hw/armv7m_nvic.c | 31 ++++-- hw/highbank.c | 277 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 44 ++++++++ hw/realview_gic.c | 7 +- target-arm/cpu.h | 3 +- target-arm/helper.c | 9 ++ target-arm/machine.c | 2 + 12 files changed, 422 insertions(+), 53 deletions(-)
PATCH v8 1/6 Add xgmac ethernet model
This adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v7
None
Changes from v6
Skipped
Changes from v5
removed c_phyaddr
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -343,6 +343,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v8 1/6] Add xgmac ethernet model
Quoted 11 lines · Mark Langsdorf
This adds very basic support for XG-mac ethernet core from Synopsis and others. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handlingSigned-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
Re: [Qemu-devel] [PATCH v8 1/6] Add xgmac ethernet model
In reply to Mark Langsdorfhw/xgmac.c line 136
Quoted 11 lines · Mark Langsdorf
This adds very basic support for XG-mac ethernet core from Synopsis and others.
hw/xgmac.c new file +8
-0+typedef struct rxtx_stats { + uint64_t rx_bytes; + uint64_t tx_bytes; + + uint64_t rx; + uint64_t rx_bcast; + uint64_t rx_mcast; +}rxtx_stats ;
Anthony pointed out to me on IRC today the bit of CODING_STYLE that mandates CamelCase for struct typedef names.
Sorry to bring up coding style issues at this point in the review process, but can I get you to go through and camelcase the struct typenames in this patch series?
thanks
-- PMM
PATCH v8 2/6 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v7
Removed unnecessary vmstate_register
Changes from v6
Removed trailing whitespace
armv7m_nvic uses num_irq properly
Some comments changed
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 31 ++++++++++++++++++------ hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 49 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -8
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,33 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* note that for the M profile gic_init() takes the number of external +* interrupt lines only. +*/ +gic_init (&s->gic, s->num_irq);memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s); -vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines. We default to 64 external and 32 internal +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v8 2/6] arm: make the number of GIC interrupts configurable
Am 11.01.2012 16:26, schrieb Mark Langsdorf:
Quoted 11 lines
Increase the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
Signed-off-by Mark Langsdorf <[email protected]>
Andreas
Quoted 30 lines
---
Changes from v7
Removed unnecessaryvmstate_register
Changes from v6
Removed trailing whitespace
armv7m_nvicusesnum_irqproperly
Some comments changed
Changes from v5
Clarify the commit message
RenameGIC_NIRQtoGIC_MAXIRQand change usage slightly Makes num-irq touint32_tin all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specificGIC_NIRQ#defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add anum_irqmember in the gic state structure
Use thenum_irqvalue as appropriate
Addnum_irqargument togic_init()
Addnum_irqto various CPU calls togic_init
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v8 2/6] arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfQuoted 7 lines · Mark Langsdorf
Increase the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretically number of GIC interrupts to 1020 and
This patch has lost the typo fix ("theoretical") that was in the last version. I wouldn't bother mentioning this if not for:
Quoted 10 lines
+static SysBusDeviceInfo
armv7m_nvic_priv_info= {
+ .init =armv7m_nvic_init,
+ .qdev.name = "armv7m_nvic",
+ .qdev.size =sizeof(nvic_state),
+ .qdev.vmsd =&vmstate_nvic,
+ .qdev.props = (Property[]) {
+ /* The ARM v7m may have anything from 0 to 496 external interrupt
+ * IRQ lines. We default to 64 external and 32 internal
+ * Other boards may differ and should set this property appropriately.
+ */
This is still wrong: from my comments on v5 of this patch:
This comment shouldn't talk about the 32 internal lines, as they are an implementation detail of arm_gic.c, not architectural (unlike the A profile GIC internal interrupt lines).
/* The ARM v7m may have anything from 0 to 496 external interrupt
* IRQ lines. We default to 64. Other boards may differ and should
* set this property appropriately.
*/
-- PMM
PATCH v8 3/6 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v7
None
Changes from v5, v6
Skipped
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct sysbus_ahci_state { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}sysbus_ahci_state ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +sysbus_ahci_state *s =FROM_SYSBUS (sysbus_ahci_state, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (sysbus_ahci_state), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , sysbus_ahci_state, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.5.4
PATCH v8 4/6 arm: Add dummy support for co-processor 15's secure config register
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
---
Changes from v7
None
Changes from v1, v2, v3, v4, v5, v6
Skipped
target-arm/cpu.h | 3 ++- target-arm/helper.c | 9 +++++++++ target-arm/machine.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-)
target-arm/cpu.h +2 -1
@@ -116,6 +116,7 @@ typedef struct CPUARMState {uint32_t c1_sys;/* System control register. */ uint32_t c1_coproc;/* Coprocessor access register. */ uint32_t c1_xscaleauxcr;/* XScale auxiliary control register. */ +uint32_t c1_scr;/* secure config register. */ uint32_t c2_base0;/* MMU translation table base 0. */ uint32_t c2_base1;/* MMU translation table base 1. */ uint32_t c2_control;/* MMU translation table base control. */
@@ -452,7 +453,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 +#define CPU_SAVE_VERSION 6/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +9 -0
@@ -1440,6 +1440,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) } goto bad_reg;case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { + env->cp15.c1_scr = val; +break ; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
@@ -1908,6 +1913,10 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg; }case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { +return env->cp15.c1_scr; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
target-arm/machine.c +2 -0
@@ -26,6 +26,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c1_sys);qemu_put_be32 (f, env->cp15.c1_coproc);qemu_put_be32 (f, env->cp15.c1_xscaleauxcr); +qemu_put_be32 (f, env->cp15.c1_scr);qemu_put_be32 (f, env->cp15.c2_base0);qemu_put_be32 (f, env->cp15.c2_base1);qemu_put_be32 (f, env->cp15.c2_control);
@@ -143,6 +144,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c1_sys =qemu_get_be32 (f); env->cp15.c1_coproc =qemu_get_be32 (f); env->cp15.c1_xscaleauxcr =qemu_get_be32 (f); + env->cp15.c1_scr =qemu_get_be32 (f); env->cp15.c2_base0 =qemu_get_be32 (f); env->cp15.c2_base1 =qemu_get_be32 (f); env->cp15.c2_control =qemu_get_be32 (f);
Signature · 1 line
1.7.5.4
PATCH v8 5/6 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v7
None
Changes from v3, v4, v5, v6
Skipped
Changes from v2
Created a reset function for highbank_regs
Handled creation of regs i/o memory region in a sensible manner Added code to boot secondary CPUs properly
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 278 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -342,6 +342,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v8 5/6] arm: SoC model for Calxeda Highbank
Quoted 6 lines · Mark Langsdorf
From: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
Signed-off-by Rob Herring <[email protected]>Signed-off-by Mark Langsdorf <[email protected]>
PATCH v8 6/6 arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfThe current comment says that the arm_timers are restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.
---
Changes from v7
None
Changes from v2, v3, v4, v5, v6
Skipped
Changes from v1
Clarified the commit message
hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.5.4
v9 cover arm: add support for Calxeda Highbank SoC
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert ahci_reset to use AHCIState". Some of the patches are carried over from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
Makefile.target | 2 + hw/a9mpcore.c | 13 ++- hw/arm11mpcore.c | 17 ++- hw/arm_gic.c | 68 +++++---- hw/arm_timer.c | 3 - hw/armv7m_nvic.c | 31 +++- hw/highbank.c | 277 +++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 44 ++++++ hw/realview_gic.c | 7 +- hw/xgmac.c | 421 ++++++++++++++++++++++++++++++++++++++++++++++++++ target-arm/cpu.h | 3 +- target-arm/helper.c | 9 + target-arm/machine.c | 2 + 13 files changed, 844 insertions(+), 53 deletions(-)
PATCH v9 1/6 Add xgmac ethernet model
This adds very basic support for the xgmac ethernet core. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v7, v8
None
Changes from v6
Skipped
Changes from v5
removed c_phyaddr
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -343,6 +343,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v9 2/6 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretical number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v8
Removed comments about armv7m_nvic's external IRQ lines
Changes from v7
Removed unnecessary vmstate_register
Changes from v6
Removed trailing whitespace
armv7m_nvic uses num_irq properly
Some comments changed
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 31 ++++++++++++++++++------ hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 49 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -8
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,33 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* note that for the M profile gic_init() takes the number of external +* interrupt lines only. +*/ +gic_init (&s->gic, s->num_irq);memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s); -vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines. We default to 64. Other boards may differ and should +* set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v9 2/6] arm: make the number of GIC interrupts configurable
Quoted 5 lines · Mark Langsdorf
+static SysBusDeviceInfo
armv7m_nvic_priv_info= {
+ .init =armv7m_nvic_init,
+ .qdev.name = "armv7m_nvic",
+ .qdev.size =sizeof(nvic_state),
+ .qdev.vmsd =&vmstate_nvic,
So Andreas pointed out the inconsistent spacing here and you fixed it in v8 of this patch but it's back again in v9.
I mention this mostly because it indicates that you have some problem with your workflow which is causing you to lose fixes you make. In fact this is the second time that I've seen a fix you've made in one round of the patch series vanish again in a subsequent round. You need to find out what is causing this and fix it :-)
You needn't bother resending this patch -- I'll just fix the space when I apply it to the arm-devs.next queue.
On that basis:
-- PMM
PATCH v9 3/6 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v7, v8
None
Changes from v5, v6
Skipped
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (s, i); } } + +typedef struct sysbus_ahci_state { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}sysbus_ahci_state ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +sysbus_ahci_state *s =FROM_SYSBUS (sysbus_ahci_state, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (sysbus_ahci_state), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , sysbus_ahci_state, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.5.4
PATCH v9 4/6 arm: Add dummy support for co-processor 15's secure config register
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
---
Changes from v7, v8
None
Changes from v1, v2, v3, v4, v5, v6
Skipped
target-arm/cpu.h | 3 ++- target-arm/helper.c | 9 +++++++++ target-arm/machine.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-)
target-arm/cpu.h +2 -1
@@ -116,6 +116,7 @@ typedef struct CPUARMState {uint32_t c1_sys;/* System control register. */ uint32_t c1_coproc;/* Coprocessor access register. */ uint32_t c1_xscaleauxcr;/* XScale auxiliary control register. */ +uint32_t c1_scr;/* secure config register. */ uint32_t c2_base0;/* MMU translation table base 0. */ uint32_t c2_base1;/* MMU translation table base 1. */ uint32_t c2_control;/* MMU translation table base control. */
@@ -452,7 +453,7 @@ void cpu_arm_set_cp_io(CPUARMState *env, int cpnum,#define cpu_signal_handler cpu_arm_signal_handler#define cpu_list arm_cpu_list -#define CPU_SAVE_VERSION 5 +#define CPU_SAVE_VERSION 6/* MMU modes definitions */ #define MMU_MODE0_SUFFIX _kernel
target-arm/helper.c +9 -0
@@ -1440,6 +1440,11 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val) } goto bad_reg;case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { + env->cp15.c1_scr = val; +break ; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
@@ -1908,6 +1913,10 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn) goto bad_reg; }case 1 :/* System configuration. */ +if (arm_feature (env,ARM_FEATURE_V7 ) + && op1 ==0 && crm ==1 && op2 ==0 ) { +return env->cp15.c1_scr; + }if (arm_feature (env,ARM_FEATURE_OMAPCP )) op2 =0 ;switch (op2) {
target-arm/machine.c +2 -0
@@ -26,6 +26,7 @@ void cpu_save(QEMUFile *f, void *opaque)qemu_put_be32 (f, env->cp15.c1_sys);qemu_put_be32 (f, env->cp15.c1_coproc);qemu_put_be32 (f, env->cp15.c1_xscaleauxcr); +qemu_put_be32 (f, env->cp15.c1_scr);qemu_put_be32 (f, env->cp15.c2_base0);qemu_put_be32 (f, env->cp15.c2_base1);qemu_put_be32 (f, env->cp15.c2_control);
@@ -143,6 +144,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) env->cp15.c1_sys =qemu_get_be32 (f); env->cp15.c1_coproc =qemu_get_be32 (f); env->cp15.c1_xscaleauxcr =qemu_get_be32 (f); + env->cp15.c1_scr =qemu_get_be32 (f); env->cp15.c2_base0 =qemu_get_be32 (f); env->cp15.c2_base1 =qemu_get_be32 (f); env->cp15.c2_control =qemu_get_be32 (f);
Signature · 1 line
1.7.5.4
PATCH v9 5/6 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v7, v8
None
Changes from v3, v4, v5, v6
Skipped
Changes from v2
Created a reset function for highbank_regs
Handled creation of regs i/o memory region in a sensible manner Added code to boot secondary CPUs properly
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 278 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -342,6 +342,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v9 5/6] arm: SoC model for Calxeda Highbank
Quoted 2 lines · Mark Langsdorf
Removed the automatic detection and resetting of
ram_size. Image MUST
be loaded with -m 4089 or it will crash
I don't know what is maintainer's politics on this, but as a user of your board I don't really like that I will have to remember this strange number when I launch Highbank emulation. Have you considered adding an automatic upper limitation to user-defined ram_size?
hw/highbank.c line 184
Quoted 10 lines
hw/highbank.c new file +10
-0+ sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (bios_name !=NULL ) { + sysboot_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (sysboot_filename !=NULL ) { +uint32_t filesize =get_image_size (sysboot_filename); +if (load_image_targphys ("sysram.bin" ,0xfff88000 , filesize)<0 ) { +hw_error ("Unable to load %s\n" , bios_name); + }
Probably should be
if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000)< 0) { and then you don't need "uint32_t filesize" at all.
hw/highbank.c line 222
Quoted 10 lines
hw/highbank.c new file +9
-0+ dev =qdev_create (NULL ,"l2x0" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xfff12000 ); + dev =qdev_create (NULL ,"highbank-regs" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xfff3c000 ); +
You can use sysbus_create_simple() here (of course, if you didn't avoid it intentionally for some reason).
Signature · 3 lines
Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: [email protected]
Re: [Qemu-devel] [PATCH v9 5/6] arm: SoC model for Calxeda Highbank
Am 12.01.2012 13:47, schrieb Mitsyanko Igor:
Quoted 14 lines · Mark Langsdorf
Review
Quoted 12 lines
hw/highbank.c new file +5
-0+ sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (bios_name !=NULL ) { + sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
bios_name);hw/highbank.c new file +3
-0+if (sysboot_filename !=NULL ) { +uint32_t filesize =get_image_size (sysboot_filename); + if (load_image_targphys("sysram.bin", 0xfff88000,filesize)< 0) {
(quoted diff) +2
-0+ hw_error("Unable to load %s\n", bios_name); + }
Quoted 3 lines
Probably should be
if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000)< 0) { and then you don't need "uint32_tfilesize" at all.
You need it either way; if you use 0x8000 there, you need to check if filesize is actually 0x8000. Doing it this way allows to load smaller files; a check for larger files should be added though. Thanks for making me aware.
Quoted 5 lines
Quoted 4 lines
hw/highbank.c new file +4
-0+ dev =qdev_create (NULL ,"l2x0" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xfff12000 );
Quoted 8 lines
hw/highbank.c line 222
Quoted 5 lines
hw/highbank.c new file +5
-0+ dev =qdev_create (NULL ,"highbank-regs" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xfff3c000 ); +You can use
sysbus_create_simple()here (of course, if you didn't avoid it intentionally for some reason).
Depends on how you read this:
/* Legacy helper function for creating devices. */ DeviceState *sysbus_create_varargs(const char *name,
target_phys_addr_t addr, ...);
DeviceState *sysbus_try_create_varargs(const char *name,
target_phys_addr_t addr, ...);
static inline DeviceState *sysbus_create_simple(const char *name,
target_phys_addr_t addr,
qemu_irq irq)
{
return sysbus_create_varargs(name, addr, irq, NULL);
}I interpret it as sysbus_create_simple() using deprecated sysbus_create_varargs() and therefore being deprecated, too.
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH v9 5/6] arm: SoC model for Calxeda Highbank
Quoted 15 lines · Andreas Färber
Am 12.01.2012 13:47, schrieb Mitsyanko Igor:
Quoted 14 lines · Mark Langsdorf
Quoted 12 lines
hw/highbank.c new file +5
-0+ sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (bios_name !=NULL ) { + sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS,
bios_name);hw/highbank.c new file +3
-0+if (sysboot_filename !=NULL ) { +uint32_t filesize =get_image_size (sysboot_filename); + if (load_image_targphys("sysram.bin", 0xfff88000,filesize)< 0) {
(quoted diff) +2
-0+ hw_error("Unable to load %s\n", bios_name); + }
Quoted 9 lines
Quoted 3 lines
Probably should be
if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000)< 0) {
and then you don't need "uint32_tfilesize" at all.You need it either way; if you use
0x8000there, you need to check if filesize is actually0x8000. Doing it this way allows to load smaller files; a check for larger files should be added though. Thanks for making me aware.
Why do we need to check if filesize is 0x8000? load_image_targphys() will call get_image_size() and check that size is not more then 0x8000 automatically, so it would operate on any file with size<=0x8000 and return error if size>0x8000, just like we need it to. Well, OK, I know load_image_targphys() is currently broken and doesn't use max_sz argument, but recently I saw a patch in mailing list which fixes this.
Quoted 28 lines
Quoted 5 lines
Quoted 4 lines
hw/highbank.c new file +4
-0+ dev =qdev_create (NULL ,"l2x0" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xfff12000 );Quoted 8 lines
hw/highbank.c line 222
Quoted 5 lines
hw/highbank.c new file +5
-0+ dev =qdev_create (NULL ,"highbank-regs" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_mmio_map (busdev,0 ,0xfff3c000 ); +You can use
sysbus_create_simple()here (of course, if you didn't avoid it intentionally for some reason).Depends on how you read this:
/* Legacy helper function for creating devices. */ DeviceState *sysbus_create_varargs(const char *name,
target_phys_addr_t addr, ...); DeviceState *sysbus_try_create_varargs(const char *name, target_phys_addr_t addr, ...); static inline DeviceState *sysbus_create_simple(const char *name, target_phys_addr_t addr, qemu_irq irq) { return sysbus_create_varargs(name, addr, irq, NULL); }
Quoted 5 lines
I interpret it as
sysbus_create_simple()using deprecatedsysbus_create_varargs()and therefore being deprecated, too.Andreas
Sorry, never paid attention that these functions are deprecated.
Signature · 3 lines
Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: [email protected]
Re: [Qemu-devel] [PATCH v9 5/6] arm: SoC model for Calxeda Highbank
Quoted 15 lines · Mitsyanko Igor
Quoted 14 lines · Andreas Färber
Depends on how you read this:
/* Legacy helper function for creating devices. */ DeviceState *sysbus_create_varargs(const char *name,
target_phys_addr_taddr, ...); DeviceState *sysbus_try_create_varargs(const char *name,target_phys_addr_taddr, ...); static inline DeviceState *sysbus_create_simple(const char *name,target_phys_addr_taddr,qemu_irqirq) {
returnsysbus_create_varargs(name, addr, irq, NULL);
}
Quoted 4 lines
Quoted 2 lines
I interpret it as
sysbus_create_simple()using deprecatedsysbus_create_varargs()and therefore being deprecated, too.Sorry, never paid attention that these functions are deprecated.
Personally I don't think we should deprecate either sysbus_create_simple() or sysbus_create_varargs() until QOM has advanced to the point where we can throw out sysbus devices altogether. These functions are a straightforward way of instantiating simple sysbus devices, they're widely used, and I don't see anything particularly wrong with them.
-- PMM
Re: [Qemu-devel] [PATCH v9 5/6] arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfQuoted 4 lines · Mark Langsdorf
hw/highbank.c new file +4
-0+ sysram =g_new (MemoryRegion,1 ); +memory_region_init_ram (sysram,"highbank.sysram" ,0x8000 ); +memory_region_add_subregion (sysmem,0xfff88000 , sysram); +if (bios_name !=NULL ) {
hw/highbank.c line 188
Quoted 10 lines
hw/highbank.c new file +10
-0+ sysboot_filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , bios_name); +if (sysboot_filename !=NULL ) { +uint32_t filesize =get_image_size (sysboot_filename); +if (load_image_targphys ("sysram.bin" ,0xfff88000 , filesize)<0 ) { +hw_error ("Unable to load %s\n" , bios_name); + } + }else { +hw_error ("Unable to find %s\n" , bios_name); + } + }
I'm sorry, I forgot to ask in my previous message, how does control is passed to uboot image at 0xfff88000 address? Shouldn't highbank_binfo be modified somehow if bios_name supplied?
Signature · 3 lines
Mitsyanko Igor ASWG, Moscow R&D center, Samsung Electronics email: [email protected]
Re: [Qemu-devel] [PATCH v9 5/6] arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfQuoted 9 lines · Mark Langsdorf
+ highbank_binfo.ram_size =
ram_size;
+ highbank_binfo.kernel_filename =kernel_filename;
+ highbank_binfo.kernel_cmdline =kernel_cmdline;
+ highbank_binfo.initrd_filename =initrd_filename;
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
+ highbank_binfo.nb_cpus =smp_cpus;
+ highbank_binfo.loader_start = 0;
+ highbank_binfo.smp_loader_start =SMP_BOOT_ADDR;
+ arm_load_kernel(env,&highbank_binfo);
So at the moment this will use address 0x10000030 as the location that the bootloader for secondary CPUs polls to find out whether it can release the secondary CPUs. This is right for realview and vexpress, because it's the sysreg SYS_FLAGS (implemented in arm_sysctl.c). Is this really the right location to poll for Highbank?
(There's a patch in the Samsung Exynos4 patch series which addresses this by allowing boards to specify a polling location. So I'm wondering what that location ought to be for Highbank...)
thanks
-- PMM
PATCH v9 6/6 arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfThe current comment says that the arm_timers are restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.
---
Changes from v7, v8
None
Changes from v2, v3, v4, v5, v6
Skipped
Changes from v1
Clarified the commit message
hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -272,11 +272,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.5.4
Quoted 6 lines · Mark Langsdorf
This patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert
ahci_resetto use AHCIState". Some of the patches are carried over from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
So, are there in fact any patches from the "various ARM fixes for Calxeda Highbank" series which this series depends on and which haven't been committed to master? It looks to me as if all the patches from that series either (a) were put into this one or
(b) were committed, but did I miss anything?
Does anybody object to my taking the AHCI patches along with this series via arm-devs.next ? (other than patch v4 which goes via target-arm.next)
-- PMM
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Mark Langsdorf
This patch series adds support for the Calxeda Highbank SoC. It depends on my previous patch series "various ARM fixes for Calxeda Highbank" and "ahci: convert
ahci_resetto use AHCIState". Some of the patches are carried over from "Various ARM fixes for Calxeda Highbank" and were reviewed but not accepted in that series.
Quoted 5 lines
So, are there in fact any patches from the "various ARM fixes for Calxeda Highbank" series which this series depends on and which haven't been committed to master? It looks to me as if all the patches from that series either (a) were put into this one or
(b) were committed, but did I miss anything?
Mark: ping? I'm just waiting for an answer to this and also to the question about the secondary boot protocol (see my email replying to patch 5/5) before I take these into arm-devs.next...
Quoted 3 lines
Does anybody object to my taking the AHCI patches along with this series via arm-devs.next ? (other than patch v4 which goes via target-arm.next)
[I got an Acked-by: from Kevin over irc regarding these and will do this.]
-- PMM
Am 13.01.2012 13:14, schrieb Peter Maydell:
Quoted 6 lines · Peter Maydell
Quoted 3 lines
Does anybody object to my taking the AHCI patches along with this series via arm-devs.next ? (other than patch v4 which goes via target-arm.next)
[I got an Acked-by: from Kevin over irc regarding these and will do this.]
FWIW I don't object. Either the maintainership of AHCI doesn't fall under "IDE" or Kevin is busy - possibly both?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 10 lines · Andreas Färber
Am 13.01.2012 13:14, schrieb Peter Maydell:
Quoted 6 lines · Peter Maydell
Quoted 3 lines
Does anybody object to my taking the AHCI patches along with this series via arm-devs.next ? (other than patch v4 which goes via target-arm.next)
[I got an Acked-by: from Kevin over irc regarding these and will do this.]
FWIW I don't object. Either the maintainership of AHCI doesn't fall under "IDE" or Kevin is busy - possibly both?
It falls under IDE and Kevin acked them :)
Alex
Am 13.01.2012 15:18, schrieb Alexander Graf:
Quoted 9 lines · Andreas Färber
Quoted 7 lines
Am 13.01.2012 13:14, schrieb Peter Maydell:
Quoted 5 lines · Peter Maydell
Quoted 3 lines
Does anybody object to my taking the AHCI patches along with this series via arm-devs.next ? (other than patch v4 which goes via target-arm.next)
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
[I got an Acked-by: from Kevin over irc regarding these and will do this.]
FWIW I don't object. Either the maintainership of AHCI doesn't fall under "IDE" or Kevin is busy - possibly both?
It falls under IDE and Kevin acked them :)
My RFC didn't get any review or testing yet, not from you either. ;(
(But that is foremost waiting for Juan to comment on the VMState size issue the Samsung guys and me ran into. And it's in no way urgent for me currently or I would've ping'ed it already.)
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 10 lines · Andreas Färber
Am 13.01.2012 15:18, schrieb Alexander Graf:
Quoted 9 lines · Andreas Färber
Quoted 7 lines
Am 13.01.2012 13:14, schrieb Peter Maydell:
Quoted 5 lines · Peter Maydell
Quoted 3 lines
Does anybody object to my taking the AHCI patches along with this series via arm-devs.next ? (other than patch v4 which goes via target-arm.next)
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
[I got an Acked-by: from Kevin over irc regarding these and will do this.]
FWIW I don't object. Either the maintainership of AHCI doesn't fall under "IDE" or Kevin is busy - possibly both?
It falls under IDE and Kevin acked them :)
My RFC didn't get any review or testing yet, not from you either. ;(
I'm sure he's still busy catching up on his email. He only got back this week :)
Quoted 3 lines
(But that is foremost waiting for Juan to comment on the VMState size issue the Samsung guys and me ran into. And it's in no way urgent for me currently or I would've ping'ed it already.)
Yup, that's the one big thing I would like to see addressed first too.
Alex
v10 cover arm: add support for Calxeda Highbank
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC.
PATCH v10 1/5 Add xgmac ethernet model
From: Rob Herring <[email protected]>
This adds very basic support for the xgmac ethernet core. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v10
Make typedef struct names into CamelCase
Changes from v7, v8
None
Changes from v6
Skipped
Changes from v5
removed c_phyaddr
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -343,6 +343,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.7.5
PATCH v10 2/5 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretical number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v9
None
Changes from v8
Removed comments about armv7m_nvic's external IRQ lines
Changes from v7
Removed unnecessary vmstate_register
Changes from v6
Removed trailing whitespace
armv7m_nvic uses num_irq properly
Some comments changed
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 31 ++++++++++++++++++------ hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 49 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -8
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,33 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* note that for the M profile gic_init() takes the number of external +* interrupt lines only. +*/ +gic_init (&s->gic, s->num_irq);memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s); -vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines. We default to 64. Other boards may differ and should +* set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.7.5
PATCH v10 3/5 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v9
Changed typedef struct names to CamelCase
Changes from v7, v8
None
Changes from v5, v6
Skipped
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (&d->ahci, i); } } + +typedef struct SysbusAHCIState { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}SysbusAHCIState ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +SysbusAHCIState *s =FROM_SYSBUS (SysbusAHCIState, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (SysbusAHCIState), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , SysbusAHCIState, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.7.5
PATCH v10 4/5 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v9
Made typedef struct names in CamelCase
Changes from v7, v8
None
Changes from v3, v4, v5, v6
Skipped
Changes from v2
Created a reset function for highbank_regs
Handled creation of regs i/o memory region in a sensible manner Added code to boot secondary CPUs properly
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 278 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -342,6 +342,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
1.7.7.5
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Mark Langsdorf
+ highbank_binfo.ram_size =
ram_size;
+ highbank_binfo.kernel_filename =kernel_filename;
+ highbank_binfo.kernel_cmdline =kernel_cmdline;
+ highbank_binfo.initrd_filename =initrd_filename;
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
+ highbank_binfo.nb_cpus =smp_cpus;
+ highbank_binfo.loader_start = 0;
+ highbank_binfo.smp_loader_start =SMP_BOOT_ADDR;
+ arm_load_kernel(env,&highbank_binfo);
Unfortunately for you Evgeny's patch to arm_boot.c has been committed to master (commit 078758d0) which means you need to update this to specify a value for highbank_binfo.smp_bootreg_addr.
The bad news is that if I'm reading this right:
http://lxr.linux.no/#linux+v3.2.1/arch/arm/mach-highbank/highbank.c#L71
that value differs depending on which CPU is to be brought out of the pen, which implies that you probably need to implement your own secondary smp boot code.
Incidentally I'm surprised this worked for you at all -- before Evgeny's patch the secondary bootloader code in arm_boot.c would have been polling 0x10000030, which the highbank kernel code doesn't ever change, so I don't see how you got the secondary cores into the kernel when using -kernel...
-- PMM
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 15 lines · Peter Maydell
hw/highbank.c line 260
Quoted 9 lines · Mark Langsdorf
hw/highbank.c new file +9
-0+ highbank_binfo.ram_size = ram_size; + highbank_binfo.kernel_filename = kernel_filename; + highbank_binfo.kernel_cmdline = kernel_cmdline; + highbank_binfo.initrd_filename = initrd_filename; + highbank_binfo.board_id =-1 ;/* provided by deviceTree */ + highbank_binfo.nb_cpus = smp_cpus; + highbank_binfo.loader_start =0 ; + highbank_binfo.smp_loader_start =SMP_BOOT_ADDR ; +arm_load_kernel (env, &highbank_binfo);Unfortunately for you Evgeny's patch to
arm_boot.chas been committed to master (commit078758d0) which means you need to update this to specify a value for highbank_binfo.smp_bootreg_addr.
Quoted 5 lines
Incidentally I'm surprised this worked for you at all -- before Evgeny's patch the secondary bootloader code in
arm_boot.cwould have been polling0x10000030, which the highbank kernel code doesn't ever change, so I don't see how you got the secondary cores into the kernel when using -kernel...
I think I was undertesting.
I can set the smp_loader code so that I can boot 2 cpus and verify their existence in /proc/cpuinfo, but I can't get 3 cpus to boot at all, no matter how I hack the existing arm_boot code.
Is there a good example of how to write secondary smp boot code other than arm_boot.c? Should I just expect to pull most of arm_boot.c into highbank and adjust from there? I don't want to duplicate code like that, but I need more flexibility than I can easily add to arm_boot.c.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 4 lines · Mark Langsdorf
I can set the
smp_loadercode so that I can boot 2 cpus and verify their existence in/proc/cpuinfo, but I can't get 3 cpus to boot at all, no matter how I hack the existingarm_bootcode.
Right, multiple secondary cores requires multiple addresses to be polled which we don't support in arm_boot.c at the moment.
Quoted 5 lines
Is there a good example of how to write secondary smp boot code other than
arm_boot.c? Should I just expect to pull most ofarm_boot.cinto highbank and adjust from there? I don't want to duplicate code like that, but I need more flexibility than I can easily add toarm_boot.c.
Nope, I'm afraid you're the first one to run into this. arm_boot.c started off as just implementing the realview secondary boot protocol, and exynos4 and vexpress have been close enough to piggyback on it. So highbank is the first board that's different enough to need its own code.
A big chunk of arm_boot.c is the primary CPU boot code, which should be standard for all arm platforms, so that shouldn't need to change. So we just need a reasonably clean solution for a platform to provide its own secondary boot code. I'm vaguely thinking about providing a hook function for 'write secondary boot code' and one for 'post-cpu-reset hook for secondary cpus', which would go in the "if (info->nb_cpus > 1) {...}" condition in arm_load_kernel() and in the else-clause of "if (env == first_cpu) in do_cpu_reset().
Can you try something along those lines?
thanks
-- PMM
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 25 lines · Peter Maydell
Quoted 5 lines · Mark Langsdorf
Is there a good example of how to write secondary smp boot code other than
arm_boot.c? Should I just expect to pull most ofarm_boot.cinto highbank and adjust from there? I don't want to duplicate code like that, but I need more flexibility than I can easily add toarm_boot.c.Nope, I'm afraid you're the first one to run into this.
arm_boot.cstarted off as just implementing the realview secondary boot protocol, and exynos4 and vexpress have been close enough to piggyback on it. So highbank is the first board that's different enough to need its own code.A big chunk of
arm_boot.cis the primary CPU boot code, which should be standard for all arm platforms, so that shouldn't need to change. So we just need a reasonably clean solution for a platform to provide its own secondary boot code. I'm vaguely thinking about providing a hook function for 'write secondary boot code' and one for 'post-cpu-reset hook for secondary cpus', which would go in the "if (info->nb_cpus> 1) {...}" condition inarm_load_kernel()and in the else-clause of "if (env ==first_cpu) indo_cpu_reset().
Quoted 1 line
Can you try something along those lines?
I think so. I was worried about accessing some of the arm_boot static variables but it doesn't look like I'll need to do that.
I'll do a quick refactor RFC of arm_boot.c and then get into the gory bits of getting something to work for Highbank.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 10 lines · Mark Langsdorf
Quoted 1 line · Peter Maydell
Can you try something along those lines?
I think so. I was worried about accessing some of the
arm_bootstatic variables but it doesn't look like I'll need to do that.I'll do a quick refactor RFC of
arm_boot.cand then get into the gory bits of getting something to work for Highbank.
Cool, thanks. NB that I have this patch
http://patchwork.ozlabs.org/patch/135991/
in the vexpress-a15 series which also touches arm_boot.c, but it's not particularly invasive so it should not be too hard to reconcile with your changes.
-- PMM
RFC PATCH 1/1 arm: add secondary cpu book callbacks to arm_boot.c
In reply to Mark LangsdorfCreate two functions, write_secondary_boot() and secondary_cpu_reset_hook(), to allow platforms more control of how secondary CPUs are brought up. The new functions default to NULL and aren't called unless they are populated so there are no changes to existing platform models.
---
I'll add this to the Highbank patch series but I wanted to throw it out now to make sure the general structure was good.
hw/arm-misc.h | 4 ++++ hw/arm_boot.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletions(-)
hw/arm-misc.h +4 -0
@@ -36,6 +36,10 @@ struct arm_boot_info {int nb_cpus;int board_id;int (*atag_board)(const struct arm_boot_info *info,void *p); +void (*write_secondary_boot)(CPUState *env, +const struct arm_boot_info *info); +void (*secondary_cpu_reset_hook)(CPUState *env, +const struct arm_boot_info *info);/* Used internally by arm_boot.c */ int is_linux;target_phys_addr_t initrd_size;
hw/arm_boot.c +5 -1
@@ -196,6 +196,8 @@ static void do_cpu_reset(void *opaque)set_kernel_args (info, info->initrd_size, info->loader_start); } + }else if (info->secondary_cpu_reset_hook) { + info->secondary_cpu_reset_hook (env, info); }else {stl_phys_notdirty (info->smp_bootreg_addr,0 ); env->regs[15 ] = info->smp_loader_start;
@@ -272,7 +274,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info) }rom_add_blob_fixed ("bootloader" , bootloader,sizeof (bootloader), info->loader_start); -if (info->nb_cpus >1 ) { +if ((info->nb_cpus >1 ) && (info->write_secondary_boot)) { + info->write_secondary_boot (env, info); + }else if (info->nb_cpus >1 ) { smpboot[ARRAY_SIZE (smpboot) -1 ] = info->smp_bootreg_addr; smpboot[ARRAY_SIZE (smpboot) -2 ] = info->smp_priv_base;for (n =0 ; n <ARRAY_SIZE (smpboot); n++) {
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH][RFC] arm: add secondary cpu book callbacks to arm_boot.c
Quoted 9 lines · Mark Langsdorf
Create two functions,
write_secondary_boot()andsecondary_cpu_reset_hook(), to allow platforms more control of how secondary CPUs are brought up. The new functions default to NULL and aren't called unless they are populated so there are no changes to existing platform models.Signed-off-by Mark Langsdorf <[email protected]>---
I'll add this to the Highbank patch series but I wanted to throw it out now to make sure the general structure was good.
Looks OK. I'm tempted to suggest that we should pull the default code out into separate functions and then at the top of arm_load_kernel() do
if (!info->write_secondary_boot) {
info->write_secondary_boot = default_write_secondary_boot;
}
if (!info->secondary_cpu_reset_hook) {
info->secondary_cpu_reset_hook = default_secondary_cpu_reset_hook;}
Then we can put all the secondary-cpu-related code that is in arm_boot.c in one place in the file.
Probably also nice to add a comment about which fields in arm_boot_info are only required if you're using the default write_secondary_boot.
-- PMM
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
In reply to Peter MaydellQuoted 8 lines · Peter Maydell
Quoted 4 lines · Mark Langsdorf
I can set the
smp_loadercode so that I can boot 2 cpus and verify their existence in/proc/cpuinfo, but I can't get 3 cpus to boot at all, no matter how I hack the existingarm_bootcode.Right, multiple secondary cores requires multiple addresses to be polled which we don't support in
arm_boot.cat the moment.
How would multiple polling supposed to work? I've tried changing
http://lxr.linux.no/#linux+v3.2.1/arch/arm/mach-highbank/highbank.c#L71
to point to a fixed address (0x50), and the boot loader still fails if there are 2 or more secondary CPUs.
I've figured out that do_cpu_reset() is only called once, even though that seems a bit strange to me. I've tried the following in my local secondary_hook call:
switch (info->nb_cpus) {
case 4:
stl_phys_notdirty(0x70, 0);
case 3:
stl_phys_notdirty(0x60, 0);
case 2:
stl_phys_notdirty(0x50, 0);
env->regs[15] = 0x100;
break;
}which works fine with 2 cpus, but fails to boot both secondary cpus if there are 3 total cpus.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 11 lines · Mark Langsdorf
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Mark Langsdorf
I can set the
smp_loadercode so that I can boot 2 cpus and verify their existence in/proc/cpuinfo, but I can't get 3 cpus to boot at all, no matter how I hack the existingarm_bootcode.Right, multiple secondary cores requires multiple addresses to be polled which we don't support in
arm_boot.cat the moment.How would multiple polling supposed to work?
You need several separate bits of code, to put each secondary core in a different loop polling a different address. (If you have access to your own bootloader sources you should be able to see how it does it :-))
Quoted 4 lines
I've tried changing
http://lxr.linux.no/#linux+v3.2.1/arch/arm/mach-highbank/highbank.c#L71
to point to a fixed address (0x50), and the boot loader still fails if there are 2 or more secondary CPUs.
Yeah, that's insufficient, because the highbank kernel doesn't have an equivalent of this bit of code for versatile et al:
http://lxr.linux.no/#linux+v3.2.1/arch/arm/plat-versatile/headsmp.S
...which puts all the cores back into yet another pen so they can be released to the main kernel secondary_startup entry point singly as they are required. On versatile when the flags register is written, every secondary CPU comes out of the bootloader pen simultaneously, so we have to catch them all again like this. Highbank, as far as I can tell, has the boot loader provide a mechanism for letting the kernel release just one core, so the highbank kernel can simply ask for the cores one at a time and direct them straight from the bootloader to secondary_startup.
This is essentially pushing some of this logic from the kernel into the bootloader, which is arguably cleaner but does make this boot code more complicated.
Quoted 2 lines
I've figured out that
do_cpu_reset()is only called once, even though that seems a bit strange to me.
It should be called once per core -- we register it with qemu_register_reset() for each core at the bottom of arm_load_kernel(). The reason it isn't in your case is a bug in highbank.c -- you should be passing first_cpu as the first parameter to arm_load_kernel(). In fact you're passing in env, which happens to be the last cpu, so the loop in arm_load_kernel() registers the reset handler for the last CPU only. (I think the only reason this bug didn't cause complete failure to boot is that you have a info->loader_start of 0 which happens to be where the core will come out of reset anyway.)
Quoted 14 lines
I've tried the following
in my localsecondary_hookcall:switch (
info->nb_cpus) {
case 4:
stl_phys_notdirty(0x70, 0);
case 3:
stl_phys_notdirty(0x60, 0);
case 2:
stl_phys_notdirty(0x50, 0);
env->regs[15] =0x100;
break;
}
Quoted 2 lines
which works fine with 2 cpus, but fails to boot both secondary cpus if there are 3 total cpus.
This is necessary but not sufficient, I think.
-- PMM
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
Quoted 5 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
How would multiple polling supposed to work?
You need several separate bits of code, to put each secondary core in a different loop polling a different address.
Er, or more sensibly, just one bit of code that does something like:
/* find out which core we are by reading cp15 MPIDR */ core = cp15_MPIDR & 0x3;
do {
/* now we can check the right flag for this core */
wfi
poll [0x40+0x10 * core] } while (it's zero);
jump to it;
(translation into assembly left as exercise for the reader)
Quoted 2 lines
(If you have access to your own bootloader sources you should be able to see how it does it :-))
This advice is still good :-)
-- PMM
Re: [Qemu-devel] [PATCH v10 4/5] arm: SoC model for Calxeda Highbank
In reply to Peter MaydellQuoted 11 lines · Peter Maydell
Quoted 10 lines · Mark Langsdorf
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Mark Langsdorf
I can set the
smp_loadercode so that I can boot 2 cpus and verify their existence in/proc/cpuinfo, but I can't get 3 cpus to boot at all, no matter how I hack the existingarm_bootcode.Right, multiple secondary cores requires multiple addresses to be polled which we don't support in
arm_boot.cat the moment.
Quoted 6 lines
Quoted 1 line
How would multiple polling supposed to work?
You need several separate bits of code, to put each secondary core in a different loop polling a different address. (If you have access to your own bootloader sources you should be able to see how it does it :-))
I wasn't sure if polling was done on the QEMU side. I can pull code from the bootloader.
Quoted 7 lines
Quoted 4 lines
I've tried changing
http://lxr.linux.no/#linux+v3.2.1/arch/arm/mach-highbank/highbank.c#L71
to point to a fixed address (0x50), and the boot loader still fails if there are 2 or more secondary CPUs.Yeah, that's insufficient, because the highbank kernel doesn't
Quoted 7 lines
Quoted 2 lines
I've figured out that
do_cpu_reset()is only called once, even though that seems a bit strange to me.It should be called once per core -- we register it with
qemu_register_reset()for each core at the bottom ofarm_load_kernel(). The reason it isn't in your case is a bug inhighbank.c-- you should be passingfirst_cpuas the first parameter toarm_load_kernel().
As it turns out, the highbank simulation will boot all 4 cores if I make the change to pass first_cpu and change the Linux code to use 0x40 for all 4 CPUs. Which is gratifying if a little surprising.
With that straightened out, I can go work on translating the polling code to opcodes. Thanks for the pointers.
--Mark Langsdorf
Calxeda, Inc.
PATCH v10 5/5 arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfThe current comment says that the arm_timers are restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.
---
Changes from v7, v8, v9
None
Changes from v2, v3, v4, v5, v6
Skipped
Changes from v1
Clarified the commit message
hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -273,11 +273,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.7.5
v11 cover arm: add support for Calxeda Highbank
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC.
PATCH v11 1/6 Add xgmac ethernet model
From: Rob Herring <[email protected]>
This adds very basic support for the xgmac ethernet core. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v10
None
Changes from v9
Make typedef struct names into CamelCase
Changes from v7, v8
None
Changes from v6
Skipped
Changes from v5
removed c_phyaddr
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -343,6 +343,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v11 2/6 arm: make the number of GIC interrupts configurable
In reply to Mark LangsdorfIncrease the maximum number of GIC interrupts for a9mp and a11mp to 1020, and create a configurable property for each defaulting to 96 and 64 (respectively) so that device modelers can set the value appropriately for their SoC. Other ARM processors also set their maximum number of used IRQs appropriately.
Set the maximum theoretical number of GIC interrupts to 1020 and update the save/restore code to only use the appropriate number for each SoC.
---
Changes from v9, v10
None
Changes from v8
Removed comments about armv7m_nvic's external IRQ lines
Changes from v7
Removed unnecessary vmstate_register
Changes from v6
Removed trailing whitespace
armv7m_nvic uses num_irq properly
Some comments changed
Changes from v5
Clarify the commit message
Rename GIC_NIRQ to GIC_MAXIRQ and change usage slightly Makes num-irq to uint32_t in all cases
Clarify the error message
Clarify documentation on the num-irq qdev property use in all files
Changes from v4
None
Changes from v3
Increase maximum number of GIC interrupts to 1020 Remove SoC/implementation specific GIC_NIRQ #defs
Added properties code to arm11mp
Changed error handling for too many interrupts
Redid save/load handling
Changes from v2
Skipped
Changes from v1
Increase the number of a9mp interrupts to 192
Add a property defaulting to 96
Add a num_irq member in the gic state structure
Use the num_irq value as appropriate
Add num_irq argument to gic_init()
Add num_irq to various CPU calls to gic_init
hw/a9mpcore.c | 13 +++++++-- hw/arm11mpcore.c | 17 ++++++++---- hw/arm_gic.c | 68 +++++++++++++++++++++++++++++----------------------- hw/armv7m_nvic.c | 31 ++++++++++++++++++------ hw/realview_gic.c | 7 ++++- 5 files changed, 87 insertions(+), 49 deletions(-)
hw/a9mpcore.c +10 -3
@@ -11,9 +11,8 @@#include "sysbus.h" /* Configuration for arm_gic.c: -* number of external IRQ lines, max number of CPUs, how to ID current CPU +* max number of CPUs, how to ID current CPU */ -#define GIC_NIRQ 96#define NCPU 4 static inline int
@@ -37,6 +36,7 @@ typedef struct a9mp_priv_state {MemoryRegion ptimer_iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } a9mp_priv_state; static uint64_t a9_scu_read(void *opaque, target_phys_addr_t offset,
@@ -153,7 +153,7 @@ static int a9mp_priv_init(SysBusDevice *dev)hw_error ("a9mp_priv_init: num-cpu may not be more than %d\n" ,NCPU ); } -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);
@@ -216,6 +216,13 @@ static SysBusDeviceInfo a9mp_priv_info = { .qdev.reset = a9mp_priv_reset, .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , a9mp_priv_state, num_cpu,1 ), +/* The Cortex-A9MP may have anything from 0 to 224 external interrupt +* IRQ lines (with another 32 internal). We default to 64+32, which +* is the number provided by the Cortex-A9MP test chip in the +* Realview PBX-A9 and Versatile Express A9 development boards. +* Other boards may differ and should set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , a9mp_priv_state, num_irq,96 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm11mpcore.c +11 -6
@@ -10,11 +10,6 @@#include "sysbus.h" #include "qemu-timer.h" -/* ??? The MPCore TRM says the on-chip controller has 224 external IRQ lines -(+ 32 internal). However my test chip only exposes/reports 32. -More importantly Linux falls over if more than 32 are present! */ -#define GIC_NIRQ 64 -#define NCPU 4 static inline int
@@ -37,6 +32,7 @@ typedef struct mpcore_priv_state {MemoryRegion iomem;MemoryRegion container;DeviceState *mptimer; +uint32_t num_irq; } mpcore_priv_state;/* Per-CPU private memory mapped IO. */
@@ -132,7 +128,7 @@ static int mpcore_priv_init(SysBusDevice *dev) {mpcore_priv_state *s =FROM_SYSBUSGIC (mpcore_priv_state, dev); -gic_init (&s->gic, s->num_cpu); +gic_init (&s->gic, s->num_cpu, s->num_irq); s->mptimer =qdev_create (NULL ,"arm_mptimer" );qdev_prop_set_uint32 (s->mptimer,"num-cpu" , s->num_cpu);qdev_init_nofail (s->mptimer);
@@ -221,6 +217,15 @@ static SysBusDeviceInfo mpcore_priv_info = { .qdev.size = sizeof(mpcore_priv_state), .qdev.props = (Property []) {DEFINE_PROP_UINT32 ("num-cpu" , mpcore_priv_state, num_cpu,1 ), +/* The ARM11 MPCORE TRM says the on-chip controller may have +* anything from 0 to 224 external interrupt IRQ lines (with another +* 32 internal). We default to 32+32, which is the number provided by +* the ARM11 MPCore test chip in the Realview Versatile Express +* coretile. Other boards may differ and should set this property +* appropriately. Some Linux kernels may not boot if the hardware +* has more IRQ lines than the kernel expects. +*/ +DEFINE_PROP_UINT32 ("num-irq" , mpcore_priv_state, num_irq,64 ),DEFINE_PROP_END_OF_LIST (), } };
hw/arm_gic.c +38 -30
232 lines not on this page · raw message
hw/armv7m_nvic.c +23 -8
@@ -15,9 +15,6 @@#include "arm-misc.h" #include "exec-memory.h" -/* 32 internal lines (16 used for system exceptions) plus 64 external -interrupt lines. */ -#define GIC_NIRQ 96#define NCPU 1#define NVIC 1
@@ -41,6 +38,7 @@ typedef struct {int64_t tick;QEMUTimer *timer; } systick; +uint32_t num_irq; } nvic_state;/* qemu timers run at 1GHz. We want something closer to 1MHz. */
@@ -125,7 +123,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)switch (offset) {case 4 :/* Interrupt Control Type. */ -return (GIC_NIRQ /32 ) -1 ; +return (s->num_irq /32 ) -1 ;case 0x10 :/* SysTick Control and Status. */ val = s->systick.control; s->systick.control &= ~SYSTICK_COUNTFLAG ;
@@ -169,7 +167,7 @@ static uint32_t nvic_readl(void *opaque, uint32_t offset)if (s->gic.current_pending[0 ] !=1023 ) val |= (s->gic.current_pending[0 ] <<12 );/* ISRPENDING */ -for (irq =32 ; irq <GIC_NIRQ ; irq++) { +for (irq =32 ; irq < s->num_irq; irq++) {if (s->gic.irq_state[irq].pending) { val |= (1 <<22 );break ;
@@ -384,16 +382,33 @@ static int armv7m_nvic_init(SysBusDevice *dev) {nvic_state *s=FROM_SYSBUSGIC (nvic_state, dev); -gic_init (&s->gic); +/* note that for the M profile gic_init() takes the number of external +* interrupt lines only. +*/ +gic_init (&s->gic, s->num_irq);memory_region_add_subregion (get_system_memory (),0xe000e000 , &s->gic.iomem); s->systick.timer =qemu_new_timer_ns (vm_clock, systick_timer_tick, s); -vmstate_register (&dev->qdev,-1 , &vmstate_nvic, s);return 0 ; } +static SysBusDeviceInfo armv7m_nvic_priv_info = { + .init = armv7m_nvic_init, + .qdev.name ="armv7m_nvic" , + .qdev.size =sizeof (nvic_state), + .qdev.vmsd = &vmstate_nvic, + .qdev.props = (Property []) { +/* The ARM v7m may have anything from 0 to 496 external interrupt +* IRQ lines. We default to 64. Other boards may differ and should +* set this property appropriately. +*/ +DEFINE_PROP_UINT32 ("num-irq" , nvic_state, num_irq,64 ), +DEFINE_PROP_END_OF_LIST (), + } +}; +static void armv7m_nvic_register_devices (void ) { -sysbus_register_dev ("armv7m_nvic" ,sizeof (nvic_state), armv7m_nvic_init); +sysbus_register_withprop (&armv7m_nvic_priv_info); }device_init (armv7m_nvic_register_devices)
hw/realview_gic.c +5 -2
@@ -9,7 +9,6 @@#include "sysbus.h" -#define GIC_NIRQ 96#define NCPU 1/* Only a single "CPU" interface is present. */
@@ -37,7 +36,11 @@ static int realview_gic_init(SysBusDevice *dev) {RealViewGICState *s =FROM_SYSBUSGIC (RealViewGICState, dev); -gic_init (&s->gic); +/* The GICs on the RealView boards have a fixed nonconfigurable +* number of interrupt lines, so we don't need to expose this as +* a qdev property. +*/ +gic_init (&s->gic,96 );realview_gic_map_setup (s);sysbus_init_mmio (dev, &s->container);return 0 ;
Signature · 1 line
1.7.5.4
PATCH v11 3/6 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v10
None
Changes from v9
Changed typedef struct names to CamelCase
Changes from v7, v8
None
Changes from v5, v6
Skipped
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (&d->ahci, i); } } + +typedef struct SysbusAHCIState { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}SysbusAHCIState ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +SysbusAHCIState *s =FROM_SYSBUS (SysbusAHCIState, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (SysbusAHCIState), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , SysbusAHCIState, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.5.4
PATCH v11 4/6 arm: add secondary cpu book callbacks to arm_boot.c
In reply to Mark LangsdorfCreate two functions, write_secondary_boot() and secondary_cpu_reset_hook(), to allow platforms more control of how secondary CPUs are brought up. The new functions default to NULL and aren't called unless they are populated so there are no changes to existing platform models.
---
Changes from v2-v10
Skipped
Changes from v1
Added default versions of the functions
Created checks so that NULL function entries became default versions Simplified calls to the secondary boot functions
Added comments on the use of these functions
hw/arm-misc.h | 15 +++++++++++++++ hw/arm_boot.c | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 9 deletions(-)
hw/arm-misc.h +15 -0
@@ -30,12 +30,27 @@ struct arm_boot_info {const char *kernel_cmdline;const char *initrd_filename;target_phys_addr_t loader_start; +/* multicore boards that use the default secondary core boot functions +* need to put the address of the secondary boot code, the boot reg, +* and the GIC address in the next 3 values, respectively. boards that +* have their own boot functions can use these values as they want. +*/ target_phys_addr_t smp_loader_start;target_phys_addr_t smp_bootreg_addr;target_phys_addr_t smp_priv_base;int nb_cpus;int board_id;int (*atag_board)(const struct arm_boot_info *info,void *p); +/* multicore boards that use the default secondary core boot functions +* can ignore these two function calls. If the default functions won't +* work, then write_secondary_boot() should mimic the board's boot +* loader code, and secondary_cpu_reset_hook() should operate handle any +* polling response and reset functions. +*/ +void (*write_secondary_boot)(CPUState *env, +const struct arm_boot_info *info); +void (*secondary_cpu_reset_hook)(CPUState *env, +const struct arm_boot_info *info);/* Used internally by arm_boot.c */ int is_linux;target_phys_addr_t initrd_size;
hw/arm_boot.c +29 -9
@@ -197,13 +197,32 @@ static void do_cpu_reset(void *opaque) info->loader_start); } }else { -stl_phys_notdirty (info->smp_bootreg_addr,0 ); - env->regs[15 ] = info->smp_loader_start; + info->secondary_cpu_reset_hook (env, info); } } } } +static void default_write_secondary (CPUState *env, +const struct arm_boot_info *info) +{ +int n; + smpboot[ARRAY_SIZE (smpboot) -1 ] = info->smp_bootreg_addr; + smpboot[ARRAY_SIZE (smpboot) -2 ] = info->smp_priv_base; +for (n =0 ; n <ARRAY_SIZE (smpboot); n++) { + smpboot[n] =tswap32 (smpboot[n]); + } +rom_add_blob_fixed ("smpboot" , smpboot,sizeof (smpboot), + info->smp_loader_start); +} + +static void default_reset_secondary (CPUState *env, +const struct arm_boot_info *info) +{ +stl_phys_notdirty (info->smp_bootreg_addr,0 ); + env->regs[15 ] = info->smp_loader_start; +} +void arm_load_kernel (CPUState *env,struct arm_boot_info *info) {int kernel_size;
@@ -220,6 +239,13 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)exit (1 ); } +if (!info->secondary_cpu_reset_hook) { + info->secondary_cpu_reset_hook = default_reset_secondary; + } +if (!info->write_secondary_boot) { + info->write_secondary_boot = default_write_secondary; + } +if (info->nb_cpus ==0 ) info->nb_cpus =1 ;
@@ -273,13 +299,7 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)rom_add_blob_fixed ("bootloader" , bootloader,sizeof (bootloader), info->loader_start);if (info->nb_cpus >1 ) { - smpboot[ARRAY_SIZE (smpboot) -1 ] = info->smp_bootreg_addr; - smpboot[ARRAY_SIZE (smpboot) -2 ] = info->smp_priv_base; -for (n =0 ; n <ARRAY_SIZE (smpboot); n++) { - smpboot[n] =tswap32 (smpboot[n]); - } -rom_add_blob_fixed ("smpboot" , smpboot,sizeof (smpboot), - info->smp_loader_start); + info->write_secondary_boot (env, info); } info->initrd_size = initrd_size; }
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v11 4/6] arm: add secondary cpu book callbacks to arm_boot.c
Quoted 1 line · Mark Langsdorf
Re: [PATCH v11 4/6] arm: add secondary cpu book callbacks to
arm_boot.c
Subject should say 'boot', not 'book'...
Quoted 34 lines
Create two functions,
write_secondary_boot()andsecondary_cpu_reset_hook(), to allow platforms more control of how secondary CPUs are brought up. The new functions default to NULL and aren't called unless they are populated so there are no changes to existing platform models.Signed-off-by Mark Langsdorf <[email protected]>---
Changes from v2-v10
Skipped
Changes from v1
Added default versions of the functions
Created checks so that NULL function entries became default versions Simplified calls to the secondary boot functions
Added comments on the use of these functionshw/arm-misc.h | 15 +++++++++++++++
hw/arm_boot.c| 38 +++++++++++++++++++++++++++++---------2 files changed, 44 insertions(+), 9 deletions(-)hw/arm-misc.h +5
-0@@ -30,12 +30,27 @@ struct arm_boot_info { const char *kernel_cmdline; const char *initrd_filename; target_phys_addr_t loader_start; + /* multicore boards that use the default secondary core boot functions + * need to put the address of the secondary boot code, the boot reg, + * and the GIC address in the next 3 values, respectively. boards that + * have their own boot functions can use these values as they want. + */ target_phys_addr_t smp_loader_start; target_phys_addr_t smp_bootreg_addr;
hw/arm-misc.h struct arm_boot_info { · line 49
Quoted 10 lines
hw/arm-misc.h +6
-0target_phys_addr_t smp_priv_base; int nb_cpus; int board_id; int (*atag_board)(const struct arm_boot_info *info, void *p); + /* multicore boards that use the default secondary core boot functions +* can ignore these two function calls. If the default functions won't +* work, then write_secondary_boot() should mimic the board's boot +* loader code, and secondary_cpu_reset_hook() should operate handle any +* polling response and reset functions. +*/
"then write_secondary_boot() should write a suitable blob of code mimicing the secondary CPU startup process used by the board's boot loader/boot ROM code, and secondary_cpu_reset_hook() should perform any necessary CPU reset handling and set the PC for the secondary CPUs to point at this boot blob."
Quoted 10 lines
hw/arm-misc.h +10
-0+static void default_write_secondary (CPUState *env, + const struct arm_boot_info *info) +{ + int n; + smpboot[ARRAY_SIZE(smpboot) - 1] = info->smp_bootreg_addr; + smpboot[ARRAY_SIZE(smpboot) - 2] = info->smp_priv_base; + for (n = 0; n < ARRAY_SIZE(smpboot); n++) { + smpboot[n] = tswap32(smpboot[n]); + } + rom_add_blob_fixed("smpboot", smpboot, sizeof(smpboot),
hw/arm-misc.h struct arm_boot_info {
Quoted 10 lines
hw/arm-misc.h +10
-0+ info->smp_loader_start); +} + +static void default_reset_secondary (CPUState *env, + const struct arm_boot_info *info) +{ + stl_phys_notdirty(info->smp_bootreg_addr, 0); + env->regs[15] = info->smp_loader_start; +} +
Can you put these two functions immediately below the smpboot[] array, and replace the comment just above smpboot[] with this one:
/* Handling for secondary CPU boot in a multicore system.
* Unlike the uniprocessor/primary CPU boot, this is platform
* dependent. The default code here is based on the secondary
* CPU boot protocol used on realview/vexpress boards, with
* some parameterisation to increase its flexibility.
* QEMU platform models for which this code is not appropriate
* should override write_secondary_boot and secondary_cpu_reset_hook
* instead.
*
* This code enables the interrupt controllers for the secondary
* CPUs and then puts all the secondary CPUs into a loop waiting
* for an interprocessor interrupt and polling a configurable
* location for the kernel secondary CPU entry point.
*/
Otherwise looks good.
-- PMM
PATCH v11 5/6 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v10
Added secondary core boot functions
Changes from v9
Made typedef struct names in CamelCase
Changes from v7, v8
None
Changes from v3, v4, v5, v6
Skipped
Changes from v2
Created a reset function for highbank_regs
Handled creation of regs i/o memory region in a sensible manner Added code to boot secondary CPUs properly
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -342,6 +342,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +321 -0
321 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
This doesn't work, because arm_boot.c does:
bootloader[1] |= info->board_id & 0xff;
bootloader[2] |= (info->board_id >> 8) & 0xff;and so when you try to boot the kernel it does this:
===begin===
cam-vm-266:maverick:qemu-jeos$ ~/linaro/qemu-from-laptop/qemu/arm-softmmu/qemu-system-arm -kernel build-arm/linux/arch/arm/boot/zImage -initrd build-arm/initramfs.img -M highbank -serial stdio
Error: unrecognized/unsupported machine ID (r1 = 0x0000ffff).
Available machine support:
ID (hex) NAME
ffffffff Highbank
Please check your kernel config and/or bootloader. ===endit===
-- PMM
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 17 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
This doesn't work, because
arm_boot.cdoes:bootloader[1] |= info->board_id & 0xff; bootloader[2] |= (info->board_id >> 8) & 0xff;and so when you try to boot the kernel it does this:
===begin===
cam-vm-266:maverick:qemu-jeos$ ~/linaro/qemu-from-laptop/qemu/arm-softmmu/qemu-system-arm -kernel build-arm/linux/arch/arm/boot/zImage -initrd build-arm/initramfs.img -M highbank -serial stdioError: unrecognized/unsupported machine ID (r1 =
0x0000ffff).
Quoted 7 lines
Available machine support:
ID (hex) NAME
ffffffff HighbankPlease check your kernel config and/or bootloader. ===endit===
Works for me, but it requires a kernel build with the device tree dtb appended to it.
===begin===
mlangsdorf@mjl-dell:~/work/qemu$ ./mainline_qemu/arm-softmmu/qemu-system-arm -nographic -M highbank -kernel linux-2.6/kernel_with_dtb.img -drive id=disk,if=ide,file=sataDisk -device ide-drive,drive=disk,bus=ide.0 -append "root=/dev/sda2 console=ttyAMA0,38400 debug earlyprintk" -m 4089 -smp 3
[ 0.000000] Booting Linux on physical CPU 0 [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 3.2.0+ (mlangsdorf@mjl-dell) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #72 SMP Wed Jan 18 15:10:31 CST 2012 [ 0.000000] CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] Machine: Highbank, model: Calxeda Highbank [ 0.000000] Memory policy: ECC disabled, Data cache writealloc [ 0.000000] On node 0 totalpages: 1046784
===endit===
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 6 lines · Mark Langsdorf
Quoted 2 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
Works for me, but it requires a kernel build with the device tree dtb appended to it.
How do I get hold of a valid dtb for this platform?
thanks
-- PMM
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Peter Maydell
Quoted 6 lines · Mark Langsdorf
Quoted 2 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
Works for me, but it requires a kernel build with the device tree dtb appended to it.
How do I get hold of a valid dtb for this platform?
The dts is at:
http://lxr.linux.no/#linux+v3.2.1/arch/arm/boot/dts/highbank.dts
I usually cross compile with:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- highbank.dtb
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Mark Langsdorf
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Mark Langsdorf
Quoted 2 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
Works for me, but it requires a kernel build with the device tree dtb appended to it.
Quoted 7 lines
Quoted 1 line
How do I get hold of a valid dtb for this platform?
The dts is at:
http://lxr.linux.no/#linux+v3.2.1/arch/arm/boot/dts/highbank.dtsI usually cross compile with:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- highbank.dtb
Right, thanks.
I have a kernel now that seems to boot but then
barfs with:
Freeing init memory: 124K
Kernel panic - not syncing: Attempted to kill init!
but that's probably a misconfiguration in my kernel.
-- PMM
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 18 lines · Peter Maydell
Quoted 9 lines · Mark Langsdorf
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Mark Langsdorf
Quoted 2 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
Works for me, but it requires a kernel build with the device tree dtb appended to it.
Quoted 7 lines
Quoted 1 line
How do I get hold of a valid dtb for this platform?
The dts is at:
http://lxr.linux.no/#linux+v3.2.1/arch/arm/boot/dts/highbank.dtsI usually cross compile with:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- highbank.dtb
Quoted 8 lines
Right, thanks.
I have a kernel now that seems to boot but then
barfs with:
Freeing init memory: 124KKernel panic - not syncing: Attempted to kill init!but that's probably a misconfiguration in my kernel.
You need to be passing -m 4089.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Mark Langsdorf
Quoted 6 lines · Peter Maydell
I have a kernel now that seems to boot but then
barfs with:
Freeing init memory: 124KKernel panic - not syncing: Attempted to kill init!but that's probably a misconfiguration in my kernel.
You need to be passing -m 4089.
cam-vm-266:maverick:qemu-jeos$ ~/linaro/qemu-from-laptop/qemu/arm-softmmu/qemu-system-arm -kernel zImage-with-dtb -initrd build-arm/initramfs.img -M highbank -serial stdio -m 4089
qemu: at most 2047 MB RAM can be simulated
I'd rather not have a model that doesn't work on 32 bit hosts if we can avoid it...
-- PMM
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Mark Langsdorf
Quoted 6 lines · Peter Maydell
I have a kernel now that seems to boot but then
barfs with:
Freeing init memory: 124KKernel panic - not syncing: Attempted to kill init!but that's probably a misconfiguration in my kernel.
You need to be passing -m 4089.
Quoted 8 lines
cam-vm-266:maverick:qemu-jeos$ ~/linaro/qemu-from-laptop/qemu/arm-softmmu/qemu-system-arm -kernel zImage-with-dtb -initrd build-arm/initramfs.img -M highbank -serial stdio -m 4089
qemu: at most 2047 MB RAM can be simulatedI'd rather not have a model that doesn't work on 32 bit hosts if we can avoid it...
The memory size is determined by the dts:
http://lxr.linux.no/#linux+v3.2.1/arch/arm/boot/dts/highbank.dts#L60
So you should be able to set it to whatever you want as long as the values match. I've tested a boot with -m 2047 and the memory range going from 0 to 0x7ff00000. That required regenerating the dtb and re-appending it to the kernel image, though. I don't know of an easy to handle that on the command line.
Is that sufficient for me to resend the patch with the changes covered below?
Quoted 10 lines
Quoted 1 line
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
I'm still not sure about this.
The linux
Documentation/devicetree/booting-without-of.txtsays there are two calling conventions for booting here, ATAGS and with-device-tree-blob, and that even with the device tree blob method it is still considered "good practise" to pass a valid machine number in r1. Can you point me to some documentation that says that -1 is OK now?
I can't, so I'll change the value. We only intend to support device tree booting.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v11 5/6] arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfQuoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id = -1; /* provided by deviceTree */
I'm still not sure about this.
The linux Documentation/devicetree/booting-without-of.txt says there are two calling conventions for booting here, ATAGS and with-device-tree-blob, and that even with the device tree blob method it is still considered "good practise" to pass a valid machine number in r1. Can you point me to some documentation that says that -1 is OK now?
(We probably ought to get round to actually implementing a -dtb option to go with -kernel and -initrd.)
thanks
-- PMM
PATCH v11 6/6 arm: Remove incorrect comment in arm_timer
In reply to Mark LangsdorfThe current comment says that the arm_timers are restricted to between 32 KHz and 1 MHz, but sp804 TRM does not specify those limits.
---
Changes from v7-v10
None
Changes from v2-v6
Skipped
Changes from v1
Clarified the commit message
hw/arm_timer.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
hw/arm_timer.c +0 -3
@@ -273,11 +273,8 @@ static int sp804_init(SysBusDevice *dev) qi =qemu_allocate_irqs (sp804_set_irq, s,2 );sysbus_init_irq (dev, &s->irq); -/* The timers are configurable between 32kHz and 1MHz -* defaulting to 1MHz but overrideable as individual properties */ s->timer[0 ] =arm_timer_init (s->freq0); s->timer[1 ] =arm_timer_init (s->freq1); - s->timer[0 ]->irq = qi[0 ]; s->timer[1 ]->irq = qi[1 ];memory_region_init_io (&s->iomem, &sp804_ops, s,"sp804" ,0x1000 );
Signature · 1 line
1.7.5.4
v12 cover arm: add support for Calxeda Highbank
In reply to Mark LangsdorfThis patch series adds support for the Calxeda Highbank SoC.
Makefile.target | 2 + hw/arm-misc.h | 17 +++ hw/arm_boot.c | 54 ++++++-- hw/highbank.c | 327 ++++++++++++++++++++++++++++++++++++++++++ hw/ide/ahci.c | 44 ++++++ hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 854 insertions(+), 11 deletions(-)
PATCH v12 1/4 Add xgmac ethernet model
From: Rob Herring <[email protected]>
This adds very basic support for the xgmac ethernet core. Missing things include:
- statistics counters
- WoL support
- rx checksum offload
- chained descriptors (only linear descriptor ring)
- broadcast and multicast handling
---
Changes from v10, v11
None
Changes from v9
Make typedef struct names into CamelCase
Changes from v7, v8
None
Changes from v6
Skipped
Changes from v5
removed c_phyaddr
Changes from v4
None
Changes from v3
Added debug macro and cleaned up some debug code Refitted all lines to fit within 80 columns
Changes from v2
None
Changes from v1
Reformated most lines to fit within 80 columns Removed a bunch of unused variables in the state structures Got rid of some camelcase structure names
Makefile.target | 1 + hw/xgmac.c | 421 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 422 insertions(+), 0 deletions(-) create mode 100644 hw/xgmac.c
Makefile.target +1 -0
@@ -343,6 +343,7 @@ obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o obj-arm-y += pl061.o +obj-arm-y += xgmac.o obj-arm-y += arm-semi.o obj-arm-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o obj-arm-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
hw/xgmac.c new file +421 -0
421 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v12 2/4 ahci: add support for non-PCI based controllers
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Add support for ahci on sysbus.
---
Changes from v10
None
Changes from v9
Changed typedef struct names to CamelCase
Changes from v7, v8
None
Changes from v5, v6
Skipped
Changes from v4
replaced all references to Plat|plat_ with sysbus_ made the number of ports into a qdev property added dummy migration support
Changes from v3
Renamed plat-ahci to sysbus-ahci
Changes from v1, v2
Corrected indentation of PlatAHCIState members Made plat_ahci_info into a single structure, not a list
hw/ide/ahci.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-)
hw/ide/ahci.c +44 -0
@@ -25,6 +25,7 @@#include <hw/msi.h> #include <hw/pc.h> #include <hw/pci.h> +#include <hw/sysbus.h> #include "monitor.h" #include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)ahci_reset_port (&d->ahci, i); } } + +typedef struct SysbusAHCIState { +SysBusDevice busdev; +AHCIState ahci; +uint32_t num_ports; +}SysbusAHCIState ; + +static const VMStateDescription vmstate_sysbus_ahci = { + .name ="sysbus-ahci" , + .unmigratable =1 , +}; + +static int sysbus_ahci_init (SysBusDevice *dev) +{ +SysbusAHCIState *s =FROM_SYSBUS (SysbusAHCIState, dev); +ahci_init (&s->ahci, &dev->qdev, s->num_ports); + +sysbus_init_mmio (dev, &s->ahci.mem); +sysbus_init_irq (dev, &s->ahci.irq); + +qemu_register_reset (ahci_reset, &s->ahci); +return 0 ; +} + +static SysBusDeviceInfo sysbus_ahci_info = { + .qdev.name ="sysbus-ahci" , + .qdev.size =sizeof (SysbusAHCIState), + .qdev.vmsd = &vmstate_sysbus_ahci, + .qdev.props = (Property []) { +DEFINE_PROP_UINT32 ("num-ports" , SysbusAHCIState, num_ports,1 ), +DEFINE_PROP_END_OF_LIST (), + }, + .init = sysbus_ahci_init, + + +}; + +static void sysbus_ahci_register (void ) +{ +sysbus_register_withprop (&sysbus_ahci_info); +} + +device_init (sysbus_ahci_register);
Signature · 1 line
1.7.5.4
PATCH v12 3/4 arm: add secondary cpu boot callbacks to arm_boot.c
In reply to Mark LangsdorfCreate two functions, write_secondary_boot() and secondary_cpu_reset_hook(), to allow platforms more control of how secondary CPUs are brought up. The new functions default to NULL and aren't called unless they are populated so there are no changes to existing platform models.
---
Changes from v11
Corrected typo in subject
expanded and corrected some documentation
moved the default_ functions nearer to smpboot array
Changes from v2-v10
Skipped
Changes from v1
Added default versions of the functions
Created checks so that NULL function entries became default versions Simplified calls to the secondary boot functions
Added comments on the use of these functions
hw/arm-misc.h | 17 +++++++++++++++++ hw/arm_boot.c | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 60 insertions(+), 11 deletions(-)
hw/arm-misc.h +17 -0
@@ -30,12 +30,29 @@ struct arm_boot_info {const char *kernel_cmdline;const char *initrd_filename;target_phys_addr_t loader_start; +/* multicore boards that use the default secondary core boot functions +* need to put the address of the secondary boot code, the boot reg, +* and the GIC address in the next 3 values, respectively. boards that +* have their own boot functions can use these values as they want. +*/ target_phys_addr_t smp_loader_start;target_phys_addr_t smp_bootreg_addr;target_phys_addr_t smp_priv_base;int nb_cpus;int board_id;int (*atag_board)(const struct arm_boot_info *info,void *p); +/* multicore boards that use the default secondary core boot functions +* can ignore these two function calls. If the default functions won't +* work, then write_secondary_boot() should write a suitable blob of +* code mimicing the secondary CPU startup process used by the board's +* boot loader/boot ROM code, and secondary_cpu_reset_hook() should +* perform any necessary CPU reset handling and set the PC for thei +* secondary CPUs to point at this boot blob. +*/ +void (*write_secondary_boot)(CPUState *env, +const struct arm_boot_info *info); +void (*secondary_cpu_reset_hook)(CPUState *env, +const struct arm_boot_info *info);/* Used internally by arm_boot.c */ int is_linux;target_phys_addr_t initrd_size;
hw/arm_boot.c +43 -11
84 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v12 4/4 arm: SoC model for Calxeda Highbank
In reply to Mark LangsdorfFrom: Rob Herring <[email protected]>
Adds support for Calxeda's Highbank SoC.
---
Changes from v11
Provided a meaningful board ID
Added comments on the way the device tree memory values interact with
qemu command line arguments for memory
Changes from v10
Added secondary core boot functions
Changes from v9
Made typedef struct names in CamelCase
Changes from v7, v8
None
Changes from v3, v4, v5, v6
Skipped
Changes from v2
Created a reset function for highbank_regs
Handled creation of regs i/o memory region in a sensible manner Added code to boot secondary CPUs properly
Changes from v1
Restructed the loading of sysram.bin and made it more clearly optional Made the regs structure into a proper qdev/sysbus object Removed some unnecessary include files
Clarified the GPL version
Simplified the reset function
Removed the automatic detection and resetting of ram_size. Image MUST
be loaded with -m 4089 or it will crash
Added a guard for xgmac creation
Added a fuller description in the QEMUMachine .desc field
Makefile.target | 1 + hw/highbank.c | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 328 insertions(+), 0 deletions(-) create mode 100644 hw/highbank.c
Makefile.target +1 -0
@@ -342,6 +342,7 @@ obj-arm-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-arm-y += arm_l2x0.o obj-arm-y += arm_mptimer.o obj-arm-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o +obj-arm-y += highbank.o obj-arm-y += pl061.o obj-arm-y += xgmac.o obj-arm-y += arm-semi.o
hw/highbank.c new file +327 -0
327 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */
Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/
Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027
-- PMM
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027
Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Rob
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 12 lines · Rob Herring
Quoted 1 line · Peter Maydell
On 19 January 2012 21:31, Mark Langsdorf <[email protected]>
Quoted 8 lines · wrote:
Quoted 1 line
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027
Quoted 6 lines
Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
We partially addressed this issue in our rejected device tree machine model patch series from last year. We added two new DTB-related arguments to the qemu cmdline:
--kernel-dtb which is the DTB that gets passed through to the kernel, and --hw-dtb which is the DTB describing the actual hardware (we were making QDEV system models by scanning and parsing the device tree)
If only a HW DTB is provided, then that same DTB is used for the kernel.
There are situations when you might want them to be different.
Rgds,
John
Signature · 3 lines
John Williams, PhD, B. Eng, B. IT PetaLogix - Linux Solutions for a Reconfigurable World w: www.petalogix.com p: +61-7-30090663 f: +61-7-30090663
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
In reply to Rob HerringQuoted 11 lines · Rob Herring
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027
Quoted 5 lines
Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Yeah, but the documentation even for DTB boot says we should pass in a machine number. If 0 or -1 are right then there should be some documentation that says so. I'll accept "mailing list post from some authoritative person [eg Grant Likely]" if necessary. But this is an ABI between boot loaders and the kernel so I don't want to just have something random that happens to work. (And in particular if -1 is the officially sanctioned number then we need to fix arm_boot to be able to pass values >16 bits wide.)
-- PMM
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 18 lines · Peter Maydell
Quoted 11 lines · Rob Herring
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027Quoted 5 lines
Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Quoted 4 lines
Yeah, but the documentation even for DTB boot says we should pass in a machine number. If 0 or -1 are right then there should be some documentation that says so. I'll accept "mailing list post from some authoritative person [eg Grant Likely]" if necessary.
Kernel DT co-maintainer is not authoritative enough for you?
The documentation needs some clarification.
Quoted 5 lines
But this is an ABI between boot loaders and the kernel so I don't want to just have something random that happens to work. (And in particular if -1 is the officially sanctioned number then we need to fix
arm_bootto be able to pass values >16 bits wide.)
Here's were the kernel sets the mach #. nr is from the database for non-DT and ~0 for DT machines.
#define MACHINE_START(_type,_name) \
static const struct machine_desc __mach_desc_##_type \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = MACH_TYPE_##_type, \ .name = _name,
#define MACHINE_END \
};
#define DT_MACHINE_START(_name, _namestr) \
static const struct machine_desc __mach_desc_##_name \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = ~0, \ .name = _namestr,
In any case, the kernel ignores the value passed in if a valid dtb is passed in.
Rob
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 1 line · Rob Herring
Kernel DT co-maintainer is not authoritative enough for you?
Only if I recognise their name :-) [ie, sorry.]
Quoted 28 lines
The documentation needs some clarification.
Quoted 5 lines
But this is an ABI between boot loaders and the kernel so I don't want to just have something random that happens to work. (And in particular if -1 is the officially sanctioned number then we need to fix
arm_bootto be able to pass values >16 bits wide.)Here's were the kernel sets the mach #. nr is from the database for non-DT and ~0 for DT machines.
#define
MACHINE_START(_type,_name)\
static const structmachine_desc__mach_desc_##_type \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = MACH_TYPE_##_type, \
.name =_name,#define
MACHINE_END\
};#define
DT_MACHINE_START(_name, _namestr)\
static const structmachine_desc__mach_desc_##_name \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = ~0, \
.name =_namestr,
Quoted 2 lines
In any case, the kernel ignores the value passed in if a valid dtb is passed in.
I wonder if we should be passing in anything-except-minus-1, since if you pass -1 and no DT then the kernel will fail silently, whereas if you pass something else and no DT the kernel will complain about the mismatch.
Even when we add a --dtb foo option to qemu, there's bound to be a pile of user error where users pass in --kernel but not --dtb.
-- PMM
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 33 lines · Peter Maydell
Quoted 1 line · Rob Herring
Kernel DT co-maintainer is not authoritative enough for you?
Only if I recognise their name :-) [ie, sorry.]
Quoted 28 lines
The documentation needs some clarification.
Quoted 5 lines
But this is an ABI between boot loaders and the kernel so I don't want to just have something random that happens to work. (And in particular if -1 is the officially sanctioned number then we need to fix
arm_bootto be able to pass values >16 bits wide.)Here's were the kernel sets the mach #. nr is from the database for non-DT and ~0 for DT machines.
#define
MACHINE_START(_type,_name)\
static const structmachine_desc__mach_desc_##_type \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = MACH_TYPE_##_type, \
.name =_name,#define
MACHINE_END\
};#define
DT_MACHINE_START(_name, _namestr)\
static const structmachine_desc__mach_desc_##_name \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = ~0, \
.name =_namestr,
Quoted 7 lines
Quoted 2 lines
In any case, the kernel ignores the value passed in if a valid dtb is passed in.
I wonder if we should be passing in anything-except-minus-1, since if you pass -1 and no DT then the kernel will fail silently, whereas if you pass something else and no DT the kernel will complain about the mismatch.
Alternately, we can make the kernel always complain about machine type ~0, which is probably safer anyway.
g.
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 8 lines · Grant Likely
Quoted 4 lines · Peter Maydell
I wonder if we should be passing in anything-except-minus-1, since if you pass -1 and no DT then the kernel will fail silently, whereas if you pass something else and no DT the kernel will complain about the mismatch.
Alternately, we can make the kernel always complain about machine type ~0, which is probably safer anyway.
That sounds like a good idea to me.
-- PMM
[Qemu-devel] Adding -dtb option to qemu
Hey Peter,
I need some advice. I'm adding a -dtb option to qemu for specifying a dtb filename to be passed on to the kernel, similar to how the -initrd flag works. The dtb filename needs to then be passed on to the selected machine, and it looks like the machine->init() callback is the best way to do that.
However, the current init callback prototype looks like this:
typedef void QEMUMachineInitFunc(ram_addr_t ram_size,
const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model);
Now, I could simply add an new "dtb_filename" to the argument list and fix up all of the users (looks to be about 90 machines), but that seems like a lot of churn that will need to be repeated the next time a new argument needs to be passed to the init func.
Alternately, I could do something like this:
struct machine_args {
ram_addr_t ram_size;
const char *boot_device;
const char *kernel_filename,
const char *kernel_cmdline,
const char *initrd_filename,
const char *dtb_filename,
const char *cpu_model,
};
typedef void QEMUMachineInitFunc(const struct machine_args *args);
And then I'd fix up all the users, which would be about the same amount of churn, but subsequent additions would be a lot easier.
A third option would be to add a new ".dt_init()" that is executed instead of .init() if populated, but that seems like an ugly band-aid to me.
How should I approach this? Or is there a better way to pass data to so that it is available at machine->init() time?
g.
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
In reply to Rob HerringQuoted 19 lines · Rob Herring
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Rob Herring
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Quoted 6 lines
Quoted 4 lines
Yeah, but the documentation even for DTB boot says we should pass in a machine number. If 0 or -1 are right then there should be some documentation that says so. I'll accept "mailing list post from some authoritative person [eg Grant Likely]" if necessary.
Kernel DT co-maintainer is not authoritative enough for you?
Peter, is that sufficient for me to send in the patch with a board_id of -1? Thanks.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 25 lines · Mark Langsdorf
Quoted 24 lines · Rob Herring
Quoted 22 lines · Peter Maydell
Quoted 11 lines · Rob Herring
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027Quoted 5 lines
Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Yeah, but the documentation even for DTB boot says we should pass in a machine number. If 0 or -1 are right then there should be some documentation that says so. I'll accept "mailing list post from some authoritative person [eg Grant Likely]" if necessary.
Quoted 4 lines
Quoted 1 line
Kernel DT co-maintainer is not authoritative enough for you?
Peter, is that sufficient for me to send in the patch with a
board_idof -1? Thanks.
It's still not clear to me from this conversation if the right answer is "0", "-1" or "anything that's not a valid board ID and not -1 either"...
-- PMM
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Mark Langsdorf
Quoted 24 lines · Rob Herring
Quoted 22 lines · Peter Maydell
Quoted 11 lines · Rob Herring
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027Quoted 5 lines
Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Yeah, but the documentation even for DTB boot says we should pass in a machine number. If 0 or -1 are right then there should be some documentation that says so. I'll accept "mailing list post from some authoritative person [eg Grant Likely]" if necessary.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Kernel DT co-maintainer is not authoritative enough for you?
Peter, is that sufficient for me to send in the patch with a
board_idof -1? Thanks.It's still not clear to me from this conversation if the right answer is "0", "-1" or "anything that's not a valid board ID and not -1 either"...
Quoting Rob from upthread:
"0 or -1 is the right value as those are obviously meaningless."
The original code that Rob wrote had a board_id of -1. That's the right answer.
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 10 lines · Mark Langsdorf
Quoted 3 lines · Peter Maydell
It's still not clear to me from this conversation if the right answer is "0", "-1" or "anything that's not a valid board ID and not -1 either"...
Quoting Rob from upthread:
"0 or -1 is the right value as those are obviously meaningless."The original code that Rob wrote had a
board_idof -1. That's the right answer.
In that case you need a patch that causes arm_boot to actually pass -1, not 0xffff.
(Also it would be nice if the kernel barfed if (id == -1 and there's no appended device tree), but that's not a qemu thing.)
-- PMM
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Mark Langsdorf
Quoted 3 lines · Peter Maydell
It's still not clear to me from this conversation if the right answer is "0", "-1" or "anything that's not a valid board ID and not -1 either"...
Quoting Rob from upthread:
"0 or -1 is the right value as those are obviously meaningless."
Quoted 8 lines
Quoted 2 lines
The original code that Rob wrote had a
board_idof -1. That's the right answer.In that case you need a patch that causes
arm_bootto actually pass -1, not0xffff.(Also it would be nice if the kernel barfed if (id == -1 and there's no appended device tree), but that's not a qemu thing.)
It looks like there's an issue with commit 2be276242135eac6, in that target-arm/helper.c:cpu_reset() is called after hw/highbank.c:highbank_cpu_reset() and keeps clobbering our c15_config_base_address. So when the kernel attempts to read that address, it gets a 0, and it never accesses the GIC code but instead reads the value of the hw/arm_boot.c:
bootloader[] array (loaded into ROM at address 0).
Is there a way to prioritize the callbacks or something so that arm's cpu_reset() doesn't clobber highbank's cpu_reset()? Alternately, is there some other way to set c15 values outside of cpu_reset()?
--Mark Langsdorf
Calxeda, Inc.
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
Quoted 4 lines · Mark Langsdorf
It looks like there's an issue with commit
2be276242135eac6, in that target-arm/helper.c:cpu_reset() is called after hw/highbank.c:highbank_cpu_reset() and keeps clobbering ourc15_config_base_address.
You may recall that when you first sent the patch with highbank_cpu_reset I said it looked like the resets would be in the wrong order, and you assured me they weren't :-) (Commit 2be276242 is the SCU register change, incidentally, and doesn't seem relevant; did you mean some other commit?)
Quoted 4 lines
Is there a way to prioritize the callbacks or something so that arm's
cpu_reset()doesn't clobber highbank'scpu_reset()? Alternately, is there some other way to set c15 values outside ofcpu_reset()?
Reset callbacks aren't supposed to do things such that they care about what order they're called in. This one does because we're uncleanly reaching into the CPUState from the highbank reset callback rather than doing CPU reset in the CPU proper. I was willing to let that pass since it happened to work OK and we didn't have a clean mechanism to hand, but if it doesn't work anyhow I guess we need to rethink.
I can't think of anything nicer (since we don't have a proper qdev object to set properties on) than adding code to cpu_reset() which saves the value of env->cp15_config_base_address across the memset(). That's quite ugly but will work. [And in fact we'd need that even with a hypothetical qdev property because the property would only set the state field once at init, and we'd need to avoid the memset() on reset trashing it. There's an argument that it's the block memset() that's ugly...]
OTOH it's 2.30am here so I may be missing a nicer approach. Suggestions welcome.
-- PMM
Re: [Qemu-devel] [PATCH v12 4/4] arm: SoC model for Calxeda Highbank
In reply to Rob HerringQuoted 19 lines · Rob Herring
Quoted 18 lines · Peter Maydell
Quoted 16 lines · Rob Herring
Quoted 9 lines · Peter Maydell
Quoted 1 line · Mark Langsdorf
+ highbank_binfo.board_id =
0xEC10100f; /* provided by deviceTree */Where does this number come from? It's not in
http://www.arm.linux.org.uk/developer/machines/Is 3027 (==0xbd3) you?
http://www.arm.linux.org.uk/developer/machines/list.php?id=3027Much of the data there is wrong as none of it is used. 0 or -1 is the right value as those are obviously meaningless. A highbank kernel will never be booted without devicetree and in that case this number is irrelevant. This is the legacy boot interface and qemu really needs to learn to boot with a separate dtb.
Quoted 14 lines
Quoted 4 lines
Yeah, but the documentation even for DTB boot says we should pass in a machine number. If 0 or -1 are right then there should be some documentation that says so. I'll accept "mailing list post from some authoritative person [eg Grant Likely]" if necessary.
Kernel DT co-maintainer is not authoritative enough for you?
The documentation needs some clarification.
Quoted 5 lines
But this is an ABI between boot loaders and the kernel so I don't want to just have something random that happens to work. (And in particular if -1 is the officially sanctioned number then we need to fix
arm_bootto be able to pass values >16 bits wide.)
I've got a patch that fixes arm_boot. I'll send it separately.
How about this patch for the kernel:
g.
---
Documentation/arm/Booting +3 -1
@@ -148,7 +148,9 @@ In either case, the following conditions must be met: - CPU register settings r0 = 0, - r1 = machine type number discovered in (3) above. + r1 = machine type number discovered in (3) above, or if booting with + a dtb then this may be set to ~0 if a valid MACH_TYPE_xxx value + does not exist for the machine. r2 = physical address of tagged list in system RAM, or physical address of device tree block (dtb) in system RAM
Documentation/devicetree/booting-without-of.txt +2 -1
@@ -176,7 +176,8 @@ it with special cases. r1 : Valid machine type number. When using a device tree, a single machine type number will often be assigned to - represent a class or family of SoCs. + represent a class or family of SoCs. If a valid machine + type number is not assigned, then use ~0. r2 : physical pointer to the device-tree block (defined in chapter II) in RAM. Device tree can be located