]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
15 months agobackends/vhost-user: remove the ioeventfd check
Alex Bennée [Mon, 30 Jan 2023 12:47:28 +0000 (12:47 +0000)]
backends/vhost-user: remove the ioeventfd check

While ioeventfds are needed for good performance with KVM guests it
should not be a gating requirement. We can run vhost-user backends using
simulated ioeventfds or inband signalling.

With this change I can run:

  $QEMU $OPTS \
    -display gtk,gl=on \
    -device vhost-user-gpu-pci,chardev=vhgpu \
    -chardev socket,id=vhgpu,path=vhgpu.sock

with:

  ./contrib/vhost-user-gpu/vhost-user-gpu \
    -s vhgpu.sock \
    -v

and at least see things start-up - although the display gets rotated by
180 degrees. Once lightdm takes over we never make it to the login
prompt and just get a blank screen.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20221202132231.1048669-1-alex.bennee@linaro.org>

Message-Id: <20230130124728.175610-1-alex.bennee@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
15 months agovirtio-net: clear guest_announce feature if no cvq backend
Eugenio Pérez [Tue, 24 Jan 2023 16:11:59 +0000 (17:11 +0100)]
virtio-net: clear guest_announce feature if no cvq backend

Since GUEST_ANNOUNCE is emulated the feature bit could be set without
backend support.  This happens in the vDPA case.

However, backend vDPA parent may not have CVQ support.  This causes an
incoherent feature set, and the driver may refuse to start.  This
happens in virtio-net Linux driver.

This may be solved differently in the future.  Qemu is able to emulate a
CVQ just for guest_announce purposes, helping guest to notify the new
location with vDPA devices that does not support it.  However, this is
left as a TODO as it is way more complex to backport.

Tested with vdpa_net_sim, toggling manually VIRTIO_NET_F_CTRL_VQ in the
driver and migrating it with x-svq=on.

Fixes: 980003debddd ("vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa")
Reported-by: Dawar, Gautam <gautam.dawar@amd.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20230124161159.2182117-1-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
Reviewed-by: Gautam Dawar <gautam.dawar@amd.com>
Tested-by: Gautam Dawar <gautam.dawar@amd.com>
Tested-by: Lei Yang <leiyang@redhat.com>
15 months agoRevert "hw/i386: pass RNG seed via setup_data entry"
Michael S. Tsirkin [Wed, 8 Feb 2023 21:05:35 +0000 (16:05 -0500)]
Revert "hw/i386: pass RNG seed via setup_data entry"

This reverts commit 67f7e426e53833a5db75b0d813e8d537b8a75bd2.

Additionally to the automatic revert, I went over the code
and dropped all mentions of legacy_no_rng_seed manually,
effectively reverting a combination of 2 additional commits:

    commit ffe2d2382e5f1aae1abc4081af407905ef380311
    Author: Jason A. Donenfeld <Jason@zx2c4.com>
    Date:   Wed Sep 21 11:31:34 2022 +0200

        x86: re-enable rng seeding via SetupData

    commit 3824e25db1a84fadc50b88dfbe27047aa2f7f85d
    Author: Gerd Hoffmann <kraxel@redhat.com>
    Date:   Wed Aug 17 10:39:40 2022 +0200

        x86: disable rng seeding via setup_data

Fixes: 67f7e426e5 ("hw/i386: pass RNG seed via setup_data entry")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoRevert "x86: return modified setup_data only if read as memory, not as file"
Michael S. Tsirkin [Wed, 8 Feb 2023 21:04:40 +0000 (16:04 -0500)]
Revert "x86: return modified setup_data only if read as memory, not as file"

This reverts commit e935b735085dfa61d8e6d276b6f9e7687796a3c7.

Fixes: e935b73508 ("x86: return modified setup_data only if read as memory, not as file")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoRevert "x86: use typedef for SetupData struct"
Michael S. Tsirkin [Wed, 8 Feb 2023 20:55:41 +0000 (15:55 -0500)]
Revert "x86: use typedef for SetupData struct"

This reverts commit eebb38a5633a77f5fa79d6486d5b2fcf8fbe3c07.

Fixes: eebb38a563 ("x86: use typedef for SetupData struct")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoRevert "x86: reinitialize RNG seed on system reboot"
Michael S. Tsirkin [Wed, 8 Feb 2023 20:55:40 +0000 (15:55 -0500)]
Revert "x86: reinitialize RNG seed on system reboot"

This reverts commit 763a2828bf313ed55878b09759dc435355035f2e.

Fixes: 763a2828bf ("x86: reinitialize RNG seed on system reboot")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoRevert "x86: re-initialize RNG seed when selecting kernel"
Michael S. Tsirkin [Wed, 8 Feb 2023 20:55:39 +0000 (15:55 -0500)]
Revert "x86: re-initialize RNG seed when selecting kernel"

This reverts commit cc63374a5a7c240b7d3be734ef589dabbefc7527.

Fixes: cc63374a5a ("x86: re-initialize RNG seed when selecting kernel")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoRevert "x86: do not re-randomize RNG seed on snapshot load"
Michael S. Tsirkin [Wed, 8 Feb 2023 20:55:38 +0000 (15:55 -0500)]
Revert "x86: do not re-randomize RNG seed on snapshot load"

This reverts commit 14b29fea742034186403914b4d013d0e83f19e78.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fixes: 14b29fea74 ("x86: do not re-randomize RNG seed on snapshot load")
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agoRevert "x86: don't let decompressed kernel image clobber setup_data"
Michael S. Tsirkin [Wed, 8 Feb 2023 20:55:36 +0000 (15:55 -0500)]
Revert "x86: don't let decompressed kernel image clobber setup_data"

This reverts commit eac7a7791bb6d719233deed750034042318ffd56.

Fixes: eac7a7791b ("x86: don't let decompressed kernel image clobber setup_data")
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
15 months agohw/smbios: fix field corruption in type 4 table
Julia Suvorova [Thu, 23 Feb 2023 12:57:47 +0000 (13:57 +0100)]
hw/smbios: fix field corruption in type 4 table

Since table type 4 of SMBIOS version 2.6 is shorter than 3.0, the
strings which follow immediately after the struct fields have been
overwritten by unconditional filling of later fields such as core_count2.
Make these fields dependent on the SMBIOS version.

