Re: [PATCH] hw/net: Add LiteEth model

2022-05-22 Thread Jason Wang
On Fri, May 20, 2022 at 2:53 PM Joel Stanley wrote: > > LiteX is a soft system-on-chip that targets FPGAs. LiteETH is a basic > network device that is commonly used in LiteX designs. > > There is an upstream Linux kernel driver for this device and support in > various other firmware projects for

Re: About restoring the state in vhost-vdpa device

2022-05-22 Thread Jason Wang
On Wed, May 18, 2022 at 8:44 PM Parav Pandit wrote: > > > > From: Jason Wang > > Sent: Monday, May 16, 2022 11:05 PM > > >> Although it's a longer route, I'd very much prefer an in-band virtio > > >> way to perform it rather than a linux/vdpa specific. It's one of the > > >> reasons I prefer the

Re: [PATCH v4] target/riscv: check 'I' and 'E' after checking 'G' in riscv_cpu_realize

2022-05-22 Thread Alistair Francis
On Wed, May 18, 2022 at 11:27 AM Weiwei Li wrote: > > - setting ext_g will implicitly set ext_i > > Signed-off-by: Weiwei Li > Signed-off-by: Junqiang Wang > Reviewed-by: Alistair Francis Thanks! Applied to riscv-to-apply.next Alistair > --- > target/riscv/cpu.c | 24

Re: [PATCH] target/riscv: add zicsr/zifencei to isa_string

2022-05-22 Thread Alistair Francis
On Wed, May 18, 2022 at 10:50 PM Hongren (Zenithal) Zheng wrote: > > Zicsr/Zifencei is not in 'I' since ISA version 20190608, > thus to fully express the capability of the CPU, > they should be exposed in isa_string. > > Signed-off-by: Hongren (Zenithal) Zheng > --- > target/riscv/cpu.c | 2 ++

Re: [PATCH] target/riscv: Fix typo of mimpid cpu option

2022-05-22 Thread Alistair Francis
On Fri, May 20, 2022 at 7:16 PM wrote: > > From: Frank Chang > > "mimpid" cpu option was mistyped to "mipid". > Fixes commit: 9951ba94 Can you use the `Fixes:` tag here instead (have a look in the QEMU log for examples). > > Signed-off-by: Frank Chang Otherwise: Reviewed-by: Alistair

Re: [PATCH v2 09/10] accel/tcg: Inline dump_opcount_info() and remove it

2022-05-22 Thread Philippe Mathieu-Daudé via
On 20/5/22 20:01, Bernhard Beschow wrote: dump_opcount_info() is a one-line wrapper around tcg_dump_op_count() which is also exported. So use the latter directly. Signed-off-by: Bernhard Beschow --- accel/tcg/cpu-exec.c | 2 +- accel/tcg/translate-all.c | 5 -

Re: [PATCH v2 08/10] accel/tcg/cpu-exec: Unexport dump_drift_info()

2022-05-22 Thread Philippe Mathieu-Daudé via
On 20/5/22 20:01, Bernhard Beschow wrote: Commit 3a841ab53f165910224dc4bebabf1a8f1d04200c 'qapi: introduce x-query-jit QMP command' basically moved the only function using dump_drift_info() to cpu-exec.c. Therefore, dump_drift_info() doesn't need to be exported any longer. Signed-off-by:

Re: [PATCH 0/6] QOM'ify PIIX southbridge creation

2022-05-22 Thread Philippe Mathieu-Daudé via
On 21/5/22 10:48, Mark Cave-Ayland wrote: On 13/05/2022 18:54, Bernhard Beschow wrote: Bernhard Beschow (6):    include/hw: Move TYPE_PIIX4_PCI_DEVICE to southbridge/piix.h    hw/isa/piix{3,4}: Move pci_map_irq_fn's near pci_set_irq_fn's    hw/isa/piix{3,4}: QOM'ify PCI device creation and

Re: [PATCH v2 1/6] include/hw/southbridge/piix: Aggregate all PIIX soughbridge type names

2022-05-22 Thread BALATON Zoltan
On Sun, 22 May 2022, Bernhard Beschow wrote: TYPE_PIIX3_PCI_DEVICE resides there as already, so add the remaining ones, too. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland --- hw/isa/piix3.c| 3 --- include/hw/isa/isa.h | 2 --

Re: [PATCH 00/50] PS2 device QOMification - part 1

2022-05-22 Thread Philippe Mathieu-Daudé via
On 22/5/22 20:17, Mark Cave-Ayland wrote: Mark Cave-Ayland (50): ps2: checkpatch fixes ps2: QOMify PS2State ps2: QOMify PS2KbdState ps2: QOMify PS2MouseState ps2: move QOM type definitions from ps2.c to ps2.h ps2: improve function prototypes in ps2.c and ps2.h ps2:

