History log of /qemu/scripts/ (Results 1 – 25 of 2370)
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
7d7a21ba13-Jun-2023 Philippe Mathieu-Daudé <philmd@linaro.org>

exec: Rename NEED_CPU_H -> COMPILING_PER_TARGET

'NEED_CPU_H' guard target-specific code; it is defined by meson
altogether with the 'CONFIG_TARGET' definition. Rename NEED_CPU_H
as COMPILING_PER_TAR

exec: Rename NEED_CPU_H -> COMPILING_PER_TARGET

'NEED_CPU_H' guard target-specific code; it is defined by meson
altogether with the 'CONFIG_TARGET' definition. Rename NEED_CPU_H
as COMPILING_PER_TARGET to clarify its meaning.

Mechanical change running:

$ sed -i s/NEED_CPU_H/COMPILING_PER_TARGET/g $(git grep -l NEED_CPU_H)

then manually add a /* COMPILING_PER_TARGET */ comment
after the '#endif' when the block is large.

Inspired-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: <20240322161439.6448-4-philmd@linaro.org>

show more ...

aadea88712-Apr-2024 Peter Maydell <peter.maydell@linaro.org>

scripts/coccinelle: New script to add ResetType to hold and exit phases

We pass a ResetType argument to the Resettable class enter phase
method, but we don't pass it to hold and exit, even though th

scripts/coccinelle: New script to add ResetType to hold and exit phases

We pass a ResetType argument to the Resettable class enter phase
method, but we don't pass it to hold and exit, even though the
callsites have it readily available. This means that if a device
cared about the ResetType it would need to record it in the enter
phase method to use later on. We should pass the type to all three
of the phase methods to avoid having to do that.

This coccinelle script adds the ResetType argument to the hold and
exit phases of the Resettable interface.

The first part of the script (rules holdfn_assigned, holdfn_defined,
exitfn_assigned, exitfn_defined) update implementations of the
interface within device models, both to change the signature of their
method implementations and to pass on the reset type when they invoke
reset on some other device.

The second part of the script is various special cases:
* method callsites in resettable_phase_hold(), resettable_phase_exit()
and device_phases_reset()
* updating the typedefs for the methods
* isl_pmbus_vr.c has some code where one device's reset method directly
calls the implementation of a different device's method

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Luc Michel <luc.michel@amd.com>
Message-id: 20240412160809.1260625-4-peter.maydell@linaro.org

show more ...

b928505d18-Mar-2024 Maksim Davydov <davydov-max@yandex-team.ru>

scripts: add script to compare compatibility properties

This script runs QEMU to obtain compat_props of machines and default
values of different types of drivers to produce comparison table. This
ta

scripts: add script to compare compatibility properties

This script runs QEMU to obtain compat_props of machines and default
values of different types of drivers to produce comparison table. This
table can be used to compare machine types to choose the most suitable
machine or compare binaries to be sure that migration to the newer version
will save all device properties. Also the json or csv format of this
table can be used to check does a new machine affect the previous ones by
comparing tables with and without the new machine.

Default values (that will be used without machine compat_props) of
properties are needed to fill "holes" in the table (one machine has
the property but another machine not. For instance, 2.12 machine has
`{ "EPYC-" TYPE_X86_CPU, "xlevel", "0x8000000a" }`, but compat_pros of
3.1 machine doesn't have it. Thus, to compare these machines we need to
get unknown value of "EPYC-x86_64-cpu-xlevel" for 3.1 machine. These
unknown values in the table are called "holes". To get values for these
"holes" the script uses list of appropriate methods.)

Notes:
* Some init values from the devices can't be available like properties
from virtio-9p when configure has --disable-virtfs. This situations will
be seen in the table as "unavailable driver".
* Default values can be obtained in an unobvious way, like x86 features.
If the script doesn't know how to get property default value to compare
one machine with another it fills "holes" with "unavailable method". This
is done because script uses whitelist model to get default values of
different types. It means that the method that can't be applied to a new
type that can crash this script. It is better to get an "unavailable
driver" when creating a new machine with new compatible properties than
to break this script. So it turns out a more stable and generic script.
* If the default value can't be obtained because this property doesn't
exist or because this property can't have default value, appropriate
"hole" will be filled by "unknown property" or "no default value"
* If the property is applied to the abstract class, the script collects
default values from all child classes and prints all these classes
* Raw table (--raw flag) should be used with json/csv parameters for
scripts and etc. Human-readable (default) format contains transformed
and simplified values and it doesn't contain lines with the same values
in columns

Example:
./scripts/compare-machine-types.py --mt pc-q35-6.2 pc-q35-7.1
╒══════════════════╤══════════════════════════╤════════════════════════════╤════════════════════════════╕
│ Driver │ Property │ build/qemu-system-x86_64 │ build/qemu-system-x86_64 │
│ │ │ pc-q35-6.2 │ pc-q35-7.1 │
╞══════════════════╪══════════════════════════╪════════════════════════════╪════════════════════════════╡
│ PIIX4_PM │ x-not-migrate-acpi-index │ True │ False │
├──────────────────┼──────────────────────────┼────────────────────────────┼────────────────────────────┤
│ arm-gicv3-common │ force-8-bit-prio │ True │ unavailable driver │
├──────────────────┼──────────────────────────┼────────────────────────────┼────────────────────────────┤
│ nvme-ns │ eui64-default │ True │ False │
├──────────────────┼──────────────────────────┼────────────────────────────┼────────────────────────────┤
│ virtio-mem │ unplugged-inaccessible │ False │ auto │
╘══════════════════╧══════════════════════════╧════════════════════════════╧════════════════════════════╛

Signed-off-by: Maksim Davydov <davydov-max@yandex-team.ru>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Message-ID: <20240318213550.155573-5-davydov-max@yandex-team.ru>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

show more ...

1f2355f512-Mar-2024 Ilya Leoshkevich <iii@linux.ibm.com>

meson: Make DEBUG_REMAP a meson option

Currently DEBUG_REMAP is a macro that needs to be manually #defined to
be activated, which makes it hard to have separate build directories
dedicated to testin

meson: Make DEBUG_REMAP a meson option