Fixes: 05e27d74c7 ("hw/smbios: add core_count2 to smbios table type 4")
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2169904

Signed-off-by: Julia Suvorova <jusual@redhat.com>
Message-Id: <20230223125747.254914-1-jusual@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Ani Sinha <ani@anisinha.ca>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
15 months agoMerge tag 'buildsys-qom-qdev-ui-20230227' of https://github.com/philmd/qemu into...
Peter Maydell [Tue, 28 Feb 2023 15:09:18 +0000 (15:09 +0000)]
Merge tag 'buildsys-qom-qdev-ui-20230227' of https://github.com/philmd/qemu into staging

- buildsys
  - Various header cleaned up (removing pointless headers)
  - Mark various files/code user/system specific
  - Make various objects target-independent
  - Remove tswapN() calls from dump.o
  - Suggest g_assert_not_reached() instead of assert(0)

- qdev / qom
  - Replace various container_of() by QOM cast macros
  - Declare some QOM macros using OBJECT_DECLARE_TYPE()
  - Embed OHCI QOM child in SM501 chipset

- hw (ISA & IDE)
  - add some documentation, improve function names
  - un-inline, open-code few functions
  - have ISA API accessing IRQ/DMA prefer ISABus over ISADevice
  - Demote IDE subsystem maintenance to "Odd Fixes"

- ui: Improve Ctrl+Alt hint on Darwin Cocoa

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmP9IeAACgkQ4+MsLN6t
# wN7bdQ//SxJYJuQvqTT6s+O0LmP6NbqvhxCXX7YAwK2jCTM+zTgcqqRZCcisLQol
# 3ENu2UhnZmiLKHSOxatOVozbws08/u8Vl+WkW4UTMUb1yo5KPaPtq808Y95RdAJB
# 7D7B5juDGnFRAHXZz38zVk9uIuEkm+Po/pD0JQa+upBtAAgOJTqGavDNSR5+T0Yl
# VjGdwK0b10skPqiF6OABYoy/4IFHVJJFIbARZh+a7hrF0llsbzUts5JiYsOxEEHQ
# t3woUItdMnS1m0+Ty4AQ8m0Yv9y4HZOIzixvsZ+vChj5ariwUhL9/7wC/s/UCYEg
# gKVA5X8R6n/ME6DScK99a+CyR/MXkz70b/rOUZxoutXhV3xdh4X1stL4WN9W/m3z
# D4i4ZrUsDUcKCGWlj49of/dKbOPwk1+e/mT0oDZD6JzG0ODjfdVxvJ/JEV2iHgS3
# WqHuSKzX/20H9j7/MgfbQ0HjBFOQ8tl781vQzhD+y+cF/IiTsHhrE6esIWho4bob
# kfSdVydUWWRnBsnyGoRZXoEMX9tn+pu0nKxEDm2Bo2+jajsa0aZZPokgjxaz4MnD
# Hx+/p1E+8IuOn05JgzQSgTJmKFdSbya203tXIsTo1kL2aJTJ6QfMvgEPP/fkn+lS
# oQyVBFZmb1JDdTM1MxOncnlWLg74rp/CWEc+u5pSdbxMO/M/uac=
# =AV/+
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 27 Feb 2023 21:34:24 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'buildsys-qom-qdev-ui-20230227' of https://github.com/philmd/qemu: (125 commits)
  ui/cocoa: user friendly characters for release mouse
  dump: Add create_win_dump() stub for non-x86 targets
  dump: Simplify compiling win_dump.o by introducing win_dump_available()
  dump: Clean included headers
  dump: Replace TARGET_PAGE_SIZE -> qemu_target_page_size()
  dump: Replace tswapN() -> cpu_to_dumpN()
  hw/ide/pci: Add PCIIDEState::isa_irq[]
  hw/ide/via: Replace magic 2 value by ARRAY_SIZE / MAX_IDE_DEVS
  hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus
  hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg
  hw/ide/piix: Remove unused includes
  hw/ide/pci: Unexport bmdma_active_if()
  hw/ide/ioport: Remove unnecessary includes
  hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
  hw/ide: Rename idebus_active_if() -> ide_bus_active_if()
  hw/ide: Rename ide_init2() -> ide_bus_init_output_irq()
  hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd()
  hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb
  hw/ide: Rename ide_create_drive() -> ide_bus_create_drive()
  hw/ide: Rename ide_set_irq() -> ide_bus_set_irq()
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15 months agoui/cocoa: user friendly characters for release mouse
Christian Schoenebeck [Tue, 27 Dec 2022 16:15:31 +0000 (17:15 +0100)]
ui/cocoa: user friendly characters for release mouse

While mouse is grabbed, window title contains a hint for the user what
keyboard keys to press to release the mouse. Make that hint text a bit
more user friendly for a Mac user:

 - Replace "Ctrl" and "Alt" by appropriate symbols for those keyboard
   keys typically displayed for them on a Mac (encode those symbols by
   using UTF-8 characters).

 - Drop " + " in between the keys, as that's not common on macOS for
   documenting keyboard shortcuts.

 - Convert lower case "g" to upper case "G", as that's common on macOS.

 - Add one additional space at start and end of key stroke set, to
   visually separate the key strokes from the rest of the text.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <E1pAClj-0003Jo-OB@lizzy.crudebyte.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agodump: Add create_win_dump() stub for non-x86 targets
Philippe Mathieu-Daudé [Thu, 23 Feb 2023 22:59:19 +0000 (23:59 +0100)]
dump: Add create_win_dump() stub for non-x86 targets

Implement the non-x86 create_win_dump(). We can remove
the last TARGET_X86_64 #ifdef'ry in dump.c, which thus
becomes target-independent. Update meson accordingly.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230225094903.53167-6-philmd@linaro.org>

15 months agodump: Simplify compiling win_dump.o by introducing win_dump_available()
Philippe Mathieu-Daudé [Thu, 23 Feb 2023 22:58:16 +0000 (23:58 +0100)]
dump: Simplify compiling win_dump.o by introducing win_dump_available()

To make dump.c less target dependent, move the TARGET_X86_64 #ifdef'ry
from dump.c to win_dump.c (introducing a win_dump_available() method
there). By doing so we can build win_dump.c on any target, and
simplify the meson rule.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230225094903.53167-5-philmd@linaro.org>