Re: [PATCH 09/50] ps2: remove duplicate setting of scancode_set in ps2_kbd_init()

2022-05-22 Thread Philippe Mathieu-Daudé via
On 22/5/22 20:17, Mark Cave-Ayland wrote: The default value for scancode_set is already set in ps2_reset() so there is no ps2_reset -> ps2_reset_keyboard ? need to duplicate this in ps2_kbd_init(). Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 1 - 1 file changed, 1 deletion(-)

Re: [PATCH 0/6] hw/acpi/viot: generate stable VIOT ACPI tables

2022-05-22 Thread Philippe Mathieu-Daudé via
On 18/5/22 13:08, Mark Cave-Ayland wrote: Mark Cave-Ayland (6): hw/acpi/viot: rename build_pci_range_node() to pci_host_bridges() hw/acpi/viot: move the individual PCI host bridge entry generation to a new function hw/acpi/viot: build array of PCI host bridges before generating

Re: [PATCH 3/6] hw/acpi/viot: build array of PCI host bridges before generating VIOT ACPI table

2022-05-22 Thread Philippe Mathieu-Daudé via
On 18/5/22 13:08, Mark Cave-Ayland wrote: Perform the generation of the VIOT ACPI table in 2 separate passes: the first pass enumerates all of the PCI host bridges and adds the min_bus and max_bus information to an array. Once this is done the VIOT table header is generated using the size of

Re: [PATCH v2 0/6] QOM'ify PIIX southbridge creation

2022-05-22 Thread Philippe Mathieu-Daudé via
On 22/5/22 23:24, Bernhard Beschow wrote: Bernhard Beschow (6): include/hw/southbridge/piix: Aggregate all PIIX soughbridge type names hw/isa/piix{3,4}: Move pci_map_irq_fn's near pci_set_irq_fn's hw/isa/piix{3,4}: QOM'ify PCI device creation and wiring hw/isa/piix{3,4}: Factor out

Re: [PATCH v2 0/3] QOM improvements for rtc/mc146818rtc

2022-05-22 Thread Philippe Mathieu-Daudé via
On 22/5/22 22:43, Bernhard Beschow wrote: v2: * Explicitly fail with _abort rather than NULL (Mark) * Explicitly fail with _abort rather than NULL in existing code (me) * Unexport rather than remove RTC_ISA_BASE (Mark) * Use object_property_get_*u*int() also for "iobase" (me) v1: This little

Re: [PATCH v4 11/17] target/m68k: Implement TPF in terms of TRAPcc

2022-05-22 Thread Philippe Mathieu-Daudé via
On 30/4/22 19:53, Richard Henderson wrote: TPF stands for "trap false", and is a long-form nop for ColdFire. Re-use the immediate consumption code from trapcc; the insn will already expand to a nop because of the TCG_COND_NEVER test within do_trapcc. Signed-off-by: Richard Henderson ---

Re: [PATCH v4 17/17] target/m68k: Mark helper_raise_exception as noreturn

2022-05-22 Thread Philippe Mathieu-Daudé via
On 30/4/22 19:53, Richard Henderson wrote: Also mark raise_exception_ra and raise_exception, lest we generate a warning about helper_raise_exception returning. Signed-off-by: Richard Henderson --- target/m68k/helper.h| 2 +- target/m68k/op_helper.c | 5 +++-- 2 files changed, 4

Re: [PATCH v4 03/17] target/m68k: Fix coding style in m68k_interrupt_all

2022-05-22 Thread Philippe Mathieu-Daudé via
On 30/4/22 19:53, Richard Henderson wrote: Add parenthesis around & vs &&. Remove assignment to sr in function call argument -- note that sr is unused after the call, so the assignment was never needed, only the result of the & expression. Suggested-by: Philippe Mathieu-Daudé Signed-off-by:

Re: [PATCH v2] linux-user: Clean up arg_start/arg_end confusion

2022-05-22 Thread Philippe Mathieu-Daudé via
On 27/4/22 04:51, Richard Henderson wrote: We had two sets of variables: arg_start/arg_end, and arg_strings/env_strings. In linuxload.c, we set the first pair to the bounds of the argv strings, but in elfload.c, we set the first pair to the bounds of the argv pointers and the second pair to the

[PATCH v2 4/6] hw/isa/piix{3, 4}: Factor out ISABus retrieval from create() functions

2022-05-22 Thread Bernhard Beschow
Modernizes the code and even saves a few lines. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland --- hw/i386/pc_piix.c | 3 ++- hw/isa/piix3.c| 3 +-- hw/isa/piix4.c| 6 +- hw/mips/malta.c | 3 ++-

[PATCH v2 5/6] hw/isa/piix4: QOM'ify PIIX4 PM creation

2022-05-22 Thread Bernhard Beschow
Just like the real hardware, create the PIIX4 ACPI controller as part of the PIIX4 southbridge. This also mirrors how the IDE and USB functions are already created. Signed-off-by: Bernhard Beschow --- hw/isa/piix4.c| 14 +++--- hw/mips/malta.c | 3 ++-

