summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
| * | hw/sd/sdcard: Reset both start/end addresses on errorPhilippe Mathieu-Daudé2020-10-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the Spec "4.3.5 Erase": The host should adhere to the following command sequence: ERASE_WR_BLK_START, ERASE_WR_BLK_END and ERASE (CMD38). If an erase (CMD38) or address setting (CMD32, 33) command is received out of sequence, the card shall set the ERASE_SEQ_ERROR bit in the status register and reset the whole sequence. Reset both addresses if the ERASE command occured out of sequence (one of the start/end address is not set). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20201015063824.212980-5-f4bug@amsat.org>
| * | hw/sd/sdcard: Do not use legal address '0' for INVALID_ADDRESSPhilippe Mathieu-Daudé2020-10-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As it is legal to WRITE/ERASE the address/block 0, change the value of this definition to an illegal address: UINT32_MAX. Unfortunately this break the migration stream, so bump the VMState version number. This affects some ARM boards and the SDHCI_PCI device (which is only used for testing). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20201015063824.212980-4-f4bug@amsat.org>
| * | hw/sd/sdcard: Introduce the INVALID_ADDRESS definitionPhilippe Mathieu-Daudé2020-10-211-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | '0' is used as a value to indicate an invalid (or unset) address. Use a definition instead of a magic value. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20201015063824.212980-3-f4bug@amsat.org>
| * | hw/sd/sdcard: Add trace event for ERASE command (CMD38)Philippe Mathieu-Daudé2020-10-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Trace addresses provided to the ERASE command. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20201015063824.212980-2-f4bug@amsat.org>
| * | hw/sd/sdhci: Yield if interrupt delivered during multiple transferPhilippe Mathieu-Daudé2020-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Descriptor Table has a bit to allow the DMA to generates Interrupt when the operation of the descriptor line is completed (see "1.13.4. Descriptor Table" of 'SD Host Controller Simplified Specification Version 2.00'). If we have pending interrupt and the descriptor requires it to be generated as soon as it is completed, reschedule pending transfers and yield to the CPU. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200903172806.489710-5-f4bug@amsat.org>
| * | hw/sd/sdhci: Let sdhci_update_irq() return if IRQ was deliveredPhilippe Mathieu-Daudé2020-10-211-2/+7
| | | | | | | | | | | | | | | | | | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200903172806.489710-4-f4bug@amsat.org>
| * | hw/sd/sdhci: Resume pending DMA transfers on MMIO accessesPhilippe Mathieu-Daudé2020-10-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | If we have pending DMA requests scheduled, process them first. So far we don't need to implement a bottom half to process them. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200903172806.489710-3-f4bug@amsat.org>
| * | hw/sd/sdhci: Stop multiple transfers when block count is clearedPhilippe Mathieu-Daudé2020-10-211-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clearing BlockCount stops multiple transfers. See "SD Host Controller Simplified Specification Version 2.00": - 2.2.3. Block Count Register (Offset 006h) - Table 2-8 : Determination of Transfer Type Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200903172806.489710-2-f4bug@amsat.org>
| * | hw/sd/sdhci: Fix DMA Transfer Block Size fieldPhilippe Mathieu-Daudé2020-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'Transfer Block Size' field is 12-bit wide. See section '2.2.2. Block Size Register (Offset 004h)' in datasheet. Two different bug reproducer available: - https://bugs.launchpad.net/qemu/+bug/1892960 - https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Fsdhci_oob_write1 Cc: qemu-stable@nongnu.org Buglink: https://bugs.launchpad.net/qemu/+bug/1892960 Fixes: d7dfca0807a ("hw/sdhci: introduce standard SD host controller") Reported-by: Alexander Bulekov <alxndr@bu.edu> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Prasad J Pandit <pjp@fedoraproject.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200901140411.112150-3-f4bug@amsat.org>
| * | hw/sd/sdhci: Document the datasheet usedPhilippe Mathieu-Daudé2020-10-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add datasheet name in the file header. We can not add the direct download link since there is a disclaimers to agree first on the SD Association website (www.sdcard.org). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200901140411.112150-3-f4bug@amsat.org>
| * | hw/sd/sdhci: Fix qemu_log_mask() format stringPhilippe Mathieu-Daudé2020-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing newline character in qemu_log_mask() format. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Alexander Bulekov <alxndr@bu.edu> Message-Id: <20200901140411.112150-2-f4bug@amsat.org>
* | | Merge remote-tracking branch ↵Peter Maydell2020-10-2122-65/+154
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'remotes/kraxel/tags/microvm-20201021-pull-request' into staging microvm: fix PCIe IRQs in APIC table. microvm: add usb support. # gpg: Signature made Wed 21 Oct 2020 15:48:00 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/microvm-20201021-pull-request: tests/acpi: update expected data files tests/acpi: add microvm rtc test tests/acpi: add microvm usb test tests/acpi: add empty tests/data/acpi/microvm/DSDT.{usb, rtc} files tests/acpi: allow updates for expected data files microvm: add usb support usb/xhci: fixup xhci kconfig deps usb/xhci: add xhci_sysbus_build_aml() helper usb/xhci: add include/hw/usb/xhci.h header file acpi: add aml builder stubs tests/acpi: disallow changes for microvm/APIC.pcie tests/acpi: update expected data files apci: drop has_pci arg for acpi_build_madt microvm: set pci_irq_mask x86: make pci irqs runtime configurable tests/acpi: add empty microvm/APIC.pcie tests/acpi: allow changes for microvm/APIC.pcie Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | | tests/acpi: update expected data filesGerd Hoffmann2020-10-213-2/+0Star
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-11-kraxel@redhat.com
| * | | tests/acpi: add microvm rtc testGerd Hoffmann2020-10-211-0/+12
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-10-kraxel@redhat.com
| * | | tests/acpi: add microvm usb testGerd Hoffmann2020-10-211-0/+12
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-9-kraxel@redhat.com
| * | | tests/acpi: add empty tests/data/acpi/microvm/DSDT.{usb, rtc} filesGerd Hoffmann2020-10-212-0/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-8-kraxel@redhat.com
| * | | tests/acpi: allow updates for expected data filesGerd Hoffmann2020-10-211-0/+2
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-7-kraxel@redhat.com
| * | | microvm: add usb supportGerd Hoffmann2020-10-214-1/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wire up "usb=on" machine option, when enabled add a sysbus xhci controller with 8 ports. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-6-kraxel@redhat.com
| * | | usb/xhci: fixup xhci kconfig depsGerd Hoffmann2020-10-211-4/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB_XHCI does not depend on PCI any more. USB_XHCI_SYSBUS must select USB_XHCI not USB. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Message-id: 20201020074844.5304-5-kraxel@redhat.com
| * | | usb/xhci: add xhci_sysbus_build_aml() helperGerd Hoffmann2020-10-212-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The helper generates an acpi dsdt device entry for the xhci sysbus device. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-4-kraxel@redhat.com
| * | | usb/xhci: add include/hw/usb/xhci.h header fileGerd Hoffmann2020-10-217-41/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move a bunch of defines which might be needed outside core xhci code to that place. Add XHCI_ prefixes to avoid name clashes. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com> Message-id: 20201020074844.5304-3-kraxel@redhat.com
| * | | acpi: add aml builder stubsGerd Hoffmann2020-10-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add stubs for aml_interrupt and aml_memory32_fixed, these will be needed by followup patches, Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201020074844.5304-2-kraxel@redhat.com
| * | | tests/acpi: disallow changes for microvm/APIC.pcieGerd Hoffmann2020-10-211-1/+0Star
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-8-kraxel@redhat.com
| * | | tests/acpi: update expected data filesGerd Hoffmann2020-10-211-0/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-7-kraxel@redhat.com
| * | | apci: drop has_pci arg for acpi_build_madtGerd Hoffmann2020-10-214-18/+14Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting x86ms->pci_irq_mask to zero has the same effect, so we don't need the has_pci argument any more. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-6-kraxel@redhat.com
| * | | microvm: set pci_irq_maskGerd Hoffmann2020-10-212-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes sure the PCI interrupt overrides are added to the APIC table in case PCIe is enabled. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-5-kraxel@redhat.com
| * | | x86: make pci irqs runtime configurableGerd Hoffmann2020-10-213-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a variable to x86 machine state instead of hard-coding the PCI interrupts. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-4-kraxel@redhat.com
| * | | tests/acpi: add empty microvm/APIC.pcieGerd Hoffmann2020-10-211-0/+0
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-3-kraxel@redhat.com
| * | | tests/acpi: allow changes for microvm/APIC.pcieGerd Hoffmann2020-10-211-0/+1
| | |/ | |/| | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201016113835.17465-2-kraxel@redhat.com
* | | Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2020-10-21' into ↵Peter Maydell2020-10-219-212/+214
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | staging QAPI patches patches for 2020-10-21 # gpg: Signature made Wed 21 Oct 2020 04:01:41 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2020-10-21: qapi: Restrict Xen migration commands to migration.json qapi: Restrict 'query-kvm' command to machine code qapi: Restrict '(p)memsave' command to machine code qapi: Restrict 'system wakeup/reset/powerdown' commands to machine.json qapi: Restrict 'inject-nmi' command to machine code Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | | qapi: Restrict Xen migration commands to migration.jsonPhilippe Mathieu-Daudé2020-10-215-44/+43Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restricting xen-set-global-dirty-log and xen-load-devices-state commands migration.json pulls slightly less QAPI-generated code into user-mode and tools. Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201012121536.3381997-6-philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
| * | | qapi: Restrict 'query-kvm' command to machine codePhilippe Mathieu-Daudé2020-10-212-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restricting query-kvm to machine.json pulls slightly less QAPI-generated code into user-mode and tools. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201012121536.3381997-5-philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
| * | | qapi: Restrict '(p)memsave' command to machine codePhilippe Mathieu-Daudé2020-10-212-61/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restricting memsave/pmemsave to machine.json pulls slightly less QAPI-generated code into user-mode and tools. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201012121536.3381997-4-philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
| * | | qapi: Restrict 'system wakeup/reset/powerdown' commands to machine.jsonPhilippe Mathieu-Daudé2020-10-214-57/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restricting system_wakeup/system_reset/system_powerdown to machine.json pulls slightly less QAPI-generated code into user-mode and tools. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201012121536.3381997-3-philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
| * | | qapi: Restrict 'inject-nmi' command to machine codePhilippe Mathieu-Daudé2020-10-213-20/+21
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restricting 'inject-nmi' to machine.json pulls slightly less QAPI-generated code into user-mode and tools. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20201012121536.3381997-2-philmd@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
* | | Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' ↵Peter Maydell2020-10-219-211/+326
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging Pull request # gpg: Signature made Tue 20 Oct 2020 20:04:54 BST # gpg: using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E # gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full] # Primary key fingerprint: FAEB 9711 A12C F475 812F 18F2 88A9 064D 1835 61EB # Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76 CBD0 7DEF 8106 AAFC 390E * remotes/jsnow-gitlab/tags/python-pull-request: (21 commits) python/qemu/qmp.py: Fix settimeout operation python/qemu/qmp.py: re-raise OSError when encountered python: add mypy config python/qemu/qmp.py: Preserve error context on re-raise python/qemu/console_socket.py: avoid encoding to/from string python/qemu/console_socket.py: Add type hint annotations python/qemu/console_socket.py: Clarify type of drain_thread python/qemu/console_socket.py: fix typing of settimeout python/qemu/console_socket.py: Correct type of recv() python/qemu: Add mypy type annotations iotests.py: Adjust HMP kwargs typing python/qemu: make 'args' style arguments immutable python/machine.py: fix _popen access python/machine.py: Add _qmp access shim python/machine.py: use qmp.command python/machine.py: Handle None events in events_wait python/machine.py: Don't modify state in _base_args() python/machine.py: reorder __init__ python/machine.py: Fix monitor address typing python/qemu: use isort to lay out imports ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * | python/qemu/qmp.py: Fix settimeout operationJohn Snow2020-10-201-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We enabled callers to interface directly with settimeout, but this reacts poorly with blocking/nonblocking operation; as they are using the same internal mechanism. 1. Whenever we change the blocking mechanism temporarily, always set it back to what it was afterwards. 2. Disallow callers from setting a timeout of "0", which means Non-blocking mode. This is going to create more weird problems than anybody wants, so just forbid it. I opt not to coerce '0' to 'None' to maintain the principal of least surprise in mirroring the semantics of Python's interface. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20201009175123.249009-4-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/qmp.py: re-raise OSError when encounteredJohn Snow2020-10-201-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nested if conditions don't change when the exception block fires; we need to explicitly re-raise the error if we didn't intend to capture and suppress it. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20201009175123.249009-3-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python: add mypy configJohn Snow2020-10-201-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Formalize the options used for checking the python library. You can run mypy from the directory that mypy.ini is in by typing `mypy qemu/`. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20201009175123.249009-2-jsnow@redhat.com [Edit: Added newline; thanks Bin Meng --js] Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/qmp.py: Preserve error context on re-raiseJohn Snow2020-10-201-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the "from ..." phrasing when re-raising errors to preserve their initial context, to help aid debugging when things go wrong. This also silences a pylint 2.6.0+ error. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-18-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/console_socket.py: avoid encoding to/from stringJohn Snow2020-10-201-15/+5Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can work directly in bytes instead of translating back and forth to string, which removes the question of which encodings to use. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-17-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/console_socket.py: Add type hint annotationsJohn Snow2020-10-201-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Finish the typing of console_socket.py with annotations and no code changes. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-16-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/console_socket.py: Clarify type of drain_threadJohn Snow2020-10-201-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | Mypy needs just a little help to guess the type here. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-15-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/console_socket.py: fix typing of settimeoutJohn Snow2020-10-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The types and names of the parameters must match the socket.socket interface. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-14-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu/console_socket.py: Correct type of recv()John Snow2020-10-201-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type and parameter names of recv() should match socket.socket(). OK, easy enough, but in the cases we don't pass straight through to the real socket implementation, we probably can't accept such flags. OK, for now, assert that we don't receive flags in such cases. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-13-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu: Add mypy type annotationsJohn Snow2020-10-204-75/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These should all be purely annotations with no changes in behavior at all. You need to be in the python folder, but you should be able to confirm that these annotations are correct (or at least self-consistent) by running `mypy --strict qemu`. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-12-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | iotests.py: Adjust HMP kwargs typingJohn Snow2020-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mypy wants to ensure there's consistency between the kwargs arguments types and any unspecified keyword arguments. In this case, conv_keys is a bool, but the remaining keys are Any type. Mypy (correctly) infers the **kwargs type to be **Dict[str, str], which is not compatible with conv_keys: bool. Because QMP typing is a little fraught right now anyway, re-type kwargs to Dict[str, Any] which has the benefit of silencing this check right now. A future re-design might type these more aggressively, but this will give us a baseline to work from with minimal disruption. (Thanks Kevin Wolf for the debugging assist here) Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-11-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/qemu: make 'args' style arguments immutableJohn Snow2020-10-202-18/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These arguments don't need to be mutable and aren't really used as such. Clarify their types as immutable and adjust code to match where necessary. In general, It's probably best not to accept a user-defined mutable object and store it as internal object state unless there's a strong justification for doing so. Instead, try to use generic types as input with empty tuples as the default, and coerce to list where necessary. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20201006235817.3280413-10-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/machine.py: fix _popen accessJohn Snow2020-10-201-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As always, Optional[T] causes problems with unchecked access. Add a helper that asserts the pipe is present before we attempt to talk with it. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-9-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
| * | python/machine.py: Add _qmp access shimJohn Snow2020-10-201-11/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like many other Optional[] types, it's not always a given that this object will be set. Wrap it in a type-shim that raises a meaningful error and will always return a concrete type. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-id: 20201006235817.3280413-8-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>