Skip to contentSkip to conversation

arm-devs queue

GIT PULL In review Peter Maydell 3 participants 13 messages Aug 13, 2012 – Aug 14, 2012

lore
Share & tools
lore
#0 lore raw

This is the usual arm-devs pullreq, with the last set of patches to go in before the 1.2 hardfreeze. Nothing particularly exciting here, mostly just cleanup, plus a fix for that embarrassing "v7m machines assert on startup" bug of mine.

thanks
-- PMM

The following changes since commit 33e95c6328a3149a52615176617997c4f8f7088b:

qom: Reimplement Interfaces (2012-08-13 11:20:41 +0200)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git arm-devs.next

for you to fetch changes up to 58f9b98f8a341c8b7bb0c9b38e492a01fe71d666:

arm: Move some ARM devices into libhw (2012-08-13 16:13:02 +0100)

----------------------------------------------------------------
Andreas Färber (1):
arm: Move some ARM devices into libhw

Mitsyanko Igor (6):
hw/sd.c: convert wp_groups in SDState to bitfield hw/sd.c: make sd_wp_addr() accept 64 bit address argument hw/sd.c: introduce wrapper for conversion address to wp group hw/sd.c: convert binary variables to bool
hw/sd.c: make sd_dataready() return bool
hw/sd.c: make sd_wp_addr() return bool

Peter A. G. Crosthwaite (2):
armv7m: Guard against no -kernel argument
ssd0323: abort() instead of exit(1) on error.

Peter Maydell (1):
hw/armv7m_nvic: Fix incorrect default for num-irqs property

 default-configs/arm-softmmu.mak |   18 ++++++++++
 hw/Makefile.objs                |   20 +++++++++++
 hw/arm/Makefile.objs            |   15 ++------
 hw/armv7m.c                     |    5 +++
 hw/armv7m_nvic.c                |   21 ++++++++----
 hw/sd.c                         |   72 +++++++++++++++++++++------------------
 hw/sd.h                         |    6 ++--
 hw/ssd0323.c                    |    4 ++-
 8 files changed, 104 insertions(+), 57 deletions(-)
#1 lore raw

PATCH 1/10 hw/armv7m_nvic: Fix incorrect default for num-irqs property

Fix an incorrect default value for the num-irqs property (we were attempting to override it from the default set by the parent class but not succeeding, which meant that the lm3s6965evb model would assert on startup attempting to wire up nonexistent irq lines). Instead of trying to override the parent's Property array, we define an instance_init function which runs after default setup but before user property setting and can just fix up the default value in the gic_state struct.

---
 hw/armv7m_nvic.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
hw/armv7m_nvic.c +14 -7
index 4867c1d..6a0832e 100644
@@ -467,7 +467,7 @@ static int armv7m_nvic_init(SysBusDevice *dev)
     s->gic.num_cpu = 1;
     /* Tell the common code we're an NVIC */
     s->gic.revision = 0xffffffff;
-    s->gic.num_irq = s->num_irq;
+    s->num_irq = s->gic.num_irq;
     nc->parent_init(dev);
     gic_init_irqs_and_distributor(&s->gic, s->num_irq);
     /* The NVIC and system controller register area looks like this:
@@ -498,14 +498,21 @@ static int armv7m_nvic_init(SysBusDevice *dev)
     return 0;
 }
 
-static Property armv7m_nvic_properties[] = {
+static void armv7m_nvic_instance_init(Object *obj)
+{
+    /* We have a different default value for the num-irq property
+     * than our superclass. This function runs after qdev init
+     * has set the defaults from the Property array and before
+     * any user-specified property setting, so just modify the
+     * value in the gic_state struct.
+     */
+    gic_state *s = ARM_GIC_COMMON(obj);
     /* 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.
+     * set the num-irq property appropriately.
      */
