Skip to contentSkip to conversation

hw/misc/bcm2835_property: Add dummy Get/Set GPIO virt buf messages

PATCH In review Benjamin Herrenschmidt 2 participants 2 messages Oct 17, 2021 – Nov 18, 2021

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

PATCH 2/2 hw/misc/bcm2835_property: Add dummy Get/Set GPIO virt buf messages

Without these the RaspiOS kernel tries to ioremap some bogus address and dumps a backtrace in the console at boot. These work around it.

The virt-gpio driver still fails to initialize but much more cleanly

---
 hw/misc/bcm2835_property.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/misc/bcm2835_property.c +7 -0
index b958fa6a5c..62037c0630 100644
@@ -274,6 +274,13 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             resplen = 4;
             break;
 
+        case 0x00048020: /* Set GPIO virt buf */
+            /* fall through */
+        case 0x00040010: /* Get GPIO virt buf */
+            stl_le_phys(&s->dma_as, value + 12, 0);
+            resplen = 4;
+            break;
+
         case 0x00060001: /* Get DMA channels */
             /* channels 2-5 */
             stl_le_phys(&s->dma_as, value + 12, 0x003C);
#1 lore raw

Hi Benjamin,

Quoted 15 lines · Benjamin Herrenschmidt

Without these the RaspiOS kernel tries to ioremap some bogus address and dumps a backtrace in the console at boot. These work around it.

The virt-gpio driver still fails to initialize but much more cleanly

---
 hw/misc/bcm2835_property.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/misc/bcm2835_property.c +0 -0
index b958fa6a5c..62037c0630 100644

hw/misc/bcm2835_property.c static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) · line 280

Quoted 7 lines
hw/misc/bcm2835_property.c +4 -0
@@ -274,6 +274,13 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value)
             resplen = 4;
             break;
 
+        case 0x00048020: /* Set GPIO virt buf */
+            /* fall through */
+        case 0x00040010: /* Get GPIO virt buf */
+            stl_le_phys(&s->dma_as, value + 12, 0);

This is not correct. You tell the kernel it can access the virtbuf at 0x0000.0000, but the raspi_smpboot code and raspi_spintables are stored there.

You need to store the uint32_t value in BCM2835PropertyState on SET and return it on GET.

hw/misc/bcm2835_property.c static void bcm2835_property_mbox_push(BCM2835PropertyState *s, uint32_t value) · line 282

Quoted 2 lines
hw/misc/bcm2835_property.c +2 -0
+            resplen = 4;
+            break;

Regards,

Phil.