Skip to contentSkip to conversation

Fix receive FIFO filling up (raspi3)

PATCH Applied ~fvanhovell 3 participants 4 messages Jul 21, 2024 – Jul 25, 2024

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

PATCH 1/1 Fix receive FIFO filling up (raspi3)

From: Frederik van Hövell <[email protected]>

When a bare-metal application on the raspi3 board reads the AUX_MU_STAT_REG MMIO register while the device's buffer is at full receive FIFO capacity
(i.e. s->read_count == BCM2835_AUX_RX_FIFO_LEN) the assertion assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN) fails.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/459

---
 hw/char/bcm2835_aux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/bcm2835_aux.c +1 -1
index 83990e20f7..fca2f27a55 100644
@@ -138,7 +138,7 @@ static uint64_t bcm2835_aux_read(void *opaque, hwaddr offset, unsigned size)
         res = 0x30e; /* space in the output buffer, empty tx fifo, idle tx/rx */
         if (s->read_count > 0) {
             res |= 0x1; /* data in input buffer */
-            assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN);
+            assert(s->read_count <= BCM2835_AUX_RX_FIFO_LEN);
             res |= ((uint32_t)s->read_count) << 16; /* rx fifo fill level */
         }
         return res;
Signature · 1 line
2.43.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · ~fvanhovell

From: Frederik van Hövell <[email protected]>

When a bare-metal application on the raspi3 board reads the AUX_MU_STAT_REG MMIO register while the device's buffer is at full receive FIFO capacity
(i.e. s->read_count == BCM2835_AUX_RX_FIFO_LEN) the assertion assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN) fails.

Quoted 19 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/459

---
  hw/char/bcm2835_aux.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/bcm2835_aux.c +1 -1
index 83990e20f7..fca2f27a55 100644
@@ -138,7 +138,7 @@ static uint64_t bcm2835_aux_read(void *opaque, hwaddr offset, unsigned size)
          res = 0x30e; /* space in the output buffer, empty tx fifo, idle tx/rx */
          if (s->read_count > 0) {
              res |= 0x1; /* data in input buffer */
-            assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN);
+            assert(s->read_count <= BCM2835_AUX_RX_FIFO_LEN);
              res |= ((uint32_t)s->read_count) << 16; /* rx fifo fill level */
          }
          return res;
#2 lore raw

[Added missing cc of qemu-devel]

Quoted 22 lines · Philippe Mathieu-Daudé
Quoted 9 lines · ~fvanhovell

From: Frederik van Hövell <[email protected]>

When a bare-metal application on the raspi3 board reads the AUX_MU_STAT_REG MMIO register while the device's buffer is at full receive FIFO capacity
(i.e. s->read_count == BCM2835_AUX_RX_FIFO_LEN) the assertion assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN) fails.

Quoted 6 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/459

---
  hw/char/bcm2835_aux.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

hw/char/bcm2835_aux.c static uint64_t bcm2835_aux_read(void *opaque, hwaddr offset, unsigned size) · line 144

Quoted 13 lines
hw/char/bcm2835_aux.c +1 -1
index 83990e20f7..fca2f27a55 100644
@@ -138,7 +138,7 @@ static uint64_t bcm2835_aux_read(void *opaque, hwaddr offset, unsigned size)
          res = 0x30e; /* space in the output buffer, empty tx fifo, idle tx/rx */
          if (s->read_count > 0) {
              res |= 0x1; /* data in input buffer */
-            assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN);
+            assert(s->read_count <= BCM2835_AUX_RX_FIFO_LEN);
              res |= ((uint32_t)s->read_count) << 16; /* rx fifo fill level */
          }
          return res;

thanks
-- PMM

#3 lore raw
Quoted 40 lines · Peter Maydell

[Added missing cc of qemu-devel]

Quoted 36 lines · Philippe Mathieu-Daudé
Quoted 9 lines · ~fvanhovell

From: Frederik van Hövell <[email protected]>

When a bare-metal application on the raspi3 board reads the AUX_MU_STAT_REG MMIO register while the device's buffer is at full receive FIFO capacity
(i.e. s->read_count == BCM2835_AUX_RX_FIFO_LEN) the assertion assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN) fails.

Quoted 19 lines

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/459

---
  hw/char/bcm2835_aux.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/char/bcm2835_aux.c +1 -1
index 83990e20f7..fca2f27a55 100644
@@ -138,7 +138,7 @@ static uint64_t bcm2835_aux_read(void *opaque, hwaddr offset, unsigned size)
          res = 0x30e; /* space in the output buffer, empty tx fifo, idle tx/rx */
          if (s->read_count > 0) {
              res |= 0x1; /* data in input buffer */
-            assert(s->read_count < BCM2835_AUX_RX_FIFO_LEN);
+            assert(s->read_count <= BCM2835_AUX_RX_FIFO_LEN);
              res |= ((uint32_t)s->read_count) << 16; /* rx fifo fill level */
          }
          return res;

Applied to target-arm.next, thanks.

-- PMM