All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/6] Trivial branch for 6.2 patches
@ 2021-11-01  8:27 Laurent Vivier
  2021-11-01  8:27 ` [PULL 1/6] monitor: Trim some trailing space from human-readable output Laurent Vivier
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Laurent Vivier

The following changes since commit af531756d25541a1b3b3d9a14e72e7fedd941a2e:

  Merge remote-tracking branch 'remotes/philmd/tags/renesas-20211030' into staging (2021-10-30 11:31:41 -0700)

are available in the Git repository at:

  git://github.com/vivier/qemu.git tags/trivial-branch-for-6.2-pull-request

for you to fetch changes up to c3f93230df9ad1d3260f03655faa8f9f23c90a52:

  hw/input/lasips2: QOM'ify the Lasi PS/2 (2021-10-31 21:05:40 +0100)

----------------------------------------------------------------
Trivial patches branch pull request 20211101

----------------------------------------------------------------

Markus Armbruster (1):
  monitor: Trim some trailing space from human-readable output

Philippe Mathieu-Daudé (4):
  MAINTAINERS: Split HPPA TCG vs HPPA machines/hardware
  hw/input/lasips2: Fix typos in function names
  hw/input/lasips2: Move LASIPS2State declaration to
    'hw/input/lasips2.h'
  hw/input/lasips2: QOM'ify the Lasi PS/2

Yanan Wang (1):
  hw/core/machine: Add the missing delimiter in cpu_slot_to_string()

 MAINTAINERS                |  5 ++-
 hw/core/machine.c          |  3 ++
 hw/hppa/lasi.c             | 10 +++++-
 hw/input/lasips2.c         | 64 +++++++++++++++++++-------------------
 include/hw/input/lasips2.h | 31 ++++++++++++++++--
 monitor/hmp-cmds.c         |  2 +-
 target/i386/cpu-dump.c     |  4 +--
 target/i386/cpu.c          |  2 +-
 target/ppc/cpu_init.c      |  2 +-
 target/s390x/cpu_models.c  |  4 +--
 target/xtensa/mmu_helper.c |  2 +-
 11 files changed, 83 insertions(+), 46 deletions(-)

-- 
2.31.1



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

* [PULL 1/6] monitor: Trim some trailing space from human-readable output
  2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
@ 2021-11-01  8:27 ` Laurent Vivier
  2021-11-01  8:27 ` [PULL 2/6] hw/core/machine: Add the missing delimiter in cpu_slot_to_string() Laurent Vivier
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Richard Henderson, Markus Armbruster, Greg Kurz,
	Max Filippov, Philippe Mathieu-Daudé,
	Laurent Vivier

From: Markus Armbruster <armbru@redhat.com>

I noticed -cpu help printing enough trailing spaces to make the output
at least 84 characters wide.  Looks ugly unless the terminal is wider.
Ugly or not, trailing spaces are stupid.

The culprit is this line in x86_cpu_list_entry():

    qemu_printf("x86 %-20s  %-58s\n", name, desc);

This prints a string with minimum field left-justified right before a
newline.  Change it to

    qemu_printf("x86 %-20s  %s\n", name, desc);

which avoids the trailing spaces and is simpler to boot.

A search for the pattern with "git-grep -E '%-[0-9]+s\\n'" found a few
more instances.  Change them similarly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Message-Id: <20211009152401.2982862-1-armbru@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 monitor/hmp-cmds.c         | 2 +-
 target/i386/cpu-dump.c     | 4 ++--
 target/i386/cpu.c          | 2 +-
 target/ppc/cpu_init.c      | 2 +-
 target/s390x/cpu_models.c  | 4 ++--
 target/xtensa/mmu_helper.c | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index bcaa41350e9a..9e45a138a505 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1945,7 +1945,7 @@ void hmp_rocker_ports(Monitor *mon, const QDict *qdict)
     monitor_printf(mon, "      port  link    duplex neg?\n");
 
     for (port = list; port; port = port->next) {
-        monitor_printf(mon, "%10s  %-4s   %-3s  %2s  %-3s\n",
+        monitor_printf(mon, "%10s  %-4s   %-3s  %2s  %s\n",
                        port->value->name,
                        port->value->enabled ? port->value->link_up ?
                        "up" : "down" : "!ena",
diff --git a/target/i386/cpu-dump.c b/target/i386/cpu-dump.c
index 02b635a52cff..08ac957e99cf 100644
--- a/target/i386/cpu-dump.c
+++ b/target/i386/cpu-dump.c
@@ -464,13 +464,13 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags)
             snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
 #ifdef TARGET_X86_64
         if (env->hflags & HF_CS64_MASK) {
-            qemu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
+            qemu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%s\n",
                          env->cc_src, env->cc_dst,
                          cc_op_name);
         } else
 #endif
         {
-            qemu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
+            qemu_fprintf(f, "CCS=%08x CCD=%08x CCO=%s\n",
                          (uint32_t)env->cc_src, (uint32_t)env->cc_dst,
                          cc_op_name);
         }
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 598d451dcf04..c5744ce08cf9 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4878,7 +4878,7 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
         desc = g_strdup_printf("%s", model_id);
     }
 
-    qemu_printf("x86 %-20s  %-58s\n", name, desc);
+    qemu_printf("x86 %-20s  %s\n", name, desc);
 }
 
 /* list available CPU models and flags */
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index 65545ba9ca8d..ba384a592bc1 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -8734,7 +8734,7 @@ void ppc_cpu_list(void)
 
 #ifdef CONFIG_KVM
     qemu_printf("\n");
-    qemu_printf("PowerPC %-16s\n", "host");
+    qemu_printf("PowerPC %s\n", "host");
 #endif
 }
 
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 4e4598cc774c..11e06cc51fab 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -398,14 +398,14 @@ void s390_cpu_list(void)
     for (feat = 0; feat < S390_FEAT_MAX; feat++) {
         const S390FeatDef *def = s390_feat_def(feat);
 
-        qemu_printf("%-20s %-50s\n", def->name, def->desc);
+        qemu_printf("%-20s %s\n", def->name, def->desc);
     }
 
     qemu_printf("\nRecognized feature groups:\n");
     for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
         const S390FeatGroupDef *def = s390_feat_group_def(group);
 
-        qemu_printf("%-20s %-50s\n", def->name, def->desc);
+        qemu_printf("%-20s %s\n", def->name, def->desc);
     }
 }
 
diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c
index b01ff9399ae6..57e319a1af3a 100644
--- a/target/xtensa/mmu_helper.c
+++ b/target/xtensa/mmu_helper.c
@@ -1098,7 +1098,7 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb)
                     qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"
                                 "\t----------  ----------  ----  ---- --- -------\n");
                 }
-                qemu_printf("\t0x%08x  0x%08x  0x%02x  0x%02x %c%c%c %-7s\n",
+                qemu_printf("\t0x%08x  0x%08x  0x%02x  0x%02x %c%c%c %s\n",
                             entry->vaddr,
                             entry->paddr,
                             entry->asid,
-- 
2.31.1



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

* [PULL 2/6] hw/core/machine: Add the missing delimiter in cpu_slot_to_string()
  2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
  2021-11-01  8:27 ` [PULL 1/6] monitor: Trim some trailing space from human-readable output Laurent Vivier
