Skip to contentSkip to conversation

hw: edu: some fixes

PATCH Superseded Li Qiang 1 participant 4 messages Apr 20, 2019

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

v2 cover hw: edu: some fixes

Recently I am considering write a driver for edu device. After reading the spec, I found these three small issue. Two first two related the MMIO access and the third is related the DMA operation.

Change since v1:
Fix format compile error on Windows

Li Qiang (3):
tests: fw_cfg: add splash time test case
edu: mmio: set 'max_access_size' to 8
edu: mmio: allow mmio read dispatch accept 8 bytes

 hw/misc/edu.c       | 13 +++++++++++++
 tests/fw_cfg-test.c | 19 +++++++++++++++++++
 2 files changed, 32 insertions(+)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v2 1/3 tests: fw_cfg: add splash time test case

---
 tests/fw_cfg-test.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
tests/fw_cfg-test.c +19 -0
index 9f75dbb5f4..de8e81ea9d 100644
@@ -192,6 +192,24 @@ static void test_fw_cfg_reboot_timeout(void)
     qtest_quit(s);
 }
 
+static void test_fw_cfg_splash_time(void)
+{
+    QFWCFG *fw_cfg;
+    QTestState *s;
+    uint16_t splash_time = 0;
+    size_t filesize;
+
+    s = qtest_init("-boot splash-time=12");
+    fw_cfg = pc_fw_cfg_init(s);
+
+    filesize = qfw_cfg_get_file(fw_cfg, "etc/boot-menu-wait",
+                     &splash_time, sizeof(splash_time));
+    g_assert_cmpint(filesize, ==, sizeof(splash_time));
+    g_assert_cmpint(splash_time, ==, 12);
+    pc_fw_cfg_uninit(fw_cfg);
+    qtest_quit(s);
+}
+
 int main(int argc, char **argv)
 {
     int ret;
@@ -214,6 +232,7 @@ int main(int argc, char **argv)
     qtest_add_func("fw_cfg/numa", test_fw_cfg_numa);
     qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu);
     qtest_add_func("fw_cfg/reboot_timeout", test_fw_cfg_reboot_timeout);
+    qtest_add_func("fw_cfg/splash_time", test_fw_cfg_splash_time);
 
     ret = g_test_run();
 
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v2 3/3 edu: mmio: allow mmio read dispatch accept 8 bytes

In reply to Li Qiang

The edu spec said when address >= 0x80, the MMIO area can be accessed by 8 bytes.

---
Change since v1:
Fix format compile error on Windows

 hw/misc/edu.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/misc/edu.c +4 -0
index 65fc32b928..4018dddcb8 100644
@@ -189,6 +189,10 @@ static uint64_t edu_mmio_read(void *opaque, hwaddr addr, unsigned size)
         return val;
     }
 
+    if (addr >= 0x80 && size != 4 && size != 8) {
+        return val;
+    }
+
     switch (addr) {
     case 0x00:
         val = 0x010000edu;
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v2 2/3 edu: mmio: set 'max_access_size' to 8

In reply to Li Qiang

The edu spec said, the MMIO area can be accessed by 8 bytes. However currently the 'max_access_size' is not so the MMIO access dispatch can only access 4 bytes one time. This patch fixes this to respect the spec.

Notice: here the 'min_access_size' is not a must, I set this for completement.

---
 hw/misc/edu.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/misc/edu.c +9 -0
index 91af452c9e..65fc32b928 100644
@@ -289,6 +289,15 @@ static const MemoryRegionOps edu_mmio_ops = {
     .read = edu_mmio_read,
     .write = edu_mmio_write,
     .endianness = DEVICE_NATIVE_ENDIAN,
+    .valid = {
+        .min_access_size = 4,
+        .max_access_size = 8,
+    },
+    .impl = {
+        .min_access_size = 4,
+        .max_access_size = 8,
+    },
+
 };
 
 /*
Signature · 1 line
2.17.1