Skip to contentSkip to conversation

Trivial patches for 2014-06-10

GIT PULL Applied Michael Tokarev 2 participants 27 messages Jun 10, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Another trivial-patches pull request.

Lots of small things all over this time. Mostly by Peter Maydell ;)

There's one sort-of questionable patch by myself - fixing error message in virtio.c, which is "shiny new", but I think such a really trivial thing is fine ;)

Please consider pulling.

Thanks,

/mjt

The following changes since commit 3334e929ae2d01e47c3e64757ee7fcf975cede94:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-console-20140610-1' into staging (2014-06-10 12:06:17 +0100)

are available in the git repository at:

git://git.corpit.ru/qemu.git tags/trivial-patches-2014-06-10

for you to fetch changes up to 1a2858995d283ddad4a745460d1cc770a9b93fc1:

virtio.c: fix error message (2014-06-10 20:07:01 +0400)

----------------------------------------------------------------
trivial patches for 2014-06-10

----------------------------------------------------------------
Chen Gang (1):
migration: Plug memory leak in migrate-set-cache-size command

Markus Armbruster (2):
libcacard: Drop superfluous conditionals around g_free()
libcacard: Clean up dead stores before g_free()

Michael Tokarev (1):
virtio.c: fix error message

Nicolas Owens (1):
hw: vmware_vga: don't return cursorx when the driver asks for cursory register

Paolo Bonzini (3):
vdi: remove double conversion
smbios: use g_free directly on NULL pointers cpu/x86: correctly set errors in x86_cpu_parse_featurestr

Peter Crosthwaite (4):
net: cadence_gem: Fix Tx descriptor update
net: cadence_gem: Add Tx descriptor fetch printf
net: cadence_gem: Comment spelling sweep
net: cadence_gem: Remove &desc[0] usages

Peter Maydell (11):
slirp: Remove unused zero_ethaddr[] variable hw/i386/pc.c: Remove unused parallel_io and parallel_irq variables hw/sd/sd.c: Drop unused sd_acmd_type[] array util/qemu-sockets.c: Avoid unused variable warnings hw/dma/xilinx_axidma: Remove unused stream_halted() function hw/intc/openpic: Remove unused function IRQ_testbit() hw/isa/pc87312: Remove unused function is_parallel_epp() target-i386/translate.c: Remove unused tcg_gen_lshift() hw/misc/milkymist-softusb: Remove unused softusb_{read, write}_pmem()
target-microblaze: Delete unused sign_extend() function hw/net/ne2000-isa: Register vmstate struct

Sergey Fedorov (1):
qtest: fix hex2nib for capital characters

Stefan Weil (1):
apb: Fix compiler warnings (large constants)

 arch_init.c                   |    1 -
 block/vdi.c                   |    1 -
 hw/display/vmware_vga.c       |    2 +-
 hw/dma/xilinx_axidma.c        |    5 -----
 hw/i386/pc.c                  |    3 ---
 hw/i386/smbios.c              |    9 ++-------
 hw/input/milkymist-softusb.c  |   25 -------------------------
 hw/intc/openpic.c             |    5 -----
 hw/isa/pc87312.c              |    5 -----
 hw/net/cadence_gem.c          |   31 ++++++++++++++++++-------------
 hw/net/ne2000-isa.c           |    1 +
 hw/pci-host/apb.c             |    4 ++--
 hw/sd/sd.c                    |   11 -----------
 hw/virtio/virtio.c            |    2 +-
 libcacard/cac.c               |   14 ++++----------
 libcacard/card_7816.c         |   12 +++---------
 libcacard/vcard.c             |   12 ++----------
 libcacard/vcard_emul_nss.c    |    4 +---
 libcacard/vreader.c           |    6 +-----
 page_cache.c                  |    1 +
 qtest.c                       |    2 +-
 slirp/slirp.c                 |    2 --
 target-i386/cpu.c             |   17 +++++++----------
 target-i386/translate.c       |    8 --------
 target-microblaze/translate.c |   13 -------------
 util/qemu-sockets.c           |    3 +--
 26 files changed, 46 insertions(+), 153 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 02/25] net: cadence_gem: Add Tx descriptor fetch printf

From: Peter Crosthwaite <[email protected]>

Add a debug printf for TX descriptor fetching. This is helpful to anyone needing to debug TX ring buffer traversal. It is also now consistent with the RX code which has a similar printf.

---
 hw/net/cadence_gem.c |    3 +++
 1 file changed, 3 insertions(+)
hw/net/cadence_gem.c +3 -0
index 5335db8..cfb696a 100644
@@ -880,6 +880,8 @@ static void gem_transmit(GemState *s)
 
     /* read current descriptor */
     packet_desc_addr = s->tx_desc_addr;
+
+    DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
     cpu_physical_memory_read(packet_desc_addr,
                              (uint8_t *)&desc[0], sizeof(desc));
     /* Handle all descriptors owned by hardware */