15 months agodump: Clean included headers
Philippe Mathieu-Daudé [Thu, 23 Feb 2023 22:56:46 +0000 (23:56 +0100)]
dump: Clean included headers

"qemu/win_dump_defs.h" is only required by win_dump.c,
but win_dump.h requires "sysemu/dump.h" which declares
the DumpState type. Remove various unused headers.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230225094903.53167-4-philmd@linaro.org>

15 months agodump: Replace TARGET_PAGE_SIZE -> qemu_target_page_size()
Philippe Mathieu-Daudé [Thu, 23 Feb 2023 22:38:59 +0000 (23:38 +0100)]
dump: Replace TARGET_PAGE_SIZE -> qemu_target_page_size()

TARGET_PAGE_SIZE is target specific. In preparation of
making dump.c target-agnostic, replace the compile-time
TARGET_PAGE_SIZE definition by runtime qemu_target_page_size().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230225094903.53167-3-philmd@linaro.org>

15 months agodump: Replace tswapN() -> cpu_to_dumpN()
Philippe Mathieu-Daudé [Fri, 16 Dec 2022 07:28:32 +0000 (08:28 +0100)]
dump: Replace tswapN() -> cpu_to_dumpN()

All uses of tswap in that file are wrong, and should be using
cpu_to_dumpN, which correctly tests the endianness of the output.

Reported-by: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20230225094903.53167-2-philmd@linaro.org>

15 months agohw/ide/pci: Add PCIIDEState::isa_irq[]
Bernhard Beschow [Thu, 26 Jan 2023 21:17:36 +0000 (22:17 +0100)]
hw/ide/pci: Add PCIIDEState::isa_irq[]

These legacy ISA IRQs allow the PIIX IDE functions to be wired up in
their south bridges and the VIA IDE functions to disuse
PCI_INTERRUPT_LINE as outlined in https://lists.nongnu.org/archive/html/qemu-devel/2020-03/msg01707.html

Suggested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230126211740.66874-7-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/ide/via: Replace magic 2 value by ARRAY_SIZE / MAX_IDE_DEVS
Philippe Mathieu-Daudé [Wed, 24 Mar 2021 17:47:59 +0000 (18:47 +0100)]
hw/ide/via: Replace magic 2 value by ARRAY_SIZE / MAX_IDE_DEVS

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: John Snow <jsnow@redhat.com>
Message-Id: <20210511041848.2743312-5-f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus
Philippe Mathieu-Daudé [Tue, 14 Feb 2023 15:28:19 +0000 (16:28 +0100)]
hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-21-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg
Philippe Mathieu-Daudé [Tue, 14 Feb 2023 15:47:39 +0000 (16:47 +0100)]
hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-20-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide/piix: Remove unused includes
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:57:15 +0000 (11:57 +0100)]
hw/ide/piix: Remove unused includes

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-19-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide/pci: Unexport bmdma_active_if()
Bernhard Beschow [Mon, 22 Aug 2022 17:02:12 +0000 (19:02 +0200)]
hw/ide/pci: Unexport bmdma_active_if()

The function is only used inside ide/pci.c, so doesn't need to be exported.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-18-philmd@linaro.org>

15 months agohw/ide/ioport: Remove unnecessary includes
Philippe Mathieu-Daudé [Fri, 10 Feb 2023 21:58:05 +0000 (22:58 +0100)]
hw/ide/ioport: Remove unnecessary includes

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-17-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:33:35 +0000 (23:33 +0100)]
hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h'

ide_get_geometry() and ide_get_bios_chs_trans() are only
used by the TYPE_PC_MACHINE.
"hw/ide.h" is a mixed bag of lost IDE declarations. In order
to remove this (almost) pointless header soon, move these
declarations to "hw/ide/internal.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230220091358.17038-18-philmd@linaro.org>

15 months agohw/ide: Rename idebus_active_if() -> ide_bus_active_if()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:33:08 +0000 (11:33 +0100)]
hw/ide: Rename idebus_active_if() -> ide_bus_active_if()

idebus_active_if() operates on a IDEBus; rename it as
ide_bus_active_if() to emphasize its first argument
is a IDEBus.

Mechanical change using:

  $ sed -i -e 's/idebus_active_if/ide_bus_active_if/g' \
        $(git grep -l idebus_active_if)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-16-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Rename ide_init2() -> ide_bus_init_output_irq()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:27:23 +0000 (11:27 +0100)]
hw/ide: Rename ide_init2() -> ide_bus_init_output_irq()

ide_init2() initializes a IDEBus, and set its output IRQ.
To emphasize this, rename it as ide_bus_init_output_irq().

Mechanical change using:

  $ sed -i -e 's/ide_init2/ide_bus_init_output_irq/g' \
        $(git grep -l ide_init2)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-15-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:26:20 +0000 (11:26 +0100)]
hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd()

ide_exec_cmd() operates on a IDEBus; rename it as
ide_bus_exec_cmd() to emphasize its first argument
is a IDEBus.

Mechanical change using:

  $ sed -i -e 's/ide_exec_cmd/ide_bus_exec_cmd/g' \
        $(git grep -wl ide_exec_cmd)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-14-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb
Philippe Mathieu-Daudé [Tue, 14 Feb 2023 15:33:38 +0000 (16:33 +0100)]
hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb

ide_register_restart_cb() operates on a IDEBus; rename it as
ide_bus_register_restart_cb() to emphasize its first argument
is a IDEBus.

Mechanical change using:

  $ sed -i -e 's/ide_register_restart_cb/ide_bus_register_restart_cb/g' \
    $(git grep -l ide_register_restart_cb)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-13-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Rename ide_create_drive() -> ide_bus_create_drive()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:31:51 +0000 (11:31 +0100)]
hw/ide: Rename ide_create_drive() -> ide_bus_create_drive()

ide_create_drive() operates on a IDEBus; rename it as
ide_bus_create_drive() to emphasize its first argument
is a IDEBus.

Mechanical change using:

  $ sed -i -e 's/ide_create_drive/ide_bus_create_drive/g' \
        $(git grep -wl ide_create_drive)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-12-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Rename ide_set_irq() -> ide_bus_set_irq()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:33:47 +0000 (11:33 +0100)]
hw/ide: Rename ide_set_irq() -> ide_bus_set_irq()

ide_set_irq() operates on a IDEBus; rename it as
ide_bus_set_irq() to emphasize its first argument
is a IDEBus.

