Skip to contentSkip to conversation

hw/timer/hpet: Fix compiler errors with -DHPET_DEBUG

PATCH In review Dov Murik 3 participants 7 messages Sep 9, 2020 – Sep 16, 2020

lore
Share & tools
lore

Dov Murik

author
#0 lore raw

cover hw/timer/hpet: Fix compiler errors with -DHPET_DEBUG

Fix several compiler errors when compiling withe -DHPET_DEBUG.

Steps to reproduce the issue:

    mkdir build
    cd build
    ../configure --target-list=x86_64-softmmu --extra-cflags=-DHPET_DEBUG
    make

Dov Murik (2):
hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw hw/timer/hpet: Fix debug format strings

 hw/timer/hpet.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 1/2 hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw

Fix compiler error about defined but not used functions when compiling with -DHPET_DEBUG by deleting the unused debug functions hpet_ram_readb and hpet_ram_readw.

---
 hw/timer/hpet.c | 14 --------------
 1 file changed, 14 deletions(-)
hw/timer/hpet.c +0 -14
index 380acfa7c8..b683f64f1d 100644
@@ -416,20 +416,6 @@ static void hpet_del_timer(HPETTimer *t)
     update_irq(t, 0);
 }
 
-#ifdef HPET_DEBUG
-static uint32_t hpet_ram_readb(void *opaque, hwaddr addr)
-{
-    printf("qemu: hpet_read b at %" PRIx64 "\n", addr);
-    return 0;
-}
-
-static uint32_t hpet_ram_readw(void *opaque, hwaddr addr)
-{
-    printf("qemu: hpet_read w at %" PRIx64 "\n", addr);
-    return 0;
-}
-#endif
-
 static uint64_t hpet_ram_read(void *opaque, hwaddr addr,
                               unsigned size)
 {
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH 2/2 hw/timer/hpet: Fix debug format strings

In reply to Dov Murik

Fix compiler errors when compiling with -DHPET_DEBUG due to mismatch between format string token "%x" and the argument type uint64_t.

Also "%#x" is replaced by "0x%" PRIx64 according to the coding style.

---
 hw/timer/hpet.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
hw/timer/hpet.c +7 -6
index b683f64f1d..73d2168c32 100644
@@ -495,7 +495,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
     HPETState *s = opaque;
     uint64_t old_val, new_val, val, index;
 
-    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = %#x\n", addr, value);
+    DPRINTF("qemu: Enter hpet_ram_writel at %" PRIx64 " = 0x%" PRIx64 "\n",
+            addr, value);
     index = addr;
     old_val = hpet_ram_read(opaque, addr, 4);
     new_val = value;
@@ -505,7 +506,7 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
         uint8_t timer_id = (addr - 0x100) / 0x20;
         HPETTimer *timer = &s->timer[timer_id];
 
-        DPRINTF("qemu: hpet_ram_writel timer_id = %#x\n", timer_id);
+        DPRINTF("qemu: hpet_ram_writel timer_id = 0x%x\n", timer_id);
         if (timer_id > s->num_timers) {
             DPRINTF("qemu: timer id out of range\n");
             return;
@@ -637,8 +638,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
             }
             s->hpet_counter =
                 (s->hpet_counter & 0xffffffff00000000ULL) | value;
-            DPRINTF("qemu: HPET counter written. ctr = %#x -> %" PRIx64 "\n",
-                    value, s->hpet_counter);
+            DPRINTF("qemu: HPET counter written. ctr = 0x%" PRIx64 " -> "
+                    "%" PRIx64 "\n", value, s->hpet_counter);
             break;
         case HPET_COUNTER + 4:
             if (hpet_enabled(s)) {
@@ -646,8 +647,8 @@ static void hpet_ram_write(void *opaque, hwaddr addr,
             }
             s->hpet_counter =
                 (s->hpet_counter & 0xffffffffULL) | (((uint64_t)value) << 32);
-            DPRINTF("qemu: HPET counter + 4 written. ctr = %#x -> %" PRIx64 "\n",
-                    value, s->hpet_counter);
+            DPRINTF("qemu: HPET counter + 4 written. ctr = 0x%" PRIx64 " -> "
+                    "%" PRIx64 "\n", value, s->hpet_counter);
             break;
         default:
             DPRINTF("qemu: invalid hpet_ram_writel\n");
Signature · 1 line
2.20.1
#3 lore raw
In reply to Dov Murik
Quoted 9 lines · Dov Murik

Fix several compiler errors when compiling withe -DHPET_DEBUG.

Steps to reproduce the issue:

    mkdir build
    cd build
    ../configure --target-list=x86_64-softmmu --extra-cflags=-DHPET_DEBUG
    make
Quoted 7 lines

Dov Murik (2):
hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw hw/timer/hpet: Fix debug format strings

 hw/timer/hpet.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

I sent almost the same patches last week :)
https://www.mail-archive.com/[email protected]/msg736836.html

You seem to fix a 4th format, can you rebase on top? (As these patches have already been queued).

Glad to see you are interested in debugging the HPET too.

Regards,

Phil.

author
#4 lore raw
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 13 lines · Dov Murik

Fix several compiler errors when compiling withe -DHPET_DEBUG.

Steps to reproduce the issue:

     mkdir build
     cd build
     ../configure --target-list=x86_64-softmmu --extra-cflags=-DHPET_DEBUG
     make

Dov Murik (2):
hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw hw/timer/hpet: Fix debug format strings

Quoted 6 lines
Quoted 3 lines
  hw/timer/hpet.c | 27 +++++++--------------------
  1 file changed, 7 insertions(+), 20 deletions(-)

I sent almost the same patches last week :)
https://www.mail-archive.com/[email protected]/msg736836.html