@@ -962,6 +964,7 @@ static void gem_transmit(GemState *s)
         } else {
             packet_desc_addr += 8;
         }
+        DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
         cpu_physical_memory_read(packet_desc_addr,
                                  (uint8_t *)&desc[0], sizeof(desc));
     }
Signature · 1 line
1.7.10.4
#2 lore raw

[Qemu-devel] [PULL 06/25] slirp: Remove unused zero_ethaddr[] variable

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The zero_ethaddr[] array is never used; delete it.

---
 slirp/slirp.c |    2 --
 1 file changed, 2 deletions(-)
slirp/slirp.c +0 -2
index 6028036..35f819a 100644
@@ -37,8 +37,6 @@ static const uint8_t special_ethaddr[ETH_ALEN] = {
     0x52, 0x55, 0x00, 0x00, 0x00, 0x00
 };
 
-static const uint8_t zero_ethaddr[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
-
 u_int curtime;
 
 static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances =
Signature · 1 line
1.7.10.4
#3 lore raw

[Qemu-devel] [PULL 05/25] qtest: fix hex2nib for capital characters

In reply to Michael Tokarev

From: Sergey Fedorov <[email protected]>

---
 qtest.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
qtest.c +1 -1
index f9695a8..04a6dc1 100644
@@ -148,7 +148,7 @@ static int hex2nib(char ch)
     } else if (ch >= 'a' && ch <= 'f') {
         return 10 + (ch - 'a');
     } else if (ch >= 'A' && ch <= 'F') {
-        return 10 + (ch - 'a');
+        return 10 + (ch - 'A');
     } else {
         return -1;
     }
Signature · 1 line
1.7.10.4
#4 lore raw

[Qemu-devel] [PULL 04/25] net: cadence_gem: Remove &desc[0] usages

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

Just use desc instead.

---
 hw/net/cadence_gem.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/cadence_gem.c +2 -2
index fe40b4e..de26609 100644
@@ -883,7 +883,7 @@ static void gem_transmit(GemState *s)
 
     DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
     cpu_physical_memory_read(packet_desc_addr,
-                             (uint8_t *)&desc[0], sizeof(desc));
+                             (uint8_t *)desc, sizeof(desc));
     /* Handle all descriptors owned by hardware */
     while (tx_desc_get_used(desc) == 0) {
 
@@ -966,7 +966,7 @@ static void gem_transmit(GemState *s)
         }
         DB_PRINT("read descriptor 0x%" HWADDR_PRIx "\n", packet_desc_addr);
         cpu_physical_memory_read(packet_desc_addr,
-                                 (uint8_t *)&desc[0], sizeof(desc));
+                                 (uint8_t *)desc, sizeof(desc));
     }
 
     if (tx_desc_get_used(desc)) {
Signature · 1 line
1.7.10.4
#5 lore raw

[Qemu-devel] [PULL 10/25] hw/dma/xilinx_axidma: Remove unused stream_halted() function

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The stream_halted() function is never used; remove it.

---
 hw/dma/xilinx_axidma.c |    5 -----
 1 file changed, 5 deletions(-)
hw/dma/xilinx_axidma.c +0 -5
index cc90eb5..ee60d3f 100644
@@ -157,11 +157,6 @@ static inline int stream_running(struct Stream *s)
     return s->regs[R_DMACR] & DMACR_RUNSTOP;
 }
 
-static inline int stream_halted(struct Stream *s)
-{
-    return s->regs[R_DMASR] & DMASR_HALTED;
-}
-
 static inline int stream_idle(struct Stream *s)
 {
     return !!(s->regs[R_DMASR] & DMASR_IDLE);
Signature · 1 line
1.7.10.4
#6 lore raw

[Qemu-devel] [PULL 19/25] smbios: use g_free directly on NULL pointers

In reply to Michael Tokarev

From: Paolo Bonzini <[email protected]>

No need to wrap it with an if.

---
 hw/i386/smbios.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
hw/i386/smbios.c +2 -7
index b3bedde..e3fa1b2 100644
@@ -745,11 +745,6 @@ void smbios_set_cpuid(uint32_t version, uint32_t features)
         field = value;                                                    \
     }
 