Currently DEBUG_REMAP is a macro that needs to be manually #defined to
be activated, which makes it hard to have separate build directories
dedicated to testing the code with it. Promote it to a meson option.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240312002402.14344-1-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

show more ...

1dfd42c428-Mar-2024 Philippe Mathieu-Daudé <philmd@linaro.org>

hw/rdma: Remove deprecated pvrdma device and rdmacm-mux helper

The whole RDMA subsystem was deprecated in commit e9a54265f5
("hw/rdma: Deprecate the pvrdma device and the rdma subsystem")
released i

hw/rdma: Remove deprecated pvrdma device and rdmacm-mux helper

The whole RDMA subsystem was deprecated in commit e9a54265f5
("hw/rdma: Deprecate the pvrdma device and the rdma subsystem")
released in v8.2.

Remove:
- PVRDMA device
- generated vmw_pvrdma/ directory from linux-headers
- rdmacm-mux tool from contrib/

Cc: Yuval Shaia <yuval.shaia.ml@gmail.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20240328130255.52257-2-philmd@linaro.org>

show more ...

6c30148527-Mar-2024 Philippe Mathieu-Daudé <philmd@linaro.org>

target/nios2: Remove the deprecated Nios II target

The Nios II target is deprecated since v8.2 in commit 9997771bc1
("target/nios2: Deprecate the Nios II architecture").

Remove:
- Buildsys / CI inf

target/nios2: Remove the deprecated Nios II target

The Nios II target is deprecated since v8.2 in commit 9997771bc1
("target/nios2: Deprecate the Nios II architecture").

Remove:
- Buildsys / CI infra
- User emulation
- System emulation (10m50-ghrd & nios2-generic-nommu machines)
- Tests

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Marek Vasut <marex@denx.de>
Message-Id: <20240327144806.11319-3-philmd@linaro.org>

show more ...


