Skip to contentSkip to conversation

hw/ppc/openpic: Do not open-code ROUND_UP() macro

PATCH Applied Philippe Mathieu-Daudé 4 participants 5 messages May 23, 2023 – Jun 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/ppc/openpic: Do not open-code ROUND_UP() macro

While reviewing, the ROUND_UP() macro is easier to figure out. Besides, the comment confirms we want to round up here.

---
 include/hw/ppc/openpic.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/ppc/openpic.h +1 -1
index ebdaf8a493..bae8dafe16 100644
@@ -55,7 +55,7 @@ typedef enum IRQType {
  * Round up to the nearest 64 IRQs so that the queue length
  * won't change when moving between 32 and 64 bit hosts.
  */
-#define IRQQUEUE_SIZE_BITS ((OPENPIC_MAX_IRQ + 63) & ~63)
+#define IRQQUEUE_SIZE_BITS ROUND_UP(OPENPIC_MAX_IRQ, 64)
 
 typedef struct IRQQueue {
     unsigned long *queue;
Signature · 1 line
2.38.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 13 lines · Philippe Mathieu-Daudé

While reviewing, the ROUND_UP() macro is easier to figure out. Besides, the comment confirms we want to round up here.

---
  include/hw/ppc/openpic.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/ppc/openpic.h +0 -0
index ebdaf8a493..bae8dafe16 100644

include/hw/ppc/openpic.h typedef enum IRQType { · line 61

Quoted 8 lines
include/hw/ppc/openpic.h +1 -1
@@ -55,7 +55,7 @@ typedef enum IRQType {
   * Round up to the nearest 64 IRQs so that the queue length
   * won't change when moving between 32 and 64 bit hosts.
   */
-#define IRQQUEUE_SIZE_BITS ((OPENPIC_MAX_IRQ + 63) & ~63)
+#define IRQQUEUE_SIZE_BITS ROUND_UP(OPENPIC_MAX_IRQ, 64)
 
  typedef struct IRQQueue {
      unsigned long *queue;

ATB,

Mark.

#3 lore raw
In reply to Philippe Mathieu-Daudé

There is no generic PPC section in MAINTAINERS covering include/hw/ppc/, so Cc'ing qemu-ppc@ manually.

Daniel, can you take this (reviewed) patch?

Thanks,

Phil.

Quoted 21 lines · Philippe Mathieu-Daudé

While reviewing, the ROUND_UP() macro is easier to figure out. Besides, the comment confirms we want to round up here.

---
  include/hw/ppc/openpic.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/ppc/openpic.h +1 -1
index ebdaf8a493..bae8dafe16 100644
@@ -55,7 +55,7 @@ typedef enum IRQType {
   * Round up to the nearest 64 IRQs so that the queue length
   * won't change when moving between 32 and 64 bit hosts.
   */
-#define IRQQUEUE_SIZE_BITS ((OPENPIC_MAX_IRQ + 63) & ~63)
+#define IRQQUEUE_SIZE_BITS ROUND_UP(OPENPIC_MAX_IRQ, 64)
 
  typedef struct IRQQueue {
      unsigned long *queue;
#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

While reviewing, the ROUND_UP() macro is easier to figure out. Besides, the comment confirms we want to round up here.

---

Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,

Daniel

Quoted 16 lines
  include/hw/ppc/openpic.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/ppc/openpic.h +1 -1
index ebdaf8a493..bae8dafe16 100644
@@ -55,7 +55,7 @@ typedef enum IRQType {
   * Round up to the nearest 64 IRQs so that the queue length
   * won't change when moving between 32 and 64 bit hosts.
   */
-#define IRQQUEUE_SIZE_BITS ((OPENPIC_MAX_IRQ + 63) & ~63)
+#define IRQQUEUE_SIZE_BITS ROUND_UP(OPENPIC_MAX_IRQ, 64)
 
  typedef struct IRQQueue {
      unsigned long *queue;