@ 2021-11-01  8:27 ` Laurent Vivier
  2021-11-01  8:27 ` [PULL 3/6] MAINTAINERS: Split HPPA TCG vs HPPA machines/hardware Laurent Vivier
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Yanan Wang, Laurent Vivier

From: Yanan Wang <wangyanan55@huawei.com>

The expected output string from cpu_slot_to_string() ought to be
like "socket-id: *, die-id: *, core-id: *, thread-id: *", so add
the missing ", " before "die-id". This affects the readability
of the error message.

Fixes: 176d2cda0d ("i386/cpu: Consolidate die-id validity in smp context")
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20211008075040.18028-1-wangyanan55@huawei.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/core/machine.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/core/machine.c b/hw/core/machine.c
index b8d95eec32d4..0a23ae310606 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1157,6 +1157,9 @@ static char *cpu_slot_to_string(const CPUArchId *cpu)
         g_string_append_printf(s, "socket-id: %"PRId64, cpu->props.socket_id);
     }
     if (cpu->props.has_die_id) {
+        if (s->len) {
+            g_string_append_printf(s, ", ");
+        }
         g_string_append_printf(s, "die-id: %"PRId64, cpu->props.die_id);
     }
     if (cpu->props.has_core_id) {
-- 
2.31.1



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

* [PULL 3/6] MAINTAINERS: Split HPPA TCG vs HPPA machines/hardware
  2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
  2021-11-01  8:27 ` [PULL 1/6] monitor: Trim some trailing space from human-readable output Laurent Vivier
  2021-11-01  8:27 ` [PULL 2/6] hw/core/machine: Add the missing delimiter in cpu_slot_to_string() Laurent Vivier
@ 2021-11-01  8:27 ` Laurent Vivier
  2021-11-01  8:27 ` [PULL 4/6] hw/input/lasips2: Fix typos in function names Laurent Vivier
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Helge Deller, Richard Henderson,
	Philippe Mathieu-Daudé,
	Laurent Vivier

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Hardware emulated models don't belong to the TCG MAINTAINERS
section. Move them to the 'HP-PARISC Machines' section.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Helge Deller <deller@gmx.de>
Message-Id: <20211004083835.3802961-1-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 MAINTAINERS | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 894dc4310526..6f2b20078032 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -205,10 +205,7 @@ HPPA (PA-RISC) TCG CPUs
 M: Richard Henderson <richard.henderson@linaro.org>
 S: Maintained
 F: target/hppa/
-F: hw/hppa/
 F: disas/hppa.c
-F: hw/net/*i82596*
-F: include/hw/net/lasi_82596.h
 
 M68K TCG CPUs
 M: Laurent Vivier <laurent@vivier.eu>
@@ -1099,6 +1096,8 @@ R: Helge Deller <deller@gmx.de>
 S: Odd Fixes
 F: configs/devices/hppa-softmmu/default.mak
 F: hw/hppa/
+F: hw/net/*i82596*
+F: include/hw/net/lasi_82596.h
 F: pc-bios/hppa-firmware.img
 
 M68K Machines
-- 
2.31.1



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

* [PULL 4/6] hw/input/lasips2: Fix typos in function names
  2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2021-11-01  8:27 ` [PULL 3/6] MAINTAINERS: Split HPPA TCG vs HPPA machines/hardware Laurent Vivier
@ 2021-11-01  8:27 ` Laurent Vivier
  2021-11-01  8:27 ` [PULL 5/6] hw/input/lasips2: Move LASIPS2State declaration to 'hw/input/lasips2.h' Laurent Vivier
  2021-11-01  8:27 ` [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2 Laurent Vivier
  5 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Damien Hedde, Philippe Mathieu-Daudé, Laurent Vivier

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Artist is another device, this one is the Lasi PS/2.
Rename the functions accordingly.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20210920064048.2729397-2-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/input/lasips2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index e7faf24058b4..68d741d34215 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -96,7 +96,7 @@ typedef enum {
     LASIPS2_STATUS_CLKSHD = 0x80,
 } lasips2_status_reg_t;
 
-static const char *artist_read_reg_name(uint64_t addr)
+static const char *lasips2_read_reg_name(uint64_t addr)
 {
     switch (addr & 0xc) {
     case REG_PS2_ID:
@@ -116,7 +116,7 @@ static const char *artist_read_reg_name(uint64_t addr)
     }
 }
 
-static const char *artist_write_reg_name(uint64_t addr)
+static const char *lasips2_write_reg_name(uint64_t addr)
 {
     switch (addr & 0x0c) {
     case REG_PS2_RESET:
@@ -145,7 +145,7 @@ static void lasips2_reg_write(void *opaque, hwaddr addr, uint64_t val,
     LASIPS2Port *port = opaque;
 
     trace_lasips2_reg_write(size, port->id, addr,
-                            artist_write_reg_name(addr), val);
+                            lasips2_write_reg_name(addr), val);
 
     switch (addr & 0xc) {
     case REG_PS2_CONTROL:
@@ -239,7 +239,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr, unsigned size)
         break;
     }
     trace_lasips2_reg_read(size, port->id, addr,
-                           artist_read_reg_name(addr), ret);
+                           lasips2_read_reg_name(addr), ret);
 
     return ret;
 }
-- 
2.31.1



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

* [PULL 5/6] hw/input/lasips2: Move LASIPS2State declaration to 'hw/input/lasips2.h'
  2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
                   ` (3 preceding siblings ...)
  2021-11-01  8:27 ` [PULL 4/6] hw/input/lasips2: Fix typos in function names Laurent Vivier
@ 2021-11-01  8:27 ` Laurent Vivier
  2021-11-01  8:27 ` [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2 Laurent Vivier
  5 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Damien Hedde, Philippe Mathieu-Daudé, Laurent Vivier

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We want to use the OBJECT_DECLARE_SIMPLE_TYPE() macro to QOM'ify
this device in the next commit. To make its review simpler, as a
first step move the LASIPS2State and LASIPS2Port declarations to
'hw/input/lasips2.h'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20210920064048.2729397-3-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/input/lasips2.c         | 18 ------------------
 include/hw/input/lasips2.h | 18 ++++++++++++++++++
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 68d741d34215..0f8362f17bc1 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -33,24 +33,6 @@
 #include "hw/irq.h"
 
 
-struct LASIPS2State;
-typedef struct LASIPS2Port {
-    struct LASIPS2State *parent;
-    MemoryRegion reg;
-    void *dev;
-    uint8_t id;
-    uint8_t control;
-    uint8_t buf;
-    bool loopback_rbne;
-    bool irq;
-} LASIPS2Port;
-
-typedef struct LASIPS2State {
-    LASIPS2Port kbd;
-    LASIPS2Port mouse;
-    qemu_irq irq;
-} LASIPS2State;
-
 static const VMStateDescription vmstate_lasips2 = {
     .name = "lasips2",
     .version_id = 0,
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 0cd7b59064a9..c88f1700162a 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -11,6 +11,24 @@
 
 #define TYPE_LASIPS2 "lasips2"
 
+struct LASIPS2State;
+typedef struct LASIPS2Port {
+    struct LASIPS2State *parent;
+    MemoryRegion reg;
+    void *dev;
+    uint8_t id;
+    uint8_t control;
+    uint8_t buf;
+    bool loopback_rbne;
+    bool irq;
+} LASIPS2Port;
+
+typedef struct LASIPS2State {
+    LASIPS2Port kbd;
+    LASIPS2Port mouse;
+    qemu_irq irq;
+} LASIPS2State;
+
 void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq);
 
 #endif /* HW_INPUT_LASIPS2_H */
-- 
2.31.1



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

* [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2
  2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
                   ` (4 preceding siblings ...)
  2021-11-01  8:27 ` [PULL 5/6] hw/input/lasips2: Move LASIPS2State declaration to 'hw/input/lasips2.h' Laurent Vivier
@ 2021-11-01  8:27 ` Laurent Vivier
  2021-11-01 15:31   ` Richard Henderson
  5 siblings, 1 reply; 10+ messages in thread
From: Laurent Vivier @ 2021-11-01  8:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Damien Hedde, Philippe Mathieu-Daudé, Laurent Vivier

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20210920064048.2729397-4-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/hppa/lasi.c             | 10 +++++++++-
 hw/input/lasips2.c         | 38 ++++++++++++++++++++++++++++----------
 include/hw/input/lasips2.h | 17 +++++++++++++----
 3 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/hw/hppa/lasi.c b/hw/hppa/lasi.c
index 88c3791eb683..91414748b70d 100644
--- a/hw/hppa/lasi.c
+++ b/hw/hppa/lasi.c
@@ -297,6 +297,7 @@ static int lasi_get_irq(unsigned long hpa)
 DeviceState *lasi_init(MemoryRegion *address_space)
 {
     DeviceState *dev;
+    SysBusDevice *sbd;
     LasiState *s;
 
     dev = qdev_new(TYPE_LASI_CHIP);
@@ -340,7 +341,14 @@ DeviceState *lasi_init(MemoryRegion *address_space)
     /* PS/2 Keyboard/Mouse */
     qemu_irq ps2kbd_irq = qemu_allocate_irq(lasi_set_irq, s,
             lasi_get_irq(LASI_PS2KBD_HPA));
-    lasips2_init(address_space, LASI_PS2KBD_HPA,  ps2kbd_irq);
+
+    sbd = SYS_BUS_DEVICE(qdev_new(TYPE_LASIPS2));
+    sysbus_realize_and_unref(sbd, &error_fatal);
+    memory_region_add_subregion(address_space, LASI_PS2KBD_HPA,
+                                sysbus_mmio_get_region(sbd, 0));
+    memory_region_add_subregion(address_space, LASI_PS2MOU_HPA,
+                                sysbus_mmio_get_region(sbd, 1));
+    sysbus_connect_irq(sbd, 0, ps2kbd_irq);
 
     return dev;
 }
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 0f8362f17bc1..46cd32316dac 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -243,28 +243,46 @@ static void ps2dev_update_irq(void *opaque, int level)
     lasips2_update_irq(port->parent);
 }
 
-void lasips2_init(MemoryRegion *address_space,
-                  hwaddr base, qemu_irq irq)
+static void lasips2_init(Object *obj)
 {
-    LASIPS2State *s;
+    LASIPS2State *s = LASIPS2(obj);
+    SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
 
-    s = g_malloc0(sizeof(LASIPS2State));
-
-    s->irq = irq;
+    sysbus_init_irq(sbd, &s->irq);
     s->mouse.id = 1;
     s->kbd.parent = s;
     s->mouse.parent = s;
 
-    vmstate_register(NULL, base, &vmstate_lasips2, s);
-
     s->kbd.dev = ps2_kbd_init(ps2dev_update_irq, &s->kbd);
     s->mouse.dev = ps2_mouse_init(ps2dev_update_irq, &s->mouse);
 
     memory_region_init_io(&s->kbd.reg, NULL, &lasips2_reg_ops, &s->kbd,
                           "lasips2-kbd", 0x100);
-    memory_region_add_subregion(address_space, base, &s->kbd.reg);
+    sysbus_init_mmio(sbd, &s->kbd.reg);
 
     memory_region_init_io(&s->mouse.reg, NULL, &lasips2_reg_ops, &s->mouse,
                           "lasips2-mouse", 0x100);
-    memory_region_add_subregion(address_space, base + 0x100, &s->mouse.reg);
+    sysbus_init_mmio(sbd, &s->mouse.reg);
+}
+
+static void lasips2_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    dc->vmsd = &vmstate_lasips2;
 }