-#define G_FREE_UNLESS_NULL(ptr)                                           \
-    if (ptr != NULL) {                                                    \
-        g_free(ptr);                                                      \
-    }
-
 void smbios_set_defaults(const char *manufacturer, const char *product,
                          const char *version, bool legacy_mode)
 {
@@ -758,7 +753,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
 
     /* drop unwanted version of command-line file blob(s) */
     if (smbios_legacy) {
-        G_FREE_UNLESS_NULL(smbios_tables);
+        g_free(smbios_tables);
         /* in legacy mode, also complain if fields were given for types > 1 */
         if (find_next_bit(have_fields_bitmap,
                           SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) {
@@ -767,7 +762,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
             exit(1);
         }
     } else {
-        G_FREE_UNLESS_NULL(smbios_entries);
+        g_free(smbios_entries);
     }
 
     SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer);
Signature · 1 line
1.7.10.4
#7 lore raw

[Qemu-devel] [PULL 22/25] libcacard: Clean up dead stores before g_free()

In reply to Michael Tokarev

From: Markus Armbruster <[email protected]>

---
 libcacard/vcard.c   |    4 ----
 libcacard/vreader.c |    2 --
 2 files changed, 6 deletions(-)
libcacard/vcard.c +0 -4
index bf342aa..87ad516 100644
@@ -117,10 +117,8 @@ vcard_delete_applet(VCardApplet *applet)
     }
     if (applet->applet_private_free) {
         applet->applet_private_free(applet->applet_private);
-        applet->applet_private = NULL;
     }
     g_free(applet->aid);
-    applet->aid = NULL;
     g_free(applet);
 }
 
@@ -174,8 +172,6 @@ vcard_free(VCard *vcard)
     }
     if (vcard->vcard_private_free) {
         (*vcard->vcard_private_free)(vcard->vcard_private);
-        vcard->vcard_private_free = 0;
-        vcard->vcard_private = 0;
     }
     for (current_applet = vcard->applet_list; current_applet;
                                         current_applet = next_applet) {
libcacard/vreader.c +0 -2
index ffa05b6..9f42f0f 100644
@@ -343,8 +343,6 @@ vreader_list_delete(VReaderList *list)
         next_entry = vreader_list_get_next(current_entry);
         vreader_list_entry_delete(current_entry);
     }
-    list->head = NULL;
-    list->tail = NULL;
     g_free(list);
 }
 
Signature · 1 line
1.7.10.4
#8 lore raw

[Qemu-devel] [PULL 21/25] libcacard: Drop superfluous conditionals around g_free()

In reply to Michael Tokarev

From: Markus Armbruster <[email protected]>

---
 libcacard/cac.c            |   14 ++++----------
 libcacard/card_7816.c      |   12 +++---------
 libcacard/vcard.c          |   10 +++-------
 libcacard/vcard_emul_nss.c |    4 +---
 libcacard/vreader.c        |    4 +---
 5 files changed, 12 insertions(+), 32 deletions(-)
libcacard/cac.c +4 -10
index 0a0163d..ae8c378 100644
@@ -100,10 +100,8 @@ cac_applet_pki_reset(VCard *card, int channel)
     pki_applet = &(applet_private->u.pki_data);
 
     pki_applet->cert_buffer = NULL;
-    if (pki_applet->sign_buffer) {
-        g_free(pki_applet->sign_buffer);
-        pki_applet->sign_buffer = NULL;
-    }
+    g_free(pki_applet->sign_buffer);
+    pki_applet->sign_buffer = NULL;
     pki_applet->cert_buffer_len = 0;
     pki_applet->sign_buffer_len = 0;
     return VCARD_DONE;
@@ -285,12 +283,8 @@ cac_delete_pki_applet_private(VCardAppletPrivate *applet_private)
         return;
     }
     pki_applet_data = &(applet_private->u.pki_data);
-    if (pki_applet_data->cert != NULL) {
-        g_free(pki_applet_data->cert);
-    }
-    if (pki_applet_data->sign_buffer != NULL) {
-        g_free(pki_applet_data->sign_buffer);
-    }
+    g_free(pki_applet_data->cert);
+    g_free(pki_applet_data->sign_buffer);
     if (pki_applet_data->key != NULL) {
         vcard_emul_delete_key(pki_applet_data->key);
     }
libcacard/card_7816.c +3 -9
index a54f880..814fa16 100644
@@ -172,16 +172,12 @@ vcard_response_delete(VCardResponse *response)
     switch (response->b_type) {
     case VCARD_MALLOC:
         /* everything was malloc'ed */
-        if (response->b_data) {
-            g_free(response->b_data);
-        }
+        g_free(response->b_data);
         g_free(response);
         break;
     case VCARD_MALLOC_DATA:
         /* only the data buffer was malloc'ed */
-        if (response->b_data) {
-            g_free(response->b_data);
-        }
+        g_free(response->b_data);
         break;
     case VCARD_MALLOC_STRUCT:
         /* only the structure was malloc'ed */
@@ -358,9 +354,7 @@ vcard_apdu_delete(VCardAPDU *apdu)
     if (apdu == NULL) {
         return;
     }
-    if (apdu->a_data) {
-        g_free(apdu->a_data);
-    }
+    g_free(apdu->a_data);
     g_free(apdu);
 }
 
libcacard/vcard.c +3 -7
index 6aaf085..bf342aa 100644
@@ -51,9 +51,7 @@ vcard_buffer_response_delete(VCardBufferResponse *buffer_response)
     if (buffer_response == NULL) {
         return;
     }