/qemu/.gitlab-ci.d/base.yml
/qemu/.gitlab-ci.d/buildtest-template.yml
/qemu/.gitlab-ci.d/buildtest.yml
/qemu/.gitlab-ci.d/cirrus.yml
/qemu/.gitlab-ci.d/crossbuild-template.yml
/qemu/.gitlab-ci.d/crossbuilds.yml
/qemu/.gitlab-ci.d/custom-runners.yml
/qemu/.gitlab-ci.d/windows.yml
/qemu/.mailmap
/qemu/.travis.yml
/qemu/MAINTAINERS
/qemu/Makefile
/qemu/VERSION
/qemu/accel/kvm/kvm-all.c
/qemu/accel/tcg/cpu-exec.c
/qemu/accel/tcg/plugin-gen.c
/qemu/accel/tcg/translate-all.c
/qemu/accel/tcg/translator.c
/qemu/backends/cryptodev-builtin.c
/qemu/backends/iommufd.c
/qemu/block.c
/qemu/block/block-backend.c
/qemu/block/copy-before-write.c
/qemu/block/io.c
/qemu/block/mirror.c
/qemu/block/nbd.c
/qemu/block/nvme.c
/qemu/block/qapi.c
/qemu/block/qcow2-bitmap.c
/qemu/block/qcow2.c
/qemu/block/qed.c
/qemu/block/snapshot.c
/qemu/block/vdi.c
/qemu/block/vmdk.c
/qemu/blockdev.c
/qemu/bsd-user/main.c
/qemu/bsd-user/signal.c
/qemu/chardev/char-io.c
/qemu/chardev/char-socket.c
/qemu/configure
/qemu/contrib/plugins/execlog.c
/qemu/contrib/plugins/howvec.c
/qemu/crypto/cipher-gcrypt.c.inc
/qemu/disas/disas-mon.c
/qemu/disas/disas.c
/qemu/disas/meson.build
/qemu/disas/nanomips.c
/qemu/docs/about/deprecated.rst
/qemu/docs/about/emulation.rst
/qemu/docs/about/removed-features.rst
/qemu/docs/devel/atomics.rst
/qemu/docs/devel/ci-jobs.rst.inc
/qemu/docs/devel/clocks.rst
/qemu/docs/devel/migration/CPR.rst
/qemu/docs/devel/migration/features.rst
/qemu/docs/devel/nested-papr.txt
/qemu/docs/interop/vhost-user.rst
/qemu/docs/specs/pvpanic.rst
/qemu/docs/system/arm/sbsa.rst
/qemu/docs/system/devices/nvme.rst
/qemu/docs/system/i386/sgx.rst
/qemu/docs/system/introduction.rst
/qemu/docs/system/ppc/amigang.rst
/qemu/docs/system/replay.rst
/qemu/docs/system/s390x/cpu-topology.rst
/qemu/docs/system/target-ppc.rst
/qemu/docs/user/main.rst
/qemu/ebpf/ebpf.c
/qemu/ebpf/ebpf.h
/qemu/ebpf/ebpf_rss-stub.c
/qemu/ebpf/ebpf_rss.c
/qemu/ebpf/ebpf_rss.h
/qemu/ebpf/meson.build
/qemu/ebpf/rss.bpf.skeleton.h
/qemu/fpu/softfloat-specialize.c.inc
/qemu/gdbstub/gdbstub.c
/qemu/gdbstub/internals.h
/qemu/gdbstub/system.c
/qemu/gdbstub/user.c
/qemu/hmp-commands.hx
/qemu/hw/Kconfig
/qemu/hw/acpi/acpi_generic_initiator.c
/qemu/hw/acpi/hmat.c
/qemu/hw/acpi/meson.build
/qemu/hw/arm/aspeed.c
/qemu/hw/arm/aspeed_ast10x0.c
/qemu/hw/arm/aspeed_ast2600.c
/qemu/hw/arm/raspi4b.c
/qemu/hw/arm/smmu-common.c
/qemu/hw/arm/virt-acpi-build.c
/qemu/hw/arm/virt.c
/qemu/hw/arm/xlnx-versal-virt.c
/qemu/hw/audio/virtio-snd.c
/qemu/hw/block/m25p80.c
/qemu/hw/block/nand.c
/qemu/hw/block/vhost-user-blk.c
/qemu/hw/block/virtio-blk.c
/qemu/hw/char/virtio-serial-bus.c
/qemu/hw/core/clock.c
/qemu/hw/core/cpu-common.c
/qemu/hw/core/loader-fit.c
/qemu/hw/core/machine-qmp-cmds.c
/qemu/hw/core/machine.c
/qemu/hw/core/numa.c
/qemu/hw/core/qdev-properties-system.c
/qemu/hw/cxl/cxl-component-utils.c
/qemu/hw/cxl/cxl-host.c
/qemu/hw/display/ati.c
/qemu/hw/display/macfb.c
/qemu/hw/display/vga.c
/qemu/hw/display/virtio-gpu.c
/qemu/hw/gpio/Kconfig
/qemu/hw/gpio/meson.build
/qemu/hw/gpio/pca9552.c
/qemu/hw/gpio/pca9554.c
/qemu/hw/gpio/pcf8574.c
/qemu/hw/gpio/trace-events
/qemu/hw/i386/Kconfig
/qemu/hw/i386/acpi-build.c
/qemu/hw/i386/fw_cfg.c
/qemu/hw/i386/fw_cfg.h
/qemu/hw/i386/kvm/xen_evtchn.c
/qemu/hw/i386/pc.c
/qemu/hw/i386/pc_piix.c
/qemu/hw/i386/pc_q35.c
/qemu/hw/i386/pc_sysfw.c
/qemu/hw/i386/x86.c
/qemu/hw/ide/ahci-internal.h
/qemu/hw/ide/ahci.c
/qemu/hw/ide/ich.c
/qemu/hw/intc/Kconfig
/qemu/hw/intc/arm_gicv3_cpuif.c
/qemu/hw/intc/ioapic_common.c
/qemu/hw/intc/loongarch_extioi.c
/qemu/hw/intc/meson.build
/qemu/hw/intc/riscv_aplic.c
/qemu/hw/isa/vt82c686.c
/qemu/hw/loongarch/virt.c
/qemu/hw/mem/cxl_type3.c
/qemu/hw/meson.build
/qemu/hw/microblaze/xlnx-zynqmp-pmu.c
/qemu/hw/misc/applesmc.c
/qemu/hw/misc/ivshmem.c
/qemu/hw/misc/macio/pmu.c
/qemu/hw/misc/meson.build
/qemu/hw/misc/pvpanic-pci.c
/qemu/hw/misc/stm32l4x5_rcc.c
/qemu/hw/misc/trace-events
/qemu/hw/misc/xlnx-versal-trng.c
/qemu/hw/net/e1000e_core.c
/qemu/hw/net/e1000e_core.h
/qemu/hw/net/igb.c
/qemu/hw/net/igb_core.c
/qemu/hw/net/igb_core.h
/qemu/hw/net/lan9118.c
/qemu/hw/net/net_tx_pkt.c
/qemu/hw/net/pcnet.c
/qemu/hw/net/vhost_net.c
/qemu/hw/net/virtio-net.c
/qemu/hw/nvme/ctrl.c
/qemu/hw/nvme/meson.build
/qemu/hw/nvme/nguid.c
/qemu/hw/nvme/ns.c
/qemu/hw/nvme/nvme.h
/qemu/hw/nvram/mac_nvram.c
/qemu/hw/pci-bridge/cxl_root_port.c
/qemu/hw/pci-bridge/cxl_upstream.c
/qemu/hw/pci-bridge/pci_expander_bridge.c
/qemu/hw/pci-host/ppc440_pcix.c
/qemu/hw/pci/pci.c
/qemu/hw/pci/pcie.c
/qemu/hw/pci/pcie_sriov.c
/qemu/hw/pci/shpc.c
/qemu/hw/pci/trace-events
/qemu/hw/ppc/mpc8544_guts.c
/qemu/hw/ppc/pnv.c
/qemu/hw/ppc/pnv_core.c
/qemu/hw/ppc/pnv_i2c.c
/qemu/hw/ppc/pnv_xscom.c
/qemu/hw/ppc/ppc.c
/qemu/hw/ppc/ppce500_spin.c
/qemu/hw/ppc/sam460ex.c
/qemu/hw/ppc/spapr.c
/qemu/hw/ppc/spapr_caps.c
/qemu/hw/ppc/spapr_cpu_core.c
/qemu/hw/ppc/spapr_hcall.c
/qemu/hw/ppc/spapr_nested.c
/qemu/hw/riscv/virt.c
/qemu/hw/s390x/s390-virtio-ccw.c
/qemu/hw/scsi/esp.c
/qemu/hw/scsi/lsi53c895a.c
/qemu/hw/scsi/scsi-generic.c
/qemu/hw/scsi/vhost-scsi.c
/qemu/hw/sd/sdhci.c
/qemu/hw/smbios/Kconfig
/qemu/hw/smbios/meson.build
/qemu/hw/smbios/smbios.c
/qemu/hw/smbios/smbios_legacy.c
/qemu/hw/smbios/smbios_legacy_stub.c
/qemu/hw/sparc64/sun4u.c
/qemu/hw/ssi/aspeed_smc.c
/qemu/hw/usb/dev-audio.c
/qemu/hw/usb/dev-storage-classic.c
/qemu/hw/vfio/ap.c
/qemu/hw/vfio/container.c
/qemu/hw/vfio/helpers.c
/qemu/hw/vfio/iommufd.c
/qemu/hw/vfio/pci-quirks.c
/qemu/hw/vfio/pci.c
/qemu/hw/vfio/platform.c
/qemu/hw/virtio/trace-events
/qemu/hw/virtio/vdpa-dev.c
/qemu/hw/virtio/vhost-user-scmi.c
/qemu/hw/virtio/vhost-user.c
/qemu/hw/virtio/vhost-vdpa.c
/qemu/hw/virtio/vhost-vsock.c
/qemu/hw/virtio/vhost.c
/qemu/hw/virtio/virtio-crypto.c
/qemu/hw/virtio/virtio-iommu.c
/qemu/hw/virtio/virtio-pci.c
/qemu/hw/virtio/virtio.c
/qemu/hw/xen/xen-mapcache.c
/qemu/hw/xen/xen_pt.c
/qemu/hw/xen/xen_pt_config_init.c
/qemu/include/disas/dis-asm.h
/qemu/include/exec/exec-all.h
/qemu/include/exec/poison.h
/qemu/include/exec/ram_addr.h
/qemu/include/exec/translator.h
/qemu/include/exec/user/abitypes.h
/qemu/include/gdbstub/user.h
/qemu/include/hw/acpi/acpi_generic_initiator.h
/qemu/include/hw/audio/virtio-snd.h
/qemu/include/hw/block/flash.h
/qemu/include/hw/boards.h
/qemu/include/hw/clock.h
/qemu/include/hw/cxl/cxl_component.h
/qemu/include/hw/cxl/cxl_pci.h
/qemu/include/hw/firmware/smbios.h
/qemu/include/hw/gpio/pca9552.h
/qemu/include/hw/gpio/pca9552_regs.h
/qemu/include/hw/gpio/pca9554.h
/qemu/include/hw/gpio/pca9554_regs.h
/qemu/include/hw/gpio/pcf8574.h
/qemu/include/hw/i386/pc.h
/qemu/include/hw/pci/pcie_regs.h
/qemu/include/hw/pci/pcie_sriov.h
/qemu/include/hw/ppc/pnv_chip.h
/qemu/include/hw/ppc/pnv_core.h
/qemu/include/hw/ppc/spapr.h
/qemu/include/hw/ppc/spapr_nested.h
/qemu/include/hw/virtio/vhost-vdpa.h
/qemu/include/hw/virtio/virtio-gpu.h
/qemu/include/hw/virtio/virtio-iommu.h
/qemu/include/hw/virtio/virtio-net.h
/qemu/include/hw/virtio/virtio.h
/qemu/include/io/channel-file.h
/qemu/include/net/vhost_net.h
/qemu/include/qapi/error.h
/qemu/include/qemu/job.h
/qemu/include/sysemu/arch_init.h
/qemu/include/sysemu/numa.h
/qemu/include/tcg/tcg.h
/qemu/include/ui/console.h
/qemu/include/ui/kbd-state.h
/qemu/io/channel-file.c
/qemu/linux-user/aarch64/signal.c
/qemu/linux-user/alpha/signal.c
/qemu/linux-user/arm/signal.c
/qemu/linux-user/elfload.c
/qemu/linux-user/hexagon/signal.c
/qemu/linux-user/hppa/signal.c
/qemu/linux-user/i386/cpu_loop.c
/qemu/linux-user/i386/signal.c
/qemu/linux-user/ioctls.h
/qemu/linux-user/loongarch64/signal.c
/qemu/linux-user/m68k/signal.c
/qemu/linux-user/main.c
/qemu/linux-user/microblaze/signal.c
/qemu/linux-user/mips/signal.c
/qemu/linux-user/mmap.c
/qemu/linux-user/openrisc/signal.c
/qemu/linux-user/ppc/signal.c
/qemu/linux-user/riscv/signal.c
/qemu/linux-user/s390x/signal.c
/qemu/linux-user/sh4/signal.c
/qemu/linux-user/signal-common.h
/qemu/linux-user/signal.c
/qemu/linux-user/sparc/signal.c
/qemu/linux-user/strace.c
/qemu/linux-user/syscall.c
/qemu/linux-user/syscall_defs.h
/qemu/linux-user/xtensa/signal.c
/qemu/meson.build
/qemu/migration/block.c
/qemu/migration/fd.c
/qemu/migration/fd.h
/qemu/migration/file.c
/qemu/migration/file.h
/qemu/migration/migration.c
/qemu/migration/multifd-zlib.c
/qemu/migration/multifd.c
/qemu/migration/options.c
/qemu/migration/postcopy-ram.c
/qemu/migration/savevm.c
/qemu/monitor/hmp-cmds-target.c
/qemu/nbd/server.c
/qemu/net/af-xdp.c
/qemu/net/tap-win32.c
/qemu/net/tap.c
/qemu/net/trace-events
/qemu/net/vhost-vdpa.c
/qemu/pc-bios/edk2-aarch64-code.fd.bz2
/qemu/pc-bios/edk2-arm-code.fd.bz2
/qemu/pc-bios/edk2-i386-code.fd.bz2
/qemu/pc-bios/edk2-i386-secure-code.fd.bz2
/qemu/pc-bios/edk2-riscv-code.fd.bz2
/qemu/pc-bios/edk2-x86_64-code.fd.bz2
/qemu/pc-bios/edk2-x86_64-microvm.fd.bz2
/qemu/pc-bios/edk2-x86_64-secure-code.fd.bz2
/qemu/plugins/loader.c
/qemu/qapi/block-core.json
/qemu/qapi/block.json
/qemu/qapi/common.json
/qemu/qapi/control.json
/qemu/qapi/crypto.json
/qemu/qapi/cxl.json
/qemu/qapi/dump.json
/qemu/qapi/ebpf.json
/qemu/qapi/machine-target.json
/qemu/qapi/machine.json
/qemu/qapi/meson.build
/qemu/qapi/migration.json
/qemu/qapi/misc.json
/qemu/qapi/net.json
/qemu/qapi/pragma.json
/qemu/qapi/qapi-schema.json
/qemu/qapi/qom.json
/qemu/qapi/replay.json
/qemu/qapi/run-state.json
/qemu/qapi/sockets.json
/qemu/qapi/stats.json
/qemu/qapi/ui.json
/qemu/qapi/virtio.json
/qemu/qemu-options.hx
/qemu/qga/qapi-schema.json
/qemu/roms/Makefile
/qemu/roms/edk2-build.config
/qemu/roms/edk2-version
coverity-scan/COMPONENTS.md
gensyscalls.sh
probe-gdb-support.py
/qemu/subprojects/libvhost-user/libvhost-user.c
/qemu/subprojects/libvhost-user/libvhost-user.h
/qemu/system/physmem.c
/qemu/system/qdev-monitor.c
/qemu/system/qemu-seccomp.c
/qemu/system/vl.c
/qemu/target/Kconfig
/qemu/target/alpha/cpu.c
/qemu/target/alpha/gdbstub.c
/qemu/target/alpha/helper.c
/qemu/target/alpha/mem_helper.c
/qemu/target/alpha/translate.c
/qemu/target/arm/arm-qmp-cmds.c
/qemu/target/arm/cpu.c
/qemu/target/arm/helper.c
/qemu/target/arm/hvf/hvf.c
/qemu/target/arm/kvm.c
/qemu/target/arm/machine.c
/qemu/target/arm/tcg/translate-a64.c
/qemu/target/arm/tcg/translate.c
/qemu/target/arm/tcg/translate.h
/qemu/target/avr/cpu.c
/qemu/target/avr/gdbstub.c
/qemu/target/avr/helper.c
/qemu/target/avr/translate.c
/qemu/target/cris/cpu.c
/qemu/target/cris/gdbstub.c
/qemu/target/cris/helper.c
/qemu/target/cris/translate.c
/qemu/target/hexagon/cpu.c
/qemu/target/hexagon/gdbstub.c
/qemu/target/hppa/cpu.h
/qemu/target/hppa/helper.h
/qemu/target/hppa/insns.decode
/qemu/target/hppa/int_helper.c
/qemu/target/hppa/mem_helper.c
/qemu/target/hppa/op_helper.c
/qemu/target/hppa/sys_helper.c
/qemu/target/hppa/translate.c
/qemu/target/i386/cpu-sysemu.c
/qemu/target/i386/cpu.c
/qemu/target/i386/cpu.h
/qemu/target/i386/helper.c
/qemu/target/i386/hvf/hvf.c
/qemu/target/i386/hvf/x86.c
/qemu/target/i386/hvf/x86.h
/qemu/target/i386/hvf/x86_descr.c
/qemu/target/i386/hvf/x86_descr.h
/qemu/target/i386/hvf/x86_emu.h
/qemu/target/i386/hvf/x86_mmu.c
/qemu/target/i386/hvf/x86_mmu.h
/qemu/target/i386/hvf/x86hvf.c
/qemu/target/i386/nvmm/nvmm-all.c
/qemu/target/i386/tcg/sysemu/excp_helper.c
/qemu/target/i386/tcg/translate.c
/qemu/target/i386/whpx/whpx-all.c
/qemu/target/loongarch/cpu-csr.h
/qemu/target/loongarch/cpu.c
/qemu/target/loongarch/cpu_helper.c
/qemu/target/loongarch/gdbstub.c
/qemu/target/loongarch/internals.h
/qemu/target/loongarch/kvm/kvm.c
/qemu/target/loongarch/loongarch-qmp-cmds.c
/qemu/target/loongarch/tcg/insn_trans/trans_atomic.c.inc
/qemu/target/loongarch/tcg/tlb_helper.c
/qemu/target/loongarch/tcg/translate.c
/qemu/target/m68k/cpu.c
/qemu/target/m68k/cpu.h
/qemu/target/m68k/fpu_helper.c
/qemu/target/m68k/gdbstub.c
/qemu/target/m68k/helper.c
/qemu/target/m68k/helper.h
/qemu/target/m68k/m68k-semi.c
/qemu/target/m68k/op_helper.c
/qemu/target/m68k/translate.c
/qemu/target/meson.build
/qemu/target/microblaze/cpu.c
/qemu/target/microblaze/gdbstub.c
/qemu/target/microblaze/helper.c
/qemu/target/microblaze/translate.c
/qemu/target/mips/cpu.c
/qemu/target/mips/gdbstub.c
/qemu/target/mips/kvm.c
/qemu/target/mips/sysemu/physaddr.c
/qemu/target/mips/tcg/exception.c
/qemu/target/mips/tcg/op_helper.c
/qemu/target/mips/tcg/sysemu/special_helper.c
/qemu/target/mips/tcg/sysemu/tlb_helper.c
/qemu/target/mips/tcg/translate.c
/qemu/target/openrisc/cpu.c
/qemu/target/openrisc/gdbstub.c
/qemu/target/openrisc/interrupt.c
/qemu/target/openrisc/translate.c
/qemu/target/ppc/cpu-models.c
/qemu/target/ppc/cpu.h
/qemu/target/ppc/cpu_init.c
/qemu/target/ppc/excp_helper.c
/qemu/target/ppc/gdbstub.c
/qemu/target/ppc/helper_regs.c
/qemu/target/ppc/insn32.decode
/qemu/target/ppc/kvm.c
/qemu/target/ppc/misc_helper.c
/qemu/target/ppc/mmu-radix64.c
/qemu/target/ppc/ppc-qmp-cmds.c
/qemu/target/ppc/translate.c
/qemu/target/ppc/translate/fixedpoint-impl.c.inc
/qemu/target/ppc/user_only_helper.c
/qemu/target/riscv/cpu.c
/qemu/target/riscv/cpu_cfg.h
/qemu/target/riscv/cpu_helper.c
/qemu/target/riscv/insn_trans/trans_rvbf16.c.inc
/qemu/target/riscv/insn_trans/trans_rvv.c.inc
/qemu/target/riscv/insn_trans/trans_rvvk.c.inc
/qemu/target/riscv/kvm/kvm-cpu.c
/qemu/target/riscv/kvm/kvm_riscv.h
/qemu/target/riscv/riscv-qmp-cmds.c
/qemu/target/riscv/tcg/tcg-cpu.c
/qemu/target/riscv/translate.c
/qemu/target/riscv/vcrypto_helper.c
/qemu/target/riscv/vector_helper.c
/qemu/target/riscv/vector_internals.c
/qemu/target/riscv/vector_internals.h
/qemu/target/rx/cpu.c
/qemu/target/rx/gdbstub.c
/qemu/target/rx/helper.c
/qemu/target/rx/translate.c
/qemu/target/s390x/cpu_models.c
/qemu/target/s390x/cpu_models_sysemu.c
/qemu/target/s390x/tcg/translate.c
/qemu/target/sh4/cpu.c
/qemu/target/sh4/cpu.h
/qemu/target/sh4/gdbstub.c
/qemu/target/sh4/helper.c
/qemu/target/sh4/helper.h
/qemu/target/sh4/op_helper.c
/qemu/target/sh4/translate.c
/qemu/target/sparc/cpu.c
/qemu/target/sparc/gdbstub.c
/qemu/target/sparc/helper.h
/qemu/target/sparc/int32_helper.c
/qemu/target/sparc/int64_helper.c
/qemu/target/sparc/ldst_helper.c
/qemu/target/sparc/mmu_helper.c
/qemu/target/sparc/translate.c
/qemu/target/tricore/cpu.c
/qemu/target/tricore/gdbstub.c
/qemu/target/tricore/helper.c
/qemu/target/tricore/translate.c
/qemu/target/xtensa/cpu.c
/qemu/target/xtensa/dbg_helper.c
/qemu/target/xtensa/exc_helper.c
/qemu/target/xtensa/gdbstub.c
/qemu/target/xtensa/helper.c
/qemu/target/xtensa/translate.c
/qemu/tcg/aarch64/tcg-target.c.inc
/qemu/tcg/optimize.c
/qemu/tcg/tcg.c
/qemu/tests/avocado/boot_linux_console.py
/qemu/tests/avocado/machine_aarch64_sbsaref.py
/qemu/tests/avocado/ppc_hv_tests.py
/qemu/tests/avocado/replay_kernel.py
/qemu/tests/data/acpi/q35/SSDT.dimmpxm
/qemu/tests/data/smbios/type11_blob
/qemu/tests/data/smbios/type11_blob.legacy
/qemu/tests/docker/Makefile.include
/qemu/tests/qemu-iotests/033
/qemu/tests/qemu-iotests/066
/qemu/tests/qemu-iotests/114
/qemu/tests/qemu-iotests/130
/qemu/tests/qemu-iotests/134
/qemu/tests/qemu-iotests/156
/qemu/tests/qemu-iotests/157
/qemu/tests/qemu-iotests/158
/qemu/tests/qemu-iotests/176.out
/qemu/tests/qemu-iotests/188
/qemu/tests/qemu-iotests/189
/qemu/tests/qemu-iotests/198
/qemu/tests/qemu-iotests/198.out
/qemu/tests/qemu-iotests/206.out
/qemu/tests/qemu-iotests/227
/qemu/tests/qemu-iotests/261
/qemu/tests/qemu-iotests/263
/qemu/tests/qemu-iotests/267.out
/qemu/tests/qemu-iotests/284
/qemu/tests/qemu-iotests/286
/qemu/tests/qemu-iotests/286.out
/qemu/tests/qemu-iotests/tests/detect-zeroes-registered-buf
/qemu/tests/qemu-iotests/tests/iothreads-nbd-export
/qemu/tests/qemu-iotests/tests/iothreads-nbd-export.out
/qemu/tests/qemu-iotests/tests/qcow2-internal-snapshots
/qemu/tests/qemu-iotests/tests/qcow2-internal-snapshots.out
/qemu/tests/qemu-iotests/tests/qsd-jobs
/qemu/tests/qemu-iotests/tests/stream-unaligned-prefetch
/qemu/tests/qemu-iotests/tests/stream-unaligned-prefetch.out
/qemu/tests/qtest/arm-cpu-features.c
/qemu/tests/qtest/bios-tables-test.c
/qemu/tests/qtest/libqos/ahci.c
/qemu/tests/qtest/libqos/ahci.h
/qemu/tests/qtest/libqos/virtio.c
/qemu/tests/qtest/libqtest.c
/qemu/tests/qtest/machine-none-test.c
/qemu/tests/qtest/migration-test.c
/qemu/tests/qtest/npcm7xx_emc-test.c
/qemu/tests/qtest/pca9552-test.c
/qemu/tests/qtest/pnv-host-i2c-test.c
/qemu/tests/qtest/stm32l4x5_gpio-test.c
/qemu/tests/qtest/virtio-9p-test.c
/qemu/tests/qtest/virtio-iommu-test.c
/qemu/tests/tcg/aarch64/Makefile.target
/qemu/tests/tcg/aarch64/test-2150.c
/qemu/tests/tcg/aarch64/test-2248.c
/qemu/tests/tcg/multiarch/Makefile.target
/qemu/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py
/qemu/tests/tcg/multiarch/linux/linux-shmat-null.c
/qemu/tests/tcg/multiarch/segfault.c
/qemu/tests/tcg/s390x/Makefile.target
/qemu/tests/tcg/s390x/ts.c
/qemu/tests/tcg/sh4/Makefile.target
/qemu/tests/tcg/sh4/test-macl.c
/qemu/tests/tcg/sh4/test-macw.c
/qemu/tests/unit/meson.build
/qemu/tests/unit/socket-helpers.c
/qemu/tests/unit/test-crypto-cipher.c
/qemu/tests/unit/test-throttle.c
/qemu/tests/vm/basevm.py
/qemu/tools/ebpf/rss.bpf.c
/qemu/ui/cocoa.m
/qemu/ui/console-priv.h
/qemu/ui/console-vc-stubs.c
/qemu/ui/console-vc.c
/qemu/ui/console.c
/qemu/ui/curses.c
/qemu/ui/dbus-listener.c
/qemu/ui/kbd-state.c
/qemu/ui/meson.build
/qemu/ui/trace-events
/qemu/ui/vnc.c
/qemu/util/qemu-coroutine.c
060b5a9315-Mar-2024 Markus Armbruster <armbru@redhat.com>