Mechanical change using:

  $ sed -i -e 's/ide_set_irq/ide_bus_set_irq/g' \
        $(git grep -l ide_set_irq)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-11-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Un-inline ide_set_irq()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:01:55 +0000 (23:01 +0100)]
hw/ide: Un-inline ide_set_irq()

Only include "hw/irq.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-10-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15 months agohw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:37:23 +0000 (23:37 +0100)]
hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h'

The IDEBus structure has PortioList fields, so we need its
declarations from "exec/ioport.h". "hw/isa/isa.h" is not required.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-9-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15 months agohw/ide: Remove unused 'qapi/qapi-types-run-state.h'
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:36:25 +0000 (23:36 +0100)]
hw/ide: Remove unused 'qapi/qapi-types-run-state.h'

Missed in commit d7458e7754 ("hw/ide/internal: Remove unused
DMARestartFunc typedef") which removed the single use of RunState.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-8-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15 months agohw/ide/atapi: Restrict 'scsi/constants.h' inclusion
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:35:21 +0000 (23:35 +0100)]
hw/ide/atapi: Restrict 'scsi/constants.h' inclusion

Only atapi.c requires the SCSI constants. No need to include
it in all files including "hw/ide/internal.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230215112712.23110-7-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15 months agohw/ide/isa: Remove intermediate ISAIDEState::irq variable
Philippe Mathieu-Daudé [Fri, 10 Feb 2023 22:16:51 +0000 (23:16 +0100)]
hw/ide/isa: Remove intermediate ISAIDEState::irq variable

The intermediate ISAIDEState::irq variable just add noise, remove it.

Message-Id: <20230215112712.23110-6-philmd@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h'
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:26:36 +0000 (23:26 +0100)]
hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h'

"hw/ide.h" is a mixed bag of lost IDE declarations.

Extract isa_ide_init() and the TYPE_ISA_IDE QOM declarations
to a new "hw/ide/isa.h" header.

Rename ISAIDEState::isairq as 'irqnum' to emphasize this is
not a qemu_irq object but the number (index) of an ISA IRQ.

Message-Id: <20230215112712.23110-5-philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h'
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 22:24:42 +0000 (23:24 +0100)]
hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h'

"hw/ide.h" is a mixed bag of lost IDE declarations.

Extract mmio_ide_init_drives() and the TYPE_MMIO_IDE QOM
declarations to a new "hw/ide/mmio.h" header.

Document the SysBus interface.

Message-Id: <20230215112712.23110-4-philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/ide/mmio: Use CamelCase for MMIO_IDE state name
Philippe Mathieu-Daudé [Fri, 6 Jan 2023 10:37:55 +0000 (11:37 +0100)]
hw/ide/mmio: Use CamelCase for MMIO_IDE state name

Following docs/devel/style.rst guidelines, rename MMIOIDEState
as IdeMmioState.

Having the structure name and its typedef named equally,
we can manually convert from the old DECLARE_INSTANCE_CHECKER()
macro to the more recent OBJECT_DECLARE_SIMPLE_TYPE().