-    DEFINE_PROP_UINT32("num-irq", nvic_state, num_irq, 64),
-    DEFINE_PROP_END_OF_LIST(),
-};
+    s->num_irq = 64;
+}
 
 static void armv7m_nvic_class_init(ObjectClass *klass, void *data)
 {
@@ -518,12 +525,12 @@ static void armv7m_nvic_class_init(ObjectClass *klass, void *data)
     sdc->init = armv7m_nvic_init;
     dc->vmsd  = &vmstate_nvic;
     dc->reset = armv7m_nvic_reset;
-    dc->props = armv7m_nvic_properties;
 }
 
 static TypeInfo armv7m_nvic_info = {
     .name          = TYPE_NVIC,
     .parent        = TYPE_ARM_GIC_COMMON,
+    .instance_init = armv7m_nvic_instance_init,
     .instance_size = sizeof(nvic_state),
     .class_init    = armv7m_nvic_class_init,
     .class_size    = sizeof(NVICClass),
Signature · 1 line
1.7.9.5
Tested-by on v1 1/10
#2 lore raw

Re: [Qemu-devel] [PATCH 01/10] hw/armv7m_nvic: Fix incorrect default for num-irqs property

Quoted 9 lines · Peter Maydell

Fix an incorrect default value for the num-irqs property (we were attempting to override it from the default set by the parent class but not succeeding, which meant that the lm3s6965evb model would assert on startup attempting to wire up nonexistent irq lines). Instead of trying to override the parent's Property array, we define an instance_init function which runs after default setup but before user property setting and can just fix up the default value in the gic_state struct.

Quoted 3 lines

I noticed this assertion recently as well while hacking on some Cortex-M3 stuff:

qemu-system-arm: /home/meadori/Code/src/qemu/hw/qdev.c:310: qdev_get_gpio_in:
Assertion `n >= 0 && n < dev->num_gpio_in' failed.
Aborted (core dumped)

I just tried out your patch and it fixes the issue I was seeing.

Signature · 3 lines
Meador Inge
CodeSourcery / Mentor Embedded
http://www.mentor.com/embedded-software
#3 lore raw

PATCH 2/10 armv7m: Guard against no -kernel argument

In reply to Peter Maydell

From: "Peter A. G. Crosthwaite" <[email protected]>

A -kernel argument must be specified for this machine. Guard against no -kernel argument. Previously gave an unhelpful "bad address" error message.

---
 hw/armv7m.c |    5 +++++
 1 file changed, 5 insertions(+)
hw/armv7m.c +5 -0
index 8cec78d..9f66667 100644
@@ -227,6 +227,11 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
     big_endian = 0;
 #endif
 
+    if (!kernel_filename) {
+        fprintf(stderr, "Guest image must be specified (using -kernel)\n");
+        exit(1);
+    }
+
     image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
                           NULL, big_endian, ELF_MACHINE, 1);
     if (image_size < 0) {
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 3/10 hw/sd.c: convert wp_groups in SDState to bitfield

In reply to Peter Maydell

From: Mitsyanko Igor <[email protected]>

Representing each group write protection flag with only one bit instead of int variable significantly reduces memory consumption.

---
 hw/sd.c |   33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)
hw/sd.c +19 -14
index 07eb263..575b509 100644
@@ -32,6 +32,7 @@
 #include "hw.h"
 #include "block.h"
 #include "sd.h"
+#include "bitmap.h"
 
 //#define DEBUG_SD 1
 
@@ -81,7 +82,7 @@ struct SDState {
     uint8_t sd_status[64];
     uint32_t vhs;
     int wp_switch;
-    int *wp_groups;
+    unsigned long *wp_groups;
     uint64_t size;
     int blk_len;
     uint32_t erase_start;
@@ -415,7 +416,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
     if (sd->wp_groups)
         g_free(sd->wp_groups);
     sd->wp_switch = bdrv ? bdrv_is_read_only(bdrv) : 0;
-    sd->wp_groups = (int *) g_malloc0(sizeof(int) * sect);
+    sd->wp_groups = bitmap_new(sect);
     memset(sd->function_group, 0, sizeof(int) * 6);
     sd->erase_start = 0;
     sd->erase_end = 0;
@@ -484,9 +485,11 @@ static void sd_erase(SDState *sd)
     sd->erase_end = 0;
     sd->csd[14] |= 0x40;
 
-    for (i = start; i <= end; i ++)
-        if (sd->wp_groups[i])
+    for (i = start; i <= end; i++) {
+        if (test_bit(i, sd->wp_groups)) {
             sd->card_status |= WP_ERASE_SKIP;
+        }
+    }
 }
 
 static uint32_t sd_wpbits(SDState *sd, uint64_t addr)
@@ -496,9 +499,11 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr)
 
     wpnum = addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);
 
-    for (i = 0; i < 32; i ++, wpnum ++, addr += WPGROUP_SIZE)
-        if (addr < sd->size && sd->wp_groups[wpnum])
+    for (i = 0; i < 32; i++, wpnum++, addr += WPGROUP_SIZE) {
+        if (addr < sd->size && test_bit(wpnum, sd->wp_groups)) {
             ret |= (1 << i);
+        }
+    }
 
     return ret;
 }
@@ -536,8 +541,8 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
 
 static inline int sd_wp_addr(SDState *sd, uint32_t addr)
 {
-    return sd->wp_groups[addr >>
-            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)];
+    return test_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
+            sd->wp_groups);
 }
 
 static void sd_lock_command(SDState *sd)
@@ -560,8 +565,8 @@ static void sd_lock_command(SDState *sd)
             sd->card_status |= LOCK_UNLOCK_FAILED;
             return;
         }
-        memset(sd->wp_groups, 0, sizeof(int) * (sd->size >>
-                        (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)));
+        bitmap_zero(sd->wp_groups,
+            (sd->size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1);
         sd->csd[14] &= ~0x10;
         sd->card_status &= ~CARD_IS_LOCKED;
         sd->pwd_len = 0;
@@ -1007,8 +1012,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
             }
 
             sd->state = sd_programming_state;
-            sd->wp_groups[addr >> (HWBLOCK_SHIFT +
-                            SECTOR_SHIFT + WPGROUP_SHIFT)] = 1;
+            set_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
+                    sd->wp_groups);
             /* Bzzzzzzztt .... Operation complete.  */
             sd->state = sd_transfer_state;
             return sd_r1b;
@@ -1027,8 +1032,8 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
             }
 
             sd->state = sd_programming_state;
-            sd->wp_groups[addr >> (HWBLOCK_SHIFT +
-                            SECTOR_SHIFT + WPGROUP_SHIFT)] = 0;
+            clear_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
+                    sd->wp_groups);
             /* Bzzzzzzztt .... Operation complete.  */
             sd->state = sd_transfer_state;
             return sd_r1b;
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 4/10 hw/sd.c: make sd_wp_addr() accept 64 bit address argument

In reply to Peter Maydell

From: Mitsyanko Igor <[email protected]>

Currently sd_wp_addr() accepts 32 bit address arguments therefore implicitly restricting SD card address range. Change address argument type to uint64_t.

---
 hw/sd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sd.c +1 -1
index 575b509..e24d04a 100644
@@ -539,7 +539,7 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
     sd->data[66] = crc & 0xff;
 }
 
-static inline int sd_wp_addr(SDState *sd, uint32_t addr)
+static inline int sd_wp_addr(SDState *sd, uint64_t addr)
 {
     return test_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
             sd->wp_groups);
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 5/10 hw/sd.c: introduce wrapper for conversion address to wp group

In reply to Peter Maydell

From: Mitsyanko Igor <[email protected]>

Add wrapper function sd_addr_to_wpnum() to replace long address-->wg_group conversion line.

---
 hw/sd.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)
hw/sd.c +13 -14
index e24d04a..d0674d5 100644
@@ -388,6 +388,11 @@ static void sd_response_r7_make(SDState *sd, uint8_t *response)
     response[3] = (sd->vhs >>  0) & 0xff;
 }
 
+static inline uint64_t sd_addr_to_wpnum(uint64_t addr)
+{
+    return addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);
+}
+
 static void sd_reset(SDState *sd, BlockDriverState *bdrv)
 {
     uint64_t size;
@@ -400,7 +405,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
     }
     size = sect << 9;
 
-    sect = (size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1;
+    sect = sd_addr_to_wpnum(size) + 1;
 
     sd->state = sd_idle_state;
     sd->rca = 0x0000;
@@ -477,10 +482,8 @@ static void sd_erase(SDState *sd)
         return;
     }
 
-    start = sd->erase_start >>
-            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);
-    end = sd->erase_end >>
-            (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);
+    start = sd_addr_to_wpnum(sd->erase_start);
+    end = sd_addr_to_wpnum(sd->erase_end);
     sd->erase_start = 0;
     sd->erase_end = 0;
     sd->csd[14] |= 0x40;
@@ -497,7 +500,7 @@ static uint32_t sd_wpbits(SDState *sd, uint64_t addr)
     uint32_t i, wpnum;
     uint32_t ret = 0;
 
-    wpnum = addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT);
+    wpnum = sd_addr_to_wpnum(addr);
 
     for (i = 0; i < 32; i++, wpnum++, addr += WPGROUP_SIZE) {
         if (addr < sd->size && test_bit(wpnum, sd->wp_groups)) {
@@ -541,8 +544,7 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
 
 static inline int sd_wp_addr(SDState *sd, uint64_t addr)
 {
-    return test_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
-            sd->wp_groups);
+    return test_bit(sd_addr_to_wpnum(addr), sd->wp_groups);
 }
 
 static void sd_lock_command(SDState *sd)
@@ -565,8 +567,7 @@ static void sd_lock_command(SDState *sd)
             sd->card_status |= LOCK_UNLOCK_FAILED;
             return;
         }
-        bitmap_zero(sd->wp_groups,
-            (sd->size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1);
+        bitmap_zero(sd->wp_groups, sd_addr_to_wpnum(sd->size) + 1);
         sd->csd[14] &= ~0x10;
         sd->card_status &= ~CARD_IS_LOCKED;
         sd->pwd_len = 0;
@@ -1012,8 +1013,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
             }
 
             sd->state = sd_programming_state;
-            set_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
-                    sd->wp_groups);
+            set_bit(sd_addr_to_wpnum(addr), sd->wp_groups);
             /* Bzzzzzzztt .... Operation complete.  */
             sd->state = sd_transfer_state;
             return sd_r1b;
@@ -1032,8 +1032,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
             }
 
             sd->state = sd_programming_state;
-            clear_bit(addr >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT),
-                    sd->wp_groups);
+            clear_bit(sd_addr_to_wpnum(addr), sd->wp_groups);
             /* Bzzzzzzztt .... Operation complete.  */
             sd->state = sd_transfer_state;
             return sd_r1b;
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 6/10 hw/sd.c: convert binary variables to bool

In reply to Peter Maydell

From: Mitsyanko Igor <[email protected]>

Several members of SDState have type int when they actually are binary variables. Change type of these variables to bool to improve code readability. Change SD API to be in consistency with new variables type.

---
 hw/sd.c |   24 ++++++++++++------------
 hw/sd.h |    4 ++--
 2 files changed, 14 insertions(+), 14 deletions(-)
hw/sd.c +12 -12
index d0674d5..ebc4e7c 100644
@@ -81,7 +81,7 @@ struct SDState {
     uint32_t card_status;
     uint8_t sd_status[64];
     uint32_t vhs;
-    int wp_switch;
+    bool wp_switch;
     unsigned long *wp_groups;
     uint64_t size;
     int blk_len;
@@ -91,12 +91,12 @@ struct SDState {
     int pwd_len;
     int function_group[6];
 
-    int spi;
+    bool spi;
     int current_cmd;
     /* True if we will handle the next command as an ACMD. Note that this does
      * *not* track the APP_CMD status bit!
      */
-    int expecting_acmd;
+    bool expecting_acmd;
     int blk_written;
     uint64_t data_start;
     uint32_t data_offset;
@@ -106,7 +106,7 @@ struct SDState {
     BlockDriverState *bdrv;
     uint8_t *buf;
 
-    int enable;
+    bool enable;
 };
 
 static void sd_set_mode(SDState *sd)
@@ -420,7 +420,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
 
     if (sd->wp_groups)
         g_free(sd->wp_groups);
-    sd->wp_switch = bdrv ? bdrv_is_read_only(bdrv) : 0;
+    sd->wp_switch = bdrv ? bdrv_is_read_only(bdrv) : false;
     sd->wp_groups = bitmap_new(sect);
     memset(sd->function_group, 0, sizeof(int) * 6);
     sd->erase_start = 0;
@@ -428,7 +428,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
     sd->size = size;
     sd->blk_len = 0x200;
     sd->pwd_len = 0;
-    sd->expecting_acmd = 0;
+    sd->expecting_acmd = false;
 }
 
 static void sd_cardchange(void *opaque, bool load)
@@ -450,14 +450,14 @@ static const BlockDevOps sd_block_ops = {
    whether card should be in SSI or MMC/SD mode.  It is also up to the
    board to ensure that ssi transfers only occur when the chip select
    is asserted.  */
-SDState *sd_init(BlockDriverState *bs, int is_spi)
+SDState *sd_init(BlockDriverState *bs, bool is_spi)
 {
     SDState *sd;
 
     sd = (SDState *) g_malloc0(sizeof(SDState));
     sd->buf = qemu_blockalign(bs, 512);
     sd->spi = is_spi;
-    sd->enable = 1;
+    sd->enable = true;
     sd_reset(sd, bs);
     if (sd->bdrv) {
         bdrv_attach_dev_nofail(sd->bdrv, sd);
@@ -1129,7 +1129,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
         if (sd->rca != rca)
             return sd_r0;
 
-        sd->expecting_acmd = 1;
+        sd->expecting_acmd = true;
         sd->card_status |= APP_CMD;
         return sd_r1;
 
@@ -1311,7 +1311,7 @@ int sd_do_command(SDState *sd, SDRequest *req,
     if (sd->card_status & CARD_IS_LOCKED) {
         if (!cmd_valid_while_locked(sd, req)) {
             sd->card_status |= ILLEGAL_COMMAND;
-            sd->expecting_acmd = 0;
+            sd->expecting_acmd = false;
             fprintf(stderr, "SD: Card is locked\n");
             rtype = sd_illegal;
             goto send_response;
@@ -1322,7 +1322,7 @@ int sd_do_command(SDState *sd, SDRequest *req,
     sd_set_mode(sd);
 
     if (sd->expecting_acmd) {
-        sd->expecting_acmd = 0;
+        sd->expecting_acmd = false;
         rtype = sd_app_command(sd, *req);
     } else {
         rtype = sd_normal_command(sd, *req);
@@ -1708,7 +1708,7 @@ int sd_data_ready(SDState *sd)
     return sd->state == sd_sendingdata_state;
 }
 
-void sd_enable(SDState *sd, int enable)
+void sd_enable(SDState *sd, bool enable)
 {
     sd->enable = enable;
 }
hw/sd.h +2 -2
index ac4b7c4..d25342f 100644
@@ -67,13 +67,13 @@ typedef struct {
 
 typedef struct SDState SDState;
 
-SDState *sd_init(BlockDriverState *bs, int is_spi);
+SDState *sd_init(BlockDriverState *bs, bool is_spi);
 int sd_do_command(SDState *sd, SDRequest *req,
                   uint8_t *response);
 void sd_write_data(SDState *sd, uint8_t value);
 uint8_t sd_read_data(SDState *sd);
 void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert);
 int sd_data_ready(SDState *sd);
-void sd_enable(SDState *sd, int enable);
+void sd_enable(SDState *sd, bool enable);
 
 #endif	/* __hw_sd_h */
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 7/10 hw/sd.c: make sd_dataready() return bool

In reply to Peter Maydell

From: Mitsyanko Igor <[email protected]>

For the sake of code clarity

---
 hw/sd.c |    2 +-
 hw/sd.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hw/sd.c +1 -1
index ebc4e7c..209bc19 100644
@@ -1703,7 +1703,7 @@ uint8_t sd_read_data(SDState *sd)
     return ret;
 }
 
-int sd_data_ready(SDState *sd)
+bool sd_data_ready(SDState *sd)
 {
     return sd->state == sd_sendingdata_state;
 }
hw/sd.h +1 -1
index d25342f..4eb9679 100644
@@ -73,7 +73,7 @@ int sd_do_command(SDState *sd, SDRequest *req,
 void sd_write_data(SDState *sd, uint8_t value);
 uint8_t sd_read_data(SDState *sd);
 void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert);
-int sd_data_ready(SDState *sd);
+bool sd_data_ready(SDState *sd);
 void sd_enable(SDState *sd, bool enable);
 
 #endif	/* __hw_sd_h */
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 8/10 hw/sd.c: make sd_wp_addr() return bool

In reply to Peter Maydell

From: Mitsyanko Igor <[email protected]>

For the sake of code clarity

---
 hw/sd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sd.c +1 -1
index 209bc19..ec26407 100644
@@ -542,7 +542,7 @@ static void sd_function_switch(SDState *sd, uint32_t arg)
     sd->data[66] = crc & 0xff;
 }
 
-static inline int sd_wp_addr(SDState *sd, uint64_t addr)
+static inline bool sd_wp_addr(SDState *sd, uint64_t addr)
 {
     return test_bit(sd_addr_to_wpnum(addr), sd->wp_groups);
 }
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 9/10 ssd0323: abort() instead of exit(1) on error.

In reply to Peter Maydell

From: "Peter A. G. Crosthwaite" <[email protected]>

To be more consistent with the newer ways of error signalling. That and SIGABT is easier to debug with than exit(1).

---
 hw/ssd0323.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ssd0323.c +3 -1
index b0b2e94..b101c51 100644
@@ -19,7 +19,9 @@
 #define DPRINTF(fmt, ...) \
 do { printf("ssd0323: " fmt , ## __VA_ARGS__); } while (0)
 #define BADF(fmt, ...) \
-do { fprintf(stderr, "ssd0323: error: " fmt , ## __VA_ARGS__); exit(1);} while (0)
+do { \
+    fprintf(stderr, "ssd0323: error: " fmt , ## __VA_ARGS__); abort(); \
+} while (0)
 #else
 #define DPRINTF(fmt, ...) do {} while(0)
 #define BADF(fmt, ...) \
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 10/10 arm: Move some ARM devices into libhw

In reply to Peter Maydell

From: Andreas Färber <[email protected]>

Avoids some unnecessary dependencies on cpu.h and prepares for a future armeb-softmmu where most machines would not be built.

Defer touching the SoC devices since most have implicit or explicit dependencies on the CPU.

---
 default-configs/arm-softmmu.mak |   18 ++++++++++++++++++
 hw/Makefile.objs                |   20 ++++++++++++++++++++
 hw/arm/Makefile.objs            |   15 +++------------
 3 files changed, 41 insertions(+), 12 deletions(-)
default-configs/arm-softmmu.mak +18 -0
index e542b4f..f335a72 100644
@@ -27,3 +27,21 @@ CONFIG_SMC91C111=y
 CONFIG_DS1338=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
+
+CONFIG_ARM_TIMER=y
+CONFIG_PL011=y
+CONFIG_PL022=y
+CONFIG_PL031=y
+CONFIG_PL041=y
+CONFIG_PL050=y
+CONFIG_PL061=y
+CONFIG_PL080=y
+CONFIG_PL110=y
+CONFIG_PL181=y
+CONFIG_PL190=y
+CONFIG_PL310=y
+CONFIG_CADENCE=y
+CONFIG_XGMAC=y
+
+CONFIG_VERSATILE_PCI=y
+CONFIG_VERSATILE_I2C=y
hw/Makefile.objs +20 -0
index 6eee9a0..7f57ed5 100644
@@ -74,6 +74,26 @@ hw-obj-$(CONFIG_PUV3) += puv3_gpio.o
 hw-obj-$(CONFIG_PUV3) += puv3_pm.o
 hw-obj-$(CONFIG_PUV3) += puv3_dma.o
 
+# ARM devices
+hw-obj-$(CONFIG_ARM_TIMER) += arm_timer.o
+hw-obj-$(CONFIG_PL011) += pl011.o
+hw-obj-$(CONFIG_PL022) += pl022.o
+hw-obj-$(CONFIG_PL031) += pl031.o
+hw-obj-$(CONFIG_PL041) += pl041.o lm4549.o
+hw-obj-$(CONFIG_PL050) += pl050.o
+hw-obj-$(CONFIG_PL061) += pl061.o
+hw-obj-$(CONFIG_PL080) += pl080.o
+hw-obj-$(CONFIG_PL110) += pl110.o
+hw-obj-$(CONFIG_PL181) += pl181.o
+hw-obj-$(CONFIG_PL190) += pl190.o
+hw-obj-$(CONFIG_PL310) += arm_l2x0.o
+hw-obj-$(CONFIG_VERSATILE_PCI) += versatile_pci.o
+hw-obj-$(CONFIG_VERSATILE_I2C) += versatile_i2c.o
+hw-obj-$(CONFIG_CADENCE) += cadence_uart.o
+hw-obj-$(CONFIG_CADENCE) += cadence_ttc.o
+hw-obj-$(CONFIG_CADENCE) += cadence_gem.o
+hw-obj-$(CONFIG_XGMAC) += xgmac.o
+
 # PCI watchdog devices
 hw-obj-$(CONFIG_PCI) += wdt_i6300esb.o
 
hw/arm/Makefile.objs +3 -12
index c413780..2b39fb3 100644
@@ -1,10 +1,5 @@
-obj-y = integratorcp.o versatilepb.o arm_pic.o arm_timer.o
-obj-y += arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
-obj-y += versatile_pci.o
-obj-y += versatile_i2c.o
-obj-y += cadence_uart.o
-obj-y += cadence_ttc.o
-obj-y += cadence_gem.o
+obj-y = integratorcp.o versatilepb.o arm_pic.o
+obj-y += arm_boot.o
 obj-y += xilinx_zynq.o zynq_slcr.o
 obj-y += arm_gic.o arm_gic_common.o
 obj-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
@@ -12,12 +7,9 @@ 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 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
+obj-y += armv7m.o armv7m_nvic.o stellaris.o stellaris_enet.o
 obj-y += highbank.o
-obj-y += pl061.o
-obj-y += xgmac.o
 obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
 obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
 obj-y += gumstix.o
@@ -37,7 +29,6 @@ obj-y += strongarm.o
 obj-y += collie.o
 obj-y += imx_serial.o imx_ccm.o imx_timer.o imx_avic.o
 obj-y += kzm.o
-obj-y += pl041.o lm4549.o
 obj-$(CONFIG_FDT) += ../device_tree.o
 
 obj-y := $(addprefix ../,$(obj-y))
Signature · 1 line
1.7.9.5
#12 lore raw
In reply to Peter Maydell
Quoted 8 lines · Peter Maydell

This is the usual arm-devs pullreq, with the last set of patches to go in before the 1.2 hardfreeze. Nothing particularly exciting here, mostly just cleanup, plus a fix for that embarrassing "v7m machines assert on startup" bug of mine.

thanks
-- PMM

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 40 lines

The following changes since commit 33e95c6328a3149a52615176617997c4f8f7088b:

qom: Reimplement Interfaces (2012-08-13 11:20:41 +0200)

are available in the git repository at:

git://git.linaro.org/people/pmaydell/qemu-arm.git arm-devs.next

for you to fetch changes up to 58f9b98f8a341c8b7bb0c9b38e492a01fe71d666:

arm: Move some ARM devices into libhw (2012-08-13 16:13:02 +0100)

----------------------------------------------------------------
Andreas Färber (1):
arm: Move some ARM devices into libhw

Mitsyanko Igor (6):
hw/sd.c: convert wp_groups in SDState to bitfield hw/sd.c: make sd_wp_addr() accept 64 bit address argument hw/sd.c: introduce wrapper for conversion address to wp group hw/sd.c: convert binary variables to bool
hw/sd.c: make sd_dataready() return bool
hw/sd.c: make sd_wp_addr() return bool

Peter A. G. Crosthwaite (2):
armv7m: Guard against no -kernel argument
ssd0323: abort() instead of exit(1) on error.

Peter Maydell (1):
hw/armv7m_nvic: Fix incorrect default for num-irqs property

 default-configs/arm-softmmu.mak |   18 ++++++++++
 hw/Makefile.objs                |   20 +++++++++++
 hw/arm/Makefile.objs            |   15 ++------
 hw/armv7m.c                     |    5 +++
 hw/armv7m_nvic.c                |   21 ++++++++----
 hw/sd.c                         |   72 +++++++++++++++++++++------------------
 hw/sd.h                         |    6 ++--
 hw/ssd0323.c                    |    4 ++-
 8 files changed, 104 insertions(+), 57 deletions(-)