qapi: Dumb down QAPISchema.lookup_entity()

QAPISchema.lookup_entity() takes an optional type argument, a subtype
of QAPISchemaDefinition, and returns that type or None. Callers can
use this to save

qapi: Dumb down QAPISchema.lookup_entity()

QAPISchema.lookup_entity() takes an optional type argument, a subtype
of QAPISchemaDefinition, and returns that type or None. Callers can
use this to save themselves an isinstance() test.

The only remaining user of this convenience feature is .lookup_type().
But we don't actually save anything anymore there: we still need the
isinstance() to help mypy over the hump.

Drop the .lookup_entity() argument, and adjust .lookup_type().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-26-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
[Commit message typo fixed]

show more ...

99e75d8c15-Mar-2024 Markus Armbruster <armbru@redhat.com>

qapi: Tighten check whether implicit object type already exists

Entities with names starting with q_obj_ are implicit object types.
Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entit

qapi: Tighten check whether implicit object type already exists

Entities with names starting with q_obj_ are implicit object types.
Therefore, QAPISchema._make_implicit_object_type()'s .lookup_entity()
can only return a QAPISchemaObjectType. Assert that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-25-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>

show more ...

8d413dbd15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: remove unnecessary asserts

With strict typing enabled, these runtime statements aren't necessary
anymore; we can prove them statically.