+
+static const TypeInfo lasips2_info = {
+    .name          = TYPE_LASIPS2,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(LASIPS2State),
+    .instance_init = lasips2_init,
+    .class_init    = lasips2_class_init,
+};
+
+static void lasips2_register_types(void)
+{
+    type_register_static(&lasips2_info);
+}
+
+type_init(lasips2_register_types)
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index c88f1700162a..834b6d867d9d 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -7,11 +7,11 @@
 #ifndef HW_INPUT_LASIPS2_H
 #define HW_INPUT_LASIPS2_H
 
-#include "exec/hwaddr.h"
+#include "hw/sysbus.h"
 
 #define TYPE_LASIPS2 "lasips2"
+OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2State, LASIPS2)
 
-struct LASIPS2State;
 typedef struct LASIPS2Port {
     struct LASIPS2State *parent;
     MemoryRegion reg;
@@ -23,12 +23,21 @@ typedef struct LASIPS2Port {
     bool irq;
 } LASIPS2Port;
 
+/*
+ * QEMU interface:
+ *  + sysbus MMIO region 0 is the keyboard port interface
+ *  + sysbus MMIO region 1 is the mouse port interface
+ *  + sysbus IRQ 0 is the interrupt line shared between
+ *    keyboard and mouse ports
+ */
 typedef struct LASIPS2State {
+    /*< private >*/
+    SysBusDevice parent_obj;
+
+    /*< public >*/
     LASIPS2Port kbd;
     LASIPS2Port mouse;
     qemu_irq irq;
 } LASIPS2State;
 
-void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq);
-
 #endif /* HW_INPUT_LASIPS2_H */