-    if (buffer_response->buffer) {
-        g_free(buffer_response->buffer);
-    }
+    g_free(buffer_response->buffer);
     g_free(buffer_response);
 }
 
@@ -121,10 +119,8 @@ vcard_delete_applet(VCardApplet *applet)
         applet->applet_private_free(applet->applet_private);
         applet->applet_private = NULL;
     }
-    if (applet->aid) {
-        g_free(applet->aid);
-        applet->aid = NULL;
-    }
+    g_free(applet->aid);
+    applet->aid = NULL;
     g_free(applet);
 }
 
libcacard/vcard_emul_nss.c +1 -3
index cefc383..f1bba57 100644
@@ -471,9 +471,7 @@ vreader_emul_delete(VReaderEmul *vreader_emul)
     if (vreader_emul->slot) {
         PK11_FreeSlot(vreader_emul->slot);
     }
-    if (vreader_emul->type_params) {
-        g_free(vreader_emul->type_params);
-    }
+    g_free(vreader_emul->type_params);
     g_free(vreader_emul);
 }
 
libcacard/vreader.c +1 -3
index d2a9b7d..ffa05b6 100644
@@ -155,9 +155,7 @@ vreader_free(VReader *reader)
     if (reader->card) {
         vcard_free(reader->card);
     }
-    if (reader->name) {
-        g_free(reader->name);
-    }
+    g_free(reader->name);
     if (reader->reader_private_free) {
         reader->reader_private_free(reader->reader_private);
     }
Signature · 1 line
1.7.10.4
#9 lore raw

[Qemu-devel] [PULL 23/25] migration: Plug memory leak in migrate-set-cache-size command

In reply to Michael Tokarev

From: Chen Gang <[email protected]>

We call g_free() after cache_fini() in migration_end(), but we don't call it after cache_fini() in xbzrle_cache_resize(), leaking the memory.

cache_init() and cache_fini() are a pair. Since cache_init() allocates the cache, let cache_fini() free it. This plugs the leak.

---
 arch_init.c  |    1 -
 page_cache.c |    1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