Signed-off-by: John Snow <jsnow@redhat.com>
Revi

qapi/schema: remove unnecessary asserts

With strict typing enabled, these runtime statements aren't necessary
anymore; we can prove them statically.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-24-armbru@redhat.com>

show more ...

aa1fed9f15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: turn on mypy strictness

This patch can be rolled in with the previous one once the series is
ready for merge, but for work-in-progress' sake, it's separate here.

Signed-off-by: John Sn

qapi/schema: turn on mypy strictness

This patch can be rolled in with the previous one once the series is
ready for merge, but for work-in-progress' sake, it's separate here.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-23-armbru@redhat.com>

show more ...

4ed3fe0815-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: add type hints

This patch only adds type hints, which aren't utilized at runtime and
don't change the behavior of this module in any way.

In a scant few locations, type hints are remov

qapi/schema: add type hints

This patch only adds type hints, which aren't utilized at runtime and
don't change the behavior of this module in any way.

In a scant few locations, type hints are removed where no longer
necessary due to inference power from typing all of the rest of
creation; and any type hints that no longer need string quotes are
changed.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-22-armbru@redhat.com>

show more ...

d5e2f3d015-Mar-2024 John Snow <jsnow@redhat.com>

qapi/parser.py: assert member.info is present in connect_member

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbr

qapi/parser.py: assert member.info is present in connect_member

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-21-armbru@redhat.com>

show more ...

7c6e446415-Mar-2024 John Snow <jsnow@redhat.com>

qapi/parser: demote QAPIExpression to Dict[str, Any]

Dict[str, object] is a stricter type, but with the way that code is
currently arranged, it is infeasible to enforce this strictness.

In particul

qapi/parser: demote QAPIExpression to Dict[str, Any]

Dict[str, object] is a stricter type, but with the way that code is
currently arranged, it is infeasible to enforce this strictness.

In particular, although expr.py's entire raison d'être is normalization
and type-checking of QAPI Expressions, that type information is not
"remembered" in any meaningful way by mypy because each individual
expression is not downcast to a specific expression type that holds all
the details of each expression's unique form.

As a result, all of the code in schema.py that deals with actually
creating type-safe specialized structures has no guarantee (myopically)
that the data it is being passed is correct.

There are two ways to solve this:

(1) Re-assert that the incoming data is in the shape we expect it to be, or
(2) Disable type checking for this data.

(1) is appealing to my sense of strictness, but I gotta concede that it
is asinine to re-check the shape of a QAPIExpression in schema.py when
expr.py has just completed that work at length. The duplication of code
and the nightmare thought of needing to update both locations if and
when we change the shape of these structures makes me extremely
reluctant to go down this route.

