OSDN Git Service

qmiga/qemu.git
16 months agotarget/riscv: Avoid reporting odd-numbered pmpcfgX in the CSR XML for RV64
Bin Meng [Tue, 28 Feb 2023 10:40:26 +0000 (18:40 +0800)]
target/riscv: Avoid reporting odd-numbered pmpcfgX in the CSR XML for RV64

At present the odd-numbered PMP configuration registers for RV64 are
reported in the CSR XML by QEMU gdbstub. However these registers do
not exist on RV64 so trying to access them from gdb results in 'E14'.

Move the pmpcfgX index check from the actual read/write routine to
the PMP CSR predicate() routine, so that non-existent pmpcfgX won't
be reported in the CSR XML for RV64.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-11-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: Simplify getting RISCVCPU pointer from env
Bin Meng [Tue, 28 Feb 2023 10:40:25 +0000 (18:40 +0800)]
target/riscv: Simplify getting RISCVCPU pointer from env

Use env_archcpu() to get RISCVCPU pointer from env directly.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-10-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: Simplify {read, write}_pmpcfg() a little bit
Bin Meng [Tue, 28 Feb 2023 10:40:24 +0000 (18:40 +0800)]
target/riscv: Simplify {read, write}_pmpcfg() a little bit

Use the register index that has already been calculated in the
pmpcfg_csr_{read,write} call.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-9-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: Use 'bool' type for read_only
Bin Meng [Tue, 28 Feb 2023 10:40:23 +0000 (18:40 +0800)]
target/riscv: Use 'bool' type for read_only

The read_only variable is currently declared as an 'int', but it
should really be a 'bool'.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-8-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: Coding style fixes in csr.c
Bin Meng [Tue, 28 Feb 2023 10:40:22 +0000 (18:40 +0800)]
target/riscv: Coding style fixes in csr.c

Fix various places that violate QEMU coding style:

- correct multi-line comment format
- indent to opening parenthesis

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-7-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: gdbstub: Do not generate CSR XML if Zicsr is disabled
Bin Meng [Tue, 28 Feb 2023 10:40:21 +0000 (18:40 +0800)]
target/riscv: gdbstub: Do not generate CSR XML if Zicsr is disabled

There is no need to generate the CSR XML if the Zicsr extension
is not enabled.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-6-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: gdbstub: Minor change for better readability
Bin Meng [Tue, 28 Feb 2023 10:40:20 +0000 (18:40 +0800)]
target/riscv: gdbstub: Minor change for better readability

Use a variable 'base_reg' to represent cs->gdb_num_regs so that
the call to ricsv_gen_dynamic_vector_xml() can be placed in one
single line for better readability.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-5-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: Use g_assert() for the predicate() NULL check
Bin Meng [Tue, 28 Feb 2023 10:40:19 +0000 (18:40 +0800)]
target/riscv: Use g_assert() for the predicate() NULL check

At present riscv_csrrw_check() checks the CSR predicate() against
NULL and throws RISCV_EXCP_ILLEGAL_INST if it is NULL. But this is
a pure software check, and has nothing to do with the emulation of
the hardware behavior, thus it is inappropriate to return illegal
instruction exception when software forgets to install the hook.

Change to use g_assert() instead.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li<liweiwei@iscas.ac.cn>
Message-ID: <20230228104035.1879882-4-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: Add some comments to clarify the priority policy of riscv_csrrw_check()
Bin Meng [Tue, 28 Feb 2023 10:40:18 +0000 (18:40 +0800)]
target/riscv: Add some comments to clarify the priority policy of riscv_csrrw_check()

The priority policy of riscv_csrrw_check() was once adjusted in
commit eacaf4401956 ("target/riscv: Fix priority of csr related check in riscv_csrrw_check")
whose commit message says the CSR existence check should come before
the access control check, but the code changes did not agree with
the commit message, that the predicate() check actually came after
the read / write check.

In fact this was intentional. Add some comments there so that people
won't bother trying to change it without a solid reason.

Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li<liweiwei@iscas.ac.cn>
Message-ID: <20230228104035.1879882-3-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: gdbstub: Check priv spec version before reporting CSR
Bin Meng [Tue, 28 Feb 2023 10:40:17 +0000 (18:40 +0800)]
target/riscv: gdbstub: Check priv spec version before reporting CSR

The gdbstub CSR XML is dynamically generated according to the result
of the CSR predicate() result. This has been working fine until
commit 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12")
introduced the privilege spec version check in riscv_csrrw_check().

When debugging the 'sifive_u' machine whose priv spec is at 1.10,
gdbstub reports priv spec 1.12 CSRs like menvcfg in the XML, hence
we see "remote failure reply 'E14'" message when examining all CSRs
via "info register system" from gdb.

Add the priv spec version check in the CSR XML generation logic to
fix this issue.

Fixes: 7100fe6c2441 ("target/riscv: Enable privileged spec version 1.12")
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230228104035.1879882-2-bmeng@tinylab.org>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv/cpu: remove CPUArchState::features and friends
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:05 +0000 (15:52 -0300)]
target/riscv/cpu: remove CPUArchState::features and friends

The attribute is no longer used since we can retrieve all the enabled
features in the hart by using cpu->cfg instead.

Remove env->feature, riscv_feature() and riscv_set_feature(). We also
need to bump vmstate_riscv_cpu version_id and minimal_version_id since
'features' is no longer being migrated.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-11-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: remove RISCV_FEATURE_MMU
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:04 +0000 (15:52 -0300)]
target/riscv: remove RISCV_FEATURE_MMU