[PATCH v2 3/6] hw/isa/piix{3, 4}: QOM'ify PCI device creation and wiring

2022-05-22 Thread Bernhard Beschow
PCI interrupt wiring and device creation (piix4 only) were performed in create() functions which are obsolete. Move these tasks into QOM functions to modernize the code. In order to avoid duplicate checking for xen_enabled() the piix3 realize methods are now split. Signed-off-by: Bernhard

[PATCH v2 6/6] hw/isa/piix{3, 4}: Inline and remove create() functions

2022-05-22 Thread Bernhard Beschow
During the previous changesets the create() functions became trivial wrappers around more generic functions. Modernize the code. Signed-off-by: Bernhard Beschow --- hw/i386/pc_piix.c | 6 +- hw/isa/piix3.c| 13 - hw/isa/piix4.c| 13

[PATCH v2 2/6] hw/isa/piix{3, 4}: Move pci_map_irq_fn's near pci_set_irq_fn's

2022-05-22 Thread Bernhard Beschow
The pci_map_irq_fn's were implemented below type_init() which made them inaccessible to QOM functions. So move them up. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland --- hw/isa/piix3.c | 22 +++--- hw/isa/piix4.c | 50

[PATCH v2 1/6] include/hw/southbridge/piix: Aggregate all PIIX soughbridge type names

2022-05-22 Thread Bernhard Beschow
TYPE_PIIX3_PCI_DEVICE resides there as already, so add the remaining ones, too. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland --- hw/isa/piix3.c| 3 --- include/hw/isa/isa.h | 2 -- include/hw/southbridge/piix.h | 4 3 files changed, 4

[PATCH v2 0/6] QOM'ify PIIX southbridge creation

2022-05-22 Thread Bernhard Beschow
v2: * Preserve `DeviceState *` as return value of piix4_create() (Mark) * Aggregate all type name movements into first commit (Mark) * Have piix4 southbridge rather than malta board instantiate piix4 pm (me) Testing done: 1) `make check-avocado` for --target-list=x86_64-softmmu,mips-softmmu

[PATCH v2 2/3] hw/i386/microvm-dt: Determine mc146818rtc's IRQ number from QOM property

2022-05-22 Thread Bernhard Beschow
Since commit 3b004a16540aa41f2aa6a1ceb0bf306716766914 'hw/rtc/ mc146818rtc: QOM'ify IRQ number' mc146818rtc's IRQ number is configurable. Fix microvm-dt to respect its value. Signed-off-by: Bernhard Beschow Reviewed-by: Mark Cave-Ayland --- hw/i386/microvm-dt.c | 2 +- 1 file changed, 1

[PATCH v2 3/3] rtc/mc146818rtc: QOM'ify io_base offset

2022-05-22 Thread Bernhard Beschow
Exposing the io_base offset as a QOM property not only allows it to be configurable but also to be displayed in HMP: Before: (qemu) info qtree ... dev: mc146818rtc, id "" gpio-out "" 1 base_year = 0 (0x0) irq = 8 (0x8)

[PATCH v2 0/3] QOM improvements for rtc/mc146818rtc

2022-05-22 Thread Bernhard Beschow
v2: * Explicitly fail with _abort rather than NULL (Mark) * Explicitly fail with _abort rather than NULL in existing code (me) * Unexport rather than remove RTC_ISA_BASE (Mark) * Use object_property_get_*u*int() also for "iobase" (me) v1: This little series enhances QOM support for mc146818rtc: *

[PATCH v2 1/3] hw/i386/microvm-dt: Force explicit failure if retrieving QOM property fails

2022-05-22 Thread Bernhard Beschow
New code will be added where this is best practice. So update existing code as well. --- hw/i386/microvm-dt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/microvm-dt.c b/hw/i386/microvm-dt.c index 9c3c4995b4..fde74819f2 100644 --- a/hw/i386/microvm-dt.c +++

[PATCH 49/50] pckbd: switch I8042 device from update_irq() function to PS2 device gpio

2022-05-22 Thread Mark Cave-Ayland
Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 keyboard and mouse devices to use it. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function

[PATCH 48/50] pckbd: add i8042_reset() function to I8042 device

2022-05-22 Thread Mark Cave-Ayland
This means that it is no longer necessary to call qemu_register_reset() manually within i8042_realizefn(). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index

[PATCH 42/50] lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init()

2022-05-22 Thread Mark Cave-Ayland
This can be improved once the ps2_kbd_init() and ps2_mouse_init() functions have been removed, but for now move the existing logic from lasi_initfn() to lasi_init(). At the same time explicitly set keyboard port id to 0, even if it isn't technically required. Signed-off-by: Mark Cave-Ayland ---