(2) allows us the chance to miss updating types in the case that types
are updated in expr.py, but it *is* an awful lot simpler and,
importantly, gets us closer to type checking schema.py *at
all*. Something is better than nothing, I'd argue.

So, do the simpler dumber thing and worry about future strictness
improvements later.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-20-armbru@redhat.com>

show more ...

7e09dd6815-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: assert inner type of QAPISchemaVariants in check_clash()

QAPISchemaVariant's "variants" field is typed as
List[QAPISchemaVariant], where the typing for QAPISchemaVariant allows
its type

qapi/schema: assert inner type of QAPISchemaVariants in check_clash()

QAPISchemaVariant's "variants" field is typed as
List[QAPISchemaVariant], where the typing for QAPISchemaVariant allows
its type field to be any QAPISchemaType.

However, QAPISchemaVariant expects that all of its variants contain the
narrower QAPISchemaObjectType. This relationship is enforced at runtime
in QAPISchemaVariants.check(). This relationship is not embedded in the
type system though, so QAPISchemaVariants.check_clash() needs to
re-assert this property in order to call
QAPISchemaVariant.type.check_clash().

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-19-armbru@redhat.com>

show more ...

583f4d6f15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: fix typing for QAPISchemaVariants.tag_member

There are two related changes here:

(1) We need to perform type narrowing for resolving the type of
tag_member during check(), and

(2)

qapi/schema: fix typing for QAPISchemaVariants.tag_member

There are two related changes here:

(1) We need to perform type narrowing for resolving the type of
tag_member during check(), and

(2) tag_member is a delayed initialization field, but we can hide it
behind a property that raises an Exception if it's called too
early. This simplifies the typing in quite a few places and avoids
needing to assert that the "tag_member is not None" at a dozen
callsites, which can be confusing and suggest the wrong thing to a
drive-by contributor.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-18-armbru@redhat.com>

show more ...

9beda22d15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: Don't initialize "members" with `None`

Declare, but don't initialize the "members" field with type
List[QAPISchemaObjectTypeMember].

This simplifies the typing from what would otherwis

qapi/schema: Don't initialize "members" with `None`

Declare, but don't initialize the "members" field with type
List[QAPISchemaObjectTypeMember].

This simplifies the typing from what would otherwise be
Optional[List[T]] to merely List[T]. This removes the need to add
assertions to several callsites that this value is not None - which it
never will be after the delayed initialization in check() anyway.

The type declaration without initialization trick will cause accidental
uses of this field prior to full initialization to raise an
AttributeError.