Note, due to that name mismatch, this macro wasn't automatically
converted during commit 8063396bf3 ("Use OBJECT_DECLARE_SIMPLE_TYPE
when possible").

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230220091358.17038-3-philmd@linaro.org>

15 months agohw/ide/ahci: Trace ncq write command as write instead of read
Fiona Ebner [Fri, 17 Feb 2023 10:31:30 +0000 (11:31 +0100)]
hw/ide/ahci: Trace ncq write command as write instead of read

Fixes: e4baa9f00b ("AHCI: Replace DPRINTF with trace-events")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230217103130.42077-1-f.ebner@proxmox.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i386/xen: Remove unused 'hw/ide.h' include from header
Philippe Mathieu-Daudé [Mon, 20 Feb 2023 09:25:22 +0000 (10:25 +0100)]
hw/i386/xen: Remove unused 'hw/ide.h' include from header

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Paul Durrant <paul@xen.org>
Message-Id: <20230220092707.22584-1-philmd@linaro.org>

15 months agoMAINTAINERS: Mark IDE and Floppy as "Odd Fixes"
John Snow [Mon, 6 Feb 2023 18:25:44 +0000 (13:25 -0500)]
MAINTAINERS: Mark IDE and Floppy as "Odd Fixes"

I have not been able to give these devices the love they need for a
while now. Update the maintainers file to reflect the truth of the
matter.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20230206182544.711117-1-jsnow@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agoscripts/checkpatch.pl: Do not allow assert(0)
Philippe Mathieu-Daudé [Tue, 21 Feb 2023 23:00:42 +0000 (00:00 +0100)]
scripts/checkpatch.pl: Do not allow assert(0)

Since commit 262a69f428 ("osdep.h: Prohibit disabling assert()
in supported builds") we can not build QEMU with NDEBUG (or
G_DISABLE_ASSERT) defined, thus 'assert(0)' always aborts QEMU.

However some static analyzers / compilers doesn't notice NDEBUG
can't be defined and emit warnings if code is used after an
'assert(0)' call.

Apparently such compiler isn't as clever with G_DISABLE_ASSERT,
so we can silent these warnings by using g_assert_not_reached()
which is easier to read anyway.

In order to avoid these annoying warnings, add a checkpatch rule
to prohibit 'assert(0)'. Suggest using g_assert_not_reached()
instead. For example when reverting the previous patch we get:

  ERROR: use g_assert_not_reached() instead of assert(0)
  #21: FILE: target/ppc/dfp_helper.c:124:
  +            assert(0); /* cannot get here */

  ERROR: use g_assert_not_reached() instead of assert(0)
  #30: FILE: target/ppc/dfp_helper.c:141:
  +            assert(0); /* cannot get here */

  total: 2 errors, 0 warnings, 16 lines checked

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230221232520.14480-3-philmd@linaro.org>

15 months agoblock/vvfat: Remove pointless check of NDEBUG
Philippe Mathieu-Daudé [Tue, 21 Feb 2023 23:15:54 +0000 (00:15 +0100)]
block/vvfat: Remove pointless check of NDEBUG

Since commit 262a69f428 ("osdep.h: Prohibit disabling
assert() in supported builds") 'NDEBUG' can not be defined,
so '#ifndef NDEBUG' is dead code. Remove it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230221232520.14480-5-philmd@linaro.org>

15 months agohw/ppc/sam460ex: Correctly set MAL properties
Philippe Mathieu-Daudé [Thu, 2 Feb 2023 13:06:42 +0000 (14:06 +0100)]
hw/ppc/sam460ex: Correctly set MAL properties

MAL properties are declared as uint8_t:

  static Property ppc4xx_mal_properties[] = {
      DEFINE_PROP_UINT8("txc-num", Ppc4xxMalState, txcnum, 0),
      DEFINE_PROP_UINT8("rxc-num", Ppc4xxMalState, rxcnum, 0),
      DEFINE_PROP_END_OF_LIST(),
  };

Correct the API use by setting the property using
qdev_prop_set_uint8(). No behavioral change.

Fixes: da116a8aab ("ppc/ppc405: QOM'ify MAL")
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230203145536.17585-7-philmd@linaro.org>

15 months agohw/display/sm501: Add fallbacks to pixman routines
BALATON Zoltan [Sat, 25 Feb 2023 21:35:28 +0000 (22:35 +0100)]
hw/display/sm501: Add fallbacks to pixman routines

Pixman may return false if it does not have a suitable implementation.
Add fallbacks to handle such cases.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reported-by: Rene Engel <ReneEngel80@emailn.de>
Tested-by: Rene Engel <ReneEngel80@emailn.de>
Message-Id: <20ed9442a0146238254ccc340c0d1efa226c6356.1677445307.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/display/sm501: Implement more 2D raster operations
BALATON Zoltan [Wed, 15 Feb 2023 15:35:42 +0000 (16:35 +0100)]
hw/display/sm501: Implement more 2D raster operations

Add simple implementation for two raster operations that are used by
AmigaOS which fixes graphics problems in some programs using these.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reported-by: Rene Engel <ReneEngel80@emailn.de>
Tested-by: Rene Engel <ReneEngel80@emailn.de>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <17ef3c59dc7868f75034e9ebe21e2999c8f718d4.1677445307.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/display/sm501: Alias 'dma-offset' QOM property in chipset object
Philippe Mathieu-Daudé [Fri, 3 Feb 2023 14:31:52 +0000 (15:31 +0100)]
hw/display/sm501: Alias 'dma-offset' QOM property in chipset object

No need to use an intermediate 'dma-offset' property in the
chipset object. Alias the property, so when the machine (here
r2d-plus) sets the value on the chipset, it is propagated to
the OHCI object.

Note we can rename the chipset 'base' property as 'dma-offset'
since the object is a non-user-creatable sysbus type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20230203145536.17585-12-philmd@linaro.org>

15 months agohw/display/sm501: Embed OHCI QOM child in chipset
Philippe Mathieu-Daudé [Fri, 3 Feb 2023 14:29:52 +0000 (15:29 +0100)]
hw/display/sm501: Embed OHCI QOM child in chipset

Note this device doesn't implement unrealize().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20230203145536.17585-11-philmd@linaro.org>

15 months agohw/usb/xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro
Philippe Mathieu-Daudé [Fri, 17 Feb 2023 13:12:13 +0000 (14:12 +0100)]
hw/usb/xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-8-philmd@linaro.org>

15 months agohw/usb/xhci-nec: Declare QOM macros for NEC_XHCI
Philippe Mathieu-Daudé [Fri, 17 Feb 2023 13:12:13 +0000 (14:12 +0100)]
hw/usb/xhci-nec: Declare QOM macros for NEC_XHCI

NEC_XHCI is a QOM object type. Declare its macros /
typedefs using OBJECT_DECLARE_SIMPLE_TYPE().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-7-philmd@linaro.org>

15 months agohw/usb/uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro
Philippe Mathieu-Daudé [Mon, 20 Feb 2023 10:42:46 +0000 (11:42 +0100)]
hw/usb/uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro

By using the QOM UHCI_GET_CLASS() cast macro we don't to
use the intermediate PCIDeviceClass variable.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-6-philmd@linaro.org>

15 months agohw/usb/uhci: Declare QOM macros using OBJECT_DECLARE_TYPE()
Philippe Mathieu-Daudé [Fri, 6 Jan 2023 12:58:32 +0000 (13:58 +0100)]
hw/usb/uhci: Declare QOM macros using OBJECT_DECLARE_TYPE()

The automatic conversion done during commit a489d1951c
("Use OBJECT_DECLARE_TYPE when possible") missed this
model because the typedefs are in a different file unit
(hcd-uhci.c) than where the DECLARE_INSTANCE_CHECKER()
is (hcd-uhci.h). Manually convert to OBJECT_DECLARE_TYPE().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-5-philmd@linaro.org>

15 months agohw/usb/ohci: Fix typo
Philippe Mathieu-Daudé [Mon, 20 Feb 2023 18:15:10 +0000 (19:15 +0100)]
hw/usb/ohci: Fix typo

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <03599fd4db313ac4f651cceb43340109ad6a14b8.1676916640.git.balaton@eik.bme.hu>

15 months agohw/usb/ohci: Add trace points for register access
BALATON Zoltan [Mon, 20 Feb 2023 18:19:09 +0000 (19:19 +0100)]
hw/usb/ohci: Add trace points for register access

To help debugging add trace points that print values read from or
written to the device's registers.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <1bb4985e5dfc1df5a290e77f76fd827ae3592ab7.1676916640.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/usb/ohci: Move a function next to where it is used
BALATON Zoltan [Mon, 20 Feb 2023 18:15:07 +0000 (19:15 +0100)]
hw/usb/ohci: Move a function next to where it is used

The ohci_port_set_if_connected() function is only used by
ohci_port_set_status(), move next to it to have them at the same place.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <46411d4980ab0fba61ab0d2209a939fdc41eb573.1676916640.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/usb/ohci: Code style fix missing braces and extra parenthesis
BALATON Zoltan [Mon, 20 Feb 2023 18:15:06 +0000 (19:15 +0100)]
hw/usb/ohci: Code style fix missing braces and extra parenthesis

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <aaa3ddee99c7677d6cc137f637982e94267b99b6.1676916640.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/usb/ohci: Code style fix white space errors
BALATON Zoltan [Mon, 20 Feb 2023 18:15:05 +0000 (19:15 +0100)]
hw/usb/ohci: Code style fix white space errors

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <c9b99b3555dcd03194a8950b810f5e1b4b4bd5d3.1676916640.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/usb/ohci: Code style fix comments
BALATON Zoltan [Mon, 20 Feb 2023 18:15:04 +0000 (19:15 +0100)]
hw/usb/ohci: Code style fix comments

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <9b0aadedc7c4780fefdc27f14f72ac9003032fbf.1676916639.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/usb/ohci: Use OHCIState type definition
Philippe Mathieu-Daudé [Mon, 20 Feb 2023 10:44:15 +0000 (11:44 +0100)]
hw/usb/ohci: Use OHCIState type definition

Forward-define the type first, then use it for the ohci_die() handler.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-3-philmd@linaro.org>

15 months agohw/usb/ohci: Include missing 'sysbus.h' header
Philippe Mathieu-Daudé [Fri, 3 Feb 2023 09:52:26 +0000 (10:52 +0100)]
hw/usb/ohci: Include missing 'sysbus.h' header

Avoid when including "hw/usb/hcd-ohci.h":

  hw/usb/hcd-ohci.h:100:5: error: unknown type name 'SysBusDevice'
      SysBusDevice parent_obj;
      ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20230203113650.78146-6-philmd@linaro.org>

15 months agohw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE()
Philippe Mathieu-Daudé [Fri, 17 Feb 2023 13:11:23 +0000 (14:11 +0100)]
hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE()

hw/usb/u2f.h was added by commit 80e267f1d1 ("hw/usb: Add
U2F key base class"), almost the same time of the automatic
conversion done by commit c821774a3b ("Use OBJECT_DECLARE_TYPE
where posible"). Manually convert to OBJECT_DECLARE_TYPE().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-9-philmd@linaro.org>

15 months agohw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus
Philippe Mathieu-Daudé [Fri, 6 Jan 2023 21:05:19 +0000 (22:05 +0100)]
hw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus

To avoid forward-declaring CCIDBus, declare CCID_BUS QOM
definitions before its use in the USBCCIDState structure.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220150515.32549-2-philmd@linaro.org>

15 months agohw/audio/ac97: Split off some definitions to a header
BALATON Zoltan [Tue, 25 Jan 2022 19:48:36 +0000 (20:48 +0100)]
hw/audio/ac97: Split off some definitions to a header

These can be shared with other AC97 implementations.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <6f0980fdc3753624be6f3935a6ab0a2dc1df4b30.1677445307.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/audio/ac97: Replace container_of() by AC97() QOM cast macro
Philippe Mathieu-Daudé [Mon, 20 Feb 2023 10:47:14 +0000 (11:47 +0100)]
hw/audio/ac97: Replace container_of() by AC97() QOM cast macro

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220131837.26292-5-philmd@linaro.org>

15 months agohw/audio/es1370: Replace container_of() by ES1370() QOM cast macro
Philippe Mathieu-Daudé [Mon, 20 Feb 2023 13:15:15 +0000 (14:15 +0100)]
hw/audio/es1370: Replace container_of() by ES1370() QOM cast macro

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220131837.26292-4-philmd@linaro.org>

15 months agohw/audio/es1370: Avoid forward-declaring ES1370State
Philippe Mathieu-Daudé [Mon, 9 Jan 2023 14:19:33 +0000 (15:19 +0100)]
hw/audio/es1370: Avoid forward-declaring ES1370State

To avoid forward-declaring ES1370State, declare ES1370 QOM
definitions before its use in the chan_bits structure.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220131837.26292-3-philmd@linaro.org>

15 months agohw/audio/hda-codec: Avoid forward-declaring HDAAudioState
Philippe Mathieu-Daudé [Fri, 6 Jan 2023 21:06:36 +0000 (22:06 +0100)]
hw/audio/hda-codec: Avoid forward-declaring HDAAudioState

To avoid forward-declaring HDAAudioState, declare HDA_AUDIO QOM
definitions before its use in the HDAAudioStream structure.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230220131837.26292-2-philmd@linaro.org>

15 months agohw/timer/hpet: Include missing 'hw/qdev-properties.h' header
Philippe Mathieu-Daudé [Wed, 15 Feb 2023 16:23:49 +0000 (17:23 +0100)]
hw/timer/hpet: Include missing 'hw/qdev-properties.h' header

Avoid when refactoring unrelated headers:

  hw/timer/hpet.c:776:39: error: array has incomplete element type 'Property' (aka 'struct Property')
  static Property hpet_device_properties[] = {
                                        ^
  hw/timer/hpet.c:777:5: error: implicit declaration of function 'DEFINE_PROP_UINT8' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      DEFINE_PROP_UINT8("timers", HPETState, num_timers, HPET_MIN_TIMERS),
      ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230215174353.37097-2-philmd@linaro.org>

15 months agohw/rtc: Rename rtc_[get|set]_memory -> mc146818rtc_[get|set]_cmos_data
Philippe Mathieu-Daudé [Fri, 10 Feb 2023 23:18:53 +0000 (00:18 +0100)]
hw/rtc: Rename rtc_[get|set]_memory -> mc146818rtc_[get|set]_cmos_data

rtc_get_memory() and rtc_set_memory() helpers only work with
TYPE_MC146818_RTC devices. 'memory' in their name refer to
the CMOS region. Rename them as mc146818rtc_get_cmos_data()
and mc146818rtc_set_cmos_data() to be explicit about what
they are doing.

Mechanical change doing:

  $ sed -i -e 's/rtc_set_memory/mc146818rtc_set_cmos_data/g' \
        $(git grep -wl rtc_set_memory)
  $ sed -i -e 's/rtc_get_memory/mc146818rtc_get_cmos_data/g' \
        $(git grep -wl rtc_get_memory)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210233116.80311-4-philmd@linaro.org>

15 months agohw/rtc/mc146818rtc: Pass MC146818RtcState instead of ISADevice argument
Philippe Mathieu-Daudé [Fri, 10 Feb 2023 23:17:51 +0000 (00:17 +0100)]
hw/rtc/mc146818rtc: Pass MC146818RtcState instead of ISADevice argument

rtc_get_memory() and rtc_set_memory() methods can not take any
TYPE_ISA_DEVICE object. They expect a TYPE_MC146818_RTC one.

Simplify the API by passing a MC146818RtcState.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210233116.80311-3-philmd@linaro.org>

15 months agohw/rtc/mc146818rtc: Rename RTCState -> MC146818RtcState
Philippe Mathieu-Daudé [Fri, 10 Feb 2023 23:17:03 +0000 (00:17 +0100)]
hw/rtc/mc146818rtc: Rename RTCState -> MC146818RtcState

RTCState only represents a Motorola MC146818 model,
not any RTC chipset. Rename the structure as MC146818RtcState
using:

  $ sed -i -e s/RTCState/MC146818RtcState/g $(git grep -wl RTCState)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210233116.80311-2-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available
Philippe Mathieu-Daudé [Wed, 15 Feb 2023 14:36:42 +0000 (15:36 +0100)]
hw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230215161641.32663-4-philmd@linaro.org>

15 months agohw/isa: Factor isa_bus_get_irq() out of isa_get_irq()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:55:03 +0000 (11:55 +0100)]
hw/isa: Factor isa_bus_get_irq() out of isa_get_irq()

isa_get_irq() was added in commit 3a38d437ca
("Add isa_reserve_irq()" Fri Aug 14 11:36:15 2009) as:

    a temporary interface to be used to allocate ISA IRQs for
    devices which have not yet been converted to qdev, and for
    special cases which are not suited for qdev conversions,
    such as the 'ferr'.

We still use it 14 years later, using the global 'isabus'
singleton. In order to get rid of such *temporary* interface,
extract isa_bus_get_irq() which can take any ISABus* object.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230215161641.32663-3-philmd@linaro.org>

15 months agohw/isa: Rename isa_get_dma() -> isa_bus_get_dma()
Philippe Mathieu-Daudé [Wed, 15 Feb 2023 14:38:19 +0000 (15:38 +0100)]
hw/isa: Rename isa_get_dma() -> isa_bus_get_dma()

isa_get_dma() returns a DMA channel handler from an ISABus.
To emphasize this, rename it as isa_bus_get_dma().

Mechanical change using:

  $ sed -i -e 's/isa_get_dma/isa_bus_get_dma/g' \
        $(git grep -l isa_get_dma)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230215161641.32663-2-philmd@linaro.org>

15 months agohw/isa: Use isa_address_space_io() to reduce access on global 'isabus'
Philippe Mathieu-Daudé [Fri, 20 Jan 2023 11:45:54 +0000 (12:45 +0100)]
hw/isa: Use isa_address_space_io() to reduce access on global 'isabus'

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230210163744.32182-11-philmd@linaro.org>

15 months agohw/isa: Rename isa_bus_irqs() -> isa_bus_register_input_irqs()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 12:32:18 +0000 (13:32 +0100)]
hw/isa: Rename isa_bus_irqs() -> isa_bus_register_input_irqs()

isa_bus_irqs() register an array of input IRQs on
the ISA bus. Rename it as isa_bus_register_input_irqs().

Mechanical change using:

 $ sed -i -e 's/isa_bus_irqs/isa_bus_register_input_irqs/g' \
   $(git grep -wl isa_bus_irqs)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-10-philmd@linaro.org>

15 months agohw/isa: Un-inline isa_bus_from_device()
Philippe Mathieu-Daudé [Tue, 7 Feb 2023 21:47:20 +0000 (22:47 +0100)]
hw/isa: Un-inline isa_bus_from_device()

No point in inlining isa_bus_from_device() which is only
used at device realization time.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230210163744.32182-9-philmd@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
15 months agohw/isa: Reorder to separate ISABus* vs ISADevice* functions
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 10:59:43 +0000 (11:59 +0100)]
hw/isa: Reorder to separate ISABus* vs ISADevice* functions

Separate functions taking an ISABus* argument versus
functions taking a ISADevice* one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-8-philmd@linaro.org>

15 months agohw/isa: Remove empty ISADeviceClass structure
Philippe Mathieu-Daudé [Tue, 14 Feb 2023 11:48:15 +0000 (12:48 +0100)]
hw/isa: Remove empty ISADeviceClass structure

ISADeviceClass is an empty class and just increase code
complexity. Remove it, directly embedding DeviceClass in
classes expanding TYPE_ISA_DEVICE.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20230215161641.32663-19-philmd@linaro.org>

15 months agohw/sparc64/sun4u: Keep reference to ISA input IRQs in EbusState
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 12:04:29 +0000 (13:04 +0100)]
hw/sparc64/sun4u: Keep reference to ISA input IRQs in EbusState

Keep reference to ISA input IRQs in EbusState.

To emphasize input/output distinction, rename arrays
as isa_irqs_in / isa_irqs_out.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-7-philmd@linaro.org>

15 months agohw/isa/vt82c686: Remove intermediate IRQ forwarder
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 09:38:42 +0000 (10:38 +0100)]
hw/isa/vt82c686: Remove intermediate IRQ forwarder

