arm-devs queue
Subsystems (2)
Usual arm-devs pullreq; this one contains my changes to allow the vexpress-a15 to accept more than 2GB of RAM, the Exynos I2C device and a couple of minor bugfix patches.
thanks
-- PMM
The following changes since commit 61dc008f3529fa74a63aad1907438dad857e255a:
Revert "audio: Make PC speaker audio card available by default" (2012-07-19 18:25:52 -0500)
are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git arm-devs.for-upstream
Mitsyanko Igor (1):
exynos4210: add Exynos4210 i2c implementation
Oleg Ogurtsov (2):
hw/exynos4210_rtc.c: Fix calculating for value of year hw/exynos4210_rtc.c: remove unnecessary code
Peter Maydell (7):
hw/pl011.c: Avoid crash on read when no chr backend present hw/arm_boot.c: Make ram_size a uint64_t
hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity
device_tree: Add support for reading device tree properties hw/arm_boot.c: Support DTBs which use 64 bit addresses hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard
device_tree.c | 30 +++++ device_tree.h | 4 + hw/arm-misc.h | 2 +- hw/arm/Makefile.objs | 2 +- hw/arm_boot.c | 46 ++++++- hw/exynos4210.c | 27 ++++ hw/exynos4210.h | 3 + hw/exynos4210_i2c.c | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/exynos4210_rtc.c | 7 +- hw/pl011.c | 4 +- hw/vexpress.c | 13 ++- 11 files changed, 456 insertions(+), 16 deletions(-) create mode 100644 hw/exynos4210_i2c.c
PATCH 1/10 hw/pl011.c: Avoid crash on read when no chr backend present
Add a missing guard that meant we would segfault if the guest read UARTDR on a PL011 serial device which had no chr backend connected. (This didn't happen for Linux guests because Linux reads the flags register and doesn't try to read the UART if it's empty.)
--- hw/pl011.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
hw/pl011.c +3 -1
@@ -78,7 +78,9 @@ static uint64_t pl011_read(void *opaque, target_phys_addr_t offset,if (s->read_count == s->read_trigger -1 ) s->int_level &= ~PL011_INT_RX ;pl011_update (s); -qemu_chr_accept_input (s->chr); +if (s->chr) { +qemu_chr_accept_input (s->chr); + }return c;case 1 :/* UARTCR */ return 0 ;
Signature · 1 line
1.7.5.4
PATCH 2/10 hw/arm_boot.c: Make ram_size a uint64_t
In reply to Peter MaydellMake the RAM size in arm_boot_info a uint64_t so it can express the larger RAM sizes that may be seen in LPAE systems.
--- hw/arm-misc.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/arm-misc.h +1 -1
@@ -25,7 +25,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,/* arm_boot.c */ struct arm_boot_info { -int ram_size; +uint64_t ram_size;const char *kernel_filename;const char *kernel_cmdline;const char *initrd_filename;
Signature · 1 line
1.7.5.4
PATCH 3/10 hw/arm_boot.c: Consistently use ram_size from arm_boot_info struct
In reply to Peter MaydellClean up the mix of getting the RAM size from the global ram_size and from the ram_size field in the arm_boot_info structure, so that we always use the structure field.
--- hw/arm_boot.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
hw/arm_boot.c +3 -2
@@ -357,7 +357,7 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)if (kernel_size <0 ) { entry = info->loader_start +KERNEL_LOAD_ADDR ; kernel_size =load_image_targphys (info->kernel_filename, entry, - ram_size -KERNEL_LOAD_ADDR ); + info->ram_size -KERNEL_LOAD_ADDR ); is_linux =1 ; }if (kernel_size <0 ) {
@@ -371,7 +371,8 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) initrd_size =load_image_targphys (info->initrd_filename, info->loader_start +INITRD_LOAD_ADDR , - ram_size -INITRD_LOAD_ADDR ); + info->ram_size + -INITRD_LOAD_ADDR );if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initrd '%s'\n" , info->initrd_filename);
Signature · 1 line
1.7.5.4
PATCH 4/10 hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity
In reply to Peter MaydellThe legacy ATAGS format for passing information to the kernel only allows RAM sizes which fit in 32 bits; enforce this restriction rather than silently doing something weird.
--- hw/arm_boot.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
hw/arm_boot.c +6 -0
@@ -399,6 +399,12 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) bootloader[5 ] = dtb_start; }else { bootloader[5 ] = info->loader_start +KERNEL_ARGS_ADDR ; +if (info->ram_size >= (1ULL <<32 )) { +fprintf (stderr,"qemu: RAM size must be less than 4GB to boot" +" Linux kernel using ATAGS (try passing a device tree" +" using -dtb)\n" ); +exit (1 ); + } } bootloader[6 ] = entry;for (n =0 ; n <sizeof (bootloader) /4 ; n++) {
Signature · 1 line
1.7.5.4
PATCH 5/10 device_tree: Add support for reading device tree properties
In reply to Peter MaydellAdd support for reading device tree properties (both generic and single-cell ones) to QEMU's convenience wrapper layer.
--- device_tree.c | 30 ++++++++++++++++++++++++++++++ device_tree.h | 4 ++++ 2 files changed, 34 insertions(+), 0 deletions(-)
device_tree.c +30 -0
@@ -178,6 +178,36 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,return r; } +const void *qemu_devtree_getprop (void *fdt,const char *node_path, +const char *property,int *lenp) +{ +int len; +const void *r; +if (!lenp) { + lenp = &len; + } + r =fdt_getprop (fdt,findnode_nofail (fdt, node_path), property, lenp); +if (!r) { +fprintf (stderr,"%s: Couldn't get %s/%s: %s\n" , __func__, + node_path, property,fdt_strerror (*lenp)); +exit (1 ); + } +return r; +} + +uint32_t qemu_devtree_getprop_cell (void *fdt,const char *node_path, +const char *property) +{ +int len; +const uint32_t *p =qemu_devtree_getprop (fdt, node_path, property, &len); +if (len !=4 ) { +fprintf (stderr,"%s: %s/%s not 4 bytes long (not a cell?)\n" , + __func__, node_path, property); +exit (1 ); + } +return be32_to_cpu (*p); +} +uint32_t qemu_devtree_get_phandle (void *fdt,const char *path) {uint32_t r;
device_tree.h +4 -0
@@ -28,6 +28,10 @@ int qemu_devtree_setprop_string(void *fdt, const char *node_path,int qemu_devtree_setprop_phandle (void *fdt,const char *node_path,const char *property,const char *target_node_path); +const void *qemu_devtree_getprop (void *fdt,const char *node_path, +const char *property,int *lenp); +uint32_t qemu_devtree_getprop_cell (void *fdt,const char *node_path, +const char *property);uint32_t qemu_devtree_get_phandle (void *fdt,const char *path);uint32_t qemu_devtree_alloc_phandle (void *fdt);int qemu_devtree_nop_node (void *fdt,const char *node_path);
Signature · 1 line
1.7.5.4
PATCH 6/10 hw/arm_boot.c: Support DTBs which use 64 bit addresses
In reply to Peter MaydellSupport the case where the device tree blob specifies that #address-cells and #size-cells are greater than 1. (This is needed for device trees which can handle 64 bit physical addresses and thus total RAM sizes over 4GB.)
--- hw/arm_boot.c | 35 ++++++++++++++++++++++++++++++++--- 1 files changed, 32 insertions(+), 3 deletions(-)
hw/arm_boot.c +32 -3
@@ -216,11 +216,12 @@ static void set_kernel_args_old(const struct arm_boot_info *info)static int load_dtb (target_phys_addr_t addr,const struct arm_boot_info *binfo) {#ifdef CONFIG_FDT -uint32_t mem_reg_property[] = {cpu_to_be32 (binfo->loader_start), -cpu_to_be32 (binfo->ram_size) }; +uint32_t *mem_reg_property; +uint32_t mem_reg_propsize;void *fdt =NULL ;char *filename;int size, rc; +uint32_t acells, scells, hival; filename =qemu_find_file (QEMU_FILE_TYPE_BIOS , binfo->dtb_filename);if (!filename) {
@@ -236,8 +237,36 @@ static int load_dtb(target_phys_addr_t addr, const struct arm_boot_info *binfo) }g_free (filename); + acells =qemu_devtree_getprop_cell (fdt,"/" ,"#address-cells" ); + scells =qemu_devtree_getprop_cell (fdt,"/" ,"#size-cells" ); +if (acells ==0 || scells ==0 ) { +fprintf (stderr,"dtb file invalid (#address-cells or #size-cells 0)\n" ); +return -1 ; + } + + mem_reg_propsize = acells + scells; + mem_reg_property =g_new0 (uint32_t, mem_reg_propsize); + mem_reg_property[acells -1 ] =cpu_to_be32 (binfo->loader_start); + hival =cpu_to_be32 (binfo->loader_start >>32 ); +if (acells >1 ) { + mem_reg_property[acells -2 ] = hival; + }else if (hival !=0 ) { +fprintf (stderr,"qemu: dtb file not compatible with " +"RAM start address > 4GB\n" ); +exit (1 ); + } + mem_reg_property[acells + scells -1 ] =cpu_to_be32 (binfo->ram_size); + hival =cpu_to_be32 (binfo->ram_size >>32 ); +if (scells >1 ) { + mem_reg_property[acells + scells -2 ] = hival; + }else if (hival !=0 ) { +fprintf (stderr,"qemu: dtb file not compatible with " +"RAM size > 4GB\n" ); +exit (1 ); + } + rc =qemu_devtree_setprop (fdt,"/memory" ,"reg" , mem_reg_property, -sizeof (mem_reg_property)); + mem_reg_propsize *sizeof (uint32_t ));if (rc <0 ) {fprintf (stderr,"couldn't set /memory/reg\n" ); }
Signature · 1 line
1.7.5.4
PATCH 7/10 hw/vexpress.c: Allow >4GB of RAM for Cortex-A15 daughterboard
In reply to Peter MaydellNow that we have LPAE support and can handle passing 64 bit RAM sizes to Linux via the device tree, we can lift the restriction in the Versatile Express A15 daughterboard model on not having more than 2GB of RAM. Allow up to 30GB, which is the maximum that can fit in the address map before running into the (unmodelled) aliases of the first 2GB.
--- hw/vexpress.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
hw/vexpress.c +10 -3
@@ -284,9 +284,16 @@ static void a15_daughterboard_init(const VEDBoardInfo *daughterboard, cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ ]; } -if (ram_size >0x80000000 ) { -fprintf (stderr,"vexpress-a15: cannot model more than 2GB RAM\n" ); -exit (1 ); + { +/* We have to use a separate 64 bit variable here to avoid the gcc +* "comparison is always false due to limited range of data type" +* warning if we are on a host where ram_addr_t is 32 bits. +*/ +uint64_t rsz = ram_size; +if (rsz > (30ULL *1024 *1024 *1024 )) { +fprintf (stderr,"vexpress-a15: cannot model more than 30GB RAM\n" ); +exit (1 ); + } }memory_region_init_ram (ram,"vexpress.highmem" , ram_size);
Signature · 1 line
1.7.5.4
PATCH 8/10 hw/exynos4210_rtc.c: Fix calculating for value of year
In reply to Peter MaydellFrom: Oleg Ogurtsov <[email protected]>
--- hw/exynos4210_rtc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
hw/exynos4210_rtc.c +1 -1
@@ -142,7 +142,7 @@ static const VMStateDescription vmstate_exynos4210_rtc_state = { };#define BCD3DIGITS (x) \ - ((uint32_t)to_bcd((uint8_t)x) + \ + ((uint32_t)to_bcd((uint8_t)(x % 100)) + \ ((uint32_t)to_bcd((uint8_t)((x % 1000) / 100)) << 8))static void check_alarm_raise (Exynos4210RTCState *s)
Signature · 1 line
1.7.5.4
PATCH 9/10 hw/exynos4210_rtc.c: remove unnecessary code
In reply to Peter MaydellFrom: Oleg Ogurtsov <[email protected]>
--- hw/exynos4210_rtc.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
hw/exynos4210_rtc.c +1 -4
@@ -510,10 +510,7 @@ static void exynos4210_rtc_reset(DeviceState *d) {Exynos4210RTCState *s = (Exynos4210RTCState *)d; -struct tm tm; - -qemu_get_timedate (&tm,0 ); - s->current_tm = tm; +qemu_get_timedate (&s->current_tm,0 ); DPRINTF("Get time from host: %d-%d-%d %2d:%02d:%02d\n", s->current_tm.tm_year, s->current_tm.tm_mon, s->current_tm.tm_mday,
Signature · 1 line
1.7.5.4
PATCH 10/10 exynos4210: add Exynos4210 i2c implementation
In reply to Peter MaydellFrom: Mitsyanko Igor <[email protected]>
Create 9 exynos4210 i2c interfaces.
--- hw/arm/Makefile.objs | 2 +- hw/exynos4210.c | 27 ++++ hw/exynos4210.h | 3 + hw/exynos4210_i2c.c | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 365 insertions(+), 1 deletions(-) create mode 100644 hw/exynos4210_i2c.c
hw/arm/Makefile.objs +1 -1
@@ -11,7 +11,7 @@ obj-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o obj-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o obj-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o obj-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o -obj-y += exynos4210_rtc.o +obj-y += exynos4210_rtc.o exynos4210_i2c.o obj-y += arm_l2x0.o obj-y += arm_mptimer.o a15mpcore.o obj-y += armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
hw/exynos4210.c +27 -0
@@ -39,6 +39,13 @@/* MCT */ #define EXYNOS4210_MCT_BASE_ADDR 0x10050000 +/* I2C */ +#define EXYNOS4210_I2C_SHIFT 0x00010000 +#define EXYNOS4210_I2C_BASE_ADDR 0x13860000 +/* Interrupt Group of External Interrupt Combiner for I2C */ +#define EXYNOS4210_I2C_INTG 27 +#define EXYNOS4210_HDMI_INTG 16 +/* UART's definitions */ #define EXYNOS4210_UART0_BASE_ADDR 0x13800000#define EXYNOS4210_UART1_BASE_ADDR 0x13810000
@@ -283,6 +290,26 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem, s->irq_table[exynos4210_get_irq(35, 3)]);sysbus_mmio_map (busdev,0 ,EXYNOS4210_MCT_BASE_ADDR ); +/*** I2C ***/ +for (n =0 ; n <EXYNOS4210_I2C_NUMBER ; n++) { +uint32_t addr =EXYNOS4210_I2C_BASE_ADDR +EXYNOS4210_I2C_SHIFT * n; +qemu_irq i2c_irq; + +if (n <8 ) { + i2c_irq = s->irq_table[exynos4210_get_irq (EXYNOS4210_I2C_INTG , n)]; + }else { + i2c_irq = s->irq_table[exynos4210_get_irq (EXYNOS4210_HDMI_INTG ,1 )]; + } + + dev =qdev_create (NULL ,"exynos4210.i2c" ); +qdev_init_nofail (dev); + busdev =sysbus_from_qdev (dev); +sysbus_connect_irq (busdev,0 , i2c_irq); +sysbus_mmio_map (busdev,0 , addr); + s->i2c_if[n] = (i2c_bus *)qdev_get_child_bus (dev,"i2c" ); + } + +/*** UARTs ***/ exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR, EXYNOS4210_UART0_FIFO_SIZE, 0, NULL,
hw/exynos4210.h +3 -0
@@ -74,6 +74,8 @@#define EXYNOS4210_EXT_GIC_NIRQ (160-32)#define EXYNOS4210_INT_GIC_NIRQ 64 +#define EXYNOS4210_I2C_NUMBER 9 + typedef struct Exynos4210Irq { qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ]; qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
@@ -95,6 +97,7 @@ typedef struct Exynos4210State {MemoryRegion dram1_mem;MemoryRegion boot_secondary;MemoryRegion bootreg_mem; +i2c_bus *i2c_if[EXYNOS4210_I2C_NUMBER ]; } Exynos4210State; void exynos4210_write_secondary(ARMCPU *cpu,
hw/exynos4210_i2c.c new file +334 -0
334 lines not on this page · raw message
Signature · 1 line
1.7.5.4