qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes
@ 2019-04-20 15:59 Li Qiang
  2019-04-20 15:59 ` Li Qiang
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: qemu-devel, liq3ea, Li Qiang

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(+)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes
  2019-04-20 15:59 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
@ 2019-04-20 15:59 ` Li Qiang
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 1/3] tests: fw_cfg: add splash time test case Li Qiang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: Li Qiang, liq3ea, qemu-devel

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(+)

-- 
2.17.1




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 1/3] tests: fw_cfg: add splash time test case
  2019-04-20 15:59 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
  2019-04-20 15:59 ` Li Qiang
@ 2019-04-20 15:59 ` Li Qiang
  2019-04-20 15:59   ` Li Qiang
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 2/3] edu: mmio: set 'max_access_size' to 8 Li Qiang
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 3/3] edu: mmio: allow mmio read dispatch accept 8 bytes Li Qiang
  3 siblings, 1 reply; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: qemu-devel, liq3ea, Li Qiang

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 tests/fw_cfg-test.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 9f75dbb5f4..de8e81ea9d 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -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();
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 1/3] tests: fw_cfg: add splash time test case
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 1/3] tests: fw_cfg: add splash time test case Li Qiang
@ 2019-04-20 15:59   ` Li Qiang
  0 siblings, 0 replies; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: Li Qiang, liq3ea, qemu-devel

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 tests/fw_cfg-test.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 9f75dbb5f4..de8e81ea9d 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -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();
 
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 2/3] edu: mmio: set 'max_access_size' to 8
  2019-04-20 15:59 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
  2019-04-20 15:59 ` Li Qiang
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 1/3] tests: fw_cfg: add splash time test case Li Qiang
@ 2019-04-20 15:59 ` Li Qiang
  2019-04-20 15:59   ` Li Qiang
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 3/3] edu: mmio: allow mmio read dispatch accept 8 bytes Li Qiang
  3 siblings, 1 reply; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: qemu-devel, liq3ea, 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.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 hw/misc/edu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 91af452c9e..65fc32b928 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -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,
+    },
+
 };
 
 /*
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 2/3] edu: mmio: set 'max_access_size' to 8
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 2/3] edu: mmio: set 'max_access_size' to 8 Li Qiang
@ 2019-04-20 15:59   ` Li Qiang
  0 siblings, 0 replies; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: Li Qiang, liq3ea, qemu-devel

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.

Signed-off-by: Li Qiang <liq3ea@163.com>
---
 hw/misc/edu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 91af452c9e..65fc32b928 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -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,
+    },
+
 };
 
 /*
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 3/3] edu: mmio: allow mmio read dispatch accept 8 bytes
  2019-04-20 15:59 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
                   ` (2 preceding siblings ...)
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 2/3] edu: mmio: set 'max_access_size' to 8 Li Qiang
@ 2019-04-20 15:59 ` Li Qiang
  2019-04-20 15:59   ` Li Qiang
  3 siblings, 1 reply; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: qemu-devel, liq3ea, Li Qiang

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

Signed-off-by: Li Qiang <liq3ea@163.com>
---
Change since v1:
Fix format compile error on Windows

 hw/misc/edu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 65fc32b928..4018dddcb8 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 3/3] edu: mmio: allow mmio read dispatch accept 8 bytes
  2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 3/3] edu: mmio: allow mmio read dispatch accept 8 bytes Li Qiang
@ 2019-04-20 15:59   ` Li Qiang
  0 siblings, 0 replies; 10+ messages in thread
From: Li Qiang @ 2019-04-20 15:59 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: Li Qiang, liq3ea, qemu-devel

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

Signed-off-by: Li Qiang <liq3ea@163.com>
---
Change since v1:
Fix format compile error on Windows

 hw/misc/edu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/misc/edu.c b/hw/misc/edu.c
index 65fc32b928..4018dddcb8 100644
--- a/hw/misc/edu.c
+++ b/hw/misc/edu.c
@@ -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;
-- 
2.17.1




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes
@ 2019-04-20 16:14 Li Qiang
  2019-04-20 16:14 ` Li Qiang
  0 siblings, 1 reply; 10+ messages in thread
From: Li Qiang @ 2019-04-20 16:14 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: qemu-devel, liq3ea, Li Qiang

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):
  edu: mmio: set 'max_access_size' to 8
  edu: mmio: allow mmio read dispatch accept 8 bytes
  edu: uses uint64_t in dma operation

 hw/misc/edu.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes
  2019-04-20 16:14 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
@ 2019-04-20 16:14 ` Li Qiang
  0 siblings, 0 replies; 10+ messages in thread
From: Li Qiang @ 2019-04-20 16:14 UTC (permalink / raw)
  To: jslaby, pbonzini; +Cc: Li Qiang, liq3ea, qemu-devel

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):
  edu: mmio: set 'max_access_size' to 8
  edu: mmio: allow mmio read dispatch accept 8 bytes
  edu: uses uint64_t in dma operation

 hw/misc/edu.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

-- 
2.17.1




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-20 16:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-20 15:59 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
2019-04-20 15:59 ` Li Qiang
2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 1/3] tests: fw_cfg: add splash time test case Li Qiang
2019-04-20 15:59   ` Li Qiang
2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 2/3] edu: mmio: set 'max_access_size' to 8 Li Qiang
2019-04-20 15:59   ` Li Qiang
2019-04-20 15:59 ` [Qemu-devel] [PATCH v2 3/3] edu: mmio: allow mmio read dispatch accept 8 bytes Li Qiang
2019-04-20 15:59   ` Li Qiang
  -- strict thread matches above, loose matches on Subject: below --
2019-04-20 16:14 [Qemu-devel] [PATCH v2 0/3] hw: edu: some fixes Li Qiang
2019-04-20 16:14 ` Li Qiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).