Directly dispatch ISA IRQs to 'cpu_intr' output IRQ
by removing the intermediate via_isa_request_i8259_irq()
handler. Rename ISA IRQs array as 'isa_irqs_in' to
emphasize these are input IRQs.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-5-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/isa/i82378: Remove intermediate IRQ forwarder
Philippe Mathieu-Daudé [Fri, 10 Feb 2023 15:05:34 +0000 (16:05 +0100)]
hw/isa/i82378: Remove intermediate IRQ forwarder

When the i82378 model was added in commit a04ff940974 ("prep:
Add i82378 PCI-to-ISA bridge emulation") the i8259 model was
not yet QOM'ified. This happened later in commit 747c70af78f
("i8259: Convert to qdev").

Directly dispatch ISA IRQs to 'cpu_intr' output IRQ
by removing the intermediate i82378_request_out0_irq()
handler. Rename ISA IRQs array as 'isa_irqs_in' to
emphasize these are input IRQs.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-4-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/isa/i82378: Rename output IRQ as 'cpu_intr'
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 12:15:16 +0000 (13:15 +0100)]
hw/isa/i82378: Rename output IRQ as 'cpu_intr'

Commit a04ff94097 ("prep: Add i82378 PCI-to-ISA bridge
emulation") aimed to model the 2 output IRQs: CPU intr
and NMI. Commit 5039d6e235 ("i8257: remove cpu_request_exit
irq") removed the NMI IRQ.
Since this model only use the CPU interrupt, replace the
'out[2]' array by a single 'cpu_intr'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-3-philmd@linaro.org>

15 months agohw/intc/i8259: Document i8259_init()
Philippe Mathieu-Daudé [Thu, 9 Feb 2023 12:19:46 +0000 (13:19 +0100)]
hw/intc/i8259: Document i8259_init()

i8259_init() helper creates a i8259 device on an ISA bus,
connects its IRQ output to the parent's input IRQ, and
returns an array of 16 ISA input IRQs.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230210163744.32182-2-philmd@linaro.org>

15 months agohw/pci: Fix a typo
Philippe Mathieu-Daudé [Wed, 8 Feb 2023 17:37:52 +0000 (18:37 +0100)]
hw/pci: Fix a typo

Fix 'interrutp' typo.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230211152239.88106-2-philmd@linaro.org>

15 months agohw: Move ich9.h to southbridge/
Bernhard Beschow [Mon, 13 Feb 2023 17:30:33 +0000 (18:30 +0100)]
hw: Move ich9.h to southbridge/

ICH9 is a south bridge which doesn't necessarily depend on x86, so move
it into the southbridge folder, analoguous to PIIX.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-13-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i386/ich9: Clean up includes
Bernhard Beschow [Mon, 13 Feb 2023 17:30:32 +0000 (18:30 +0100)]
hw/i386/ich9: Clean up includes

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-12-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw: Move ioapic*.h to intc/
Bernhard Beschow [Mon, 13 Feb 2023 17:30:31 +0000 (18:30 +0100)]
hw: Move ioapic*.h to intc/

The ioapic sources reside in hw/intc already. Move the headers there
as well.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-11-shentey@gmail.com>
[PMD: Keep ioapic_internal.h in hw/intc/, not under include/]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i386/ich9: Remove redundant GSI_NUM_PINS
Bernhard Beschow [Mon, 13 Feb 2023 17:30:30 +0000 (18:30 +0100)]
hw/i386/ich9: Remove redundant GSI_NUM_PINS

Most code uses IOAPIC_NUM_PINS. The only place where GSI_NUM_PINS defines
the size of an array is ICH9LPCState::gsi which needs to match
IOAPIC_NUM_PINS. Remove GSI_NUM_PINS for consistency.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-10-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation
Bernhard Beschow [Mon, 13 Feb 2023 17:30:29 +0000 (18:30 +0100)]
hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation

ich9_lpc_reset() is the dc->reset callback which is called
automatically. No need to call it explicitly during k->realize.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-9-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/isa/lpc_ich9: Connect PM stuff to LPC internally
Bernhard Beschow [Mon, 13 Feb 2023 17:30:28 +0000 (18:30 +0100)]
hw/isa/lpc_ich9: Connect PM stuff to LPC internally

Make TYPE_ICH9_LPC_DEVICE more self-contained by moving the call to
ich9_lpc_pm_init() from board code to its realize function. In order
to propagate x86_machine_is_smm_enabled(), introduce an "smm-enabled"
property like we have in piix4.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-8-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE
Bernhard Beschow [Mon, 13 Feb 2023 17:30:27 +0000 (18:30 +0100)]
hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE

This is a preparation to make the next patch cleaner.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-7-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it
Bernhard Beschow [Mon, 13 Feb 2023 17:30:26 +0000 (18:30 +0100)]
hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it

ich9_smb_init() is a legacy init function, so modernize the code.

Note that the smb_io_base parameter was unused.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-6-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize()
Bernhard Beschow [Mon, 13 Feb 2023 17:30:25 +0000 (18:30 +0100)]
hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize()

This is a preparation for the next commit to make it cleaner.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-5-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus
Bernhard Beschow [Mon, 13 Feb 2023 17:30:24 +0000 (18:30 +0100)]
hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus

By using qdev_get_child_bus() we can eliminate ICH9LPCState::isa_bus and
spare the ich9_lpc variable in pc_q35, too.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-4-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/isa/lpc_ich9: Unexport PIRQ functions
Bernhard Beschow [Mon, 13 Feb 2023 17:30:23 +0000 (18:30 +0100)]
hw/isa/lpc_ich9: Unexport PIRQ functions

No need to rely on the board to wire up the ICH9 PCI IRQs. All functions
access private state of the LPC device which suggests that it should
wire up the IRQs.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-3-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i386/ich9: Rename Q35_MASK to ICH9_MASK
Bernhard Beschow [Mon, 13 Feb 2023 17:30:22 +0000 (18:30 +0100)]
hw/i386/ich9: Rename Q35_MASK to ICH9_MASK

The Q35_MASK macro is already defined by TYPE_Q35_HOST_DEVICE, so let
TYPE_ICH9_LPC_DEVICE have its own one to prevent potential name clash.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20230213173033.98762-2-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15 months agohw/i386/x86: Reduce init_topo_info() scope
Philippe Mathieu-Daudé [Fri, 16 Dec 2022 21:25:23 +0000 (22:25 +0100)]
hw/i386/x86: Reduce init_topo_info() scope

This function is not used anywhere outside this file, so
we can delete the prototype from include/hw/i386/x86.h and
make the function "static void".

This fixes when building with -Wall and using Clang
("Apple clang version 14.0.0 (clang-1400.0.29.202)"):

  ../hw/i386/x86.c:70:24: error: static function 'MACHINE' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
      MachineState *ms = MACHINE(x86ms);
                         ^
  include/hw/i386/x86.h:101:1: note: use 'static' to give inline function 'init_topo_info' internal linkage
  void init_topo_info(X86CPUTopoInfo *topo_info, const X86MachineState *x86ms);
  ^
  static
  include/hw/boards.h:24:49: note: 'MACHINE' declared here
  OBJECT_DECLARE_TYPE(MachineState, MachineClass, MACHINE)
                                                  ^

Reported-by: Stefan Weil <sw@weilnetz.de>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20221216220158.6317-6-philmd@linaro.org>

15 months agohw/cpu: Extend CPUState::cluster_index documentation
Philippe Mathieu-Daudé [Thu, 16 Feb 2023 09:09:48 +0000 (10:09 +0100)]
hw/cpu: Extend CPUState::cluster_index documentation

Copy part of the description of commit f7b78602fd ("accel/tcg:
Add cluster number to TCG TB hash") in tcg_cpu_init_cflags(),
improving a bit CPUState::cluster_index documentation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20230216142338.82982-2-philmd@linaro.org>