-- 
2.31.1



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

* Re: [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2
  2021-11-01  8:27 ` [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2 Laurent Vivier
@ 2021-11-01 15:31   ` Richard Henderson
  2021-11-01 15:43     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2021-11-01 15:31 UTC (permalink / raw)
  To: Laurent Vivier, qemu-devel
  Cc: qemu-trivial, Damien Hedde, Philippe Mathieu-Daudé

On 11/1/21 4:27 AM, Laurent Vivier wrote:
> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
> Message-Id: <20210920064048.2729397-4-f4bug@amsat.org>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>   hw/hppa/lasi.c             | 10 +++++++++-
>   hw/input/lasips2.c         | 38 ++++++++++++++++++++++++++++----------
>   include/hw/input/lasips2.h | 17 +++++++++++++----
>   3 files changed, 50 insertions(+), 15 deletions(-)

This has broken the qtest-hppa device-introspection test:

ERROR:../src/qom/object.c:2011:object_get_canonical_path_component: code should not be reached
Broken pipe
Aborted (core dumped)

Also, the previous patch 5 does not compile on its own:

In file included from ../src/hw/input/lasips2.c:28:0:
/home/richard.henderson/qemu/src/include/hw/input/lasips2.h:17:18: error: field ‘reg’ has 
incomplete type
      MemoryRegion reg;
                   ^~~
ninja: build stopped: subcommand failed.

Reverting to patch 4 builds, and passes the introspection test.


r~


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

* Re: [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2
  2021-11-01 15:31   ` Richard Henderson
@ 2021-11-01 15:43     ` Philippe Mathieu-Daudé
  2021-11-02 16:48       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-01 15:43 UTC (permalink / raw)
  To: Richard Henderson, Laurent Vivier, qemu-devel; +Cc: qemu-trivial, Damien Hedde

On 11/1/21 16:31, Richard Henderson wrote:
> On 11/1/21 4:27 AM, Laurent Vivier wrote:
>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
>> Message-Id: <20210920064048.2729397-4-f4bug@amsat.org>
>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>> ---
>>   hw/hppa/lasi.c             | 10 +++++++++-
>>   hw/input/lasips2.c         | 38 ++++++++++++++++++++++++++++----------
>>   include/hw/input/lasips2.h | 17 +++++++++++++----
>>   3 files changed, 50 insertions(+), 15 deletions(-)
> 
> This has broken the qtest-hppa device-introspection test:
> 
> ERROR:../src/qom/object.c:2011:object_get_canonical_path_component: code
> should not be reached
> Broken pipe
> Aborted (core dumped)
> 
> Also, the previous patch 5 does not compile on its own:
> 
> In file included from ../src/hw/input/lasips2.c:28:0:
> /home/richard.henderson/qemu/src/include/hw/input/lasips2.h:17:18:
> error: field ‘reg’ has incomplete type
>      MemoryRegion reg;
>                   ^~~
> ninja: build stopped: subcommand failed.
> 
> Reverting to patch 4 builds, and passes the introspection test.

Thank you for the update, I'll have a look.


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

* Re: [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2
  2021-11-01 15:43     ` Philippe Mathieu-Daudé
@ 2021-11-02 16:48       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-11-02 16:48 UTC (permalink / raw)
  To: Richard Henderson, Laurent Vivier, qemu-devel; +Cc: qemu-trivial, Damien Hedde

Hi Laurent,

On 11/1/21 16:43, Philippe Mathieu-Daudé wrote:
> On 11/1/21 16:31, Richard Henderson wrote:
>> On 11/1/21 4:27 AM, Laurent Vivier wrote:
>>> From: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
>>> Message-Id: <20210920064048.2729397-4-f4bug@amsat.org>
>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
>>> ---
>>>   hw/hppa/lasi.c             | 10 +++++++++-
>>>   hw/input/lasips2.c         | 38 ++++++++++++++++++++++++++++----------
>>>   include/hw/input/lasips2.h | 17 +++++++++++++----
>>>   3 files changed, 50 insertions(+), 15 deletions(-)
>>
>> This has broken the qtest-hppa device-introspection test:
>>
>> ERROR:../src/qom/object.c:2011:object_get_canonical_path_component: code
>> should not be reached
>> Broken pipe
>> Aborted (core dumped)
>>
>> Also, the previous patch 5 does not compile on its own:
>>
>> In file included from ../src/hw/input/lasips2.c:28:0:
>> /home/richard.henderson/qemu/src/include/hw/input/lasips2.h:17:18:
>> error: field ‘reg’ has incomplete type
>>      MemoryRegion reg;
>>                   ^~~
>> ninja: build stopped: subcommand failed.
>>
>> Reverting to patch 4 builds, and passes the introspection test.
> 
> Thank you for the update, I'll have a look.

The last 2 patches are broken, do you mind resending your pullreq
without them?

Thanks,

Phil.


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

end of thread, other threads:[~2021-11-02 16:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01  8:27 [PULL 0/6] Trivial branch for 6.2 patches Laurent Vivier
2021-11-01  8:27 ` [PULL 1/6] monitor: Trim some trailing space from human-readable output Laurent Vivier
2021-11-01  8:27 ` [PULL 2/6] hw/core/machine: Add the missing delimiter in cpu_slot_to_string() Laurent Vivier
2021-11-01  8:27 ` [PULL 3/6] MAINTAINERS: Split HPPA TCG vs HPPA machines/hardware Laurent Vivier
2021-11-01  8:27 ` [PULL 4/6] hw/input/lasips2: Fix typos in function names Laurent Vivier
2021-11-01  8:27 ` [PULL 5/6] hw/input/lasips2: Move LASIPS2State declaration to 'hw/input/lasips2.h' Laurent Vivier
2021-11-01  8:27 ` [PULL 6/6] hw/input/lasips2: QOM'ify the Lasi PS/2 Laurent Vivier
2021-11-01 15:31   ` Richard Henderson
2021-11-01 15:43     ` Philippe Mathieu-Daudé
2021-11-02 16:48       ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.