Skip to contentSkip to conversation

libqos: pci-pc: use 32-bit write for EJ register

PATCH In review Paolo Bonzini 3 participants 5 messages Jun 23, 2020 – Jun 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libqos: pci-pc: use 32-bit write for EJ register

The memory region ops have min_access_size == 4 so obey it.

---
 tests/qtest/libqos/pci-pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqos/pci-pc.c +1 -1
index 0bc591d1da..3bb2eb3ba8 100644
@@ -186,7 +186,7 @@ void qpci_unplug_acpi_device_test(QTestState *qts, const char *id, uint8_t slot)
     g_assert(!qdict_haskey(response, "error"));
     qobject_unref(response);
 
-    qtest_outb(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
+    qtest_outl(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
 
     qtest_qmp_eventwait(qts, "DEVICE_DELETED");
 }
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Paolo Bonzini

The memory region ops have min_access_size == 4 so obey it.

I assume you are queueing this with the memory core change?

Quoted 19 lines
---
 tests/qtest/libqos/pci-pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqos/pci-pc.c +1 -1
index 0bc591d1da..3bb2eb3ba8 100644
@@ -186,7 +186,7 @@ void qpci_unplug_acpi_device_test(QTestState *qts, const char *id, uint8_t slot)
     g_assert(!qdict_haskey(response, "error"));
     qobject_unref(response);
 
-    qtest_outb(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
+    qtest_outl(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
 
     qtest_qmp_eventwait(qts, "DEVICE_DELETED");
 }
Signature · 1 line
2.26.2
#2 lore raw
Quoted 8 lines · Michael S. Tsirkin
Quoted 3 lines · Paolo Bonzini

The memory region ops have min_access_size == 4 so obey it.

I assume you are queueing this with the memory core change?

Yes, I am.

Quoted 21 lines
Quoted 20 lines
---
 tests/qtest/libqos/pci-pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqos/pci-pc.c +1 -1
index 0bc591d1da..3bb2eb3ba8 100644
@@ -186,7 +186,7 @@ void qpci_unplug_acpi_device_test(QTestState *qts, const char *id, uint8_t slot)
     g_assert(!qdict_haskey(response, "error"));
     qobject_unref(response);
 
-    qtest_outb(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
+    qtest_outl(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
 
     qtest_qmp_eventwait(qts, "DEVICE_DELETED");
 }
Signature · 1 line
2.26.2
Tested-by on v1 1/1
#3 lore raw
In reply to Paolo Bonzini
Quoted 12 lines · Paolo Bonzini

The memory region ops have min_access_size == 4 so obey it.

---
  tests/qtest/libqos/pci-pc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqos/pci-pc.c +0 -0
index 0bc591d1da..3bb2eb3ba8 100644

tests/qtest/libqos/pci-pc.c void qpci_unplug_acpi_device_test(QTestState *qts, const char *id, uint8_t slot) · line 192

Quoted 8 lines
tests/qtest/libqos/pci-pc.c +1 -1
@@ -186,7 +186,7 @@ void qpci_unplug_acpi_device_test(QTestState *qts, const char *id, uint8_t slot)
      g_assert(!qdict_haskey(response, "error"));
      qobject_unref(response);
 
-    qtest_outb(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
+    qtest_outl(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
 
      qtest_qmp_eventwait(qts, "DEVICE_DELETED");
  }

I was a little bit afraid that this could cause endianess issues on big endian hosts, but I gave it a try on a s390x machine and it seems to work fine.

#4 lore raw
Quoted 25 lines · Thomas Huth
Quoted 12 lines · Paolo Bonzini

The memory region ops have min_access_size == 4 so obey it.

---
  tests/qtest/libqos/pci-pc.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqos/pci-pc.c +0 -0
index 0bc591d1da..3bb2eb3ba8 100644

tests/qtest/libqos/pci-pc.c void qpci_unplug_acpi_device_test(QTestState *qts, · line 192

Quoted 7 lines
tests/qtest/libqos/pci-pc.c +1 -0
@@ -186,7 +186,7 @@ void qpci_unplug_acpi_device_test(QTestState *qts,
 const char *id, uint8_t slot)
       g_assert(!qdict_haskey(response, "error"));
       qobject_unref(response);
   -    qtest_outb(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
+    qtest_outl(qts, ACPI_PCIHP_ADDR + PCI_EJ_BASE, 1 << slot);
         qtest_qmp_eventwait(qts, "DEVICE_DELETED");
   }

I was a little bit afraid that this could cause endianess issues on big endian hosts, but I gave it a try on a s390x machine and it seems to work fine.

Quoted 1 line

Also because this is "pci-pc.c". :)) But seriously: if anything this would fix big endian bugs, not break them.

Paolo