arch_init.c +0 -1
index 9f1a174..23044c1 100644
@@ -739,7 +739,6 @@ static void migration_end(void)
     XBZRLE_cache_lock();
     if (XBZRLE.cache) {
         cache_fini(XBZRLE.cache);
-        g_free(XBZRLE.cache);
         g_free(XBZRLE.encoded_buf);
         g_free(XBZRLE.current_buf);
         XBZRLE.cache = NULL;
page_cache.c +1 -0
index b033681..89bb1ec 100644
@@ -109,6 +109,7 @@ void cache_fini(PageCache *cache)
 
     g_free(cache->page_cache);
     cache->page_cache = NULL;
+    g_free(cache);
 }
 
 static size_t cache_get_cache_pos(const PageCache *cache,
Signature · 1 line
1.7.10.4
#10 lore raw

[Qemu-devel] [PULL 17/25] apb: Fix compiler warnings (large constants)

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

Both constants need more than 32 bit.

---
 hw/pci-host/apb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/pci-host/apb.c +2 -2
index 1497008..6fa2723 100644
@@ -99,8 +99,8 @@ do { printf("IOMMU: " fmt , ## __VA_ARGS__); } while (0)
 #define IOMMU_TTE_DATA_SIZE     (1ULL << 61)
 #define IOMMU_TTE_DATA_W        (1ULL << 1)
 
-#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000
-#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000
+#define IOMMU_TTE_PHYS_MASK_8K  0x1ffffffe000ULL
+#define IOMMU_TTE_PHYS_MASK_64K 0x1ffffff8000ULL
 
 #define IOMMU_TSB_8K_OFFSET_MASK_8M    0x00000000007fe000ULL
 #define IOMMU_TSB_8K_OFFSET_MASK_16M   0x0000000000ffe000ULL
Signature · 1 line
1.7.10.4
#11 lore raw

[Qemu-devel] [PULL 14/25] hw/misc/milkymist-softusb: Remove unused softusb_{read, write}_pmem()

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The functions softusb_read_pmem() and softusb_write_pmem() are unused; remove them.

---
 hw/input/milkymist-softusb.c |   25 -------------------------
 1 file changed, 25 deletions(-)
hw/input/milkymist-softusb.c +0 -25
index 53ba714..1b4b8d4 100644
@@ -156,31 +156,6 @@ static inline void softusb_write_dmem(MilkymistSoftUsbState *s,
     memcpy(s->dmem_ptr + offset, buf, len);
 }
 
-static inline void softusb_read_pmem(MilkymistSoftUsbState *s,
-        uint32_t offset, uint8_t *buf, uint32_t len)
-{
-    if (offset + len >= s->pmem_size) {
-        error_report("milkymist_softusb: read pmem out of bounds "
-                "at offset 0x%x, len %d", offset, len);
-        memset(buf, 0, len);
-        return;
-    }
-
-    memcpy(buf, s->pmem_ptr + offset, len);
-}
-
-static inline void softusb_write_pmem(MilkymistSoftUsbState *s,
-        uint32_t offset, uint8_t *buf, uint32_t len)
-{
-    if (offset + len >= s->pmem_size) {
-        error_report("milkymist_softusb: write pmem out of bounds "
-                "at offset 0x%x, len %d", offset, len);
-        return;
-    }
-
-    memcpy(s->pmem_ptr + offset, buf, len);
-}
-
 static void softusb_mouse_changed(MilkymistSoftUsbState *s)
 {
     uint8_t m;
Signature · 1 line
1.7.10.4
#12 lore raw

[Qemu-devel] [PULL 12/25] hw/isa/pc87312: Remove unused function is_parallel_epp()

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The function is_parallel_epp() is unused; remove it.

---
 hw/isa/pc87312.c |    5 -----
 1 file changed, 5 deletions(-)
hw/isa/pc87312.c +0 -5
index b352b49..9327c53 100644
@@ -86,11 +86,6 @@ static inline uint32_t get_parallel_irq(PC87312State *s)
     }
 }
 
-static inline bool is_parallel_epp(PC87312State *s)
-{
-    return s->regs[REG_PTR] & PTR_EPP_MODE;
-}
-
 
 /* UARTs */
 
Signature · 1 line
1.7.10.4
#13 lore raw

[Qemu-devel] [PULL 01/25] net: cadence_gem: Fix Tx descriptor update

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

The local variable "desc" was being used to read-modify-write the first descriptor (of a multi-desc packet) upon packet completion. desc however continues to be used by the code as the current descriptor. Give this first desc RMW it's own local variable to avoid trampling.

---
 hw/net/cadence_gem.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
hw/net/cadence_gem.c +7 -5
index a26861e..5335db8 100644
@@ -911,14 +911,16 @@ static void gem_transmit(GemState *s)
 
         /* Last descriptor for this packet; hand the whole thing off */
         if (tx_desc_get_last(desc)) {
+            unsigned    desc_first[2];
+
             /* Modify the 1st descriptor of this packet to be owned by
              * the processor.
              */
-            cpu_physical_memory_read(s->tx_desc_addr,
-                                     (uint8_t *)&desc[0], sizeof(desc));
-            tx_desc_set_used(desc);
-            cpu_physical_memory_write(s->tx_desc_addr,
-                                      (uint8_t *)&desc[0], sizeof(desc));
+            cpu_physical_memory_read(s->tx_desc_addr, (uint8_t *)desc_first,
+                                     sizeof(desc_first));
+            tx_desc_set_used(desc_first);
+            cpu_physical_memory_write(s->tx_desc_addr, (uint8_t *)desc_first,
+                                      sizeof(desc_first));
             /* Advance the hardare current descriptor past this packet */
             if (tx_desc_get_wrap(desc)) {
                 s->tx_desc_addr = s->regs[GEM_TXQBASE];
Signature · 1 line
1.7.10.4
#14 lore raw

[Qemu-devel] [PULL 24/25] hw: vmware_vga: don't return cursorx when the driver asks for cursory register

In reply to Michael Tokarev

From: Nicolas Owens <[email protected]>

hello qemu-*@nongnu.org, this is my first contribution. apologies if something is incorrect.

this patch fixes vmware_vga.c so that it actually returns the cursory register when asked for, instead of cursorx.

---
 hw/display/vmware_vga.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/display/vmware_vga.c +1 -1
index 9ba47e6..ab54b6f 100644
@@ -863,7 +863,7 @@ static uint32_t vmsvga_value_read(void *opaque, uint32_t address)
         break;
 
     case SVGA_REG_CURSOR_Y:
-        ret = s->cursor.x;
+        ret = s->cursor.y;
         break;
 
     case SVGA_REG_CURSOR_ON:
Signature · 1 line
1.7.10.4
#15 lore raw

[Qemu-devel] [PULL 03/25] net: cadence_gem: Comment spelling sweep

In reply to Michael Tokarev

From: Peter Crosthwaite <[email protected]>

Fix some typos in comments.

---
 hw/net/cadence_gem.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
hw/net/cadence_gem.c +6 -6
index cfb696a..fe40b4e 100644
@@ -50,7 +50,7 @@
 #define GEM_IER           (0x00000028/4) /* Interrupt Enable reg */
 #define GEM_IDR           (0x0000002C/4) /* Interrupt Disable reg */
 #define GEM_IMR           (0x00000030/4) /* Interrupt Mask reg */
-#define GEM_PHYMNTNC      (0x00000034/4) /* Phy Maintaince reg */
+#define GEM_PHYMNTNC      (0x00000034/4) /* Phy Maintenance reg */
 #define GEM_RXPAUSE       (0x00000038/4) /* RX Pause Time reg */
 #define GEM_TXPAUSE       (0x0000003C/4) /* TX Pause Time reg */
 #define GEM_TXPARTIALSF   (0x00000040/4) /* TX Partial Store and Forward */
@@ -150,7 +150,7 @@
 #define GEM_NWCTRL_LOCALLOOP   0x00000002 /* Local Loopback */
 
 #define GEM_NWCFG_STRIP_FCS    0x00020000 /* Strip FCS field */
-#define GEM_NWCFG_LERR_DISC    0x00010000 /* Discard RX frames with lenth err */
+#define GEM_NWCFG_LERR_DISC    0x00010000 /* Discard RX frames with len err */
 #define GEM_NWCFG_BUFF_OFST_M  0x0000C000 /* Receive buffer offset mask */
 #define GEM_NWCFG_BUFF_OFST_S  14         /* Receive buffer offset shift */
 #define GEM_NWCFG_UCAST_HASH   0x00000080 /* accept unicast if hash match */
@@ -397,7 +397,7 @@ static const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
  */
 static void gem_init_register_masks(GemState *s)
 {
-    /* Mask of register bits which are read only*/
+    /* Mask of register bits which are read only */
     memset(&s->regs_ro[0], 0, sizeof(s->regs_ro));
     s->regs_ro[GEM_NWCTRL]   = 0xFFF80000;
     s->regs_ro[GEM_NWSTATUS] = 0xFFFFFFFF;
@@ -719,7 +719,7 @@ static ssize_t gem_receive(NetClientState *nc, const uint8_t *buf, size_t size)
         unsigned crc_val;
 
         /* The application wants the FCS field, which QEMU does not provide.
-         * We must try and caclculate one.
+         * We must try and calculate one.
          */
 
         memcpy(rxbuf, buf, size);
@@ -871,7 +871,7 @@ static void gem_transmit(GemState *s)
 
     DB_PRINT("\n");
 
-    /* The packet we will hand off to qemu.
+    /* The packet we will hand off to QEMU.
      * Packets scattered across multiple descriptors are gathered to this
      * one contiguous buffer first.
      */
@@ -923,7 +923,7 @@ static void gem_transmit(GemState *s)
             tx_desc_set_used(desc_first);
             cpu_physical_memory_write(s->tx_desc_addr, (uint8_t *)desc_first,
                                       sizeof(desc_first));
-            /* Advance the hardare current descriptor past this packet */
+            /* Advance the hardware current descriptor past this packet */
             if (tx_desc_get_wrap(desc)) {
                 s->tx_desc_addr = s->regs[GEM_TXQBASE];
             } else {
Signature · 1 line
1.7.10.4
#16 lore raw

[Qemu-devel] [PULL 11/25] hw/intc/openpic: Remove unused function IRQ_testbit()

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The IRQ_testbit() function is never used; remove it.

---
 hw/intc/openpic.c |    5 -----
 1 file changed, 5 deletions(-)
hw/intc/openpic.c +0 -5
index 17136c9..08e0e19 100644
@@ -311,11 +311,6 @@ static inline void IRQ_resetbit(IRQQueue *q, int n_IRQ)
     clear_bit(n_IRQ, q->queue);
 }
 
-static inline int IRQ_testbit(IRQQueue *q, int n_IRQ)
-{
-    return test_bit(n_IRQ, q->queue);
-}
-
 static void IRQ_check(OpenPICState *opp, IRQQueue *q)
 {
     int irq = -1;
Signature · 1 line
1.7.10.4
#17 lore raw

[Qemu-devel] [PULL 13/25] target-i386/translate.c: Remove unused tcg_gen_lshift()

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The function tcg_gen_lshift() is unused; remove it.

---
 target-i386/translate.c |    8 --------
 1 file changed, 8 deletions(-)
target-i386/translate.c +0 -8
index 2359787..6fcd824 100644
@@ -1506,14 +1506,6 @@ static void gen_shift_rm_im(DisasContext *s, TCGMemOp ot, int op1, int op2,
     }
 }
 
-static inline void tcg_gen_lshift(TCGv ret, TCGv arg1, target_long arg2)
-{
-    if (arg2 >= 0)
-        tcg_gen_shli_tl(ret, arg1, arg2);
-    else
-        tcg_gen_shri_tl(ret, arg1, -arg2);
-}
-
 static void gen_rot_rm_T1(DisasContext *s, TCGMemOp ot, int op1, int is_right)
 {
     target_ulong mask = (ot == MO_64 ? 0x3f : 0x1f);
Signature · 1 line
1.7.10.4
#18 lore raw

[Qemu-devel] [PULL 16/25] hw/net/ne2000-isa: Register vmstate struct

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The ne2000-isa device defines a VMState struct for migration, but we forgot to actually register it. Correct this deficiency by setting dc->vmsd.

---
 hw/net/ne2000-isa.c |    1 +
 1 file changed, 1 insertion(+)
hw/net/ne2000-isa.c +1 -0
index c660e58..0a14f6d 100644
@@ -98,6 +98,7 @@ static void isa_ne2000_class_initfn(ObjectClass *klass, void *data)
 
     dc->realize = isa_ne2000_realizefn;
     dc->props = ne2000_isa_properties;
+    dc->vmsd = &vmstate_isa_ne2000;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
 
Signature · 1 line
1.7.10.4
#19 lore raw

[Qemu-devel] [PULL 18/25] vdi: remove double conversion

In reply to Michael Tokarev

From: Paolo Bonzini <[email protected]>

This should be a problem when running on big-endian machines.

---
 block/vdi.c |    1 -
 1 file changed, 1 deletion(-)
block/vdi.c +0 -1
index 27737af..1b2be1a 100644
@@ -239,7 +239,6 @@ static void vdi_header_to_le(VdiHeader *header)
     cpu_to_le32s(&header->block_extra);
     cpu_to_le32s(&header->blocks_in_image);
     cpu_to_le32s(&header->blocks_allocated);
-    cpu_to_le32s(&header->blocks_allocated);
     uuid_convert(header->uuid_image);
     uuid_convert(header->uuid_last_snap);
     uuid_convert(header->uuid_link);
Signature · 1 line
1.7.10.4
#20 lore raw

[Qemu-devel] [PULL 25/25] virtio.c: fix error message

In reply to Michael Tokarev
---
 hw/virtio/virtio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio.c +1 -1
index 3557c17..a07ae8a 100644
@@ -440,7 +440,7 @@ void virtqueue_map_sg(struct iovec *sg, hwaddr *addr,
         len = sg[i].iov_len;
         sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write);
         if (sg[i].iov_base == NULL || len != sg[i].iov_len) {
-            error_report("virtio: trying to map MMIO memory");
+            error_report("virtio: error trying to map MMIO memory");
             exit(1);
         }
     }
Signature · 1 line
1.7.10.4
#21 lore raw

[Qemu-devel] [PULL 07/25] hw/i386/pc.c: Remove unused parallel_io and parallel_irq variables

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The variables parallel_io and parallel_irq are unused; delete them.

---
 hw/i386/pc.c |    3 ---
 1 file changed, 3 deletions(-)
hw/i386/pc.c +0 -3
index e6369d5..32d1632 100644
@@ -922,9 +922,6 @@ static const int ne2000_io[NE2000_NB_MAX] = { 0x300, 0x320, 0x340, 0x360,
                                               0x280, 0x380 };
 static const int ne2000_irq[NE2000_NB_MAX] = { 9, 10, 11, 3, 4, 5 };
 
-static const int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
-static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
-
 void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd)
 {
     static int nb_ne2k = 0;
Signature · 1 line
1.7.10.4
#22 lore raw
In reply to Michael Tokarev
Quoted 21 lines · Michael Tokarev

Another trivial-patches pull request.

Lots of small things all over this time. Mostly by Peter Maydell ;)

There's one sort-of questionable patch by myself - fixing error message in virtio.c, which is "shiny new", but I think such a really trivial thing is fine ;)

Please consider pulling.

Thanks,

/mjt

The following changes since commit 3334e929ae2d01e47c3e64757ee7fcf975cede94:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-console-20140610-1' into staging (2014-06-10 12:06:17 +0100)

are available in the git repository at:

Quoted 9 lines

git://git.corpit.ru/qemu.git tags/trivial-patches-2014-06-10

for you to fetch changes up to 1a2858995d283ddad4a745460d1cc770a9b93fc1:

virtio.c: fix error message (2014-06-10 20:07:01 +0400)

----------------------------------------------------------------
trivial patches for 2014-06-10

Applied, thanks.

-- PMM

#23 lore raw

[Qemu-devel] [PULL 09/25] util/qemu-sockets.c: Avoid unused variable warnings

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The 'on' variable is never used, and 'off' is only used if IPV6_V6ONLY is defined; delete 'on' and move 'off' to the point where it is used. This avoids warnings from clang 3.4.

---
 util/qemu-sockets.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
util/qemu-sockets.c +1 -2
index 627e609..e3d29ee 100644
@@ -30,8 +30,6 @@
 # define AI_ADDRCONFIG 0
 #endif
 
-static const int on=1, off=0;
-
 /* used temporarily until all users are converted to QemuOpts */
 QemuOptsList socket_optslist = {
     .name = "socket",
@@ -159,6 +157,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
 #ifdef IPV6_V6ONLY
         if (e->ai_family == PF_INET6) {
             /* listen on both ipv4 and ipv6 */
+            const int off = 0;
             qemu_setsockopt(slisten, IPPROTO_IPV6, IPV6_V6ONLY, &off,
                             sizeof(off));
         }
Signature · 1 line
1.7.10.4
#24 lore raw

[Qemu-devel] [PULL 20/25] cpu/x86: correctly set errors in x86_cpu_parse_featurestr

In reply to Michael Tokarev

From: Paolo Bonzini <[email protected]>

Because of the "goto out", the contents of local_err are leaked and lost.

---
 target-i386/cpu.c |   17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
target-i386/cpu.c +7 -10
index dde052c..8983457 100644
@@ -1688,8 +1688,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
 
                 numvalue = strtoul(val, &err, 0);
                 if (!*val || *err) {
-                    error_setg(&local_err, "bad numerical value %s", val);
-                    goto out;
+                    error_setg(errp, "bad numerical value %s", val);
+                    return;
                 }
                 if (numvalue < 0x80000000) {
                     error_report("xlevel value shall always be >= 0x80000000"
@@ -1706,8 +1706,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
                 tsc_freq = strtosz_suffix_unit(val, &err,
                                                STRTOSZ_DEFSUFFIX_B, 1000);
                 if (tsc_freq < 0 || *err) {
-                    error_setg(&local_err, "bad numerical value %s", val);
-                    goto out;
+                    error_setg(errp, "bad numerical value %s", val);
+                    return;
                 }
                 snprintf(num, sizeof(num), "%" PRId64, tsc_freq);
                 object_property_parse(OBJECT(cpu), num, "tsc-frequency",
@@ -1718,8 +1718,8 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
                 char num[32];
                 numvalue = strtoul(val, &err, 0);
                 if (!*val || *err) {
-                    error_setg(&local_err, "bad numerical value %s", val);
-                    goto out;
+                    error_setg(errp, "bad numerical value %s", val);
+                    return;
                 }
                 if (numvalue < min) {
                     error_report("hv-spinlocks value shall always be >= 0x%x"
@@ -1738,7 +1738,7 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
         }
         if (local_err) {
             error_propagate(errp, local_err);
-            goto out;
+            return;
         }
         featurestr = strtok(NULL, ",");
     }
@@ -1758,9 +1758,6 @@ static void x86_cpu_parse_featurestr(CPUState *cs, char *features,
     env->features[FEAT_KVM] &= ~minus_features[FEAT_KVM];
     env->features[FEAT_SVM] &= ~minus_features[FEAT_SVM];
     env->features[FEAT_7_0_EBX] &= ~minus_features[FEAT_7_0_EBX];
-
-out:
-    return;
 }
 
 /* generate a composite string into buf of all cpuid names in featureset
Signature · 1 line
1.7.10.4
#25 lore raw

[Qemu-devel] [PULL 08/25] hw/sd/sd.c: Drop unused sd_acmd_type[] array

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

Drop the sd_acmd_type[] array: it is never used. (The equivalent sd_cmd_type[] array for normal commands is used to identify those commands whose argument includes the card address in the top 16 bits; but for app commands the card address is passed with the APP_CMD prefix, not with the argument to the app command itself.)

---
 hw/sd/sd.c |   11 -----------
 1 file changed, 11 deletions(-)
hw/sd/sd.c +0 -11
index 4502ad1..5efe8c1 100644
@@ -151,17 +151,6 @@ static const sd_cmd_type_t sd_cmd_type[64] = {
     sd_adtc, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
 };
 
-static const sd_cmd_type_t sd_acmd_type[64] = {
-    sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_ac,   sd_none,
-    sd_none, sd_none, sd_none, sd_none, sd_none, sd_adtc, sd_none, sd_none,
-    sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_adtc, sd_ac,
-    sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
-    sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
-    sd_none, sd_bcr,  sd_ac,   sd_none, sd_none, sd_none, sd_none, sd_none,
-    sd_none, sd_none, sd_none, sd_adtc, sd_none, sd_none, sd_none, sd_none,
-    sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none, sd_none,
-};
-
 static const int sd_cmd_class[64] = {
     0,  0,  0,  0,  0,  9, 10,  0,  0,  0,  0,  1,  0,  0,  0,  0,
     2,  2,  2,  2,  3,  3,  3,  3,  4,  4,  4,  4,  6,  6,  6,  6,
Signature · 1 line
1.7.10.4
#26 lore raw

[Qemu-devel] [PULL 15/25] target-microblaze: Delete unused sign_extend() function

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

The sign_extend() function is unused; delete it.

---
 target-microblaze/translate.c |   13 -------------
 1 file changed, 13 deletions(-)
target-microblaze/translate.c +0 -13
index c422bdc..03ea158 100644
@@ -99,19 +99,6 @@ static const char *special_regnames[] =
     "sr16", "sr17", "sr18"
 };
 
-/* Sign extend at translation time.  */
-static inline int sign_extend(unsigned int val, unsigned int width)
-{
-        int sval;
-
-        /* LSL.  */
-        val <<= 31 - width;
-        sval = val;
-        /* ASR.  */
-        sval >>= 31 - width;
-        return sval;
-}
-
 static inline void t_sync_flags(DisasContext *dc)
 {
     /* Synch the tb dependent flags between translator and runtime.  */
Signature · 1 line
1.7.10.4