Oops, missed that. You're right.

Quoted 2 lines

You seem to fix a 4th format, can you rebase on top? (As these patches have already been queued).

Actually there's a small issue in one of your suggested fixes: you added "0x" but kept the "%#". I think it should be without the "#" (also according to the coding style document).

I suggest you fix this small issue, and also add any changes you wish from this patchset; then we can throw my patchset to the bin.

-Dov

#5 lore raw

Cc'ing qemu-trivial@

Quoted 28 lines · Dov Murik
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Dov Murik

Fix several compiler errors when compiling withe -DHPET_DEBUG.

Steps to reproduce the issue:

     mkdir build
     cd build
     ../configure --target-list=x86_64-softmmu
--extra-cflags=-DHPET_DEBUG
     make

Dov Murik (2):
   hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw hw/timer/hpet: Fix debug format strings

Quoted 6 lines
Quoted 3 lines

  hw/timer/hpet.c | 27 +++++++--------------------

  1 file changed, 7 insertions(+), 20 deletions(-)

I sent almost the same patches last week :)
https://www.mail-archive.com/[email protected]/msg736836.html

Oops, missed that. You're right.

Quoted 2 lines

You seem to fix a 4th format, can you rebase on top? (As these patches have already been queued).

Quoted 6 lines

Actually there's a small issue in one of your suggested fixes: you added "0x" but kept the "%#".  I think it should be without the "#" (also according to the coding style document).

I suggest you fix this small issue, and also add any changes you wish from this patchset; then we can throw my patchset to the bin.

Let's use your patchset instead.

Series:

Quoted 3 lines

-Dov

#6 lore raw

Le 13/09/2020 à 13:42, Philippe Mathieu-Daudé a écrit :

Quoted 35 lines

Cc'ing qemu-trivial@

Quoted 32 lines · Dov Murik
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Dov Murik

Fix several compiler errors when compiling withe -DHPET_DEBUG.

Steps to reproduce the issue:

     mkdir build
     cd build
     ../configure --target-list=x86_64-softmmu
--extra-cflags=-DHPET_DEBUG
     make

Dov Murik (2):
   hw/timer/hpet: Remove unused functions hpet_ram_readb, hpet_ram_readw hw/timer/hpet: Fix debug format strings

Quoted 6 lines
Quoted 3 lines

  hw/timer/hpet.c | 27 +++++++--------------------

  1 file changed, 7 insertions(+), 20 deletions(-)

I sent almost the same patches last week :)
https://www.mail-archive.com/[email protected]/msg736836.html

Oops, missed that. You're right.

Quoted 2 lines

You seem to fix a 4th format, can you rebase on top? (As these patches have already been queued).

Actually there's a small issue in one of your suggested fixes: you added "0x" but kept the "%#".  I think it should be without the "#" (also according to the coding style document).

Quoted 8 lines
Quoted 2 lines

I suggest you fix this small issue, and also add any changes you wish from this patchset; then we can throw my patchset to the bin.

Let's use your patchset instead.

Series:

Series applied to my trivial-patches branch.

Thanks,
Laurent