* [PULL 00/24] target-arm queue
@ 2020-11-23 11:42 Peter Maydell
2020-11-23 17:03 ` Peter Maydell
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2020-11-23 11:42 UTC (permalink / raw)
To: qemu-devel
A big pullreq by number of patches, but most of them are just docs
updates or MAINTAINERS file fixes. The actual code changes are pretty
minimal bugfixes.
thanks
-- PMM
The following changes since commit 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122' into staging (2020-11-22 15:02:52 +0000)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201123
for you to fetch changes up to c6ff78563ad2971f289168c7cae6ecb0b4359516:
docs/system/pr-manager.rst: Fix minor docs nits (2020-11-23 11:10:04 +0000)
----------------------------------------------------------------
target-arm queue:
* incorporate 'orphan' rST docs into manuals
* linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
* target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
* document raspi boards and tosa
* docs/system: Deprecate raspi2/raspi3 machine aliases
* docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
* MAINTAINERS: add lines for docs files for Arm boards
* hw/intc: fix heap-buffer-overflow in rxicu_realize()
* hw/arm: Fix bad print format specifiers
* target/arm: fix stage 2 page-walks in 32-bit emulation
----------------------------------------------------------------
AlexChen (1):
hw/arm: Fix bad print format specifiers
Chen Qun (1):
hw/intc: fix heap-buffer-overflow in rxicu_realize()
Peter Maydell (11):
target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
docs: Move virtio-net-failover.rst into the system manual
docs: Move cpu-hotplug.rst into the system manual
docs: Move virtio-pmem.rst into the system manual
docs/system/virtio-pmem.rst: Fix minor style issues
docs: Split out 'pc' machine model docs into their own file
docs: Move microvm.rst into the system manual
docs: Move pr-manager.rst into the system manual
docs: Split qemu-pr-helper documentation into tools manual
docs/system/pr-manager.rst: Fix minor docs nits
Philippe Mathieu-Daudé (10):
MAINTAINERS: Cover system/arm/cpu-features.rst with ARM TCG CPUs
MAINTAINERS: Cover system/arm/aspeed.rst with ASPEED BMC machines
MAINTAINERS: Cover system/arm/nuvoton.rst with Nuvoton NPCM7xx
MAINTAINERS: Fix system/arm/orangepi.rst path
MAINTAINERS: Cover system/arm/sbsa.rst with SBSA-REF machine
MAINTAINERS: Cover system/arm/sx1.rst with OMAP machines
docs/system: Deprecate raspi2/raspi3 machine aliases
docs/system/arm: Document the various raspi boards
docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
docs/system/arm: Document the Sharp Zaurus SL-6000
Rémi Denis-Courmont (1):
target/arm: fix stage 2 page-walks in 32-bit emulation
docs/meson.build | 1 +
docs/system/arm/aspeed.rst | 1 +
docs/system/arm/raspi.rst | 43 +++++++++++++++
docs/system/arm/xscale.rst | 20 ++++---
docs/{ => system}/cpu-hotplug.rst | 0
docs/system/deprecated.rst | 7 +++
docs/{ => system/i386}/microvm.rst | 5 +-
docs/system/i386/pc.rst | 7 +++
docs/system/index.rst | 4 ++
docs/{ => system}/pr-manager.rst | 44 +++------------
docs/system/target-arm.rst | 1 +
docs/system/target-i386.rst | 19 +++++--
docs/{ => system}/virtio-net-failover.rst | 0
docs/system/virtio-pmem.rst | 76 ++++++++++++++++++++++++++
docs/tools/conf.py | 2 +
docs/tools/index.rst | 1 +
docs/tools/qemu-pr-helper.rst | 90 +++++++++++++++++++++++++++++++
docs/virtio-pmem.rst | 76 --------------------------
hw/arm/pxa2xx.c | 2 +-
hw/arm/spitz.c | 2 +-
hw/arm/tosa.c | 2 +-
hw/intc/rx_icu.c | 18 +++----
linux-user/arm/cpu_loop.c | 28 ++++++++++
target/arm/arm-semi.c | 12 +++--
target/arm/helper.c | 4 +-
MAINTAINERS | 8 ++-
26 files changed, 326 insertions(+), 147 deletions(-)
create mode 100644 docs/system/arm/raspi.rst
rename docs/{ => system}/cpu-hotplug.rst (100%)
rename docs/{ => system/i386}/microvm.rst (98%)
create mode 100644 docs/system/i386/pc.rst
rename docs/{ => system}/pr-manager.rst (68%)
rename docs/{ => system}/virtio-net-failover.rst (100%)
create mode 100644 docs/system/virtio-pmem.rst
create mode 100644 docs/tools/qemu-pr-helper.rst
delete mode 100644 docs/virtio-pmem.rst
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PULL 00/24] target-arm queue
2020-11-23 11:42 Peter Maydell
@ 2020-11-23 17:03 ` Peter Maydell
0 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2020-11-23 17:03 UTC (permalink / raw)
To: QEMU Developers
On Mon, 23 Nov 2020 at 11:43, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> A big pullreq by number of patches, but most of them are just docs
> updates or MAINTAINERS file fixes. The actual code changes are pretty
> minimal bugfixes.
>
> thanks
> -- PMM
>
> The following changes since commit 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
>
> Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122' into staging (2020-11-22 15:02:52 +0000)
>
> are available in the Git repository at:
>
> https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201123
>
> for you to fetch changes up to c6ff78563ad2971f289168c7cae6ecb0b4359516:
>
> docs/system/pr-manager.rst: Fix minor docs nits (2020-11-23 11:10:04 +0000)
>
> ----------------------------------------------------------------
> target-arm queue:
> * incorporate 'orphan' rST docs into manuals
> * linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
> * target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
> * document raspi boards and tosa
> * docs/system: Deprecate raspi2/raspi3 machine aliases
> * docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
> * MAINTAINERS: add lines for docs files for Arm boards
> * hw/intc: fix heap-buffer-overflow in rxicu_realize()
> * hw/arm: Fix bad print format specifiers
> * target/arm: fix stage 2 page-walks in 32-bit emulation
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PULL 00/24] target-arm queue
@ 2021-07-02 12:59 Peter Maydell
2021-07-04 13:03 ` Peter Maydell
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2021-07-02 12:59 UTC (permalink / raw)
To: qemu-devel
The following changes since commit 5a67d7735d4162630769ef495cf813244fc850df:
Merge remote-tracking branch 'remotes/berrange-gitlab/tags/tls-deps-pull-request' into staging (2021-07-02 08:22:39 +0100)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210702
for you to fetch changes up to 04ea4d3cfd0a21b248ece8eb7a9436a3d9898dd8:
target/arm: Implement MVE shifts by register (2021-07-02 11:48:38 +0100)
----------------------------------------------------------------
target-arm queue:
* more MVE instructions
* hw/gpio/gpio_pwr: use shutdown function for reboot
* target/arm: Check NaN mode before silencing NaN
* tests: Boot and halt a Linux guest on the Raspberry Pi 2 machine
* hw/arm: Add basic power management to raspi.
* docs/system/arm: Add quanta-gbs-bmc, quanta-q7l1-bmc
----------------------------------------------------------------
Joe Komlodi (1):
target/arm: Check NaN mode before silencing NaN
Maxim Uvarov (1):
hw/gpio/gpio_pwr: use shutdown function for reboot
Nolan Leake (1):
hw/arm: Add basic power management to raspi.
Patrick Venture (2):
docs/system/arm: Add quanta-q7l1-bmc reference
docs/system/arm: Add quanta-gbs-bmc reference
Peter Maydell (18):
target/arm: Fix MVE widening/narrowing VLDR/VSTR offset calculation
target/arm: Fix bugs in MVE VRMLALDAVH, VRMLSLDAVH
target/arm: Make asimd_imm_const() public
target/arm: Use asimd_imm_const for A64 decode
target/arm: Use dup_const() instead of bitfield_replicate()
target/arm: Implement MVE logical immediate insns
target/arm: Implement MVE vector shift left by immediate insns
target/arm: Implement MVE vector shift right by immediate insns
target/arm: Implement MVE VSHLL
target/arm: Implement MVE VSRI, VSLI
target/arm: Implement MVE VSHRN, VRSHRN
target/arm: Implement MVE saturating narrowing shifts
target/arm: Implement MVE VSHLC
target/arm: Implement MVE VADDLV
target/arm: Implement MVE long shifts by immediate
target/arm: Implement MVE long shifts by register
target/arm: Implement MVE shifts by immediate
target/arm: Implement MVE shifts by register
Philippe Mathieu-Daudé (1):
tests: Boot and halt a Linux guest on the Raspberry Pi 2 machine
docs/system/arm/aspeed.rst | 1 +
docs/system/arm/nuvoton.rst | 5 +-
include/hw/arm/bcm2835_peripherals.h | 3 +-
include/hw/misc/bcm2835_powermgt.h | 29 ++
target/arm/helper-mve.h | 108 +++++++
target/arm/translate.h | 41 +++
target/arm/mve.decode | 177 ++++++++++-
target/arm/t32.decode | 71 ++++-
hw/arm/bcm2835_peripherals.c | 13 +-
hw/gpio/gpio_pwr.c | 2 +-
hw/misc/bcm2835_powermgt.c | 160 ++++++++++
target/arm/helper-a64.c | 12 +-
target/arm/mve_helper.c | 524 +++++++++++++++++++++++++++++++--
target/arm/translate-a64.c | 86 +-----
target/arm/translate-mve.c | 261 +++++++++++++++-
target/arm/translate-neon.c | 81 -----
target/arm/translate.c | 327 +++++++++++++++++++-
target/arm/vfp_helper.c | 24 +-
hw/misc/meson.build | 1 +
tests/acceptance/boot_linux_console.py | 43 +++
20 files changed, 1760 insertions(+), 209 deletions(-)
create mode 100644 include/hw/misc/bcm2835_powermgt.h
create mode 100644 hw/misc/bcm2835_powermgt.c
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PULL 00/24] target-arm queue
2021-07-02 12:59 Peter Maydell
@ 2021-07-04 13:03 ` Peter Maydell
0 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2021-07-04 13:03 UTC (permalink / raw)
To: QEMU Developers
On Fri, 2 Jul 2021 at 13:59, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> The following changes since commit 5a67d7735d4162630769ef495cf813244fc850df:
>
> Merge remote-tracking branch 'remotes/berrange-gitlab/tags/tls-deps-pull-request' into staging (2021-07-02 08:22:39 +0100)
>
> are available in the Git repository at:
>
> https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210702
>
> for you to fetch changes up to 04ea4d3cfd0a21b248ece8eb7a9436a3d9898dd8:
>
> target/arm: Implement MVE shifts by register (2021-07-02 11:48:38 +0100)
>
> ----------------------------------------------------------------
> target-arm queue:
> * more MVE instructions
> * hw/gpio/gpio_pwr: use shutdown function for reboot
> * target/arm: Check NaN mode before silencing NaN
> * tests: Boot and halt a Linux guest on the Raspberry Pi 2 machine
> * hw/arm: Add basic power management to raspi.
> * docs/system/arm: Add quanta-gbs-bmc, quanta-q7l1-bmc
>
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PULL 00/24] target-arm queue
@ 2022-10-20 12:21 Peter Maydell
2022-10-20 20:04 ` Stefan Hajnoczi
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2022-10-20 12:21 UTC (permalink / raw)
To: qemu-devel
Hi; here's the latest arm pullreq. This is mostly patches from
RTH, plus a couple of other more minor things. Switching to
PCREL is the big one, hopefully should improve performance.
thanks
-- PMM
The following changes since commit 214a8da23651f2472b296b3293e619fd58d9e212:
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-10-18 11:14:31 -0400)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20221020
for you to fetch changes up to 5db899303799e49209016a93289b8694afa1449e:
hw/ide/microdrive: Use device_cold_reset() for self-resets (2022-10-20 12:11:53 +0100)
----------------------------------------------------------------
target-arm queue:
* Switch to TARGET_TB_PCREL
* More pagetable-walk refactoring preparatory to HAFDBS
* update the cortex-a15 MIDR to latest rev
* hw/char/pl011: fix baud rate calculation
* hw/ide/microdrive: Use device_cold_reset() for self-resets
----------------------------------------------------------------
Alex Bennée (1):
target/arm: update the cortex-a15 MIDR to latest rev
Baruch Siach (1):
hw/char/pl011: fix baud rate calculation
Peter Maydell (1):
hw/ide/microdrive: Use device_cold_reset() for self-resets
Richard Henderson (21):
target/arm: Enable TARGET_PAGE_ENTRY_EXTRA
target/arm: Use probe_access_full for MTE
target/arm: Use probe_access_full for BTI
target/arm: Add ARMMMUIdx_Phys_{S,NS}
target/arm: Move ARMMMUIdx_Stage2 to a real tlb mmu_idx
target/arm: Restrict tlb flush from vttbr_write to vmid change
target/arm: Split out S1Translate type
target/arm: Plumb debug into S1Translate
target/arm: Move be test for regime into S1TranslateResult
target/arm: Use softmmu tlbs for page table walking
target/arm: Split out get_phys_addr_twostage
target/arm: Use bool consistently for get_phys_addr subroutines
target/arm: Introduce curr_insn_len
target/arm: Change gen_goto_tb to work on displacements
target/arm: Change gen_*set_pc_im to gen_*update_pc
target/arm: Change gen_exception_insn* to work on displacements
target/arm: Remove gen_exception_internal_insn pc argument
target/arm: Change gen_jmp* to work on displacements
target/arm: Introduce gen_pc_plus_diff for aarch64
target/arm: Introduce gen_pc_plus_diff for aarch32
target/arm: Enable TARGET_TB_PCREL
target/arm/cpu-param.h | 17 +-
target/arm/cpu.h | 47 ++--
target/arm/internals.h | 1 +
target/arm/sve_ldst_internal.h | 1 +
target/arm/translate-a32.h | 2 +-
target/arm/translate.h | 66 ++++-
hw/char/pl011.c | 2 +-
hw/ide/microdrive.c | 8 +-
target/arm/cpu.c | 23 +-
target/arm/cpu_tcg.c | 4 +-
target/arm/helper.c | 155 +++++++++---
target/arm/mte_helper.c | 62 ++---
target/arm/ptw.c | 535 +++++++++++++++++++++++++----------------
target/arm/sve_helper.c | 54 ++---
target/arm/tlb_helper.c | 24 +-
target/arm/translate-a64.c | 220 ++++++++++-------
target/arm/translate-m-nocp.c | 8 +-
target/arm/translate-mve.c | 2 +-
target/arm/translate-vfp.c | 10 +-
target/arm/translate.c | 284 +++++++++++++---------
20 files changed, 918 insertions(+), 607 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PULL 00/24] target-arm queue
2022-10-20 12:21 Peter Maydell
@ 2022-10-20 20:04 ` Stefan Hajnoczi
0 siblings, 0 replies; 36+ messages in thread
From: Stefan Hajnoczi @ 2022-10-20 20:04 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/7.2 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PULL 00/24] target-arm queue
@ 2023-08-31 10:44 Peter Maydell
2023-08-31 16:15 ` Stefan Hajnoczi
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2023-08-31 10:44 UTC (permalink / raw)
To: qemu-devel
Hi; here's the latest round of arm patches. I have included also
my patchset for the RTC devices to avoid keeping time_t and
time_t diffs in 32-bit variables.
thanks
-- PMM
The following changes since commit 156618d9ea67f2f2e31d9dedd97f2dcccbe6808c:
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2023-08-30 09:20:27 -0400)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20230831
for you to fetch changes up to e73b8bb8a3e9a162f70e9ffbf922d4fafc96bbfb:
hw/arm: Set number of MPU regions correctly for an505, an521, an524 (2023-08-31 11:07:02 +0100)
----------------------------------------------------------------
target-arm queue:
* Some of the preliminary patches for Cortex-A710 support
* i.MX7 and i.MX6UL refactoring
* Implement SRC device for i.MX7
* Catch illegal-exception-return from EL3 with bad NSE/NS
* Use 64-bit offsets for holding time_t differences in RTC devices
* Model correct number of MPU regions for an505, an521, an524 boards
----------------------------------------------------------------
Alex Bennée (1):
target/arm: properly document FEAT_CRC32
Jean-Christophe Dubois (6):
Remove i.MX7 IOMUX GPR device from i.MX6UL
Refactor i.MX6UL processor code
Add i.MX6UL missing devices.
Refactor i.MX7 processor code
Add i.MX7 missing TZ devices and memory regions
Add i.MX7 SRC device implementation
Peter Maydell (8):
target/arm: Catch illegal-exception-return from EL3 with bad NSE/NS
hw/rtc/m48t59: Use 64-bit arithmetic in set_alarm()
hw/rtc/twl92230: Use int64_t for sec_offset and alm_sec
hw/rtc/aspeed_rtc: Use 64-bit offset for holding time_t difference
rtc: Use time_t for passing and returning time offsets
target/arm: Do all "ARM_FEATURE_X implies Y" checks in post_init
hw/arm/armv7m: Add mpu-ns-regions and mpu-s-regions properties
hw/arm: Set number of MPU regions correctly for an505, an521, an524
Richard Henderson (9):
target/arm: Reduce dcz_blocksize to uint8_t
target/arm: Allow cpu to configure GM blocksize
target/arm: Support more GM blocksizes
target/arm: When tag memory is not present, set MTE=1
target/arm: Introduce make_ccsidr64
target/arm: Apply access checks to neoverse-n1 special registers
target/arm: Apply access checks to neoverse-v1 special registers
target/arm: Suppress FEAT_TRBE (Trace Buffer Extension)
target/arm: Implement FEAT_HPDS2 as a no-op
docs/system/arm/emulation.rst | 2 +
include/hw/arm/armsse.h | 5 +
include/hw/arm/armv7m.h | 8 +
include/hw/arm/fsl-imx6ul.h | 158 ++++++++++++++++---
include/hw/arm/fsl-imx7.h | 338 ++++++++++++++++++++++++++++++-----------
include/hw/misc/imx7_src.h | 66 ++++++++
include/hw/rtc/aspeed_rtc.h | 2 +-
include/sysemu/rtc.h | 4 +-
target/arm/cpregs.h | 2 +
target/arm/cpu.h | 5 +-
target/arm/internals.h | 6 -
target/arm/tcg/translate.h | 2 +
hw/arm/armsse.c | 16 ++
hw/arm/armv7m.c | 21 +++
hw/arm/fsl-imx6ul.c | 174 +++++++++++++--------
hw/arm/fsl-imx7.c | 201 +++++++++++++++++++-----
hw/arm/mps2-tz.c | 29 ++++
hw/misc/imx7_src.c | 276 +++++++++++++++++++++++++++++++++
hw/rtc/aspeed_rtc.c | 5 +-
hw/rtc/m48t59.c | 2 +-
hw/rtc/twl92230.c | 4 +-
softmmu/rtc.c | 4 +-
target/arm/cpu.c | 207 ++++++++++++++-----------
target/arm/helper.c | 15 +-
target/arm/tcg/cpu32.c | 2 +-
target/arm/tcg/cpu64.c | 102 +++++++++----
target/arm/tcg/helper-a64.c | 9 ++
target/arm/tcg/mte_helper.c | 90 ++++++++---
target/arm/tcg/translate-a64.c | 5 +-
hw/misc/meson.build | 1 +
hw/misc/trace-events | 4 +
31 files changed, 1393 insertions(+), 372 deletions(-)
create mode 100644 include/hw/misc/imx7_src.h
create mode 100644 hw/misc/imx7_src.c
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PULL 00/24] target-arm queue
2023-08-31 10:44 Peter Maydell
@ 2023-08-31 16:15 ` Stefan Hajnoczi
0 siblings, 0 replies; 36+ messages in thread
From: Stefan Hajnoczi @ 2023-08-31 16:15 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PULL 00/24] target-arm queue
@ 2023-10-19 13:35 Peter Maydell
2023-10-19 13:35 ` [PULL 01/24] hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder Peter Maydell
` (24 more replies)
0 siblings, 25 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
Hi; here's a queue of arm patches (plus a few elf2dmp changes);
mostly these are minor cleanups and bugfixes.
thanks
-- PMM
The following changes since commit deaca3fd30d3a8829160f8d3705d65ad83176800:
Merge tag 'pull-vfio-20231018' of https://github.com/legoater/qemu into staging (2023-10-18 06:21:15 -0400)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20231019
for you to fetch changes up to 2a052b4ee01b3c413cef2ef49cb780cde17d4ba1:
contrib/elf2dmp: Use g_malloc(), g_new() and g_free() (2023-10-19 14:32:13 +0100)
----------------------------------------------------------------
target-arm queue:
* hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder
* hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot'
* xlnx devices: remove deprecated device reset
* xlnx-bbram: hw/nvram: Use dot in device type name
* elf2dmp: fix coverity issues
* elf2dmp: convert to g_malloc, g_new and g_free
* target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0
* hw/arm: refactor virt PPI logic
* arm/kvm: convert to kvm_set_one_reg, kvm_get_one_reg
* target/arm: Permit T32 LDM with single register
* smmuv3: Advertise SMMUv3.1-XNX
* target/arm: Implement FEAT_HPMN0
* Remove some unnecessary include lines
* target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL
* hw/timer/npcm7xx_timer: Prevent timer from counting down past zero
----------------------------------------------------------------
Chris Rauer (1):
hw/timer/npcm7xx_timer: Prevent timer from counting down past zero
Cornelia Huck (2):
arm/kvm: convert to kvm_set_one_reg
arm/kvm: convert to kvm_get_one_reg
Leif Lindholm (3):
{include/}hw/arm: refactor virt PPI logic
include/hw/arm: move BSA definitions to bsa.h
hw/arm/sbsa-ref: use bsa.h for PPI definitions
Michal Orzel (1):
target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0
Peter Maydell (8):
target/arm: Permit T32 LDM with single register
hw/arm/smmuv3: Update ID register bit field definitions
hw/arm/smmuv3: Sort ID register setting into field order
hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
target/arm: Implement FEAT_HPMN0
target/arm/kvm64.c: Remove unused include
target/arm/common-semi-target.h: Remove unnecessary boot.h include
target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL
Philippe Mathieu-Daudé (1):
hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot.h'
Suraj Shirvankar (1):
contrib/elf2dmp: Use g_malloc(), g_new() and g_free()
Thomas Huth (1):
hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder
Tong Ho (4):
xlnx-bbram: hw/nvram: Remove deprecated device reset
xlnx-zynqmp-efuse: hw/nvram: Remove deprecated device reset
xlnx-versal-efuse: hw/nvram: Remove deprecated device reset
xlnx-bbram: hw/nvram: Use dot in device type name
Viktor Prutyanov (2):
elf2dmp: limit print length for sign_rsds
elf2dmp: check array bounds in pdb_get_file_size
MAINTAINERS | 2 +-
docs/system/arm/emulation.rst | 1 +
hw/arm/smmuv3-internal.h | 38 ++++++++
include/hw/arm/bsa.h | 35 +++++++
include/hw/arm/exynos4210.h | 2 +-
include/hw/{misc => arm}/raspberrypi-fw-defs.h | 0
include/hw/arm/virt.h | 12 +--
include/hw/nvram/xlnx-bbram.h | 2 +-
target/arm/common-semi-target.h | 4 +-
target/arm/cpu-qom.h | 2 -
target/arm/cpu.h | 22 +++++
contrib/elf2dmp/addrspace.c | 7 +-
contrib/elf2dmp/main.c | 11 +--
contrib/elf2dmp/pdb.c | 32 ++++---
contrib/elf2dmp/qemu_elf.c | 7 +-
hw/arm/boot.c | 95 +++++--------------
hw/arm/sbsa-ref.c | 21 ++---
hw/arm/smmuv3.c | 8 +-
hw/arm/virt-acpi-build.c | 12 +--
hw/arm/virt.c | 24 +++--
hw/misc/bcm2835_property.c | 2 +-
hw/nvram/xlnx-bbram.c | 8 +-
hw/nvram/xlnx-versal-efuse-ctrl.c | 8 +-
hw/nvram/xlnx-zynqmp-efuse.c | 8 +-
hw/timer/npcm7xx_timer.c | 3 +
target/arm/arm-powerctl.c | 53 +----------
target/arm/cpu.c | 95 +++++++++++++++++++
target/arm/helper.c | 19 +---
target/arm/kvm.c | 28 ++----
target/arm/kvm64.c | 124 +++++++------------------
target/arm/tcg/cpu32.c | 4 +
target/arm/tcg/cpu64.c | 1 +
target/arm/tcg/translate.c | 37 +++++---
33 files changed, 368 insertions(+), 359 deletions(-)
create mode 100644 include/hw/arm/bsa.h
rename include/hw/{misc => arm}/raspberrypi-fw-defs.h (100%)
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PULL 01/24] hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 02/24] hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot.h' Peter Maydell
` (23 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Thomas Huth <thuth@redhat.com>
The file is obviously related to the raspberrypi machine, so
it should reside in hw/arm/ instead of hw/misc/. And while we're
at it, also adjust the wildcard in MAINTAINERS so that it covers
this file, too.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231012073458.860187-1-thuth@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
MAINTAINERS | 2 +-
include/hw/{misc => arm}/raspberrypi-fw-defs.h | 0
hw/misc/bcm2835_property.c | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename include/hw/{misc => arm}/raspberrypi-fw-defs.h (100%)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9bd4fe378d4..9282b4b0f55 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -885,7 +885,7 @@ S: Odd Fixes
F: hw/arm/raspi.c
F: hw/arm/raspi_platform.h
F: hw/*/bcm283*
-F: include/hw/arm/raspi*
+F: include/hw/arm/rasp*
F: include/hw/*/bcm283*
F: docs/system/arm/raspi.rst
diff --git a/include/hw/misc/raspberrypi-fw-defs.h b/include/hw/arm/raspberrypi-fw-defs.h
similarity index 100%
rename from include/hw/misc/raspberrypi-fw-defs.h
rename to include/hw/arm/raspberrypi-fw-defs.h
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 4ed9faa54a1..ff55a4e2cd2 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -12,7 +12,7 @@
#include "migration/vmstate.h"
#include "hw/irq.h"
#include "hw/misc/bcm2835_mbox_defs.h"
-#include "hw/misc/raspberrypi-fw-defs.h"
+#include "hw/arm/raspberrypi-fw-defs.h"
#include "sysemu/dma.h"
#include "qemu/log.h"
#include "qemu/module.h"
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 02/24] hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot.h'
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
2023-10-19 13:35 ` [PULL 01/24] hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 03/24] xlnx-bbram: hw/nvram: Remove deprecated device reset Peter Maydell
` (22 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Philippe Mathieu-Daudé <philmd@linaro.org>
struct arm_boot_info is declared in "hw/arm/boot.h".
By including the correct header we don't need to declare
it again in "target/arm/cpu-qom.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20231013130214.95742-1-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/arm/exynos4210.h | 2 +-
target/arm/cpu-qom.h | 2 --
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
index 68db19f0cb7..d33fe385865 100644
--- a/include/hw/arm/exynos4210.h
+++ b/include/hw/arm/exynos4210.h
@@ -30,7 +30,7 @@
#include "hw/intc/exynos4210_gic.h"
#include "hw/intc/exynos4210_combiner.h"
#include "hw/core/split-irq.h"
-#include "target/arm/cpu-qom.h"
+#include "hw/arm/boot.h"
#include "qom/object.h"
#define EXYNOS4210_NCPUS 2
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
index 514c22ced9b..d06c08a734e 100644
--- a/target/arm/cpu-qom.h
+++ b/target/arm/cpu-qom.h
@@ -23,8 +23,6 @@
#include "hw/core/cpu.h"
#include "qom/object.h"
-struct arm_boot_info;
-
#define TYPE_ARM_CPU "arm-cpu"
OBJECT_DECLARE_CPU_TYPE(ARMCPU, ARMCPUClass, ARM_CPU)
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 03/24] xlnx-bbram: hw/nvram: Remove deprecated device reset
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
2023-10-19 13:35 ` [PULL 01/24] hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder Peter Maydell
2023-10-19 13:35 ` [PULL 02/24] hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot.h' Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 04/24] xlnx-zynqmp-efuse: " Peter Maydell
` (21 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Tong Ho <tong.ho@amd.com>
This change implements the ResettableClass interface for the device.
Signed-off-by: Tong Ho <tong.ho@amd.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231003052345.199725-1-tong.ho@amd.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/nvram/xlnx-bbram.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/nvram/xlnx-bbram.c b/hw/nvram/xlnx-bbram.c
index c6b484cc85b..e18e7770e1e 100644
--- a/hw/nvram/xlnx-bbram.c
+++ b/hw/nvram/xlnx-bbram.c
@@ -2,6 +2,7 @@
* QEMU model of the Xilinx BBRAM Battery Backed RAM
*
* Copyright (c) 2014-2021 Xilinx Inc.
+ * Copyright (c) 2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -416,9 +417,9 @@ static RegisterAccessInfo bbram_ctrl_regs_info[] = {
}
};
-static void bbram_ctrl_reset(DeviceState *dev)
+static void bbram_ctrl_reset_hold(Object *obj)
{
- XlnxBBRam *s = XLNX_BBRAM(dev);
+ XlnxBBRam *s = XLNX_BBRAM(obj);
unsigned int i;
for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) {
@@ -522,8 +523,9 @@ static Property bbram_ctrl_props[] = {
static void bbram_ctrl_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
- dc->reset = bbram_ctrl_reset;
+ rc->phases.hold = bbram_ctrl_reset_hold;
dc->realize = bbram_ctrl_realize;
dc->vmsd = &vmstate_bbram_ctrl;
device_class_set_props(dc, bbram_ctrl_props);
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 04/24] xlnx-zynqmp-efuse: hw/nvram: Remove deprecated device reset
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (2 preceding siblings ...)
2023-10-19 13:35 ` [PULL 03/24] xlnx-bbram: hw/nvram: Remove deprecated device reset Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 05/24] xlnx-versal-efuse: " Peter Maydell
` (20 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Tong Ho <tong.ho@amd.com>
This change implements the ResettableClass interface for the device.
Signed-off-by: Tong Ho <tong.ho@amd.com>
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
Message-id: 20231004055713.324009-1-tong.ho@amd.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/nvram/xlnx-zynqmp-efuse.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/nvram/xlnx-zynqmp-efuse.c b/hw/nvram/xlnx-zynqmp-efuse.c
index 228ba0bbfaf..3db5f98ec1a 100644
--- a/hw/nvram/xlnx-zynqmp-efuse.c
+++ b/hw/nvram/xlnx-zynqmp-efuse.c
@@ -2,6 +2,7 @@
* QEMU model of the ZynqMP eFuse
*
* Copyright (c) 2015 Xilinx Inc.
+ * Copyright (c) 2023 Advanced Micro Devices, Inc.
*
* Written by Edgar E. Iglesias <edgari@xilinx.com>
*
@@ -769,9 +770,9 @@ static void zynqmp_efuse_register_reset(RegisterInfo *reg)
register_reset(reg);
}
-static void zynqmp_efuse_reset(DeviceState *dev)
+static void zynqmp_efuse_reset_hold(Object *obj)
{
- XlnxZynqMPEFuse *s = XLNX_ZYNQMP_EFUSE(dev);
+ XlnxZynqMPEFuse *s = XLNX_ZYNQMP_EFUSE(obj);
unsigned int i;
for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) {
@@ -837,8 +838,9 @@ static Property zynqmp_efuse_props[] = {
static void zynqmp_efuse_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
- dc->reset = zynqmp_efuse_reset;
+ rc->phases.hold = zynqmp_efuse_reset_hold;
dc->realize = zynqmp_efuse_realize;
dc->vmsd = &vmstate_efuse;
device_class_set_props(dc, zynqmp_efuse_props);
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 05/24] xlnx-versal-efuse: hw/nvram: Remove deprecated device reset
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (3 preceding siblings ...)
2023-10-19 13:35 ` [PULL 04/24] xlnx-zynqmp-efuse: " Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 06/24] xlnx-bbram: hw/nvram: Use dot in device type name Peter Maydell
` (19 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Tong Ho <tong.ho@amd.com>
This change implements the ResettableClass interface for the device.
Signed-off-by: Tong Ho <tong.ho@amd.com>
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
Message-id: 20231004055339.323833-1-tong.ho@amd.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/nvram/xlnx-versal-efuse-ctrl.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/nvram/xlnx-versal-efuse-ctrl.c b/hw/nvram/xlnx-versal-efuse-ctrl.c
index b35ba65ab57..beb5661c35f 100644
--- a/hw/nvram/xlnx-versal-efuse-ctrl.c
+++ b/hw/nvram/xlnx-versal-efuse-ctrl.c
@@ -2,6 +2,7 @@
* QEMU model of the Versal eFuse controller
*
* Copyright (c) 2020 Xilinx Inc.
+ * Copyright (c) 2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -657,9 +658,9 @@ static void efuse_ctrl_register_reset(RegisterInfo *reg)
register_reset(reg);
}
-static void efuse_ctrl_reset(DeviceState *dev)
+static void efuse_ctrl_reset_hold(Object *obj)
{
- XlnxVersalEFuseCtrl *s = XLNX_VERSAL_EFUSE_CTRL(dev);
+ XlnxVersalEFuseCtrl *s = XLNX_VERSAL_EFUSE_CTRL(obj);
unsigned int i;
for (i = 0; i < ARRAY_SIZE(s->regs_info); ++i) {
@@ -749,8 +750,9 @@ static Property efuse_ctrl_props[] = {
static void efuse_ctrl_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
- dc->reset = efuse_ctrl_reset;
+ rc->phases.hold = efuse_ctrl_reset_hold;
dc->realize = efuse_ctrl_realize;
dc->vmsd = &vmstate_efuse_ctrl;
device_class_set_props(dc, efuse_ctrl_props);
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 06/24] xlnx-bbram: hw/nvram: Use dot in device type name
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (4 preceding siblings ...)
2023-10-19 13:35 ` [PULL 05/24] xlnx-versal-efuse: " Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 07/24] elf2dmp: limit print length for sign_rsds Peter Maydell
` (18 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Tong Ho <tong.ho@amd.com>
This replaces the comma (,) to dot (.) in the device type name
so the name can be used with the 'driver=' command line option.
Signed-off-by: Tong Ho <tong.ho@amd.com>
Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>
Message-id: 20231003052139.199665-1-tong.ho@amd.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/nvram/xlnx-bbram.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/hw/nvram/xlnx-bbram.h b/include/hw/nvram/xlnx-bbram.h
index 87d59ef3c0c..6fc13f8cc17 100644
--- a/include/hw/nvram/xlnx-bbram.h
+++ b/include/hw/nvram/xlnx-bbram.h
@@ -34,7 +34,7 @@
#define RMAX_XLNX_BBRAM ((0x4c / 4) + 1)
-#define TYPE_XLNX_BBRAM "xlnx,bbram-ctrl"
+#define TYPE_XLNX_BBRAM "xlnx.bbram-ctrl"
OBJECT_DECLARE_SIMPLE_TYPE(XlnxBBRam, XLNX_BBRAM);
struct XlnxBBRam {
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 07/24] elf2dmp: limit print length for sign_rsds
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (5 preceding siblings ...)
2023-10-19 13:35 ` [PULL 06/24] xlnx-bbram: hw/nvram: Use dot in device type name Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 08/24] elf2dmp: check array bounds in pdb_get_file_size Peter Maydell
` (17 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Viktor Prutyanov <viktor@daynix.com>
String sign_rsds isn't terminated, so the print length must be limited.
Fixes: Coverity CID 1521598
Signed-off-by: Viktor Prutyanov <viktor@daynix.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-id: 20230930235317.11469-2-viktor@daynix.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
contrib/elf2dmp/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
index 5db163bdbe8..6de5c9808ef 100644
--- a/contrib/elf2dmp/main.c
+++ b/contrib/elf2dmp/main.c
@@ -478,7 +478,7 @@ static bool pe_check_pdb_name(uint64_t base, void *start_addr,
}
if (memcmp(&rsds->Signature, sign_rsds, sizeof(sign_rsds))) {
- eprintf("CodeView signature is \'%.4s\', \'%s\' expected\n",
+ eprintf("CodeView signature is \'%.4s\', \'%.4s\' expected\n",
rsds->Signature, sign_rsds);
return false;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 08/24] elf2dmp: check array bounds in pdb_get_file_size
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (6 preceding siblings ...)
2023-10-19 13:35 ` [PULL 07/24] elf2dmp: limit print length for sign_rsds Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 09/24] target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0 Peter Maydell
` (16 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Viktor Prutyanov <viktor@daynix.com>
Index in file_size array must be checked against num_files, because the
entries we are looking for may be absent in the PDB.
Fixes: Coverity CID 1521597
Signed-off-by: Viktor Prutyanov <viktor@daynix.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230930235317.11469-3-viktor@daynix.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
contrib/elf2dmp/pdb.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c
index 6ca5086f02e..8e3c18c82f7 100644
--- a/contrib/elf2dmp/pdb.c
+++ b/contrib/elf2dmp/pdb.c
@@ -25,6 +25,10 @@
static uint32_t pdb_get_file_size(const struct pdb_reader *r, unsigned idx)
{
+ if (idx >= r->ds.toc->num_files) {
+ return 0;
+ }
+
return r->ds.toc->file_size[idx];
}
@@ -159,16 +163,17 @@ static void *pdb_ds_read_file(struct pdb_reader* r, uint32_t file_number)
static int pdb_init_segments(struct pdb_reader *r)
{
- char *segs;
unsigned stream_idx = r->segments;
- segs = pdb_ds_read_file(r, stream_idx);
- if (!segs) {
+ r->segs = pdb_ds_read_file(r, stream_idx);
+ if (!r->segs) {
return 1;
}
- r->segs = segs;
r->segs_size = pdb_get_file_size(r, stream_idx);
+ if (!r->segs_size) {
+ return 1;
+ }
return 0;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 09/24] target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (7 preceding siblings ...)
2023-10-19 13:35 ` [PULL 08/24] elf2dmp: check array bounds in pdb_get_file_size Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 10/24] {include/}hw/arm: refactor virt PPI logic Peter Maydell
` (15 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Michal Orzel <michal.orzel@amd.com>
On an attempt to access CNTPCT_EL0 from EL0 using a guest running on top
of Xen, a trap from EL2 was observed which is something not reproducible
on HW (also, Xen does not trap accesses to physical counter).
This is because gt_counter_access() checks for an incorrect bit (1
instead of 0) of CNTHCTL_EL2 if HCR_EL2.E2H is 0 and access is made to
physical counter. Refer ARM ARM DDI 0487J.a, D19.12.2:
When HCR_EL2.E2H is 0:
- EL1PCTEN, bit [0]: refers to physical counter
- EL1PCEN, bit [1]: refers to physical timer registers
Drop entire block "if (hcr & HCR_E2H) {...} else {...}" from EL0 case
and fall through to EL1 case, given that after fixing checking for the
correct bit, the handling is the same.
Fixes: 5bc8437136fb ("target/arm: Update timer access for VHE")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Tested-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Message-id: 20230928094404.20802-1-michal.orzel@amd.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/helper.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 74fbb6e1d78..01cd1474565 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -2475,22 +2475,7 @@ static CPAccessResult gt_counter_access(CPUARMState *env, int timeridx,
if (!extract32(env->cp15.c14_cntkctl, timeridx, 1)) {
return CP_ACCESS_TRAP;
}
-
- /* If HCR_EL2.<E2H,TGE> == '10': check CNTHCTL_EL2.EL1PCTEN. */
- if (hcr & HCR_E2H) {
- if (timeridx == GTIMER_PHYS &&
- !extract32(env->cp15.cnthctl_el2, 10, 1)) {
- return CP_ACCESS_TRAP_EL2;
- }
- } else {
- /* If HCR_EL2.<E2H> == 0: check CNTHCTL_EL2.EL1PCEN. */
- if (has_el2 && timeridx == GTIMER_PHYS &&
- !extract32(env->cp15.cnthctl_el2, 1, 1)) {
- return CP_ACCESS_TRAP_EL2;
- }
- }
- break;
-
+ /* fall through */
case 1:
/* Check CNTHCTL_EL2.EL1PCTEN, which changes location based on E2H. */
if (has_el2 && timeridx == GTIMER_PHYS &&
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 10/24] {include/}hw/arm: refactor virt PPI logic
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (8 preceding siblings ...)
2023-10-19 13:35 ` [PULL 09/24] target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0 Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 11/24] include/hw/arm: move BSA definitions to bsa.h Peter Maydell
` (14 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Leif Lindholm <quic_llindhol@quicinc.com>
GIC Private Peripheral Interrupts (PPI) are defined as GIC INTID 16-31.
As in, PPI0 is INTID16 .. PPI15 is INTID31.
Arm's Base System Architecture specification (BSA) lists the mandated and
recommended private interrupt IDs by INTID, not by PPI index. But current
definitions in virt define them by PPI index, complicating cross
referencing.
Meanwhile, the PPI(x) macro counterintuitively adds 16 to the input value,
converting a PPI index to an INTID.
Resolve this by redefining the BSA-allocated PPIs by their INTIDs,
and replacing the PPI(x) macro with an INTID_TO_PPI(x) one where required.
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
Message-id: 20230919090229.188092-2-quic_llindhol@quicinc.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/arm/virt.h | 14 +++++++-------
hw/arm/virt-acpi-build.c | 12 ++++++------
hw/arm/virt.c | 24 ++++++++++++++----------
3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index e1ddbea96be..5704d95736d 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -43,16 +43,16 @@
#define NUM_VIRTIO_TRANSPORTS 32
#define NUM_SMMU_IRQS 4
-#define ARCH_GIC_MAINT_IRQ 9
+#define ARCH_GIC_MAINT_IRQ 25
-#define ARCH_TIMER_VIRT_IRQ 11
-#define ARCH_TIMER_S_EL1_IRQ 13
-#define ARCH_TIMER_NS_EL1_IRQ 14
-#define ARCH_TIMER_NS_EL2_IRQ 10
+#define ARCH_TIMER_VIRT_IRQ 27
+#define ARCH_TIMER_S_EL1_IRQ 29
+#define ARCH_TIMER_NS_EL1_IRQ 30
+#define ARCH_TIMER_NS_EL2_IRQ 26
-#define VIRTUAL_PMU_IRQ 7
+#define VIRTUAL_PMU_IRQ 23
-#define PPI(irq) ((irq) + 16)
+#define INTID_TO_PPI(irq) ((irq) - 16)
/* See Linux kernel arch/arm64/include/asm/pvclock-abi.h */
#define PVTIME_SIZE_PER_CPU 64
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 6b674231c27..9ce136cd88c 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -601,21 +601,21 @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
* The interrupt values are the same with the device tree when adding 16
*/
/* Secure EL1 timer GSIV */
- build_append_int_noprefix(table_data, ARCH_TIMER_S_EL1_IRQ + 16, 4);
+ build_append_int_noprefix(table_data, ARCH_TIMER_S_EL1_IRQ, 4);
/* Secure EL1 timer Flags */
build_append_int_noprefix(table_data, irqflags, 4);
/* Non-Secure EL1 timer GSIV */
- build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL1_IRQ + 16, 4);
+ build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL1_IRQ, 4);
/* Non-Secure EL1 timer Flags */
build_append_int_noprefix(table_data, irqflags |
1UL << 2, /* Always-on Capability */
4);
/* Virtual timer GSIV */
- build_append_int_noprefix(table_data, ARCH_TIMER_VIRT_IRQ + 16, 4);
+ build_append_int_noprefix(table_data, ARCH_TIMER_VIRT_IRQ, 4);
/* Virtual Timer Flags */
build_append_int_noprefix(table_data, irqflags, 4);
/* Non-Secure EL2 timer GSIV */
- build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL2_IRQ + 16, 4);
+ build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL2_IRQ, 4);
/* Non-Secure EL2 timer Flags */
build_append_int_noprefix(table_data, irqflags, 4);
/* CntReadBase Physical address */
@@ -729,9 +729,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
for (i = 0; i < MACHINE(vms)->smp.cpus; i++) {
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
uint64_t physical_base_address = 0, gich = 0, gicv = 0;
- uint32_t vgic_interrupt = vms->virt ? PPI(ARCH_GIC_MAINT_IRQ) : 0;
+ uint32_t vgic_interrupt = vms->virt ? ARCH_GIC_MAINT_IRQ : 0;
uint32_t pmu_interrupt = arm_feature(&armcpu->env, ARM_FEATURE_PMU) ?
- PPI(VIRTUAL_PMU_IRQ) : 0;
+ VIRTUAL_PMU_IRQ : 0;
if (vms->gic_version == VIRT_GIC_VERSION_2) {
physical_base_address = memmap[VIRT_GIC_CPU].base;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 15e74249f9d..ebc9f3fdb1d 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -366,10 +366,14 @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
}
qemu_fdt_setprop(ms->fdt, "/timer", "always-on", NULL, 0);
qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts",
- GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_S_EL1_IRQ, irqflags,
- GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_NS_EL1_IRQ, irqflags,
- GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_VIRT_IRQ, irqflags,
- GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_NS_EL2_IRQ, irqflags);
+ GIC_FDT_IRQ_TYPE_PPI,
+ INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags,
+ GIC_FDT_IRQ_TYPE_PPI,
+ INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags,
+ GIC_FDT_IRQ_TYPE_PPI,
+ INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags,
+ GIC_FDT_IRQ_TYPE_PPI,
+ INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags);
}
static void fdt_add_cpu_nodes(const VirtMachineState *vms)
@@ -800,7 +804,7 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem)
*/
for (i = 0; i < smp_cpus; i++) {
DeviceState *cpudev = DEVICE(qemu_get_cpu(i));
- int ppibase = NUM_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
+ int intidbase = NUM_IRQS + i * GIC_INTERNAL;
/* Mapping from the output timer irq lines from the CPU to the
* GIC PPI inputs we use for the virt board.
*/
@@ -814,22 +818,22 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem)
for (unsigned irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) {
qdev_connect_gpio_out(cpudev, irq,
qdev_get_gpio_in(vms->gic,
- ppibase + timer_irq[irq]));
+ intidbase + timer_irq[irq]));
}
if (vms->gic_version != VIRT_GIC_VERSION_2) {
qemu_irq irq = qdev_get_gpio_in(vms->gic,
- ppibase + ARCH_GIC_MAINT_IRQ);
+ intidbase + ARCH_GIC_MAINT_IRQ);
qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt",
0, irq);
} else if (vms->virt) {
qemu_irq irq = qdev_get_gpio_in(vms->gic,
- ppibase + ARCH_GIC_MAINT_IRQ);
+ intidbase + ARCH_GIC_MAINT_IRQ);
sysbus_connect_irq(gicbusdev, i + 4 * smp_cpus, irq);
}
qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0,
- qdev_get_gpio_in(vms->gic, ppibase
+ qdev_get_gpio_in(vms->gic, intidbase
+ VIRTUAL_PMU_IRQ));
sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
@@ -1989,7 +1993,7 @@ static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
if (pmu) {
assert(arm_feature(&ARM_CPU(cpu)->env, ARM_FEATURE_PMU));
if (kvm_irqchip_in_kernel()) {
- kvm_arm_pmu_set_irq(cpu, PPI(VIRTUAL_PMU_IRQ));
+ kvm_arm_pmu_set_irq(cpu, VIRTUAL_PMU_IRQ);
}
kvm_arm_pmu_init(cpu);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 11/24] include/hw/arm: move BSA definitions to bsa.h
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (9 preceding siblings ...)
2023-10-19 13:35 ` [PULL 10/24] {include/}hw/arm: refactor virt PPI logic Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 12/24] hw/arm/sbsa-ref: use bsa.h for PPI definitions Peter Maydell
` (13 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Leif Lindholm <quic_llindhol@quicinc.com>
virt.h defines a number of IRQs that are ultimately described by Arm's
Base System Architecture specification. Move these to a dedicated header
so that they can be reused by other platforms that do the same.
Include that header from virt.h to minimise churn.
While we're moving the definitions, sort them into numerical order,
and add the ARCH_TIMER_NS_EL2_VIRT_IRQ definition used by sbsa-ref
and which will eventually be needed by virt also.
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
Message-id: 20230919090229.188092-3-quic_llindhol@quicinc.com
[PMM: Remove unused PPI_TO_INTID macro; sort numerically;
add ARCH_TIMER_NS_EL2_VIRT_IRQ]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/arm/bsa.h | 35 +++++++++++++++++++++++++++++++++++
include/hw/arm/virt.h | 12 +-----------
2 files changed, 36 insertions(+), 11 deletions(-)
create mode 100644 include/hw/arm/bsa.h
diff --git a/include/hw/arm/bsa.h b/include/hw/arm/bsa.h
new file mode 100644
index 00000000000..8eaab603c03
--- /dev/null
+++ b/include/hw/arm/bsa.h
@@ -0,0 +1,35 @@
+/*
+ * Common definitions for Arm Base System Architecture (BSA) platforms.
+ *
+ * Copyright (c) 2015 Linaro Limited
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2 or later, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef QEMU_ARM_BSA_H
+#define QEMU_ARM_BSA_H
+
+/* These are architectural INTID values */
+#define VIRTUAL_PMU_IRQ 23
+#define ARCH_GIC_MAINT_IRQ 25
+#define ARCH_TIMER_NS_EL2_IRQ 26
+#define ARCH_TIMER_VIRT_IRQ 27
+#define ARCH_TIMER_NS_EL2_VIRT_IRQ 28
+#define ARCH_TIMER_S_EL1_IRQ 29
+#define ARCH_TIMER_NS_EL1_IRQ 30
+
+#define INTID_TO_PPI(irq) ((irq) - 16)
+
+#endif /* QEMU_ARM_BSA_H */
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 5704d95736d..f69239850e6 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -34,6 +34,7 @@
#include "qemu/notify.h"
#include "hw/boards.h"
#include "hw/arm/boot.h"
+#include "hw/arm/bsa.h"
#include "hw/block/flash.h"
#include "sysemu/kvm.h"
#include "hw/intc/arm_gicv3_common.h"
@@ -43,17 +44,6 @@
#define NUM_VIRTIO_TRANSPORTS 32
#define NUM_SMMU_IRQS 4
-#define ARCH_GIC_MAINT_IRQ 25
-
-#define ARCH_TIMER_VIRT_IRQ 27
-#define ARCH_TIMER_S_EL1_IRQ 29
-#define ARCH_TIMER_NS_EL1_IRQ 30
-#define ARCH_TIMER_NS_EL2_IRQ 26
-
-#define VIRTUAL_PMU_IRQ 23
-
-#define INTID_TO_PPI(irq) ((irq) - 16)
-
/* See Linux kernel arch/arm64/include/asm/pvclock-abi.h */
#define PVTIME_SIZE_PER_CPU 64
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 12/24] hw/arm/sbsa-ref: use bsa.h for PPI definitions
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (10 preceding siblings ...)
2023-10-19 13:35 ` [PULL 11/24] include/hw/arm: move BSA definitions to bsa.h Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 13/24] arm/kvm: convert to kvm_set_one_reg Peter Maydell
` (12 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Leif Lindholm <quic_llindhol@quicinc.com>
Use the private peripheral interrupt definitions from bsa.h instead of
defining them locally. Refactor to use the INTIDs defined there instead
of the PPI# used previously.
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
Message-id: 20230919090229.188092-4-quic_llindhol@quicinc.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/sbsa-ref.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index 3c7dfcd6dc5..e8a82618f0a 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -2,6 +2,7 @@
* ARM SBSA Reference Platform emulation
*
* Copyright (c) 2018 Linaro Limited
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Written by Hongbo Zhang <hongbo.zhang@linaro.org>
*
* This program is free software; you can redistribute it and/or modify it
@@ -30,6 +31,7 @@
#include "exec/hwaddr.h"
#include "kvm_arm.h"
#include "hw/arm/boot.h"
+#include "hw/arm/bsa.h"
#include "hw/arm/fdt.h"
#include "hw/arm/smmuv3.h"
#include "hw/block/flash.h"
@@ -55,14 +57,6 @@
#define NUM_SMMU_IRQS 4
#define NUM_SATA_PORTS 6
-#define VIRTUAL_PMU_IRQ 7
-#define ARCH_GIC_MAINT_IRQ 9
-#define ARCH_TIMER_VIRT_IRQ 11
-#define ARCH_TIMER_S_EL1_IRQ 13
-#define ARCH_TIMER_NS_EL1_IRQ 14
-#define ARCH_TIMER_NS_EL2_IRQ 10
-#define ARCH_TIMER_NS_EL2_VIRT_IRQ 12
-
enum {
SBSA_FLASH,
SBSA_MEM,
@@ -479,7 +473,7 @@ static void create_gic(SBSAMachineState *sms, MemoryRegion *mem)
*/
for (i = 0; i < smp_cpus; i++) {
DeviceState *cpudev = DEVICE(qemu_get_cpu(i));
- int ppibase = NUM_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
+ int intidbase = NUM_IRQS + i * GIC_INTERNAL;
int irq;
/*
* Mapping from the output timer irq lines from the CPU to the
@@ -496,14 +490,17 @@ static void create_gic(SBSAMachineState *sms, MemoryRegion *mem)
for (irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) {
qdev_connect_gpio_out(cpudev, irq,
qdev_get_gpio_in(sms->gic,
- ppibase + timer_irq[irq]));
+ intidbase + timer_irq[irq]));
}
qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", 0,
- qdev_get_gpio_in(sms->gic, ppibase
+ qdev_get_gpio_in(sms->gic,
+ intidbase
+ ARCH_GIC_MAINT_IRQ));
+
qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0,
- qdev_get_gpio_in(sms->gic, ppibase
+ qdev_get_gpio_in(sms->gic,
+ intidbase
+ VIRTUAL_PMU_IRQ));
sysbus_connect_irq(gicbusdev, i, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 13/24] arm/kvm: convert to kvm_set_one_reg
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (11 preceding siblings ...)
2023-10-19 13:35 ` [PULL 12/24] hw/arm/sbsa-ref: use bsa.h for PPI definitions Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 14/24] arm/kvm: convert to kvm_get_one_reg Peter Maydell
` (11 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Cornelia Huck <cohuck@redhat.com>
We can neaten the code by switching to the kvm_set_one_reg function.
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231010142453.224369-2-cohuck@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/kvm.c | 13 +++------
target/arm/kvm64.c | 66 +++++++++++++---------------------------------
2 files changed, 21 insertions(+), 58 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index b66b936a958..1a8084c4601 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -589,7 +589,6 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
bool ok = true;
for (i = 0; i < cpu->cpreg_array_len; i++) {
- struct kvm_one_reg r;
uint64_t regidx = cpu->cpreg_indexes[i];
uint32_t v32;
int ret;
@@ -598,19 +597,17 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
continue;
}
- r.id = regidx;
switch (regidx & KVM_REG_SIZE_MASK) {
case KVM_REG_SIZE_U32:
v32 = cpu->cpreg_values[i];
- r.addr = (uintptr_t)&v32;
+ ret = kvm_set_one_reg(cs, regidx, &v32);
break;
case KVM_REG_SIZE_U64:
- r.addr = (uintptr_t)(cpu->cpreg_values + i);
+ ret = kvm_set_one_reg(cs, regidx, cpu->cpreg_values + i);
break;
default:
g_assert_not_reached();
}
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &r);
if (ret) {
/* We might fail for "unknown register" and also for
* "you tried to set a register which is constant with
@@ -731,17 +728,13 @@ void kvm_arm_get_virtual_time(CPUState *cs)
void kvm_arm_put_virtual_time(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
- struct kvm_one_reg reg = {
- .id = KVM_REG_ARM_TIMER_CNT,
- .addr = (uintptr_t)&cpu->kvm_vtime,
- };
int ret;
if (!cpu->kvm_vtime_dirty) {
return;
}
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, KVM_REG_ARM_TIMER_CNT, &cpu->kvm_vtime);
if (ret) {
error_report("Failed to set KVM_REG_ARM_TIMER_CNT");
abort();
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 5e95c496bb9..047b269a791 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -540,14 +540,10 @@ static int kvm_arm_sve_set_vls(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
uint64_t vls[KVM_ARM64_SVE_VLS_WORDS] = { cpu->sve_vq.map };
- struct kvm_one_reg reg = {
- .id = KVM_REG_ARM64_SVE_VLS,
- .addr = (uint64_t)&vls[0],
- };
assert(cpu->sve_max_vq <= KVM_ARM64_SVE_VQ_MAX);
- return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ return kvm_set_one_reg(cs, KVM_REG_ARM64_SVE_VLS, &vls[0]);
}
#define ARM_CPU_ID_MPIDR 3, 0, 0, 0, 5
@@ -726,19 +722,17 @@ static void kvm_inject_arm_sea(CPUState *c)
static int kvm_arch_put_fpsimd(CPUState *cs)
{
CPUARMState *env = &ARM_CPU(cs)->env;
- struct kvm_one_reg reg;
int i, ret;
for (i = 0; i < 32; i++) {
uint64_t *q = aa64_vfp_qreg(env, i);
#if HOST_BIG_ENDIAN
uint64_t fp_val[2] = { q[1], q[0] };
- reg.addr = (uintptr_t)fp_val;
+ ret = kvm_set_one_reg(cs, AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]),
+ fp_val);
#else
- reg.addr = (uintptr_t)q;
+ ret = kvm_set_one_reg(cs, AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]), q);
#endif
- reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]);
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
if (ret) {
return ret;
}
@@ -759,14 +753,11 @@ static int kvm_arch_put_sve(CPUState *cs)
CPUARMState *env = &cpu->env;
uint64_t tmp[ARM_MAX_VQ * 2];
uint64_t *r;
- struct kvm_one_reg reg;
int n, ret;
for (n = 0; n < KVM_ARM64_SVE_NUM_ZREGS; ++n) {
r = sve_bswap64(tmp, &env->vfp.zregs[n].d[0], cpu->sve_max_vq * 2);
- reg.addr = (uintptr_t)r;
- reg.id = KVM_REG_ARM64_SVE_ZREG(n, 0);
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, KVM_REG_ARM64_SVE_ZREG(n, 0), r);
if (ret) {
return ret;
}
@@ -775,9 +766,7 @@ static int kvm_arch_put_sve(CPUState *cs)
for (n = 0; n < KVM_ARM64_SVE_NUM_PREGS; ++n) {
r = sve_bswap64(tmp, r = &env->vfp.pregs[n].p[0],
DIV_ROUND_UP(cpu->sve_max_vq * 2, 8));
- reg.addr = (uintptr_t)r;
- reg.id = KVM_REG_ARM64_SVE_PREG(n, 0);
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, KVM_REG_ARM64_SVE_PREG(n, 0), r);
if (ret) {
return ret;
}
@@ -785,9 +774,7 @@ static int kvm_arch_put_sve(CPUState *cs)
r = sve_bswap64(tmp, &env->vfp.pregs[FFR_PRED_NUM].p[0],
DIV_ROUND_UP(cpu->sve_max_vq * 2, 8));
- reg.addr = (uintptr_t)r;
- reg.id = KVM_REG_ARM64_SVE_FFR(0);
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, KVM_REG_ARM64_SVE_FFR(0), r);
if (ret) {
return ret;
}
@@ -797,7 +784,6 @@ static int kvm_arch_put_sve(CPUState *cs)
int kvm_arch_put_registers(CPUState *cs, int level)
{
- struct kvm_one_reg reg;
uint64_t val;
uint32_t fpr;
int i, ret;
@@ -814,9 +800,8 @@ int kvm_arch_put_registers(CPUState *cs, int level)
}
for (i = 0; i < 31; i++) {
- reg.id = AARCH64_CORE_REG(regs.regs[i]);
- reg.addr = (uintptr_t) &env->xregs[i];
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(regs.regs[i]),
+ &env->xregs[i]);
if (ret) {
return ret;
}
@@ -827,16 +812,12 @@ int kvm_arch_put_registers(CPUState *cs, int level)
*/
aarch64_save_sp(env, 1);
- reg.id = AARCH64_CORE_REG(regs.sp);
- reg.addr = (uintptr_t) &env->sp_el[0];
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(regs.sp), &env->sp_el[0]);
if (ret) {
return ret;
}
- reg.id = AARCH64_CORE_REG(sp_el1);
- reg.addr = (uintptr_t) &env->sp_el[1];
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(sp_el1), &env->sp_el[1]);
if (ret) {
return ret;
}
@@ -847,23 +828,17 @@ int kvm_arch_put_registers(CPUState *cs, int level)
} else {
val = cpsr_read(env);
}
- reg.id = AARCH64_CORE_REG(regs.pstate);
- reg.addr = (uintptr_t) &val;
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(regs.pstate), &val);
if (ret) {
return ret;
}
- reg.id = AARCH64_CORE_REG(regs.pc);
- reg.addr = (uintptr_t) &env->pc;
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(regs.pc), &env->pc);
if (ret) {
return ret;
}
- reg.id = AARCH64_CORE_REG(elr_el1);
- reg.addr = (uintptr_t) &env->elr_el[1];
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(elr_el1), &env->elr_el[1]);
if (ret) {
return ret;
}
@@ -882,9 +857,8 @@ int kvm_arch_put_registers(CPUState *cs, int level)
/* KVM 0-4 map to QEMU banks 1-5 */
for (i = 0; i < KVM_NR_SPSR; i++) {
- reg.id = AARCH64_CORE_REG(spsr[i]);
- reg.addr = (uintptr_t) &env->banked_spsr[i + 1];
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_CORE_REG(spsr[i]),
+ &env->banked_spsr[i + 1]);
if (ret) {
return ret;
}
@@ -899,18 +873,14 @@ int kvm_arch_put_registers(CPUState *cs, int level)
return ret;
}
- reg.addr = (uintptr_t)(&fpr);
fpr = vfp_get_fpsr(env);
- reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpsr);
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_SIMD_CTRL_REG(fp_regs.fpsr), &fpr);
if (ret) {
return ret;
}
- reg.addr = (uintptr_t)(&fpr);
fpr = vfp_get_fpcr(env);
- reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpcr);
- ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®);
+ ret = kvm_set_one_reg(cs, AARCH64_SIMD_CTRL_REG(fp_regs.fpcr), &fpr);
if (ret) {
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 14/24] arm/kvm: convert to kvm_get_one_reg
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (12 preceding siblings ...)
2023-10-19 13:35 ` [PULL 13/24] arm/kvm: convert to kvm_set_one_reg Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 15/24] target/arm: Permit T32 LDM with single register Peter Maydell
` (10 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Cornelia Huck <cohuck@redhat.com>
We can neaten the code by switching the callers that work on a
CPUstate to the kvm_get_one_reg function.
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231010142453.224369-3-cohuck@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
target/arm/kvm.c | 15 +++---------
target/arm/kvm64.c | 57 ++++++++++++----------------------------------
2 files changed, 18 insertions(+), 54 deletions(-)
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 1a8084c4601..7903e2ddde1 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -553,24 +553,19 @@ bool write_kvmstate_to_list(ARMCPU *cpu)
bool ok = true;
for (i = 0; i < cpu->cpreg_array_len; i++) {
- struct kvm_one_reg r;
uint64_t regidx = cpu->cpreg_indexes[i];
uint32_t v32;
int ret;
- r.id = regidx;
-
switch (regidx & KVM_REG_SIZE_MASK) {
case KVM_REG_SIZE_U32:
- r.addr = (uintptr_t)&v32;
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r);
+ ret = kvm_get_one_reg(cs, regidx, &v32);
if (!ret) {
cpu->cpreg_values[i] = v32;
}
break;
case KVM_REG_SIZE_U64:
- r.addr = (uintptr_t)(cpu->cpreg_values + i);
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &r);
+ ret = kvm_get_one_reg(cs, regidx, cpu->cpreg_values + i);
break;
default:
g_assert_not_reached();
@@ -706,17 +701,13 @@ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu)
void kvm_arm_get_virtual_time(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
- struct kvm_one_reg reg = {
- .id = KVM_REG_ARM_TIMER_CNT,
- .addr = (uintptr_t)&cpu->kvm_vtime,
- };
int ret;
if (cpu->kvm_vtime_dirty) {
return;
}
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, KVM_REG_ARM_TIMER_CNT, &cpu->kvm_vtime);
if (ret) {
error_report("Failed to get KVM_REG_ARM_TIMER_CNT");
abort();
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 047b269a791..558c0b88dd6 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -909,14 +909,11 @@ int kvm_arch_put_registers(CPUState *cs, int level)
static int kvm_arch_get_fpsimd(CPUState *cs)
{
CPUARMState *env = &ARM_CPU(cs)->env;
- struct kvm_one_reg reg;
int i, ret;
for (i = 0; i < 32; i++) {
uint64_t *q = aa64_vfp_qreg(env, i);
- reg.id = AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]);
- reg.addr = (uintptr_t)q;
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_SIMD_CORE_REG(fp_regs.vregs[i]), q);
if (ret) {
return ret;
} else {
@@ -940,15 +937,12 @@ static int kvm_arch_get_sve(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
- struct kvm_one_reg reg;
uint64_t *r;
int n, ret;
for (n = 0; n < KVM_ARM64_SVE_NUM_ZREGS; ++n) {
r = &env->vfp.zregs[n].d[0];
- reg.addr = (uintptr_t)r;
- reg.id = KVM_REG_ARM64_SVE_ZREG(n, 0);
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, KVM_REG_ARM64_SVE_ZREG(n, 0), r);
if (ret) {
return ret;
}
@@ -957,9 +951,7 @@ static int kvm_arch_get_sve(CPUState *cs)
for (n = 0; n < KVM_ARM64_SVE_NUM_PREGS; ++n) {
r = &env->vfp.pregs[n].p[0];
- reg.addr = (uintptr_t)r;
- reg.id = KVM_REG_ARM64_SVE_PREG(n, 0);
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, KVM_REG_ARM64_SVE_PREG(n, 0), r);
if (ret) {
return ret;
}
@@ -967,9 +959,7 @@ static int kvm_arch_get_sve(CPUState *cs)
}
r = &env->vfp.pregs[FFR_PRED_NUM].p[0];
- reg.addr = (uintptr_t)r;
- reg.id = KVM_REG_ARM64_SVE_FFR(0);
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, KVM_REG_ARM64_SVE_FFR(0), r);
if (ret) {
return ret;
}
@@ -980,7 +970,6 @@ static int kvm_arch_get_sve(CPUState *cs)
int kvm_arch_get_registers(CPUState *cs)
{
- struct kvm_one_reg reg;
uint64_t val;
unsigned int el;
uint32_t fpr;
@@ -990,31 +979,24 @@ int kvm_arch_get_registers(CPUState *cs)
CPUARMState *env = &cpu->env;
for (i = 0; i < 31; i++) {
- reg.id = AARCH64_CORE_REG(regs.regs[i]);
- reg.addr = (uintptr_t) &env->xregs[i];
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(regs.regs[i]),
+ &env->xregs[i]);
if (ret) {
return ret;
}
}
- reg.id = AARCH64_CORE_REG(regs.sp);
- reg.addr = (uintptr_t) &env->sp_el[0];
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(regs.sp), &env->sp_el[0]);
if (ret) {
return ret;
}
- reg.id = AARCH64_CORE_REG(sp_el1);
- reg.addr = (uintptr_t) &env->sp_el[1];
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(sp_el1), &env->sp_el[1]);
if (ret) {
return ret;
}
- reg.id = AARCH64_CORE_REG(regs.pstate);
- reg.addr = (uintptr_t) &val;
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(regs.pstate), &val);
if (ret) {
return ret;
}
@@ -1031,9 +1013,7 @@ int kvm_arch_get_registers(CPUState *cs)
*/
aarch64_restore_sp(env, 1);
- reg.id = AARCH64_CORE_REG(regs.pc);
- reg.addr = (uintptr_t) &env->pc;
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(regs.pc), &env->pc);
if (ret) {
return ret;
}
@@ -1047,9 +1027,7 @@ int kvm_arch_get_registers(CPUState *cs)
aarch64_sync_64_to_32(env);
}
- reg.id = AARCH64_CORE_REG(elr_el1);
- reg.addr = (uintptr_t) &env->elr_el[1];
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(elr_el1), &env->elr_el[1]);
if (ret) {
return ret;
}
@@ -1059,9 +1037,8 @@ int kvm_arch_get_registers(CPUState *cs)
* KVM SPSRs 0-4 map to QEMU banks 1-5
*/
for (i = 0; i < KVM_NR_SPSR; i++) {
- reg.id = AARCH64_CORE_REG(spsr[i]);
- reg.addr = (uintptr_t) &env->banked_spsr[i + 1];
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_CORE_REG(spsr[i]),
+ &env->banked_spsr[i + 1]);
if (ret) {
return ret;
}
@@ -1082,17 +1059,13 @@ int kvm_arch_get_registers(CPUState *cs)
return ret;
}
- reg.addr = (uintptr_t)(&fpr);
- reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpsr);
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_SIMD_CTRL_REG(fp_regs.fpsr), &fpr);
if (ret) {
return ret;
}
vfp_set_fpsr(env, fpr);
- reg.addr = (uintptr_t)(&fpr);
- reg.id = AARCH64_SIMD_CTRL_REG(fp_regs.fpcr);
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®);
+ ret = kvm_get_one_reg(cs, AARCH64_SIMD_CTRL_REG(fp_regs.fpcr), &fpr);
if (ret) {
return ret;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 15/24] target/arm: Permit T32 LDM with single register
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (13 preceding siblings ...)
2023-10-19 13:35 ` [PULL 14/24] arm/kvm: convert to kvm_get_one_reg Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 16/24] hw/arm/smmuv3: Update ID register bit field definitions Peter Maydell
` (9 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
For the Thumb T32 encoding of LDM, if only a single register is
specified in the register list this instruction is UNPREDICTABLE,
with the following choices:
* instruction UNDEFs
* instruction is a NOP
* instruction loads a single register
* instruction loads an unspecified set of registers
Currently we choose to UNDEF (a behaviour chosen in commit
4b222545dbf30 in 2019; previously we treated it as "load the
specified single register").
Unfortunately there is real world code out there (which shipped in at
least Android 11, 12 and 13) which incorrectly uses this
UNPREDICTABLE insn on the assumption that it does a single register
load, which is (presumably) what it happens to do on real hardware,
and is also what it does on the equivalent A32 encoding.
Revert to the pre-4b222545dbf30 behaviour of not UNDEFing
for this T32 encoding.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1799
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230927101853.39288-1-peter.maydell@linaro.org
---
target/arm/tcg/translate.c | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 48927fbb8ce..b3660173d1d 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -7882,7 +7882,7 @@ static void op_addr_block_post(DisasContext *s, arg_ldst_block *a,
}
}
-static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n)
+static bool op_stm(DisasContext *s, arg_ldst_block *a)
{
int i, j, n, list, mem_idx;
bool user = a->u;
@@ -7899,7 +7899,14 @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n)
list = a->list;
n = ctpop16(list);
- if (n < min_n || a->rn == 15) {
+ /*
+ * This is UNPREDICTABLE for n < 1 in all encodings, and we choose
+ * to UNDEF. In the T32 STM encoding n == 1 is also UNPREDICTABLE,
+ * but hardware treats it like the A32 version and implements the
+ * single-register-store, and some in-the-wild (buggy) software
+ * assumes that, so we don't UNDEF on that case.
+ */
+ if (n < 1 || a->rn == 15) {
unallocated_encoding(s);
return true;
}
@@ -7935,8 +7942,7 @@ static bool op_stm(DisasContext *s, arg_ldst_block *a, int min_n)
static bool trans_STM(DisasContext *s, arg_ldst_block *a)
{
- /* BitCount(list) < 1 is UNPREDICTABLE */
- return op_stm(s, a, 1);
+ return op_stm(s, a);
}
static bool trans_STM_t32(DisasContext *s, arg_ldst_block *a)
@@ -7946,11 +7952,10 @@ static bool trans_STM_t32(DisasContext *s, arg_ldst_block *a)
unallocated_encoding(s);
return true;
}
- /* BitCount(list) < 2 is UNPREDICTABLE */
- return op_stm(s, a, 2);
+ return op_stm(s, a);
}
-static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)
+static bool do_ldm(DisasContext *s, arg_ldst_block *a)
{
int i, j, n, list, mem_idx;
bool loaded_base;
@@ -7979,7 +7984,14 @@ static bool do_ldm(DisasContext *s, arg_ldst_block *a, int min_n)
list = a->list;
n = ctpop16(list);
- if (n < min_n || a->rn == 15) {
+ /*
+ * This is UNPREDICTABLE for n < 1 in all encodings, and we choose
+ * to UNDEF. In the T32 LDM encoding n == 1 is also UNPREDICTABLE,
+ * but hardware treats it like the A32 version and implements the
+ * single-register-load, and some in-the-wild (buggy) software
+ * assumes that, so we don't UNDEF on that case.
+ */
+ if (n < 1 || a->rn == 15) {
unallocated_encoding(s);
return true;
}
@@ -8045,8 +8057,7 @@ static bool trans_LDM_a32(DisasContext *s, arg_ldst_block *a)
unallocated_encoding(s);
return true;
}
- /* BitCount(list) < 1 is UNPREDICTABLE */
- return do_ldm(s, a, 1);
+ return do_ldm(s, a);
}
static bool trans_LDM_t32(DisasContext *s, arg_ldst_block *a)
@@ -8056,16 +8067,14 @@ static bool trans_LDM_t32(DisasContext *s, arg_ldst_block *a)
unallocated_encoding(s);
return true;
}
- /* BitCount(list) < 2 is UNPREDICTABLE */
- return do_ldm(s, a, 2);
+ return do_ldm(s, a);
}
static bool trans_LDM_t16(DisasContext *s, arg_ldst_block *a)
{
/* Writeback is conditional on the base register not being loaded. */
a->w = !(a->list & (1 << a->rn));
- /* BitCount(list) < 1 is UNPREDICTABLE */
- return do_ldm(s, a, 1);
+ return do_ldm(s, a);
}
static bool trans_CLRM(DisasContext *s, arg_CLRM *a)
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 16/24] hw/arm/smmuv3: Update ID register bit field definitions
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (14 preceding siblings ...)
2023-10-19 13:35 ` [PULL 15/24] target/arm: Permit T32 LDM with single register Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 17/24] hw/arm/smmuv3: Sort ID register setting into field order Peter Maydell
` (8 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
Update the SMMUv3 ID register bit field definitions to the
set in the most recent specification (IHI0700 F.a).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20230914145705.1648377-2-peter.maydell@linaro.org
---
hw/arm/smmuv3-internal.h | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
index 648c2e37a27..6076025ad6a 100644
--- a/hw/arm/smmuv3-internal.h
+++ b/hw/arm/smmuv3-internal.h
@@ -38,33 +38,71 @@ REG32(IDR0, 0x0)
FIELD(IDR0, S1P, 1 , 1)
FIELD(IDR0, TTF, 2 , 2)
FIELD(IDR0, COHACC, 4 , 1)
+ FIELD(IDR0, BTM, 5 , 1)
+ FIELD(IDR0, HTTU, 6 , 2)
+ FIELD(IDR0, DORMHINT, 8 , 1)
+ FIELD(IDR0, HYP, 9 , 1)
+ FIELD(IDR0, ATS, 10, 1)
+ FIELD(IDR0, NS1ATS, 11, 1)
FIELD(IDR0, ASID16, 12, 1)
+ FIELD(IDR0, MSI, 13, 1)
+ FIELD(IDR0, SEV, 14, 1)
+ FIELD(IDR0, ATOS, 15, 1)
+ FIELD(IDR0, PRI, 16, 1)
+ FIELD(IDR0, VMW, 17, 1)
FIELD(IDR0, VMID16, 18, 1)
+ FIELD(IDR0, CD2L, 19, 1)
+ FIELD(IDR0, VATOS, 20, 1)
FIELD(IDR0, TTENDIAN, 21, 2)
+ FIELD(IDR0, ATSRECERR, 23, 1)
FIELD(IDR0, STALL_MODEL, 24, 2)
FIELD(IDR0, TERM_MODEL, 26, 1)
FIELD(IDR0, STLEVEL, 27, 2)
+ FIELD(IDR0, RME_IMPL, 30, 1)
REG32(IDR1, 0x4)
FIELD(IDR1, SIDSIZE, 0 , 6)
+ FIELD(IDR1, SSIDSIZE, 6 , 5)
+ FIELD(IDR1, PRIQS, 11, 5)
FIELD(IDR1, EVENTQS, 16, 5)
FIELD(IDR1, CMDQS, 21, 5)
+ FIELD(IDR1, ATTR_PERMS_OVR, 26, 1)
+ FIELD(IDR1, ATTR_TYPES_OVR, 27, 1)
+ FIELD(IDR1, REL, 28, 1)
+ FIELD(IDR1, QUEUES_PRESET, 29, 1)
+ FIELD(IDR1, TABLES_PRESET, 30, 1)
+ FIELD(IDR1, ECMDQ, 31, 1)
#define SMMU_IDR1_SIDSIZE 16
#define SMMU_CMDQS 19
#define SMMU_EVENTQS 19
REG32(IDR2, 0x8)
+ FIELD(IDR2, BA_VATOS, 0, 10)
+
REG32(IDR3, 0xc)
FIELD(IDR3, HAD, 2, 1);
+ FIELD(IDR3, PBHA, 3, 1);
+ FIELD(IDR3, XNX, 4, 1);
+ FIELD(IDR3, PPS, 5, 1);
+ FIELD(IDR3, MPAM, 7, 1);
+ FIELD(IDR3, FWB, 8, 1);
+ FIELD(IDR3, STT, 9, 1);
FIELD(IDR3, RIL, 10, 1);
FIELD(IDR3, BBML, 11, 2);
+ FIELD(IDR3, E0PD, 13, 1);
+ FIELD(IDR3, PTWNNC, 14, 1);
+ FIELD(IDR3, DPT, 15, 1);
+
REG32(IDR4, 0x10)
+
REG32(IDR5, 0x14)
FIELD(IDR5, OAS, 0, 3);
FIELD(IDR5, GRAN4K, 4, 1);
FIELD(IDR5, GRAN16K, 5, 1);
FIELD(IDR5, GRAN64K, 6, 1);
+ FIELD(IDR5, VAX, 10, 2);
+ FIELD(IDR5, STALL_MAX, 16, 16);
#define SMMU_IDR5_OAS 4
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 17/24] hw/arm/smmuv3: Sort ID register setting into field order
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (15 preceding siblings ...)
2023-10-19 13:35 ` [PULL 16/24] hw/arm/smmuv3: Update ID register bit field definitions Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 18/24] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature Peter Maydell
` (7 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
In smmuv3_init_regs() when we set the various bits in the ID
registers, we do this almost in order of the fields in the
registers, but not quite. Move the initialization of
SMMU_IDR3.RIL and SMMU_IDR5.OAS into their correct places.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20230914145705.1648377-3-peter.maydell@linaro.org
---
hw/arm/smmuv3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index 6f2b2bd45f9..f03d58300fa 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -278,15 +278,15 @@ static void smmuv3_init_regs(SMMUv3State *s)
s->idr[1] = FIELD_DP32(s->idr[1], IDR1, EVENTQS, SMMU_EVENTQS);
s->idr[1] = FIELD_DP32(s->idr[1], IDR1, CMDQS, SMMU_CMDQS);
- s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 1);
s->idr[3] = FIELD_DP32(s->idr[3], IDR3, HAD, 1);
+ s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 1);
s->idr[3] = FIELD_DP32(s->idr[3], IDR3, BBML, 2);
+ s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS); /* 44 bits */
/* 4K, 16K and 64K granule support */
s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN4K, 1);
s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN16K, 1);
s->idr[5] = FIELD_DP32(s->idr[5], IDR5, GRAN64K, 1);
- s->idr[5] = FIELD_DP32(s->idr[5], IDR5, OAS, SMMU_IDR5_OAS); /* 44 bits */
s->cmdq.base = deposit64(s->cmdq.base, 0, 5, SMMU_CMDQS);
s->cmdq.prod = 0;
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 18/24] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (16 preceding siblings ...)
2023-10-19 13:35 ` [PULL 17/24] hw/arm/smmuv3: Sort ID register setting into field order Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 19/24] target/arm: Implement FEAT_HPMN0 Peter Maydell
` (6 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
The SMMUv3.1-XNX feature is mandatory for an SMMUv3.1 if S2P is
supported, so we should theoretically have implemented it as part of
the recent S2P work. Fortunately, for us the implementation is a
no-op.
This feature is about interpretation of the stage 2 page table
descriptor XN bits, which control execute permissions.
For QEMU, the permission bits passed to an IOMMU (via MemTxAttrs and
IOMMUAccessFlags) only indicate read and write; we do not distinguish
data reads from instruction reads outside the CPU proper. In the
SMMU architecture's terms, our interconnect between the client device
and the SMMU doesn't have the ability to convey the INST attribute,
and we therefore use the default value of "data" for this attribute.
We also do not support the bits in the Stream Table Entry that can
override the on-the-bus transaction attribute permissions (we do not
set SMMU_IDR1.ATTR_PERMS_OVR=1).
These two things together mean that for our implementation, it never
has to deal with transactions with the INST attribute, and so it can
correctly ignore the XN bits entirely. So we already implement
FEAT_XNX's "XN field is now 2 bits, not 1" behaviour to the extent
that we need to.
Advertise the presence of the feature in SMMU_IDR3.XNX.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Mostafa Saleh <smostafa@google.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-id: 20230914145705.1648377-4-peter.maydell@linaro.org
---
hw/arm/smmuv3.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index f03d58300fa..c3871ae067f 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -279,6 +279,10 @@ static void smmuv3_init_regs(SMMUv3State *s)
s->idr[1] = FIELD_DP32(s->idr[1], IDR1, CMDQS, SMMU_CMDQS);
s->idr[3] = FIELD_DP32(s->idr[3], IDR3, HAD, 1);
+ if (FIELD_EX32(s->idr[0], IDR0, S2P)) {
+ /* XNX is a stage-2-specific feature */
+ s->idr[3] = FIELD_DP32(s->idr[3], IDR3, XNX, 1);
+ }
s->idr[3] = FIELD_DP32(s->idr[3], IDR3, RIL, 1);
s->idr[3] = FIELD_DP32(s->idr[3], IDR3, BBML, 2);
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 19/24] target/arm: Implement FEAT_HPMN0
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (17 preceding siblings ...)
2023-10-19 13:35 ` [PULL 18/24] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 20/24] target/arm/kvm64.c: Remove unused include Peter Maydell
` (5 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
FEAT_HPMN0 is a small feature which defines that it is valid for
MDCR_EL2.HPMN to be set to 0, meaning "no PMU event counters provided
to an EL1 guest" (previously this setting was reserved). QEMU's
implementation almost gets HPMN == 0 right, but we need to fix
one check in pmevcntr_is_64_bit(). That is enough for us to
advertise the feature in the 'max' CPU.
(We don't need to make the behaviour conditional on feature
presence, because the FEAT_HPMN0 behaviour is within the range
of permitted UNPREDICTABLE behaviour for a non-FEAT_HPMN0
implementation.)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230921185445.3339214-1-peter.maydell@linaro.org
---
docs/system/arm/emulation.rst | 1 +
target/arm/helper.c | 2 +-
target/arm/tcg/cpu32.c | 4 ++++
target/arm/tcg/cpu64.c | 1 +
4 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
index 965cbf84c51..47fd648035f 100644
--- a/docs/system/arm/emulation.rst
+++ b/docs/system/arm/emulation.rst
@@ -46,6 +46,7 @@ the following architecture extensions:
- FEAT_HCX (Support for the HCRX_EL2 register)
- FEAT_HPDS (Hierarchical permission disables)
- FEAT_HPDS2 (Translation table page-based hardware attributes)
+- FEAT_HPMN0 (Setting of MDCR_EL2.HPMN to zero)
- FEAT_I8MM (AArch64 Int8 matrix multiplication instructions)
- FEAT_IDST (ID space trap handling)
- FEAT_IESB (Implicit error synchronization event)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 01cd1474565..b29edb26af8 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1283,7 +1283,7 @@ static bool pmevcntr_is_64_bit(CPUARMState *env, int counter)
bool hlp = env->cp15.mdcr_el2 & MDCR_HLP;
int hpmn = env->cp15.mdcr_el2 & MDCR_HPMN;
- if (hpmn != 0 && counter >= hpmn) {
+ if (counter >= hpmn) {
return hlp;
}
}
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
index 1f918ff5375..0d5d8e307dd 100644
--- a/target/arm/tcg/cpu32.c
+++ b/target/arm/tcg/cpu32.c
@@ -89,6 +89,10 @@ void aa32_max_features(ARMCPU *cpu)
t = FIELD_DP32(t, ID_DFR0, COPSDBG, 9); /* FEAT_Debugv8p4 */
t = FIELD_DP32(t, ID_DFR0, PERFMON, 6); /* FEAT_PMUv3p5 */
cpu->isar.id_dfr0 = t;
+
+ t = cpu->isar.id_dfr1;
+ t = FIELD_DP32(t, ID_DFR1, HPMN0, 1); /* FEAT_HPMN0 */
+ cpu->isar.id_dfr1 = t;
}
/* CPU models. These are not needed for the AArch64 linux-user build. */
diff --git a/target/arm/tcg/cpu64.c b/target/arm/tcg/cpu64.c
index 68928e51272..d978aa5f7ad 100644
--- a/target/arm/tcg/cpu64.c
+++ b/target/arm/tcg/cpu64.c
@@ -1109,6 +1109,7 @@ void aarch64_max_tcg_initfn(Object *obj)
t = cpu->isar.id_aa64dfr0;
t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 9); /* FEAT_Debugv8p4 */
t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 6); /* FEAT_PMUv3p5 */
+ t = FIELD_DP64(t, ID_AA64DFR0, HPMN0, 1); /* FEAT_HPMN0 */
cpu->isar.id_aa64dfr0 = t;
t = cpu->isar.id_aa64smfr0;
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 20/24] target/arm/kvm64.c: Remove unused include
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (18 preceding siblings ...)
2023-10-19 13:35 ` [PULL 19/24] target/arm: Implement FEAT_HPMN0 Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 21/24] target/arm/common-semi-target.h: Remove unnecessary boot.h include Peter Maydell
` (4 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
The include of hw/arm/virt.h in kvm64.c is unnecessary and also a
layering violation since the generic KVM code shouldn't need to know
anything about board-specifics. The include line is an accidental
leftover from commit 15613357ba53a4763, where we cleaned up the code
to not depend on virt board internals but forgot to also remove the
now-redundant include line.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230925110429.3917202-1-peter.maydell@linaro.org
---
target/arm/kvm64.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 558c0b88dd6..4bb68646e43 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -30,7 +30,6 @@
#include "internals.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/ghes.h"
-#include "hw/arm/virt.h"
static bool have_guest_debug;
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 21/24] target/arm/common-semi-target.h: Remove unnecessary boot.h include
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (19 preceding siblings ...)
2023-10-19 13:35 ` [PULL 20/24] target/arm/kvm64.c: Remove unused include Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 22/24] target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL Peter Maydell
` (3 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
The hw/arm/boot.h include in common-semi-target.h is not actually
needed, and it's a bit odd because it pulls a hw/arm header into a
target/arm file.
This include was originally needed because the semihosting code used
the arm_boot_info struct to get the base address of the RAM in system
emulation, to use in a (bad) heuristic for the return values for the
SYS_HEAPINFO semihosting call. We've since overhauled how we
calculate the HEAPINFO values in system emulation, and the code no
longer uses the arm_boot_info struct.
Remove the now-redundant include line, and instead directly include
the cpu-qom.h header that we were previously getting via boot.h.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230925112219.3919261-1-peter.maydell@linaro.org
---
target/arm/common-semi-target.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/target/arm/common-semi-target.h b/target/arm/common-semi-target.h
index 19438ed8cd3..da51f2d7f54 100644
--- a/target/arm/common-semi-target.h
+++ b/target/arm/common-semi-target.h
@@ -10,9 +10,7 @@
#ifndef TARGET_ARM_COMMON_SEMI_TARGET_H
#define TARGET_ARM_COMMON_SEMI_TARGET_H
-#ifndef CONFIG_USER_ONLY
-#include "hw/arm/boot.h"
-#endif
+#include "target/arm/cpu-qom.h"
static inline target_ulong common_semi_arg(CPUState *cs, int argno)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 22/24] target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (20 preceding siblings ...)
2023-10-19 13:35 ` [PULL 21/24] target/arm/common-semi-target.h: Remove unnecessary boot.h include Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 23/24] hw/timer/npcm7xx_timer: Prevent timer from counting down past zero Peter Maydell
` (2 subsequent siblings)
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
The code for powering on a CPU in arm-powerctl.c has two separate
use cases:
* emulation of a real hardware power controller
* emulation of firmware interfaces (primarily PSCI) with
CPU on/off APIs
For the first case, we only need to reset the CPU and set its
starting PC and X0. For the second case, because we're emulating the
firmware we need to ensure that it's in the state that the firmware
provides. In particular, when we reset to a lower EL than the
highest one we are emulating, we need to put the CPU into a state
that permits correct running at that lower EL. We already do a
little of this in arm-powerctl.c (for instance we set SCR_HCE to
enable the HVC insn) but we don't do enough of it. This means that
in the case where we are emulating EL3 but also providing emulated
PSCI the guest will crash when a secondary core tries to use a
feature that needs an SCR_EL3 bit to be set, such as MTE or PAuth.
The hw/arm/boot.c code also has to support this "start guest code in
an EL that's lower than the highest emulated EL" case in order to do
direct guest kernel booting; it has all the necessary initialization
code to set the SCR_EL3 bits. Pull the relevant boot.c code out into
a separate function so we can share it between there and
arm-powerctl.c.
This refactoring has a few code changes that look like they
might be behaviour changes but aren't:
* if info->secure_boot is false and info->secure_board_setup is
true, then the old code would start the first CPU in Hyp
mode but without changing SCR.NS and NSACR.{CP11,CP10}.
This was wrong behaviour because there's no such thing
as Secure Hyp mode. The new code will leave the CPU in SVC.
(There is no board which sets secure_boot to false and
secure_board_setup to true, so this isn't a behaviour
change for any of our boards.)
* we don't explicitly clear SCR.NS when arm-powerctl.c
does a CPU-on to EL3. This was a no-op because CPU reset
will reset to NS == 0.
And some real behaviour changes:
* we no longer set HCR_EL2.RW when booting into EL2: the guest
can and should do that themselves before dropping into their
EL1 code. (arm-powerctl and boot did this differently; I
opted to use the logic from arm-powerctl, which only sets
HCR_EL2.RW when it's directly starting the guest in EL1,
because it's more correct, and I don't expect guests to be
accidentally depending on our having set the RW bit for them.)
* if we are booting a CPU into AArch32 Secure SVC then we won't
set SCR.HCE any more. This affects only the vexpress-a15 and
raspi2b machine types. Guests booting in this case will either:
- be able to set SCR.HCE themselves as part of moving from
Secure SVC into NS Hyp mode
- will move from Secure SVC to NS SVC, and won't care about
behaviour of the HVC insn
- will stay in Secure SVC, and won't care about HVC
* on an arm-powerctl CPU-on we will now set the SCR bits for
pauth/mte/sve/sme/hcx/fgt features
The first two of these are very minor and I don't expect guest
code to trip over them, so I didn't judge it worth convoluting
the code in an attempt to keep exactly the same boot.c behaviour.
The third change fixes issue 1899.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1899
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230926155619.4028618-1-peter.maydell@linaro.org
---
target/arm/cpu.h | 22 +++++++++
hw/arm/boot.c | 95 ++++++++++-----------------------------
target/arm/arm-powerctl.c | 53 +---------------------
target/arm/cpu.c | 95 +++++++++++++++++++++++++++++++++++++++
4 files changed, 141 insertions(+), 124 deletions(-)
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index a9edfb8353e..76d4cef9e3a 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -1149,6 +1149,28 @@ int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
int cpuid, DumpState *s);
+/**
+ * arm_emulate_firmware_reset: Emulate firmware CPU reset handling
+ * @cpu: CPU (which must have been freshly reset)
+ * @target_el: exception level to put the CPU into
+ * @secure: whether to put the CPU in secure state
+ *
+ * When QEMU is directly running a guest kernel at a lower level than
+ * EL3 it implicitly emulates some aspects of the guest firmware.
+ * This includes that on reset we need to configure the parts of the
+ * CPU corresponding to EL3 so that the real guest code can run at its
+ * lower exception level. This function does that post-reset CPU setup,
+ * for when we do direct boot of a guest kernel, and for when we
+ * emulate PSCI and similar firmware interfaces starting a CPU at a
+ * lower exception level.
+ *
+ * @target_el must be an EL implemented by the CPU between 1 and 3.
+ * We do not support dropping into a Secure EL other than 3.
+ *
+ * It is the responsibility of the caller to call arm_rebuild_hflags().
+ */
+void arm_emulate_firmware_reset(CPUState *cpustate, int target_el);
+
#ifdef TARGET_AARCH64
int aarch64_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg);
int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 24fa1690600..84ea6a807a4 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -722,84 +722,35 @@ static void do_cpu_reset(void *opaque)
cpu_set_pc(cs, entry);
} else {
- /* If we are booting Linux then we need to check whether we are
- * booting into secure or non-secure state and adjust the state
- * accordingly. Out of reset, ARM is defined to be in secure state
- * (SCR.NS = 0), we change that here if non-secure boot has been
- * requested.
+ /*
+ * If we are booting Linux then we might need to do so at:
+ * - AArch64 NS EL2 or NS EL1
+ * - AArch32 Secure SVC (EL3)
+ * - AArch32 NS Hyp (EL2)
+ * - AArch32 NS SVC (EL1)
+ * Configure the CPU in the way boot firmware would do to
+ * drop us down to the appropriate level.
*/
- if (arm_feature(env, ARM_FEATURE_EL3)) {
- /* AArch64 is defined to come out of reset into EL3 if enabled.
- * If we are booting Linux then we need to adjust our EL as
- * Linux expects us to be in EL2 or EL1. AArch32 resets into
- * SVC, which Linux expects, so no privilege/exception level to
- * adjust.
- */
- if (env->aarch64) {
- env->cp15.scr_el3 |= SCR_RW;
- if (arm_feature(env, ARM_FEATURE_EL2)) {
- env->cp15.hcr_el2 |= HCR_RW;
- env->pstate = PSTATE_MODE_EL2h;
- } else {
- env->pstate = PSTATE_MODE_EL1h;
- }
- if (cpu_isar_feature(aa64_pauth, cpu)) {
- env->cp15.scr_el3 |= SCR_API | SCR_APK;
- }
- if (cpu_isar_feature(aa64_mte, cpu)) {
- env->cp15.scr_el3 |= SCR_ATA;
- }
- if (cpu_isar_feature(aa64_sve, cpu)) {
- env->cp15.cptr_el[3] |= R_CPTR_EL3_EZ_MASK;
- env->vfp.zcr_el[3] = 0xf;
- }
- if (cpu_isar_feature(aa64_sme, cpu)) {
- env->cp15.cptr_el[3] |= R_CPTR_EL3_ESM_MASK;
- env->cp15.scr_el3 |= SCR_ENTP2;
- env->vfp.smcr_el[3] = 0xf;
- }
- if (cpu_isar_feature(aa64_hcx, cpu)) {
- env->cp15.scr_el3 |= SCR_HXEN;
- }
- if (cpu_isar_feature(aa64_fgt, cpu)) {
- env->cp15.scr_el3 |= SCR_FGTEN;
- }
+ int target_el = arm_feature(env, ARM_FEATURE_EL2) ? 2 : 1;
- /* AArch64 kernels never boot in secure mode */
- assert(!info->secure_boot);
- /* This hook is only supported for AArch32 currently:
- * bootloader_aarch64[] will not call the hook, and
- * the code above has already dropped us into EL2 or EL1.
- */
- assert(!info->secure_board_setup);
- }
-
- if (arm_feature(env, ARM_FEATURE_EL2)) {
- /* If we have EL2 then Linux expects the HVC insn to work */
- env->cp15.scr_el3 |= SCR_HCE;
- }
-
- /* Set to non-secure if not a secure boot */
- if (!info->secure_boot &&
- (cs != first_cpu || !info->secure_board_setup)) {
- /* Linux expects non-secure state */
- env->cp15.scr_el3 |= SCR_NS;
- /* Set NSACR.{CP11,CP10} so NS can access the FPU */
- env->cp15.nsacr |= 3 << 10;
- }
- }
-
- if (!env->aarch64 && !info->secure_boot &&
- arm_feature(env, ARM_FEATURE_EL2)) {
+ if (env->aarch64) {
/*
- * This is an AArch32 boot not to Secure state, and
- * we have Hyp mode available, so boot the kernel into
- * Hyp mode. This is not how the CPU comes out of reset,
- * so we need to manually put it there.
+ * AArch64 kernels never boot in secure mode, and we don't
+ * support the secure_board_setup hook for AArch64.
*/
- cpsr_write(env, ARM_CPU_MODE_HYP, CPSR_M, CPSRWriteRaw);
+ assert(!info->secure_boot);
+ assert(!info->secure_board_setup);
+ } else {
+ if (arm_feature(env, ARM_FEATURE_EL3) &&
+ (info->secure_boot ||
+ (info->secure_board_setup && cs == first_cpu))) {
+ /* Start this CPU in Secure SVC */
+ target_el = 3;
+ }
}
+ arm_emulate_firmware_reset(cs, target_el);
+
if (cs == first_cpu) {
AddressSpace *as = arm_boot_address_space(cpu, info);
diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
index 326a03153df..c078849403c 100644
--- a/target/arm/arm-powerctl.c
+++ b/target/arm/arm-powerctl.c
@@ -65,60 +65,9 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state,
/* Initialize the cpu we are turning on */
cpu_reset(target_cpu_state);
+ arm_emulate_firmware_reset(target_cpu_state, info->target_el);
target_cpu_state->halted = 0;
- if (info->target_aa64) {
- if ((info->target_el < 3) && arm_feature(&target_cpu->env,
- ARM_FEATURE_EL3)) {
- /*
- * As target mode is AArch64, we need to set lower
- * exception level (the requested level 2) to AArch64
- */
- target_cpu->env.cp15.scr_el3 |= SCR_RW;
- }
-
- if ((info->target_el < 2) && arm_feature(&target_cpu->env,
- ARM_FEATURE_EL2)) {
- /*
- * As target mode is AArch64, we need to set lower
- * exception level (the requested level 1) to AArch64
- */
- target_cpu->env.cp15.hcr_el2 |= HCR_RW;
- }
-
- target_cpu->env.pstate = aarch64_pstate_mode(info->target_el, true);
- } else {
- /* We are requested to boot in AArch32 mode */
- static const uint32_t mode_for_el[] = { 0,
- ARM_CPU_MODE_SVC,
- ARM_CPU_MODE_HYP,
- ARM_CPU_MODE_SVC };
-
- cpsr_write(&target_cpu->env, mode_for_el[info->target_el], CPSR_M,
- CPSRWriteRaw);
- }
-
- if (info->target_el == 3) {
- /* Processor is in secure mode */
- target_cpu->env.cp15.scr_el3 &= ~SCR_NS;
- } else {
- /* Processor is not in secure mode */
- target_cpu->env.cp15.scr_el3 |= SCR_NS;
-
- /* Set NSACR.{CP11,CP10} so NS can access the FPU */
- target_cpu->env.cp15.nsacr |= 3 << 10;
-
- /*
- * If QEMU is providing the equivalent of EL3 firmware, then we need
- * to make sure a CPU targeting EL2 comes out of reset with a
- * functional HVC insn.
- */
- if (arm_feature(&target_cpu->env, ARM_FEATURE_EL3)
- && info->target_el == 2) {
- target_cpu->env.cp15.scr_el3 |= SCR_HCE;
- }
- }
-
/* We check if the started CPU is now at the correct level */
assert(info->target_el == arm_current_el(&target_cpu->env));
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 6c6c551573e..aa4e006f21a 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -553,6 +553,101 @@ static void arm_cpu_reset_hold(Object *obj)
}
}
+void arm_emulate_firmware_reset(CPUState *cpustate, int target_el)
+{
+ ARMCPU *cpu = ARM_CPU(cpustate);
+ CPUARMState *env = &cpu->env;
+ bool have_el3 = arm_feature(env, ARM_FEATURE_EL3);
+ bool have_el2 = arm_feature(env, ARM_FEATURE_EL2);
+
+ /*
+ * Check we have the EL we're aiming for. If that is the
+ * highest implemented EL, then cpu_reset has already done
+ * all the work.
+ */
+ switch (target_el) {
+ case 3:
+ assert(have_el3);
+ return;
+ case 2:
+ assert(have_el2);
+ if (!have_el3) {
+ return;
+ }
+ break;
+ case 1:
+ if (!have_el3 && !have_el2) {
+ return;
+ }
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ if (have_el3) {
+ /*
+ * Set the EL3 state so code can run at EL2. This should match
+ * the requirements set by Linux in its booting spec.
+ */
+ if (env->aarch64) {
+ env->cp15.scr_el3 |= SCR_RW;
+ if (cpu_isar_feature(aa64_pauth, cpu)) {
+ env->cp15.scr_el3 |= SCR_API | SCR_APK;
+ }
+ if (cpu_isar_feature(aa64_mte, cpu)) {
+ env->cp15.scr_el3 |= SCR_ATA;
+ }
+ if (cpu_isar_feature(aa64_sve, cpu)) {
+ env->cp15.cptr_el[3] |= R_CPTR_EL3_EZ_MASK;
+ env->vfp.zcr_el[3] = 0xf;
+ }
+ if (cpu_isar_feature(aa64_sme, cpu)) {
+ env->cp15.cptr_el[3] |= R_CPTR_EL3_ESM_MASK;
+ env->cp15.scr_el3 |= SCR_ENTP2;
+ env->vfp.smcr_el[3] = 0xf;
+ }
+ if (cpu_isar_feature(aa64_hcx, cpu)) {
+ env->cp15.scr_el3 |= SCR_HXEN;
+ }
+ if (cpu_isar_feature(aa64_fgt, cpu)) {
+ env->cp15.scr_el3 |= SCR_FGTEN;
+ }
+ }
+
+ if (target_el == 2) {
+ /* If the guest is at EL2 then Linux expects the HVC insn to work */
+ env->cp15.scr_el3 |= SCR_HCE;
+ }
+
+ /* Put CPU into non-secure state */
+ env->cp15.scr_el3 |= SCR_NS;
+ /* Set NSACR.{CP11,CP10} so NS can access the FPU */
+ env->cp15.nsacr |= 3 << 10;
+ }
+
+ if (have_el2 && target_el < 2) {
+ /* Set EL2 state so code can run at EL1. */
+ if (env->aarch64) {
+ env->cp15.hcr_el2 |= HCR_RW;
+ }
+ }
+
+ /* Set the CPU to the desired state */
+ if (env->aarch64) {
+ env->pstate = aarch64_pstate_mode(target_el, true);
+ } else {
+ static const uint32_t mode_for_el[] = {
+ 0,
+ ARM_CPU_MODE_SVC,
+ ARM_CPU_MODE_HYP,
+ ARM_CPU_MODE_SVC,
+ };
+
+ cpsr_write(env, mode_for_el[target_el], CPSR_M, CPSRWriteRaw);
+ }
+}
+
+
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 23/24] hw/timer/npcm7xx_timer: Prevent timer from counting down past zero
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (21 preceding siblings ...)
2023-10-19 13:35 ` [PULL 22/24] target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-19 13:35 ` [PULL 24/24] contrib/elf2dmp: Use g_malloc(), g_new() and g_free() Peter Maydell
2023-10-20 16:06 ` [PULL 00/24] target-arm queue Stefan Hajnoczi
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Chris Rauer <crauer@google.com>
The counter register is only 24-bits and counts down. If the timer is
running but the qtimer to reset it hasn't fired off yet, there is a chance
the regster read can return an invalid result.
Signed-off-by: Chris Rauer <crauer@google.com>
Message-id: 20230922181411.2697135-1-crauer@google.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/timer/npcm7xx_timer.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/timer/npcm7xx_timer.c b/hw/timer/npcm7xx_timer.c
index 32f5e021f85..a8bd93aeb2c 100644
--- a/hw/timer/npcm7xx_timer.c
+++ b/hw/timer/npcm7xx_timer.c
@@ -138,6 +138,9 @@ static int64_t npcm7xx_timer_count_to_ns(NPCM7xxTimer *t, uint32_t count)
/* Convert a time interval in nanoseconds to a timer cycle count. */
static uint32_t npcm7xx_timer_ns_to_count(NPCM7xxTimer *t, int64_t ns)
{
+ if (ns < 0) {
+ return 0;
+ }
return clock_ns_to_ticks(t->ctrl->clock, ns) /
npcm7xx_tcsr_prescaler(t->tcsr);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PULL 24/24] contrib/elf2dmp: Use g_malloc(), g_new() and g_free()
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (22 preceding siblings ...)
2023-10-19 13:35 ` [PULL 23/24] hw/timer/npcm7xx_timer: Prevent timer from counting down past zero Peter Maydell
@ 2023-10-19 13:35 ` Peter Maydell
2023-10-20 16:06 ` [PULL 00/24] target-arm queue Stefan Hajnoczi
24 siblings, 0 replies; 36+ messages in thread
From: Peter Maydell @ 2023-10-19 13:35 UTC (permalink / raw)
To: qemu-devel
From: Suraj Shirvankar <surajshirvankar@gmail.com>
QEMU coding style uses the glib memory allocation APIs, not
the raw libc malloc/free. Switch the allocation and free
calls in elf2dmp to use these functions (dropping the now-unneeded
checks for failure).
Signed-off-by: Suraj Shirvankar <surajshirvankar@gmail.com>
Message-id: 169753938460.23804.11418813007617535750-1@git.sr.ht
[PMM: also remove NULL checks from g_malloc() calls;
beef up commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
contrib/elf2dmp/addrspace.c | 7 ++-----
contrib/elf2dmp/main.c | 9 +++------
contrib/elf2dmp/pdb.c | 19 ++++++++-----------
contrib/elf2dmp/qemu_elf.c | 7 ++-----
4 files changed, 15 insertions(+), 27 deletions(-)
diff --git a/contrib/elf2dmp/addrspace.c b/contrib/elf2dmp/addrspace.c
index 64b5d680adc..6f608a517b1 100644
--- a/contrib/elf2dmp/addrspace.c
+++ b/contrib/elf2dmp/addrspace.c
@@ -72,10 +72,7 @@ int pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf)
}
}
- ps->block = malloc(sizeof(*ps->block) * ps->block_nr);
- if (!ps->block) {
- return 1;
- }
+ ps->block = g_new(struct pa_block, ps->block_nr);
for (i = 0; i < phdr_nr; i++) {
if (phdr[i].p_type == PT_LOAD) {
@@ -97,7 +94,7 @@ int pa_space_create(struct pa_space *ps, QEMU_Elf *qemu_elf)
void pa_space_destroy(struct pa_space *ps)
{
ps->block_nr = 0;
- free(ps->block);
+ g_free(ps->block);
}
void va_space_set_dtb(struct va_space *vs, uint64_t dtb)
diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c
index 6de5c9808ef..cbc38a7c103 100644
--- a/contrib/elf2dmp/main.c
+++ b/contrib/elf2dmp/main.c
@@ -120,14 +120,11 @@ static KDDEBUGGER_DATA64 *get_kdbg(uint64_t KernBase, struct pdb_reader *pdb,
}
}
- kdbg = malloc(kdbg_hdr.Size);
- if (!kdbg) {
- return NULL;
- }
+ kdbg = g_malloc(kdbg_hdr.Size);
if (va_space_rw(vs, KdDebuggerDataBlock, kdbg, kdbg_hdr.Size, 0)) {
eprintf("Failed to extract entire KDBG\n");
- free(kdbg);
+ g_free(kdbg);
return NULL;
}
@@ -643,7 +640,7 @@ int main(int argc, char *argv[])
}
out_kdbg:
- free(kdbg);
+ g_free(kdbg);
out_pdb:
pdb_exit(&pdb);
out_pdb_file:
diff --git a/contrib/elf2dmp/pdb.c b/contrib/elf2dmp/pdb.c
index 8e3c18c82f7..40991f5f4c3 100644
--- a/contrib/elf2dmp/pdb.c
+++ b/contrib/elf2dmp/pdb.c
@@ -94,18 +94,18 @@ uint64_t pdb_resolve(uint64_t img_base, struct pdb_reader *r, const char *name)
static void pdb_reader_ds_exit(struct pdb_reader *r)
{
- free(r->ds.toc);
+ g_free(r->ds.toc);
}
static void pdb_exit_symbols(struct pdb_reader *r)
{
- free(r->modimage);
- free(r->symbols);
+ g_free(r->modimage);
+ g_free(r->symbols);
}
static void pdb_exit_segments(struct pdb_reader *r)
{
- free(r->segs);
+ g_free(r->segs);
}
static void *pdb_ds_read(const PDB_DS_HEADER *header,
@@ -120,10 +120,7 @@ static void *pdb_ds_read(const PDB_DS_HEADER *header,
nBlocks = (size + header->block_size - 1) / header->block_size;
- buffer = malloc(nBlocks * header->block_size);
- if (!buffer) {
- return NULL;
- }
+ buffer = g_malloc(nBlocks * header->block_size);
for (i = 0; i < nBlocks; i++) {
memcpy(buffer + i * header->block_size, (const char *)header +
@@ -206,7 +203,7 @@ static int pdb_init_symbols(struct pdb_reader *r)
return 0;
out_symbols:
- free(symbols);
+ g_free(symbols);
return err;
}
@@ -263,7 +260,7 @@ static int pdb_reader_init(struct pdb_reader *r, void *data)
out_sym:
pdb_exit_symbols(r);
out_root:
- free(r->ds.root);
+ g_free(r->ds.root);
out_ds:
pdb_reader_ds_exit(r);
@@ -274,7 +271,7 @@ static void pdb_reader_exit(struct pdb_reader *r)
{
pdb_exit_segments(r);
pdb_exit_symbols(r);
- free(r->ds.root);
+ g_free(r->ds.root);
pdb_reader_ds_exit(r);
}
diff --git a/contrib/elf2dmp/qemu_elf.c b/contrib/elf2dmp/qemu_elf.c
index de6ad744c6d..055e6f8792e 100644
--- a/contrib/elf2dmp/qemu_elf.c
+++ b/contrib/elf2dmp/qemu_elf.c
@@ -94,10 +94,7 @@ static int init_states(QEMU_Elf *qe)
printf("%zu CPU states has been found\n", cpu_nr);
- qe->state = malloc(sizeof(*qe->state) * cpu_nr);
- if (!qe->state) {
- return 1;
- }
+ qe->state = g_new(QEMUCPUState*, cpu_nr);
cpu_nr = 0;
@@ -115,7 +112,7 @@ static int init_states(QEMU_Elf *qe)
static void exit_states(QEMU_Elf *qe)
{
- free(qe->state);
+ g_free(qe->state);
}
static bool check_ehdr(QEMU_Elf *qe)
--
2.34.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PULL 00/24] target-arm queue
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
` (23 preceding siblings ...)
2023-10-19 13:35 ` [PULL 24/24] contrib/elf2dmp: Use g_malloc(), g_new() and g_free() Peter Maydell
@ 2023-10-20 16:06 ` Stefan Hajnoczi
24 siblings, 0 replies; 36+ messages in thread
From: Stefan Hajnoczi @ 2023-10-20 16:06 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PULL 00/24] target-arm queue
@ 2024-07-11 13:17 Peter Maydell
2024-07-11 21:32 ` Richard Henderson
0 siblings, 1 reply; 36+ messages in thread
From: Peter Maydell @ 2024-07-11 13:17 UTC (permalink / raw)
To: qemu-devel
The following changes since commit 59084feb256c617063e0dbe7e64821ae8852d7cf:
Merge tag 'pull-aspeed-20240709' of https://github.com/legoater/qemu into staging (2024-07-09 07:13:55 -0700)
are available in the Git repository at:
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240711
for you to fetch changes up to 7f49089158a4db644fcbadfa90cd3d30a4868735:
target/arm: Convert PMULL to decodetree (2024-07-11 11:41:34 +0100)
----------------------------------------------------------------
target-arm queue:
* Refactor FPCR/FPSR handling in preparation for FEAT_AFP
* More decodetree conversions
* target/arm: Use cpu_env in cpu_untagged_addr
* target/arm: Set arm_v7m_tcg_ops cpu_exec_halt to arm_cpu_exec_halt()
* hw/char/pl011: Avoid division-by-zero in pl011_get_baudrate()
* hw/misc/bcm2835_thermal: Fix access size handling in bcm2835_thermal_ops
* accel/tcg: Make TCGCPUOps::cpu_exec_halt mandatory
* STM32L4x5: Handle USART interrupts correctly
----------------------------------------------------------------
Inès Varhol (3):
hw/misc: In STM32L4x5 EXTI, consolidate 2 constants
hw/misc: In STM32L4x5 EXTI, handle direct interrupts
hw/arm: In STM32L4x5 SOC, connect USART devices to EXTI
Peter Maydell (12):
target/arm: Correct comments about M-profile FPSCR
target/arm: Make vfp_get_fpscr() call vfp_get_{fpcr, fpsr}
target/arm: Make vfp_set_fpscr() call vfp_set_{fpcr, fpsr}
target/arm: Support migration when FPSR/FPCR won't fit in the FPSCR
target/arm: Implement store_cpu_field_low32() macro
target/arm: Store FPSR and FPCR in separate CPU state fields
target/arm: Rename FPCR_ QC, NZCV macros to FPSR_
target/arm: Rename FPSR_MASK and FPCR_MASK and define them symbolically
target/arm: Allow FPCR bits that aren't in FPSCR
target/arm: Set arm_v7m_tcg_ops cpu_exec_halt to arm_cpu_exec_halt()
target: Set TCGCPUOps::cpu_exec_halt to target's has_work implementation
accel/tcg: Make TCGCPUOps::cpu_exec_halt mandatory
Richard Henderson (7):
target/arm: Use cpu_env in cpu_untagged_addr
target/arm: Convert SMULL, UMULL, SMLAL, UMLAL, SMLSL, UMLSL to decodetree
target/arm: Convert SADDL, SSUBL, SABDL, SABAL, and unsigned to decodetree
target/arm: Convert SQDMULL, SQDMLAL, SQDMLSL to decodetree
target/arm: Convert SADDW, SSUBW, UADDW, USUBW to decodetree
target/arm: Convert ADDHN, SUBHN, RADDHN, RSUBHN to decodetree
target/arm: Convert PMULL to decodetree
Zheyu Ma (2):
hw/char/pl011: Avoid division-by-zero in pl011_get_baudrate()
hw/misc/bcm2835_thermal: Fix access size handling in bcm2835_thermal_ops
include/hw/core/tcg-cpu-ops.h | 9 +-
include/hw/misc/stm32l4x5_exti.h | 4 +-
target/arm/cpu.h | 113 ++--
target/arm/internals.h | 3 +
target/arm/tcg/translate-a32.h | 7 +
target/arm/tcg/translate.h | 3 +-
target/riscv/internals.h | 3 +
target/arm/tcg/a64.decode | 77 +++
accel/tcg/cpu-exec.c | 11 +-
hw/arm/stm32l4x5_soc.c | 24 +-
hw/char/pl011.c | 13 +-
hw/misc/bcm2835_thermal.c | 2 +
hw/misc/stm32l4x5_exti.c | 13 +-
target/alpha/cpu.c | 1 +
target/arm/cpu.c | 2 +-
target/arm/machine.c | 135 ++++-
target/arm/tcg/cpu-v7m.c | 1 +
target/arm/tcg/mve_helper.c | 12 +-
target/arm/tcg/translate-a64.c | 1155 ++++++++++++-------------------------
target/arm/tcg/translate-m-nocp.c | 22 +-
target/arm/tcg/translate-vfp.c | 4 +-
target/arm/vfp_helper.c | 187 +++---
target/avr/cpu.c | 1 +
target/cris/cpu.c | 2 +
target/hppa/cpu.c | 1 +
target/loongarch/cpu.c | 1 +
target/m68k/cpu.c | 1 +
target/microblaze/cpu.c | 1 +
target/mips/cpu.c | 1 +
target/openrisc/cpu.c | 1 +
target/ppc/cpu_init.c | 2 +
target/riscv/cpu.c | 2 +-
target/riscv/tcg/tcg-cpu.c | 2 +
target/rx/cpu.c | 1 +
target/s390x/cpu.c | 1 +
target/sh4/cpu.c | 1 +
target/sparc/cpu.c | 1 +
target/tricore/cpu.c | 1 +
target/xtensa/cpu.c | 1 +
39 files changed, 893 insertions(+), 929 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PULL 00/24] target-arm queue
2024-07-11 13:17 Peter Maydell
@ 2024-07-11 21:32 ` Richard Henderson
0 siblings, 0 replies; 36+ messages in thread
From: Richard Henderson @ 2024-07-11 21:32 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
On 7/11/24 06:17, Peter Maydell wrote:
> The following changes since commit 59084feb256c617063e0dbe7e64821ae8852d7cf:
>
> Merge tag 'pull-aspeed-20240709' ofhttps://github.com/legoater/qemu into staging (2024-07-09 07:13:55 -0700)
>
> are available in the Git repository at:
>
> https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240711
>
> for you to fetch changes up to 7f49089158a4db644fcbadfa90cd3d30a4868735:
>
> target/arm: Convert PMULL to decodetree (2024-07-11 11:41:34 +0100)
>
> ----------------------------------------------------------------
> target-arm queue:
> * Refactor FPCR/FPSR handling in preparation for FEAT_AFP
> * More decodetree conversions
> * target/arm: Use cpu_env in cpu_untagged_addr
> * target/arm: Set arm_v7m_tcg_ops cpu_exec_halt to arm_cpu_exec_halt()
> * hw/char/pl011: Avoid division-by-zero in pl011_get_baudrate()
> * hw/misc/bcm2835_thermal: Fix access size handling in bcm2835_thermal_ops
> * accel/tcg: MakeTCGCPUOps::cpu_exec_halt mandatory
> * STM32L4x5: Handle USART interrupts correctly
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/9.1 as appropriate.
r~
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2024-07-11 21:33 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-19 13:35 [PULL 00/24] target-arm queue Peter Maydell
2023-10-19 13:35 ` [PULL 01/24] hw/arm: Move raspberrypi-fw-defs.h to the include/hw/arm/ folder Peter Maydell
2023-10-19 13:35 ` [PULL 02/24] hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot.h' Peter Maydell
2023-10-19 13:35 ` [PULL 03/24] xlnx-bbram: hw/nvram: Remove deprecated device reset Peter Maydell
2023-10-19 13:35 ` [PULL 04/24] xlnx-zynqmp-efuse: " Peter Maydell
2023-10-19 13:35 ` [PULL 05/24] xlnx-versal-efuse: " Peter Maydell
2023-10-19 13:35 ` [PULL 06/24] xlnx-bbram: hw/nvram: Use dot in device type name Peter Maydell
2023-10-19 13:35 ` [PULL 07/24] elf2dmp: limit print length for sign_rsds Peter Maydell
2023-10-19 13:35 ` [PULL 08/24] elf2dmp: check array bounds in pdb_get_file_size Peter Maydell
2023-10-19 13:35 ` [PULL 09/24] target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0 Peter Maydell
2023-10-19 13:35 ` [PULL 10/24] {include/}hw/arm: refactor virt PPI logic Peter Maydell
2023-10-19 13:35 ` [PULL 11/24] include/hw/arm: move BSA definitions to bsa.h Peter Maydell
2023-10-19 13:35 ` [PULL 12/24] hw/arm/sbsa-ref: use bsa.h for PPI definitions Peter Maydell
2023-10-19 13:35 ` [PULL 13/24] arm/kvm: convert to kvm_set_one_reg Peter Maydell
2023-10-19 13:35 ` [PULL 14/24] arm/kvm: convert to kvm_get_one_reg Peter Maydell
2023-10-19 13:35 ` [PULL 15/24] target/arm: Permit T32 LDM with single register Peter Maydell
2023-10-19 13:35 ` [PULL 16/24] hw/arm/smmuv3: Update ID register bit field definitions Peter Maydell
2023-10-19 13:35 ` [PULL 17/24] hw/arm/smmuv3: Sort ID register setting into field order Peter Maydell
2023-10-19 13:35 ` [PULL 18/24] hw/arm/smmuv3: Advertise SMMUv3.1-XNX feature Peter Maydell
2023-10-19 13:35 ` [PULL 19/24] target/arm: Implement FEAT_HPMN0 Peter Maydell
2023-10-19 13:35 ` [PULL 20/24] target/arm/kvm64.c: Remove unused include Peter Maydell
2023-10-19 13:35 ` [PULL 21/24] target/arm/common-semi-target.h: Remove unnecessary boot.h include Peter Maydell
2023-10-19 13:35 ` [PULL 22/24] target/arm/arm-powerctl: Correctly init CPUs when powered on to lower EL Peter Maydell
2023-10-19 13:35 ` [PULL 23/24] hw/timer/npcm7xx_timer: Prevent timer from counting down past zero Peter Maydell
2023-10-19 13:35 ` [PULL 24/24] contrib/elf2dmp: Use g_malloc(), g_new() and g_free() Peter Maydell
2023-10-20 16:06 ` [PULL 00/24] target-arm queue Stefan Hajnoczi
-- strict thread matches above, loose matches on Subject: below --
2024-07-11 13:17 Peter Maydell
2024-07-11 21:32 ` Richard Henderson
2023-08-31 10:44 Peter Maydell
2023-08-31 16:15 ` Stefan Hajnoczi
2022-10-20 12:21 Peter Maydell
2022-10-20 20:04 ` Stefan Hajnoczi
2021-07-02 12:59 Peter Maydell
2021-07-04 13:03 ` Peter Maydell
2020-11-23 11:42 Peter Maydell
2020-11-23 17:03 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).