Skip to contentSkip to conversation

riscv: virt: Allow PCI address 0

PATCH In review Bin Meng 2 participants 4 messages Nov 22, 2019 – Feb 18, 2020 RISC-V

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 riscv: virt: Allow PCI address 0

When testing e1000 with the virt machine, e1000's I/O space cannot be accessed. Debugging shows that the I/O BAR (BAR1) is correctly written with address 0 plus I/O enable bit, but QEMU's "info pci" shows that:

Bus 0, device 1, function 0:
Ethernet controller: PCI device 8086:100e
...

      BAR1: I/O at 0xffffffffffffffff [0x003e].

...

It turns out we should set pci_allow_0_address to true to allow 0 PCI address, otherwise pci_bar_address() treats such address as PCI_BAR_UNMAPPED.

---

 hw/riscv/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/riscv/virt.c +1 -0
index 23f340d..411bef5 100644
@@ -603,6 +603,7 @@ static void riscv_virt_machine_class_init(ObjectClass *oc, void *data)
     mc->init = riscv_virt_board_init;
     mc->max_cpus = 8;
     mc->default_cpu_type = VIRT_CPU;
+    mc->pci_allow_0_address = true;
 }
 
 static const TypeInfo riscv_virt_machine_typeinfo = {
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · On Fri, 22 Nov 2019 07:27:52 PST (-0800), [email protected] wrote:

When testing e1000 with the virt machine, e1000's I/O space cannot be accessed. Debugging shows that the I/O BAR (BAR1) is correctly written with address 0 plus I/O enable bit, but QEMU's "info pci" shows that:

Bus 0, device 1, function 0:
Ethernet controller: PCI device 8086:100e
...

      BAR1: I/O at 0xffffffffffffffff [0x003e].

...

It turns out we should set pci_allow_0_address to true to allow 0 PCI address, otherwise pci_bar_address() treats such address as PCI_BAR_UNMAPPED.

---

 hw/riscv/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/riscv/virt.c +0 -0
index 23f340d..411bef5 100644

hw/riscv/virt.c static void riscv_virt_machine_class_init(ObjectClass *oc, void *data) · line 609

Quoted 7 lines
hw/riscv/virt.c +1 -0
@@ -603,6 +603,7 @@ static void riscv_virt_machine_class_init(ObjectClass *oc, void *data)
     mc->init = riscv_virt_board_init;
     mc->max_cpus = 8;
     mc->default_cpu_type = VIRT_CPU;
+    mc->pci_allow_0_address = true;
 }
 
 static const TypeInfo riscv_virt_machine_typeinfo = {

I've put this on for-next, as I don't think this is 4.2 material.

Thanks!

author
#2 lore raw

Hi Palmer,

Quoted 34 lines · Palmer Dabbelt
Quoted 32 lines · On Fri, 22 Nov 2019 07:27:52 PST (-0800), [email protected] wrote:

When testing e1000 with the virt machine, e1000's I/O space cannot be accessed. Debugging shows that the I/O BAR (BAR1) is correctly written with address 0 plus I/O enable bit, but QEMU's "info pci" shows that:

Bus 0, device 1, function 0:
Ethernet controller: PCI device 8086:100e
...

      BAR1: I/O at 0xffffffffffffffff [0x003e].

...

It turns out we should set pci_allow_0_address to true to allow 0 PCI address, otherwise pci_bar_address() treats such address as PCI_BAR_UNMAPPED.

---

 hw/riscv/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/riscv/virt.c +1 -0
index 23f340d..411bef5 100644
@@ -603,6 +603,7 @@ static void riscv_virt_machine_class_init(ObjectClass *oc, void *data)
     mc->init = riscv_virt_board_init;
     mc->max_cpus = 8;
     mc->default_cpu_type = VIRT_CPU;
+    mc->pci_allow_0_address = true;
 }
 
Quoted 5 lines

hw/riscv/virt.c static void riscv_virt_machine_class_init(ObjectClass *oc, void *data) · line 609

Quoted 1 line
hw/riscv/virt.c +0 -0
 static const TypeInfo riscv_virt_machine_typeinfo = {

I've put this on for-next, as I don't think this is 4.2 material.

Looks you missed picking up this one :(

Regards,
Bin

#3 lore raw
Quoted 37 lines · On Sun, 02 Feb 2020 07:41:25 PST (-0800), [email protected] wrote:

Hi Palmer,

Quoted 34 lines · Palmer Dabbelt
Quoted 32 lines · On Fri, 22 Nov 2019 07:27:52 PST (-0800), [email protected] wrote:

When testing e1000 with the virt machine, e1000's I/O space cannot be accessed. Debugging shows that the I/O BAR (BAR1) is correctly written with address 0 plus I/O enable bit, but QEMU's "info pci" shows that:

Bus 0, device 1, function 0:
Ethernet controller: PCI device 8086:100e
...

      BAR1: I/O at 0xffffffffffffffff [0x003e].

...

It turns out we should set pci_allow_0_address to true to allow 0 PCI address, otherwise pci_bar_address() treats such address as PCI_BAR_UNMAPPED.

---

 hw/riscv/virt.c | 1 +
 1 file changed, 1 insertion(+)
hw/riscv/virt.c +1 -0
index 23f340d..411bef5 100644
@@ -603,6 +603,7 @@ static void riscv_virt_machine_class_init(ObjectClass *oc, void *data)
     mc->init = riscv_virt_board_init;
     mc->max_cpus = 8;
     mc->default_cpu_type = VIRT_CPU;
+    mc->pci_allow_0_address = true;
 }
 
Quoted 7 lines
Quoted 5 lines

hw/riscv/virt.c static void riscv_virt_machine_class_init(ObjectClass *oc, void *data) · line 609

Quoted 1 line
hw/riscv/virt.c +0 -0
 static const TypeInfo riscv_virt_machine_typeinfo = {

I've put this on for-next, as I don't think this is 4.2 material.

Looks you missed picking up this one :(

Sorry about that, it's back on for-master.