[PATCH 41/50] lasips2: move mapping of LASIPS2 registers to HPPA machine

2022-05-22 Thread Mark Cave-Ayland
Now that the register memory regions are exposed as SysBus memory regions, move the mapping of the LASIPS2 registers from lasips2_initfn() to the HPPA machine (which is its only user). Signed-off-by: Mark Cave-Ayland --- hw/hppa/machine.c | 11 +-- hw/input/lasips2.c |

[PATCH 46/50] lasips2: switch over from update_irq() function to PS2 device gpio

2022-05-22 Thread Mark Cave-Ayland
Add a qdev gpio input in lasips2_init() by taking the existing lasips2_port_set_irq() function, updating it accordingly and then renaming to lasips2_set_irq(). Use these new qdev gpio inputs to wire up the PS2 keyboard and mouse devices. At the same time set update_irq() and update_arg to NULL

[PATCH 37/50] lasips2: QOMify LASIPS2State

2022-05-22 Thread Mark Cave-Ayland
Currently lasip2_init() creates a new LASIPS2State directly which is used by the HPPA machine. Introduce a new LASIPS2 QOM type that will soon be used to allow the HPPA machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 29

[PATCH 45/50] lasips2: use qdev gpio for output IRQ

2022-05-22 Thread Mark Cave-Ayland
This enables the IRQ to be wired up using qdev_connect_gpio_out() in lasips2_initfn(). Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 8 include/hw/input/lasips2.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c

[PATCH 47/50] pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio

2022-05-22 Thread Mark Cave-Ayland
Define a new qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 keyboard and mouse devices to use it. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy update_irq() function

[PATCH 33/50] ps2: introduce ps2_lower_irq() instead of calling update_irq() directly

2022-05-22 Thread Mark Cave-Ayland
This consolidates the logic of lowering the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 55a2ac08c2..214dda60bf 100644 --- a/hw/input/ps2.c

Re: [RFC PATCH v2 0/8] Removal of AioContext lock, bs->parents and ->children: new rwlock

2022-05-22 Thread Stefan Hajnoczi
On Wed, May 18, 2022 at 06:14:17PM +0200, Kevin Wolf wrote: > Am 18.05.2022 um 14:43 hat Paolo Bonzini geschrieben: > > On 5/18/22 14:28, Emanuele Giuseppe Esposito wrote: > > > For example, all callers of bdrv_open() always take the AioContext lock. > > > Often it is taken very high in the call

[PATCH 43/50] lasips2: add base property

2022-05-22 Thread Mark Cave-Ayland
This is in preparation for handling vmstate_register() within the device. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 17 - include/hw/input/lasips2.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/input/lasips2.c

[PATCH 40/50] lasips2: implement lasips2_init() function

2022-05-22 Thread Mark Cave-Ayland
Move the initialisation of the keyboard and mouse memory regions to lasips2_init() and expose them as SysBus memory regions. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 18 ++ 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/input/lasips2.c

[PATCH 36/50] pl050: switch over from update_irq() function to PS2 device gpio

2022-05-22 Thread Mark Cave-Ayland
Add a new pl050_init() function which initialises a qdev input gpio for handling incoming PS2 IRQs, and then wire up the PS2 device to use it. At the same time set update_irq() and update_arg to NULL in ps2_kbd_init() and ps2_mouse_init() to ensure that any accidental attempt to use the legacy

[PATCH 27/50] pckbd: alter i8042_mm_init() to return a I8042_MMIO device

2022-05-22 Thread Mark Cave-Ayland
This exposes the I8042_MMIO device to the caller to allow the register memory region to be mapped outside of i8042_mm_init(). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 8 +--- include/hw/input/i8042.h | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff

[PATCH 38/50] lasips2: move lasips2 QOM types from lasips2.c to lasips2.h

2022-05-22 Thread Mark Cave-Ayland
This allows the QOM types in lasips2.c to be used elsewhere by simply including lasips2.h. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 23 --- include/hw/input/lasips2.h | 22 ++ 2 files changed, 22 insertions(+), 23 deletions(-)

[PATCH 29/50] pckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize()

2022-05-22 Thread Mark Cave-Ayland
Note in this case it is not possible to register a (new) VMStateDescription in the DeviceClass without breaking migration compatibility for the MIPS magnum machine. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[PATCH 24/50] pckbd: add size qdev property to I8042_MMIO device

2022-05-22 Thread Mark Cave-Ayland
This will soon be used to set the size of the register memory region using a qdev property. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 2 ++ include/hw/input/i8042.h | 1 + 2 files changed, 3 insertions(+) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index

[PATCH 32/50] ps2: use ps2_raise_irq() instead of calling update_irq() directly

2022-05-22 Thread Mark Cave-Ayland
This consolidates the logic of raising the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 8b76ce1cdc..55a2ac08c2 100644 --- a/hw/input/ps2.c +++