(Note that it is valid to have an empty members list, see the internal
q_empty object as an example. For this reason, we cannot use the empty
list as a replacement test for full initialization and instead rely on
the _checked/_check_complete fields.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-17-armbru@redhat.com>

show more ...

875f624215-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: add _check_complete flag

Instead of using the None value for the members field, use a dedicated
flag to detect recursive misconfigurations.

This is intended to assist with subsequent p

qapi/schema: add _check_complete flag

Instead of using the None value for the members field, use a dedicated
flag to detect recursive misconfigurations.

This is intended to assist with subsequent patches that seek to remove
the "None" value from the members field (which can never hold that value
after the final call to check()) in order to simplify the static typing
of that field; avoiding the need of assertions littered at many
callsites to eliminate the possibility of the None value.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-16-armbru@redhat.com>

show more ...

8b9e7fd315-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: assert info is present when necessary

QAPISchemaInfo arguments can often be None because built-in definitions
don't have such information. The type hint can only be
Optional[QAPISchema

qapi/schema: assert info is present when necessary

QAPISchemaInfo arguments can often be None because built-in definitions
don't have such information. The type hint can only be
Optional[QAPISchemaInfo] then. But, mypy gets upset about all the
places where we exploit that it can't actually be None there. Add
assertions that will help mypy over the hump, to enable adding type
hints in a forthcoming commit.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-15-armbru@redhat.com>

show more ...

8c91329f15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type

Adjust the expression at the callsite to work around mypy's weak type
introspection that believes this expression can resolve to
QAP

qapi/schema: fix QAPISchemaArrayType.check's call to resolve_type

Adjust the expression at the callsite to work around mypy's weak type
introspection that believes this expression can resolve to
QAPISourceInfo; it cannot.

(Fundamentally: self.info only resolves to false in a boolean expression
when it is None; therefore this expression may only ever produce
Optional[str]. mypy does not know that 'info', when it is a
QAPISourceInfo object, cannot ever be false.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-14-armbru@redhat.com>

show more ...

7191400a15-Mar-2024 Markus Armbruster <armbru@redhat.com>

qapi: Assert built-in types exist

QAPISchema.lookup_type('FOO') returns a QAPISchemaType when type 'FOO'
exists, else None. It won't return None for built-in types like
'int'.

Since mypy can't see

qapi: Assert built-in types exist

QAPISchema.lookup_type('FOO') returns a QAPISchemaType when type 'FOO'
exists, else None. It won't return None for built-in types like
'int'.

Since mypy can't see that, it'll complain that we assign the
Optional[QAPISchemaType] returned by .lookup_type() to QAPISchemaType
variables.

Add assertions to help it over the hump.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-13-armbru@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>

show more ...

802a3e3f15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: assert resolve_type has 'info' and 'what' args on error

resolve_type() is generally used to resolve configuration-provided type
names into type objects, and generally requires valid 'in

qapi/schema: assert resolve_type has 'info' and 'what' args on error

resolve_type() is generally used to resolve configuration-provided type
names into type objects, and generally requires valid 'info' and 'what'
parameters.

In some cases, such as with QAPISchemaArrayType.check(), resolve_type
may be used to resolve built-in types and as such will not have an
'info' argument, but also must not fail in this scenario.

Use an assertion to sate mypy that we will indeed have 'info' and 'what'
parameters for the error pathway in resolve_type.

Note: there are only three callsites to resolve_type at present where
"info" is perceived by mypy to be possibly None:

1) QAPISchemaArrayType.check()
2) QAPISchemaObjectTypeMember.check()
3) QAPISchemaEvent.check()

Of those three, only the first actually ever passes None; the other two
are limited by their base class initializers which accept info=None, but
neither subclass actually use a None value in practice, currently.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-12-armbru@redhat.com>

show more ...

10755a9515-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: add type narrowing to lookup_type()

This function is a bit hard to type as-is; mypy needs some assertions to
assist with the type narrowing.

Signed-off-by: John Snow <jsnow@redhat.com>

qapi/schema: add type narrowing to lookup_type()

This function is a bit hard to type as-is; mypy needs some assertions to
assist with the type narrowing.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-11-armbru@redhat.com>

show more ...

9bda6c7d15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: adjust type narrowing for mypy's benefit

We already take care to perform some type narrowing for arg_type and
ret_type, but not in a way where mypy can utilize the result once we add
ty

qapi/schema: adjust type narrowing for mypy's benefit

We already take care to perform some type narrowing for arg_type and
ret_type, but not in a way where mypy can utilize the result once we add
type hints, e.g.:

qapi/schema.py:833: error: Incompatible types in assignment (expression
has type "QAPISchemaType", variable has type
"Optional[QAPISchemaObjectType]") [assignment]

qapi/schema.py:893: error: Incompatible types in assignment (expression
has type "QAPISchemaType", variable has type
"Optional[QAPISchemaObjectType]") [assignment]

A simple change to use a temporary variable helps the medicine go down.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-10-armbru@redhat.com>

show more ...

d150be3d15-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: make c_type() and json_type() abstract methods

These methods should always return a str, it's only the default abstract
implementation that doesn't. They can be marked "abstract", which

qapi/schema: make c_type() and json_type() abstract methods

These methods should always return a str, it's only the default abstract
implementation that doesn't. They can be marked "abstract", which
requires subclasses to override the method with the proper return type.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-9-armbru@redhat.com>

show more ...

578cd93215-Mar-2024 John Snow <jsnow@redhat.com>

qapi/schema: declare type for QAPISchemaArrayType.element_type

A QAPISchemaArrayType's element type gets resolved only during .check().
We have QAPISchemaArrayType.__init__() initialize self.element

qapi/schema: declare type for QAPISchemaArrayType.element_type

A QAPISchemaArrayType's element type gets resolved only during .check().
We have QAPISchemaArrayType.__init__() initialize self.element_type =
None, and .check() assign the actual type. Using .element_type before
.check() is wrong, and hopefully crashes due to the value being None.
Works.

However, it makes for awkward typing. With .element_type:
Optional[QAPISchemaType], mypy is of course unable to see that it's None
before .check(), and a QAPISchemaType after. To help it over the hump,
we'd have to assert self.element_type is not None before all the (valid)
uses. The assertion catches invalid uses, but only at run time; mypy
can't flag them.

Instead, declare .element_type in .__init__() as QAPISchemaType
*without* initializing it. Using .element_type before .check() now
certainly crashes, which is an improvement. Mypy still can't flag
invalid uses, but that's okay.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240315152301.3621858-8-armbru@redhat.com>

show more ...

12345678910>>...95