RISCV_FEATURE_MMU is set whether cpu->cfg.mmu is set, so let's just use
the flag directly instead.

With this change the enum is also removed. It is worth noticing that
this enum, and all the RISCV_FEATURES_* that were contained in it,
predates the existence of the cpu->cfg object. Today, using cpu->cfg is
an easier way to retrieve all the features and extensions enabled in the
hart.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-10-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agohw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus()
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:03 +0000 (15:52 -0300)]
hw/riscv/virt.c: do not use RISCV_FEATURE_MMU in create_fdt_socket_cpus()

Read cpu_ptr->cfg.mmu directly. As a bonus, use cpu_ptr in
riscv_isa_string().

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-9-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: remove RISCV_FEATURE_PMP
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:02 +0000 (15:52 -0300)]
target/riscv: remove RISCV_FEATURE_PMP

RISCV_FEATURE_PMP is being set via riscv_set_feature() by mirroring the
cpu->cfg.pmp flag. Use the flag instead.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-8-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: remove RISCV_FEATURE_EPMP
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:01 +0000 (15:52 -0300)]
target/riscv: remove RISCV_FEATURE_EPMP

RISCV_FEATURE_EPMP is always set to the same value as the cpu->cfg.epmp
flag. Use the flag directly.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-7-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv/cpu.c: error out if EPMP is enabled without PMP
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:52:00 +0000 (15:52 -0300)]
target/riscv/cpu.c: error out if EPMP is enabled without PMP

Instead of silently ignoring the EPMP setting if there is no PMP
available, error out informing the user that EPMP depends on PMP
support:

$ ./qemu-system-riscv64 -cpu rv64,pmp=false,x-epmp=true
qemu-system-riscv64: Invalid configuration: EPMP requires PMP support

This will force users to pick saner options in the QEMU command line.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-6-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: remove RISCV_FEATURE_DEBUG
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:59 +0000 (15:51 -0300)]
target/riscv: remove RISCV_FEATURE_DEBUG

RISCV_FEATURE_DEBUG will always follow the value defined by
cpu->cfg.debug flag. Read the flag instead.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-5-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: allow MISA writes as experimental
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:58 +0000 (15:51 -0300)]
target/riscv: allow MISA writes as experimental

At this moment, and apparently since ever, we have no way of enabling
RISCV_FEATURE_MISA. This means that all the code from write_misa(), all
the nuts and bolts that handles how to properly write this CSR, has
always been a no-op as well because write_misa() will always exit
earlier.

This seems to be benign in the majority of cases. Booting an Ubuntu
'virt' guest and logging all the calls to 'write_misa' shows that no
writes to MISA CSR was attempted. Writing MISA, i.e. enabling/disabling
RISC-V extensions after the machine is powered on, seems to be a niche
use.

After discussions in the mailing list, most notably in [1], we reached
the consensus that this code is not suited to be exposed to users
because it's not well tested, but at the same time removing it is a bit
extreme because we would like to fix it, and it's easier to do so with
the code available to use instead of fetching it from git log.

The approach taken here is to get rid of RISCV_FEATURE_MISA altogether
and use a new experimental flag called x-misa-w. The default value is
false, meaning that we're keeping the existing behavior of doing nothing
if a write_misa() is attempted. As with any existing experimental flag,
x-misa-w is also a temporary flag that we need to remove once we fix
write_misa().

[1] https://lists.gnu.org/archive/html/qemu-devel/2023-02/msg05092.html

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Weiwei Li<liweiwei@iscas.ac.cn>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Message-ID: <20230222185205.355361-4-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: do not mask unsupported QEMU extensions in write_misa()
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:57 +0000 (15:51 -0300)]
target/riscv: do not mask unsupported QEMU extensions in write_misa()

The masking done using env->misa_ext_mask already filters any extension
that QEMU doesn't support. If the hart supports the extension then QEMU
supports it as well.

If the masking done by env->misa_ext_mask is somehow letting unsupported
QEMU extensions pass by, misa_ext_mask itself needs to be fixed instead.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Message-ID: <20230222185205.355361-3-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 months agotarget/riscv: introduce riscv_cpu_cfg()
Daniel Henrique Barboza [Wed, 22 Feb 2023 18:51:56 +0000 (15:51 -0300)]
target/riscv: introduce riscv_cpu_cfg()

We're going to do changes that requires accessing the RISCVCPUConfig
struct from the RISCVCPU, having access only to a CPURISCVState 'env'
pointer. Add a helper to make the code easier to read.

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20230222185205.355361-2-dbarboza@ventanamicro.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
16 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>
16 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>
16 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>

16 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>

16 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>

16 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>

16 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>

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>

16 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>
16 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>

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>
16 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>

16 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>
16 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>

16 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>
16 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>

16 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>

16 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>

16 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>
16 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>
16 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>

16 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>

16 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>

16 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>

16 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>

16 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>

16 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>

16 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>
16 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>
16 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>
16 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>
16 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>
16 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>

16 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>

16 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>

16 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>

16 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>
16 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>

16 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>

16 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>

16 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>

16 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>

16 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>

16 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>

16 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>
16 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>

16 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>

16 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>

16 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>

16 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>

16 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>
16 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>

16 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>

16 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>

16 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>
16 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>
16 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>

16 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>

16 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>

16 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>
16 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>
16 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>
16 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>