[PATCH 30/50] pckbd: move ps2_kbd_init() and ps2_mouse_init() to i8042_mmio_realize()

2022-05-22 Thread Mark Cave-Ayland
Move ps2_kbd_init() and ps2_mouse_init() from i8042_mm_init() to i8042_mmio_realize() to further reduce the initialisation logic done in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH 35/50] pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState

2022-05-22 Thread Mark Cave-Ayland
This allows both IRQs to be declared as a single qdev gpio array. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 12 ++-- include/hw/input/i8042.h | 6 -- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index

[PATCH 26/50] pckbd: implement i8042_mmio_init() function

2022-05-22 Thread Mark Cave-Ayland
This enables use to expose the register memory region of the I8042_MMIO device using sysbus_init_mmio(). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 8 1 file changed, 8 insertions(+) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index addd1f058a..c407c082e2 100644 ---

[PATCH 25/50] pckbd: implement i8042_mmio_realize() function

2022-05-22 Thread Mark Cave-Ayland
Move the initialisation of the register memory region to the I8042_MMIO device realize function. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 12 +++- include/hw/input/i8042.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c

[PATCH 20/50] pckbd: move ISAKBDState from pckbd.c to i8042.h

2022-05-22 Thread Mark Cave-Ayland
This allows the QOM types in pckbd.c to be used elsewhere by simply including i8042.h. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 10 -- include/hw/input/i8042.h | 10 ++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/input/pckbd.c

[PATCH 31/50] ps2: make ps2_raise_irq() function static

2022-05-22 Thread Mark Cave-Ayland
This function is no longer used outside of ps2.c and so can be declared static. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 2 +- include/hw/input/ps2.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index

[PATCH 21/50] pckbd: introduce new I8042_MMIO QOM type

2022-05-22 Thread Mark Cave-Ayland
Currently i8042_mm_init() creates a new KBDState directly which is used by the MIPS magnum machine. Introduce a new I8042_MMIO QOM type that will soon be used to allow the MIPS magnum machine to be wired up using standard qdev GPIOs. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c

[PATCH 28/50] pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine

2022-05-22 Thread Mark Cave-Ayland
Now that the register memory region is exposed as a SysBus memory region, move the mapping of the I8042_MMIO registers from i8042_mm_init() to the MIPS magnum machine (which is its only user). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 5 + hw/mips/jazz.c | 11

[PATCH 17/50] lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq()

2022-05-22 Thread Mark Cave-Ayland
This better reflects that the IRQ input opaque is a LASIPS2Port structure and not a PS2_DEVICE. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 2ac3433014..adfde1684f

[PATCH 18/50] pckbd: checkpatch fixes

2022-05-22 Thread Mark Cave-Ayland
Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 150 ++- 1 file changed, 97 insertions(+), 53 deletions(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 4efdf75620..ab0d66d00d 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@

[PATCH 50/50] ps2: remove update_irq() function and update_arg parameter

2022-05-22 Thread Mark Cave-Ayland
Now that all the PS2 devices have been converted to use GPIOs the update_irq() callback function and the update_arg parameter can be removed. This allows these arguments to be completely removed from ps2_kbd_init() and ps2_mouse_init(), along with the transitional logic that was added to

[PATCH 22/50] pckbd: implement i8042_mmio_reset() for I8042_MMIO device

2022-05-22 Thread Mark Cave-Ayland
This allows the I8042_MMIO reset function to be registered directly within the DeviceClass rather than using qemu_register_reset() directly. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/input/pckbd.c

[PATCH 14/50] pl050: checkpatch fixes

2022-05-22 Thread Mark Cave-Ayland
This patch also includes a couple of minor spacing updates. Signed-off-by: Mark Cave-Ayland --- hw/input/pl050.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index d279b6c148..889a0674d3 100644 ---

[PATCH 19/50] pckbd: move KBDState from pckbd.c to i8042.h

2022-05-22 Thread Mark Cave-Ayland
This allows the QOM types in pckbd.c to be used elsewhere by simply including i8042.h. Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 24 include/hw/input/i8042.h | 25 + 2 files changed, 25 insertions(+), 24 deletions(-) diff

[PATCH 15/50] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions

2022-05-22 Thread Mark Cave-Ayland
This will soon allow pl050_set_irq() to be used as a GPIO input function. Signed-off-by: Mark Cave-Ayland --- hw/input/pl050.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/input/pl050.c b/hw/input/pl050.c index 889a0674d3..66f8c20d9f 100644 ---

[PATCH 44/50] lasips2: implement lasips2_realize()

2022-05-22 Thread Mark Cave-Ayland
Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to lasips2_realize. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index a7c7192c07..6849b71e5c 100644

[PATCH 08/50] ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset()

2022-05-22 Thread Mark Cave-Ayland
The functionality of ps2_common_reset() can be moved into a new ps2_reset() function for the PS2_DEVICE QOM type. Update PS2DeviceClass to hold a reference to the parent reset function and update the PS2_KBD_DEVICE and PS2_MOUSE_DEVICE types to use device_class_set_parent_reset() accordingly.

[PATCH 16/50] lasips2: spacing fixes

2022-05-22 Thread Mark Cave-Ayland
This helps improve the readability of lasips2.c. Signed-off-by: Mark Cave-Ayland --- hw/input/lasips2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 94f18be4cd..2ac3433014 100644 --- a/hw/input/lasips2.c +++

[PATCH 39/50] lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device

2022-05-22 Thread Mark Cave-Ayland
When QOMifying a device it is typical to use _init() as the suffix for an instance_init function, however this name is already in use by the legacy LASIPS2 wrapper function. Eventually the wrapper function will be removed, but for now rename it to lasips2_initfn() to avoid a naming collision. At

[PATCH 11/50] ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler

2022-05-22 Thread Mark Cave-Ayland
Move the registration of ps2_mouse_handler from ps2_mouse_init() to a new ps2_mouse_realize() function. Since the abstract PS2_DEVICE parent class doesn't have a realize() function then it is not necessary to store the reference to it in PS2DeviceClass and use device_class_set_parent_realize().

[PATCH 07/50] ps2: introduce PS2DeviceClass

2022-05-22 Thread Mark Cave-Ayland
This is in preparation for allowing the new PS2_KBD_DEVICE and PS2_MOUSE_DEVICE QOM types to reference the parent PS2_DEVICE device reset() function. Signed-off-by: Mark Cave-Ayland --- include/hw/input/ps2.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git

[PATCH 13/50] ps2: don't use vmstate_register() in ps2_mouse_init()

2022-05-22 Thread Mark Cave-Ayland
Since PS2_MOUSE_DEVICE is a qdev device then vmstate_ps2_mouse can be registered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2 parameters to vmstate_register() are NULL and 0 respectively.

[PATCH 34/50] ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq()

2022-05-22 Thread Mark Cave-Ayland
Define the gpio for the PS2 output IRQ in ps2_init() and add logic to optionally use it in ps2_raise_irq() and ps2_lower_irq() if the gpio is connected. If the gpio is not connected then call the legacy update_irq() function as before. This allows the incremental conversion of devices from the

[PATCH 06/50] ps2: improve function prototypes in ps2.c and ps2.h

2022-05-22 Thread Mark Cave-Ayland
With the latest changes it is now possible to improve some of the function prototypes in ps2.c and ps.h to use the appropriate PS2KbdState or PS2MouseState type instead of being a void opaque. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 22 +-

[PATCH 10/50] ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler

2022-05-22 Thread Mark Cave-Ayland
Move the registration of ps2_keyboard_handler from ps2_kbd_init() to a new ps2_kbd_realize() function. Since the abstract PS2_DEVICE parent class doesn't have a realize() function then it is not necessary to store the reference to it in PS2DeviceClass and use device_class_set_parent_realize().

[PATCH 12/50] ps2: don't use vmstate_register() in ps2_kbd_init()

2022-05-22 Thread Mark Cave-Ayland
Since PS2_KBD_DEVICE is a qdev device then vmstate_ps2_keyboard can be registered using the DeviceClass vmsd field instead. There is no need to use qdev_set_legacy_instance_id() to ensure migration compatibility since the first 2 parameters to vmstate_register() are NULL and 0 respectively.

[PATCH 03/50] ps2: QOMify PS2KbdState

2022-05-22 Thread Mark Cave-Ayland
Make PS2KbdState into a new PS2_KBD_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 104 ++--- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/hw/input/ps2.c

[PATCH 05/50] ps2: move QOM type definitions from ps2.c to ps2.h

2022-05-22 Thread Mark Cave-Ayland
Move the QOM type definitions into the ps2.h header file to allow the new QOM types to be used by other devices. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 55 --- include/hw/input/ps2.h | 58 +- 2

[PATCH 23/50] pckbd: add mask qdev property to I8042_MMIO device

2022-05-22 Thread Mark Cave-Ayland
This allows the KBDState mask value to be set using a qdev property rather than directly in i8042_mm_init(). Signed-off-by: Mark Cave-Ayland --- hw/input/pckbd.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index

[PATCH 04/50] ps2: QOMify PS2MouseState

2022-05-22 Thread Mark Cave-Ayland
Make PS2MouseState into a new PS2_MOUSE_DEVICE QOM type which inherits from the abstract PS2_DEVICE type. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 98 ++ 1 file changed, 60 insertions(+), 38 deletions(-) diff --git a/hw/input/ps2.c

[PATCH 01/50] ps2: checkpatch fixes

2022-05-22 Thread Mark Cave-Ayland
Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 154 +++-- 1 file changed, 86 insertions(+), 68 deletions(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index c16df1de7a..67dd2eca84 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -34,41

[PATCH 09/50] ps2: remove duplicate setting of scancode_set in ps2_kbd_init()

2022-05-22 Thread Mark Cave-Ayland
The default value for scancode_set is already set in ps2_reset() so there is no need to duplicate this in ps2_kbd_init(). Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 5990eb6f79..555abb5392 100644 ---

[PATCH 02/50] ps2: QOMify PS2State

2022-05-22 Thread Mark Cave-Ayland
Make PS2State a new abstract PS2_DEVICE QOM type to represent the common functionality shared between PS2 keyboard and mouse devices. Signed-off-by: Mark Cave-Ayland --- hw/input/ps2.c | 28 1 file changed, 28 insertions(+) diff --git a/hw/input/ps2.c

[PATCH 00/50] PS2 device QOMification - part 1

2022-05-22 Thread Mark Cave-Ayland
This series came about when looking at improving the LASI PS2 device for the HPPA machine: there were improvements that I was keen to make, but was restricted because the PS2 device(s) weren't QOMified. Trying to do everything in a single patchset would be a very large series indeed, so here is

[PATCH v2 5/6] hw/acpi/viot: sort VIOT ACPI table entries by PCI host bridge min_bus

2022-05-22 Thread Mark Cave-Ayland
This ensures that the VIOT ACPI table output is always stable for a given PCI topology by ensuring that entries are ordered according to min_bus. Signed-off-by: Mark Cave-Ayland Reviewed-by: Ani Sinha --- hw/acpi/viot.c | 17 + 1 file changed, 17 insertions(+) diff --git

[PATCH v2 6/6] tests/acpi: virt: update golden masters for VIOT

2022-05-22 Thread Mark Cave-Ayland
Differences between disassembled ASL files for VIOT: +++ /tmp/asl-V69GM1.dsl 2022-05-18 10:22:27.239796759 +0100 @@ -36,11 +36,11 @@ [041h 0065 1] Reserved : 00 [042h 0066 2] Length : 0018 -[044h 0068 4] Endpoint start : 3000

[PATCH v2 4/6] tests/acpi: virt: allow VIOT acpi table changes

2022-05-22 Thread Mark Cave-Ayland
Signed-off-by: Mark Cave-Ayland Acked-by: Ani Sinha --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..8367ffe1d4 100644 ---

[PATCH v2 2/6] hw/acpi/viot: move the individual PCI host bridge entry generation to a new function

2022-05-22 Thread Mark Cave-Ayland
Instead of generating each table entry inline, move the individual PCI host bridge table entry generation to a separate build_pci_host_range() function. Signed-off-by: Mark Cave-Ayland Reviewed-by: Ani Sinha --- hw/acpi/viot.c | 48 +++- 1 file

[PATCH v2 3/6] hw/acpi/viot: build array of PCI host bridges before generating VIOT ACPI table

2022-05-22 Thread Mark Cave-Ayland
Perform the generation of the VIOT ACPI table in 2 separate passes: the first pass enumerates all of the PCI host bridges and adds the min_bus and max_bus information to an array. Once this is done the VIOT table header is generated using the size of the array to calculate the node count, which

[PATCH v2 1/6] hw/acpi/viot: rename build_pci_range_node() to enumerate_pci_host_bridges()

2022-05-22 Thread Mark Cave-Ayland
This is in preparation for separating out the VIOT ACPI table build from the PCI host bridge numeration. Signed-off-by: Mark Cave-Ayland --- hw/acpi/viot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/acpi/viot.c b/hw/acpi/viot.c index c1af75206e..a41daded71 100644

[PATCH v2 0/6] hw/acpi/viot: generate stable VIOT ACPI tables

2022-05-22 Thread Mark Cave-Ayland
I was working away at some improvements for PS2 devices when I noticed that one small change to the instantiation of a PS2 mouse device caused a regression in tests/qtest/bios-tables-test, specifically the /x86_64/acpi/q35/viot subtest. Closer examination of the failed test output showed the

Re: [PATCH 5/6] hw/acpi/viot: sort VIOT ACPI table entries by PCI host bus min_bus

2022-05-22 Thread Mark Cave-Ayland
On 19/05/2022 08:50, Ani Sinha wrote: On Wed, May 18, 2022 at 4:39 PM Mark Cave-Ayland wrote: This ensures that the VIOT ACPI table output is always stable for a given PCI topology by ensuring that entries are ordered according to min_bus. Signed-off-by: Mark Cave-Ayland other than the

Re: [PATCH 1/6] hw/acpi/viot: rename build_pci_range_node() to pci_host_bridges()

2022-05-22 Thread Mark Cave-Ayland
On 19/05/2022 08:45, Ani Sinha wrote: On Wed, May 18, 2022 at 5:57 PM Mark Cave-Ayland wrote: On 18/05/2022 12:36, Ani Sinha wrote: On Wed, May 18, 2022 at 4:38 PM Mark Cave-Ayland wrote: This is in preparation for separating out the VIOT ACPI table build from the PCI host bridge

Re: [PATCH 5/6] hw/isa/piix4: Factor out SM bus initialization from create() function

2022-05-22 Thread Mark Cave-Ayland
On 22/05/2022 10:21, Bernhard Beschow wrote: On Sat, May 21, 2022 at 10:39 AM Mark Cave-Ayland > wrote: On 13/05/2022 18:54, Bernhard Beschow wrote: > Initialize the SM bus just like is done for piix3 which modernizes the > code. >

Re: [PATCH 2/2] rtc/mc146818rtc: QOM'ify io_base offset

2022-05-22 Thread Bernhard Beschow
Am 22. Mai 2022 12:13:48 UTC schrieb Mark Cave-Ayland : >On 22/05/2022 10:07, Bernhard Beschow wrote: > >> On Sat, May 21, 2022 at 11:24 AM Mark Cave-Ayland >> mailto:mark.cave-ayl...@ilande.co.uk>> wrote: >> >> On 20/05/2022 18:45, Bernhard Beschow wrote: >> >> > Exposing the io_base

Re: [PATCH 2/2] rtc/mc146818rtc: QOM'ify io_base offset

2022-05-22 Thread Mark Cave-Ayland
On 22/05/2022 10:07, Bernhard Beschow wrote: On Sat, May 21, 2022 at 11:24 AM Mark Cave-Ayland > wrote: On 20/05/2022 18:45, Bernhard Beschow wrote: > Exposing the io_base offset as a QOM property not only allows it to be > configurable but

Re: [PATCH 3/6] hw/isa/piix{3, 4}: QOM'ify PCI device creation and wiring

2022-05-22 Thread Bernhard Beschow
On Sat, May 21, 2022 at 10:27 AM Mark Cave-Ayland < mark.cave-ayl...@ilande.co.uk> wrote: > On 13/05/2022 18:54, Bernhard Beschow wrote: > > > PCI interrupt wiring and device creation (piix4 only) were performed > > in create() functions which are obsolete. Move these tasks into QOM > > functions

Re: [PATCH 5/6] hw/isa/piix4: Factor out SM bus initialization from create() function

2022-05-22 Thread Bernhard Beschow
On Sat, May 21, 2022 at 10:39 AM Mark Cave-Ayland < mark.cave-ayl...@ilande.co.uk> wrote: > On 13/05/2022 18:54, Bernhard Beschow wrote: > > > Initialize the SM bus just like is done for piix3 which modernizes the > > code. > > > > Signed-off-by: Bernhard Beschow > > --- > > hw/isa/piix4.c

Re: [PATCH 6/6] hw/isa/piix{3, 4}: Inline and remove create() functions

2022-05-22 Thread Bernhard Beschow
On Sat, May 21, 2022 at 10:43 AM Mark Cave-Ayland < mark.cave-ayl...@ilande.co.uk> wrote: > On 13/05/2022 18:54, Bernhard Beschow wrote: > > > During the previous changesets the create() functions became trivial > > wrappers around more generic functions. Modernize the code. > > > >

Re: [PATCH 2/2] rtc/mc146818rtc: QOM'ify io_base offset

2022-05-22 Thread Bernhard Beschow
On Sat, May 21, 2022 at 11:24 AM Mark Cave-Ayland < mark.cave-ayl...@ilande.co.uk> wrote: > On 20/05/2022 18:45, Bernhard Beschow wrote: > > > Exposing the io_base offset as a QOM property not only allows it to be > > configurable but also to be displayed in HMP: > > > > Before: > > > > (qemu)

Re: [PATCH 1/2] hw/i386/microvm-dt: Determine mc146818rtc's IRQ number from QOM property

2022-05-22 Thread Bernhard Beschow
On Sat, May 21, 2022 at 11:20 AM Mark Cave-Ayland < mark.cave-ayl...@ilande.co.uk> wrote: > On 20/05/2022 18:45, Bernhard Beschow wrote: > > > Since commit 3b004a16540aa41f2aa6a1ceb0bf306716766914 'hw/rtc/ > > mc146818rtc: QOM'ify IRQ number' mc146818rtc's IRQ number is > > configurable. Fix

Re: qemu-user (arm64) fails (null ptr deref) under qemu-system-x86_64 w/o avx?

2022-05-22 Thread Michael Tokarev
Hello Richard! 22.05.2022 04:17, Richard Henderson wrote: On 5/18/22 02:13, Michael Tokarev wrote: Hi! Here's an interesting bug. Interesting because qemu-user does not run under qemu-system. Running 7.0.0 qemu-aarch64-static under 7.0.0 qemu-system-x86_64 -enable-kvm with default cpu

  1   2   >