target-arm queue
Subsystems (2)
Hi; here's an arm pullreq. This is mostly bug fixes; the new features are emulation of a couple of small Arm CPU features.
thanks
-- PMM
The following changes since commit 2db91528542672cf0db78b3f2cc0e22b36302b38:
Merge tag 'pull-vfio-20260527' of https://github.com/legoater/qemu into staging (2026-05-27 14:45:58 -0400)
are available in the Git repository at:
https://gitlab.com/pm215/qemu.git tags/pull-target-arm-20260529
for you to fetch changes up to 44f2c7f3df0028de7991385f568add12e24aca47:
hw/dma/omap_dma: Fix indentation after ifdef removal (2026-05-29 10:18:11 +0100)
----------------------------------------------------------------
target-arm queue:
* target/arm: Implement FEAT_CMPBR emulation
* target/arm: Implement FEAT_RNG_TRAP emulation
* target/arm: Don't assert if 64-bit EL2 AT insn sees a Domain fault
* target/arm: SME BFCVT, BFCVTN have "Alternate BFloat16 behaviors"
* target/arm: Enable REVD for SVE2.1
* zynq: Various minor bug fixes
* hw/misc: Add dummy ZYNQ DDR controller
* hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d
* hw/dma/omap_dma: Remove unused ifdeffed out code
----------------------------------------------------------------
Jason Wright (2):
target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS target/arm: advertise FEAT_RNG_TRAP on cortex-max
Peter Maydell (5):
target/arm: Don't assert if 64-bit EL2 AT insn sees a Domain fault target/arm: SME BFCVT, BFCVTN have "Alternate BFloat16 behaviors" hw/dma/omap_dma: Remove unused ifdeffed out code hw/dma/omap_dma: Fix coding style in omap_dma_transfer_setup() hw/dma/omap_dma: Fix indentation after ifdef removal
Richard Henderson (5):
target/arm: Enable REVD for SVE2.1 target/arm: Add feature predicate for FEAT_CMPBR target/arm: Implement CB, CBB, CBH target/arm: Implement CB (immediate) target/arm: Enable FEAT_CMPBR for -cpu max
YannickV (9):
hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff hw/arm/zynq-devcfg: Prevent unintended unlock during initialization hw/dma/zynq: Ensure PCFG_DONE bit remains set to indicate PL is in user mode hw/dma/zynq-devcfg: Simulate dummy PL reset
hw/dma/zynq-devcfg: Indicate power-up status of PL
hw/misc: Add dummy ZYNQ DDR controller
hw/misc/zynq_slcr: Add logic for DCI configuration hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d hw/arm/xilinx_zynq: Split xilinx_zynq into header and implementation files
MAINTAINERS | 2 + docs/system/arm/emulation.rst | 2 + hw/arm/Kconfig | 1 + hw/arm/xilinx_zynq.c | 29 ++- hw/block/m25p80.c | 3 +- hw/dma/omap_dma.c | 247 ++++++++--------------- hw/dma/xlnx-zynq-devcfg.c | 27 ++- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/xlnx-zynq-ddrc.c | 421 +++++++++++++++++++++++++++++++++++++++ hw/misc/zynq_slcr.c | 31 +++ include/hw/arm/xilinx_zynq.h | 30 +++ include/hw/misc/xlnx-zynq-ddrc.h | 147 ++++++++++++++ linux-user/aarch64/elfload.c | 1 + target/arm/cpu-features.h | 10 + target/arm/helper.c | 58 +++++- target/arm/internals.h | 10 + target/arm/tcg/a64.decode | 11 + target/arm/tcg/cpu64.c | 3 +- target/arm/tcg/translate-a64.c | 86 ++++++++ target/arm/tcg/translate-sme.c | 4 +- target/arm/tcg/translate-sve.c | 3 +- 22 files changed, 939 insertions(+), 191 deletions(-) create mode 100644 hw/misc/xlnx-zynq-ddrc.c create mode 100644 include/hw/arm/xilinx_zynq.h create mode 100644 include/hw/misc/xlnx-zynq-ddrc.h
[PULL 01/21] target/arm: Enable REVD for SVE2.1
From: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/tcg/translate-sve.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
target/arm/tcg/translate-sve.c +2 -1
@@ -2993,7 +2993,8 @@ TRANS_FEAT(REVH, aa64_sme_or_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0)TRANS_FEAT (REVW , aa64_sme_or_sve, gen_gvec_ool_arg_zpz, a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) -TRANS_FEAT(REVD, aa64_sme, gen_gvec_ool_arg_zpz, gen_helper_sme_revd_q, a, 0) +TRANS_FEAT (REVD , aa64_sme_or_sve2p1, gen_gvec_ool_arg_zpz, + gen_helper_sme_revd_q, a, 0)TRANS_FEAT (SPLICE , aa64_sme_or_sve, gen_gvec_ool_arg_zpzz, gen_helper_sve_splice, a, a->esz)
Signature · 1 line
2.43.0
[PULL 09/21] hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d
In reply to Peter MaydellFrom: YannickV <[email protected]>
The is25lp016d has 4 Block Write Protect Bits. BP3 specifies whether the upper or lower range should be protected. Therefore, we add the HAS_SR_TB flag to the is25lp016d flags.
Message-id: [email protected]
--- hw/block/m25p80.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/block/m25p80.c +2 -1
@@ -217,7 +217,8 @@ static const FlashPartInfo known_devices[] = {/* ISSI */ { INFO("is25lq040b", 0x9d4013, 0, 64 << 10, 8, ER_4K) }, { INFO("is25lp080d", 0x9d6014, 0, 64 << 10, 16, ER_4K) }, - { INFO("is25lp016d", 0x9d6015, 0, 64 << 10, 32, ER_4K) }, + { INFO("is25lp016d", 0x9d6015, 0, 64 << 10, 32, + ER_4K | HAS_SR_TB) }, { INFO("is25lp032", 0x9d6016, 0, 64 << 10, 64, ER_4K) }, { INFO("is25lp064", 0x9d6017, 0, 64 << 10, 128, ER_4K) }, { INFO("is25lp128", 0x9d6018, 0, 64 << 10, 256, ER_4K) },
Signature · 1 line
2.43.0
[PULL 12/21] target/arm: Implement CB, CBB, CBH
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Compare and branch instructions, with various operand widths.
Message-id: [email protected]
--- target/arm/tcg/a64.decode | 9 +++++++ target/arm/tcg/translate-a64.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+)
target/arm/tcg/a64.decode +9 -0
@@ -208,6 +208,15 @@ TBZ . 011011 nz:1 ..... .............. rt:5 &tbz imm=%imm14 bitpos= # B.cond and BC.cond B_cond 0101010 0 ................... c:1 cond:4 imm=%imm19 +# CB, CBB, CBH +%imm9 5:s9 !function=times_4 +&cb cc rt rm imm esz +@cb . ....... cc:3 rm:5 .. ......... rt:5 &cb imm=%imm9 +CB_cond 0 1110100 ... ..... 00 ......... ..... @cb esz=2 +CB_cond 1 1110100 ... ..... 00 ......... ..... @cb esz=3 +CB_cond 0 1110100 ... ..... 10 ......... ..... @cb esz=0 # CBB +CB_cond 0 1110100 ... ..... 11 ......... ..... @cb esz=1 # CBH + BR 1101011 0000 11111 000000 rn:5 00000 &r BLR 1101011 0001 11111 000000 rn:5 00000 &r RET 1101011 0010 11111 000000 rn:5 00000 &r
target/arm/tcg/translate-a64.c +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 04/21] hw/dma/zynq: Ensure PCFG_DONE bit remains set to indicate PL is in user mode
In reply to Peter MaydellFrom: YannickV <[email protected]>
All register bits are clear on write by writing 1s to those bits, however the register bits will only be cleared if the condition that sets the interrupt flag is no longer true. Since we can assume that programming is always done, the PCFG_DONE flag is always set to 1, so it will not never be cleared.
Message-id: [email protected]
--- hw/dma/xlnx-zynq-devcfg.c | 2 ++ 1 file changed, 2 insertions(+)
hw/dma/xlnx-zynq-devcfg.c +2 -0
@@ -188,6 +188,8 @@ static void r_ixr_post_write(RegisterInfo *reg, uint64_t val) {XlnxZynqDevcfg *s =XLNX_ZYNQ_DEVCFG (reg->opaque); + s->regs[R_INT_STS ] |=R_INT_STS_PCFG_DONE_MASK ; +xlnx_zynq_devcfg_update_ixr (s); }
Signature · 1 line
2.43.0
[PULL 07/21] hw/misc: Add dummy ZYNQ DDR controller
In reply to Peter MaydellFrom: YannickV <[email protected]>
A dummy DDR controller for ZYNQ has been added. While all registers are present, not all are functional. Read and write access is validated, and the user mode can be set. This provides a basic DDR controller initialization, preventing system hangs due to endless polling or similar issues.
Message-id: [email protected]
--- MAINTAINERS | 2 + hw/arm/Kconfig | 1 + hw/arm/xilinx_zynq.c | 16 +- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/xlnx-zynq-ddrc.c | 421 +++++++++++++++++++++++++++++++ include/hw/misc/xlnx-zynq-ddrc.h | 147 +++++++++++ 7 files changed, 588 insertions(+), 3 deletions(-) create mode 100644 hw/misc/xlnx-zynq-ddrc.c create mode 100644 include/hw/misc/xlnx-zynq-ddrc.h
MAINTAINERS +2 -0
@@ -1144,8 +1144,10 @@ L: [email protected] S: Maintained F: hw/*/xilinx_* F: hw/*/cadence_* +F: hw/misc/xlnx-zynq-ddrc.c F: hw/misc/zynq_slcr.c F: hw/adc/zynq-xadc.c +F: include/hw/misc/xlnx-zynq-ddrc.h F: include/hw/misc/zynq_slcr.h F: include/hw/adc/zynq-xadc.h X: hw/ssi/xilinx_*
hw/arm/Kconfig +1 -0
@@ -289,6 +289,7 @@ config ZYNQ select XILINX_AXI select XILINX_SPI select XILINX_SPIPS + select XLNX_ZYNQ_DDRC select ZYNQ_DEVCFG config ARM_V7M
hw/arm/xilinx_zynq.c +13 -3
@@ -201,6 +201,17 @@ static void zynq_set_boot_mode(Object *obj, const char *str, m->boot_mode = mode; } +static void ddr_ctrl_init (uint32_t base) +{ +DeviceState *dev; +SysBusDevice *busdev; + + dev =qdev_new ("zynq.ddr-ctlr" ); + busdev =SYS_BUS_DEVICE (dev); +sysbus_realize_and_unref (busdev, &error_fatal); +sysbus_mmio_map (busdev,0 , base); +} +static void zynq_init (MachineState *machine) {ZynqMachineState *zynq_machine =ZYNQ_MACHINE (machine);
@@ -312,6 +323,8 @@ static void zynq_init(MachineState *machine)sysbus_create_varargs ("cadence_ttc" ,0xF8002000 , pic[69 -GIC_INTERNAL ], pic[70 -GIC_INTERNAL ], pic[71 -GIC_INTERNAL ],NULL ); +ddr_ctrl_init (0xF8006000 ); +gem_init (0xE000B000 , pic[54 -GIC_INTERNAL ]);gem_init (0xE000C000 , pic[77 -GIC_INTERNAL ]);
@@ -393,9 +406,6 @@ static void zynq_init(MachineState *machine)/* System Watchdog Timer Registers */ create_unimplemented_device ("zynq.swdt" ,0xF8005000 ,4 * KiB); -/* DDR memory controller */ -create_unimplemented_device ("zynq.ddrc" ,0xF8006000 ,4 * KiB); -/* AXI_HP Interface (AFI) */ create_unimplemented_device ("zynq.axi_hp0" ,0xF8008000 ,0x28 );create_unimplemented_device ("zynq.axi_hp1" ,0xF8009000 ,0x28 );
hw/misc/Kconfig +3 -0
@@ -254,4 +254,7 @@ config IOSB config XLNX_VERSAL_TRNG bool +config XLNX_ZYNQ_DDRC + bool + source macio/Kconfig
hw/misc/meson.build +1 -0
@@ -97,6 +97,7 @@ system_ss.add(when: 'CONFIG_RASPI', if_true: files( )) system_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) system_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) +system_ss.add(when: 'CONFIG_XLNX_ZYNQ_DDRC', if_true: files('xlnx-zynq-ddrc.c')) system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c')) system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c')) system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(
hw/misc/xlnx-zynq-ddrc.c new file +421 -0
421 lines not on this page · raw message
include/hw/misc/xlnx-zynq-ddrc.h new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 15/21] target/arm: Don't assert if 64-bit EL2 AT insn sees a Domain fault
In reply to Peter MaydellThe Domain fault type can only happen for 32-bit short-format descriptors. This means that it almost never needs to be encoded in a long-format fault status code. However, there is one corner case where we do need to report it as a long-format FSC: if a 64-bit EL2 does an AT insn on an AArch32 EL1&0 translation regime that is using short-descriptors and that translation operation hits a Domain fault, then this is reported in the PAR_EL1 in long-format.
The PAR_EL1 register description defines that this should be reported as 0b111101 for a level 1 Domain fault or 0b111110 for a level 2 Domain fault.
The Arm ARM pseudocode special cases this in the function AArch64_PARFaultStatus() (because no other "fault to LFSC" code path can be a Domain fault). For QEMU, implement it in arm_fi_to_lfsc().
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3512
Message-id: [email protected]
--- target/arm/internals.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
target/arm/internals.h +10 -0
@@ -893,6 +893,16 @@ static inline uint32_t arm_fi_to_lfsc(ARMMMUFaultInfo *fi)assert (fi->level >=0 && fi->level <=3 ); fsc =0b001100 | fi->level;break ; +case ARMFault_Domain: +/* +* This can only happen when doing an AT insn at EL2 for an AArch32 +* stage 1 EL1&0 translation regime using short-descriptors, and +* the translation hits a Domain fault. This needs to be reported in +* the long-format PAR. Compare pseudocode AArch64_PARFaultStatus(). +*/ +assert (fi->level ==1 || fi->level ==2 ); + fsc =0b111100 | fi->level; +break ;case ARMFault_Translation:assert (fi->level >=-1 && fi->level <=3 );if (fi->level <0 ) {
Signature · 1 line
2.43.0
[PULL 16/21] target/arm: SME BFCVT, BFCVTN have "Alternate BFloat16 behaviors"
In reply to Peter MaydellThe Arm ARM A1.5.10 notes that some instructions have "Alternate Bfloat16 behaviors" when FPCR.AH == 1. We implement these using the FPST_AH and FPST_AH_F16 fp_status words. The list includes the SME BFVCT (single-precision to BFloat16) and BFCVTN, but we forgot to make those use FPST_AH_F16 when we implemented them. (We get the ASIMD and SVE insns on the list right.)
Add the missing logic to select the right FPST.
Message-id: [email protected]
--- target/arm/tcg/translate-sme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target/arm/tcg/translate-sme.c +2 -2
@@ -1449,9 +1449,9 @@ static bool do_zz_fpst(DisasContext *s, arg_zz_n *a, int data, }TRANS_FEAT (BFCVT , aa64_sme2, do_zz_fpst, a,0 , - FPST_A64, gen_helper_sme2_bfcvt) + s->fpcr_ah ? FPST_AH : FPST_A64, gen_helper_sme2_bfcvt)TRANS_FEAT (BFCVTN , aa64_sme2, do_zz_fpst, a,0 , - FPST_A64, gen_helper_sme2_bfcvtn) + s->fpcr_ah ? FPST_AH : FPST_A64, gen_helper_sme2_bfcvtn)TRANS_FEAT (FCVT_n, aa64_sme2, do_zz_fpst, a,0 , FPST_A64, gen_helper_sme2_fcvt_n) TRANS_FEAT(FCVTN, aa64_sme2, do_zz_fpst, a, 0,
Signature · 1 line
2.43.0
[PULL 08/21] hw/misc/zynq_slcr: Add logic for DCI configuration
In reply to Peter MaydellFrom: YannickV <[email protected]>
The registers for the digitally controlled impedance (DCI) clock are part of the system level control registers (SLCR). The DONE bit in the status register indicates a successfull DCI calibration. An description of the calibration process can be found here:
https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/DDR-IOB-Impedance-Calibration
The DCI control register and status register have been added. As soon as the ENABLE and RESET bit are set, the RESET bit has also been toggled to 0 before and the UPDATE_CONTROL is not set, the DONE bit in the status register is set. If these bits change the DONE bit is reset. Note that the option bits are not taken into consideration.
Message-id: [email protected]
--- hw/misc/zynq_slcr.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
hw/misc/zynq_slcr.c +31 -0
@@ -180,6 +180,12 @@ REG32(GPIOB_CFG_HSTL, 0xb14) REG32(GPIOB_DRVR_BIAS_CTRL, 0xb18) REG32(DDRIOB, 0xb40) +REG32(DDRIOB_DCI_CTRL, 0xb70) + FIELD(DDRIOB_DCI_CTRL, RESET, 0, 1) + FIELD(DDRIOB_DCI_CTRL, ENABLE, 1, 1) + FIELD(DDRIOB_DCI_CTRL, UPDATE_CONTROL, 20, 1) +REG32(DDRIOB_DCI_STATUS, 0xb74) + FIELD(DDRIOB_DCI_STATUS, DONE, 13, 1)#define DDRIOB_LENGTH 14#define ZYNQ_SLCR_MMIO_SIZE 0x1000
@@ -193,6 +199,8 @@ struct ZynqSLCRState {MemoryRegion iomem; +bool ddriob_dci_ctrl_reset_toggled; +uint32_t regs[ZYNQ_SLCR_NUM_REGS ];Clock *ps_clk;
@@ -331,6 +339,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type)DB_PRINT ("RESET\n" ); + s->ddriob_dci_ctrl_reset_toggled = false; + s->regs[R_LOCKSTA ] =1 ;/* 0x100 - 0x11C */ s->regs[R_ARM_PLL_CTRL ] =0x0001A008 ;
@@ -418,6 +428,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type) s->regs[R_DDRIOB +4 ] = s->regs[R_DDRIOB +5 ] = s->regs[R_DDRIOB +6 ] =0x00000e00 ; s->regs[R_DDRIOB +12 ] =0x00000021 ; + + s->regs[R_DDRIOB_DCI_CTRL ] =0x00000020 ; }static void zynq_slcr_reset_hold (Object *obj,ResetType type)
@@ -554,6 +566,25 @@ static void zynq_slcr_write(void *opaque, hwaddr offset, (int)offset, (unsigned)val & 0xFFFF); }return ; + +case R_DDRIOB_DCI_CTRL : +if (!FIELD_EX32 (val,DDRIOB_DCI_CTRL ,RESET ) && +FIELD_EX32 (s->regs[R_DDRIOB_DCI_CTRL ],DDRIOB_DCI_CTRL ,RESET )) { + + s->ddriob_dci_ctrl_reset_toggled = true; +DB_PRINT ("DDRIOB DCI CTRL RESET was toggled\n" ); + } + +if (FIELD_EX32 (val,DDRIOB_DCI_CTRL ,ENABLE ) && +FIELD_EX32 (val,DDRIOB_DCI_CTRL ,RESET ) && + !FIELD_EX32 (val,DDRIOB_DCI_CTRL ,UPDATE_CONTROL ) && + s->ddriob_dci_ctrl_reset_toggled) { + + s->regs[R_DDRIOB_DCI_STATUS ] |=R_DDRIOB_DCI_STATUS_DONE_MASK ; + }else { + s->regs[R_DDRIOB_DCI_STATUS ] &= ~R_DDRIOB_DCI_STATUS_DONE_MASK ; + } +break ; }if (s->regs[R_LOCKSTA ]) {
Signature · 1 line
2.43.0
Re: [PULL 08/21] hw/misc/zynq_slcr: Add logic for DCI configuration
Quoted 9 lines · Peter Maydell
From: YannickV <[email protected]>
The registers for the digitally controlled impedance (DCI) clock are part of the system level control registers (SLCR). The DONE bit in the status register indicates a successfull DCI calibration. An description of the calibration process can be found here:
https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/DDR-IOB-Impedance-Calibration
Quoted 5 lines
The DCI control register and status register have been added. As soon as the ENABLE and RESET bit are set, the RESET bit has also been toggled to 0 before and the
UPDATE_CONTROLis not set, the DONE bit in the status register is set. If these bits change the DONE bit is reset. Note that the option bits are not taken into consideration.
Hi; we've just had a Coverity Scan run that went over this code, and it points out an issue:
Quoted 2 lines
REG32(DDRIOB, 0xb40)
+REG32(DDRIOB_DCI_CTRL,0xb70)
These REG32() macros define R_DDRIOB as 0xb40 / 4 == 0x2d0, and R_DDRIOB_DCI_CTRL as 0xb70 / 4 == 0x2dc...
hw/misc/zynq_slcr.c static void zynq_slcr_reset_init(Object *obj, ResetType type) · line 432
Quoted 6 lines
hw/misc/zynq_slcr.c +2
-0@@ -418,6 +428,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type) s->regs[R_DDRIOB +4 ] = s->regs[R_DDRIOB +5 ] = s->regs[R_DDRIOB +6 ] =0x00000e00 ; s->regs[R_DDRIOB +12 ] =0x00000021 ; + + s->regs[R_DDRIOB_DCI_CTRL ] =0x00000020 ;
...and here in the reset function we are now initializing both s->regs[R_DDRIOB + 12] and s->regs[R_DDRIOB_DCI_CTRL], but those are the same array element (since 0x2d0 + 12 == 0x2dc).
What was the intention here? Which reset value is correct? Should we be resetting some other register where we currently are resetting s->regs[R_DDRIOB + 12] ?
thanks
-- PMM
Re: [PULL 08/21] hw/misc/zynq_slcr: Add logic for DCI configuration
Ping -- Corvin, Yannick, please could you suggest the right resolution for this bug?
thanks
-- PMM
Quoted 43 lines · Peter Maydell
Quoted 9 lines · Peter Maydell
From: YannickV <[email protected]>
The registers for the digitally controlled impedance (DCI) clock are part of the system level control registers (SLCR). The DONE bit in the status register indicates a successfull DCI calibration. An description of the calibration process can be found here:
https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/DDR-IOB-Impedance-CalibrationQuoted 5 lines
The DCI control register and status register have been added. As soon as the ENABLE and RESET bit are set, the RESET bit has also been toggled to 0 before and the
UPDATE_CONTROLis not set, the DONE bit in the status register is set. If these bits change the DONE bit is reset. Note that the option bits are not taken into consideration.Hi; we've just had a Coverity Scan run that went over this code, and it points out an issue:
Quoted 2 lines
REG32(DDRIOB, 0xb40)
+REG32(DDRIOB_DCI_CTRL,0xb70)These
REG32()macros defineR_DDRIOBas0xb40/ 4 ==0x2d0, andR_DDRIOB_DCI_CTRLas0xb70/ 4 ==0x2dc...hw/misc/zynq_slcr.c static void zynq_slcr_reset_init(Object *obj, ResetType type) · line 432
Quoted 6 lines
hw/misc/zynq_slcr.c +2
-0@@ -418,6 +428,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type) s->regs[R_DDRIOB +4 ] = s->regs[R_DDRIOB +5 ] = s->regs[R_DDRIOB +6 ] =0x00000e00 ; s->regs[R_DDRIOB +12 ] =0x00000021 ; + + s->regs[R_DDRIOB_DCI_CTRL ] =0x00000020 ;...and here in the reset function we are now initializing both s->regs[R_DDRIOB + 12] and s->regs[R_DDRIOB_DCI_CTRL], but those are the same array element (since
0x2d0+ 12 ==0x2dc).What was the intention here? Which reset value is correct? Should we be resetting some other register where we currently are resetting s->regs[R_DDRIOB + 12] ?
thanks
-- PMM
Re: [PULL 08/21] hw/misc/zynq_slcr: Add logic for DCI configuration
Hi Peter,
sry, for the late response. I've checked the manual [1]. 0xb70 is the right offset for R_DDRIOB_DCI_CTRL. Additionally, the correct reset value is 0x20 not 0x21. The commit also requires 0x20 as reset value because it tries to detect a toggle of the reset bit (bit 0). Do you fix the commit or should we do it? Thanks for catching!
[1]
https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/Register-slcr-DDRIOB_DCI_CTRL
Signature · 2 lines
Best regards, Corvin
Quoted 53 lines · Peter Maydell
Ping -- Corvin, Yannick, please could you suggest the right resolution for this bug?
thanks
-- PMMQuoted 45 lines · Peter Maydell
Quoted 9 lines · Peter Maydell
From: YannickV <[email protected]>
The registers for the digitally controlled impedance (DCI) clock are part of the system level control registers (SLCR). The DONE bit in the status register indicates a successfull DCI calibration. An description of the calibration process can be found here:
https://urldefense.com/v3/__https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/DDR-IOB-Impedance-Calibration__;!!PlYMe_wG1g!lthDLWtCQd7a8JMN8G4iIPO8hmKqHg5ON9qsiI2YQGx5fTuThS3u5WwV6IeiZCeJf2gNSKMWSZ2wKu91Kb6gVFdpPQ$Quoted 5 lines
The DCI control register and status register have been added. As soon as the ENABLE and RESET bit are set, the RESET bit has also been toggled to 0 before and the
UPDATE_CONTROLis not set, the DONE bit in the status register is set. If these bits change the DONE bit is reset. Note that the option bits are not taken into consideration.Hi; we've just had a Coverity Scan run that went over this code, and it points out an issue:
Quoted 2 lines
REG32(DDRIOB,
0xb40)
+REG32(DDRIOB_DCI_CTRL,0xb70)These
REG32()macros defineR_DDRIOBas0xb40/ 4 ==0x2d0, andR_DDRIOB_DCI_CTRLas0xb70/ 4 ==0x2dc...hw/misc/zynq_slcr.c static void zynq_slcr_reset_init(Object *obj, ResetType type) · line 432
Quoted 7 lines
(quoted diff) +0
-0@@ -418,6 +428,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type)s->regs[R_DDRIOB + 4] = s->regs[R_DDRIOB + 5] = s->regs[R_DDRIOB + 6] =
0x00000e00;
s->regs[R_DDRIOB + 12] =0x00000021;hw/misc/zynq_slcr.c +2
-0+ + s->regs[R_DDRIOB_DCI_CTRL ] =0x00000020 ;...and here in the reset function we are now initializing both s->regs[R_DDRIOB + 12] and s->regs[R_DDRIOB_DCI_CTRL], but those are the same array element (since
0x2d0+ 12 ==0x2dc).What was the intention here? Which reset value is correct? Should we be resetting some other register where we currently are resetting s->regs[R_DDRIOB + 12] ?
thanks
-- PMM
This email contains confidential information. If you have received it in error, you must not read, use, copy or pass on this e-mail or its attachments. If you have received the e-mail in error, please inform me immediately by reply e-mail and then delete this e-mail from your system. Thank you
Diese E-Mail enthält vertrauliche Informationen. Sollten Sie sie irrtümlich erhalten haben, dürfen Sie diese E-Mail oder ihre Anhänge nicht lesen, verwenden, kopieren oder weitergeben. Sollten Sie die Mail versehentlich erhalten haben, teilen Sie mir dies bitte umgehend per Antwort-E-Mail mit und löschen Sie diese E-Mail dann aus Ihrem System. Vielen Dank
Beckhoff Automation GmbH & Co. KG
Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany
Register court: Guetersloh HRA 7075
DisclaimerID:x9d5u140
Re: [PULL 08/21] hw/misc/zynq_slcr: Add logic for DCI configuration
Quoted 8 lines · Corvin Köhne
Hi Peter,
sry, for the late response. I've checked the manual [1].
0xb70is the right offset forR_DDRIOB_DCI_CTRL. Additionally, the correct reset value is0x20not0x21. The commit also requires0x20as reset value because it tries to detect a toggle of the reset bit (bit 0). Do you fix the commit or should we do it? Thanks for catching!
If you could send a patch with the fix that would be best, I think.
-- PMM
[PULL 14/21] target/arm: Enable FEAT_CMPBR for -cpu max
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- docs/system/arm/emulation.rst | 1 + linux-user/aarch64/elfload.c | 1 + target/arm/tcg/cpu64.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
docs/system/arm/emulation.rst +1 -0
@@ -35,6 +35,7 @@ the following architecture extensions: - FEAT_CCIDX (Extended cache index) - FEAT_CHK (Check Feature Status) - FEAT_CMOW (Control for cache maintenance permission) +- FEAT_CMPBR (Compare and Branch instructions) - FEAT_CRC32 (CRC32 instructions) - FEAT_Crypto (Cryptographic Extension) - FEAT_CSSC (Common Short Sequence Compression instructions)
linux-user/aarch64/elfload.c +1 -0
@@ -170,6 +170,7 @@ abi_ulong get_elf_hwcap(CPUState *cs)GET_FEATURE_ID (aa64_rcpc_8_3,ARM_HWCAP_A64_LRCPC );GET_FEATURE_ID (aa64_rcpc_8_4,ARM_HWCAP_A64_ILRCPC );GET_FEATURE_ID (aa64_gcs,ARM_HWCAP_A64_GCS ); +GET_FEATURE_ID (aa64_cmpbr,ARM_HWCAP_A64_CMPBR );return hwcaps; }
target/arm/tcg/cpu64.c +1 -1
@@ -1262,7 +1262,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR2 ,MOPS ,1 );/* FEAT_MOPS */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,BC ,1 );/* FEAT_HBC */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,WFXT ,2 );/* FEAT_WFxT */ - t =FIELD_DP64 (t,ID_AA64ISAR2 ,CSSC ,1 );/* FEAT_CSSC */ + t =FIELD_DP64 (t,ID_AA64ISAR2 ,CSSC ,2 );/* FEAT_CSSC, FEAT_CMPBR */ t =FIELD_DP64 (t,ID_AA64ISAR2 ,ATS1A ,1 );/* FEAT_ATS1A */ SET_IDREG (isar,ID_AA64ISAR2 , t);
Signature · 1 line
2.43.0
[PULL 03/21] hw/arm/zynq-devcfg: Prevent unintended unlock during initialization
In reply to Peter MaydellFrom: YannickV <[email protected]>
During the emulation startup, all registers are reset, which triggers the r_unlock_post_write function with a value of 0. This led to an unintended memory access disable, making the devcfg unusable.
During startup, the memory space no longer gets locked.
Message-id: [email protected]
--- hw/dma/xlnx-zynq-devcfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/dma/xlnx-zynq-devcfg.c +3 -1
@@ -221,7 +221,9 @@ static void r_unlock_post_write(RegisterInfo *reg, uint64_t val) {XlnxZynqDevcfg *s =XLNX_ZYNQ_DEVCFG (reg->opaque);const char *device_prefix =object_get_typename (OBJECT (s)); - +if (device_is_in_reset (DEVICE (s))) { +return ; + }if (val ==R_UNLOCK_MAGIC ) {DB_PRINT ("successful unlock\n" ); s->regs[R_CTRL ] |=R_CTRL_PCAP_PR_MASK ;
Signature · 1 line
2.43.0
[PULL 02/21] hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff
In reply to Peter MaydellFrom: YannickV <[email protected]>
A DMA transfer to destination address 0xffffffff should trigger a bitstream load via the PCAP interface. Currently, this case is not intercepted, causing loaders to enter an infinite loop when polling the status register.
This commit adds a check for 0xffffffff as the destination address. If detected, the relevant status register bits (DMA_DONE, DMA_P_DONE, and PCFG_DONE) are set to indicate a successful bitstream load. If the address is different, the DMA transfer proceeds as usual. A successful load is indicated but nothing is actually done. Guests relying on FPGA functions are still known to fail.
This feature is required for the integration of the Beckhoff CX7200 model.
Message-id: [email protected]
--- hw/dma/xlnx-zynq-devcfg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/dma/xlnx-zynq-devcfg.c +8 -1
@@ -247,7 +247,14 @@ static uint64_t r_lock_pre_write(RegisterInfo *reg, uint64_t val)static void r_dma_dst_len_post_write (RegisterInfo *reg,uint64_t val) {XlnxZynqDevcfg *s =XLNX_ZYNQ_DEVCFG (reg->opaque); - +if ((s->regs[R_DMA_DST_ADDR ]) ==0xffffffff ) { +DB_PRINT ("bitstream loading detected\n" ); + s->regs[R_INT_STS ] |=R_INT_STS_DMA_DONE_MASK | +R_INT_STS_DMA_P_DONE_MASK | +R_INT_STS_PCFG_DONE_MASK ; +xlnx_zynq_devcfg_update_ixr (s); +return ; + } s->dma_cmd_fifo[s->dma_cmd_fifo_num] = (XlnxZynqDevcfgDMACmd ) { .src_addr = s->regs[R_DMA_SRC_ADDR ] & ~0x3UL , .dest_addr = s->regs[R_DMA_DST_ADDR ] & ~0x3UL ,
Signature · 1 line
2.43.0
[PULL 20/21] hw/dma/omap_dma: Fix coding style in omap_dma_transfer_setup()
In reply to Peter MaydellWe're about to fix indent in a section of the omap_dma_transfer_setup() function, which will make checkpatch complain. Since we're touching the code anyway, fix the uses of if() with no braces and wrongly formatted multiline comments.
Message-id: [email protected]
--- hw/dma/omap_dma.c | 51 ++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 18 deletions(-)
hw/dma/omap_dma.c +33 -18
@@ -471,49 +471,59 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)/* If the channel is element synchronized, deactivate it */ -if (min_elems == elements[omap_dma_intr_element_sync]) +if (min_elems == elements[omap_dma_intr_element_sync]) {omap_dma_deactivate_channel (s, ch); + }/* If it is the last frame, set the LAST_FRAME interrupt */ -if (min_elems == elements[omap_dma_intr_last_frame]) +if (min_elems == elements[omap_dma_intr_last_frame]) { ch->status |=LAST_FRAME_INTR ; + } -/* If exactly half of the frame was reached, set the HALF_FRAME -interrupt */ -if (min_elems == elements[omap_dma_intr_half_frame]) +/* +* If exactly half of the frame was reached, set the HALF_FRAME +* interrupt +*/ +if (min_elems == elements[omap_dma_intr_half_frame]) { ch->status |=HALF_FRAME_INTR ; + }/* If a full packet has been transferred, set the END_PKT interrupt */ -if (min_elems == elements[omap_dma_intr_packet]) +if (min_elems == elements[omap_dma_intr_packet]) { ch->status |=END_PKT_INTR ; + }/* If the channel is packet-synchronized, deactivate it */ -if (min_elems == elements[omap_dma_intr_packet_sync]) +if (min_elems == elements[omap_dma_intr_packet_sync]) {omap_dma_deactivate_channel (s, ch); + }/* If the channel is frame synchronized, deactivate it */ -if (min_elems == elements[omap_dma_intr_frame_sync]) +if (min_elems == elements[omap_dma_intr_frame_sync]) {omap_dma_deactivate_channel (s, ch); + }/* Set the END_FRAME interrupt */ -if (min_elems == elements[omap_dma_intr_frame]) +if (min_elems == elements[omap_dma_intr_frame]) { ch->status |=END_FRAME_INTR ; + }if (min_elems == elements[omap_dma_intr_block]) {/* End of Block */ /* Disable the channel */ -if (!ch->auto_init) +if (!ch->auto_init) {omap_dma_disable_channel (s, ch); -else if (ch->repeat || ch->end_prog) + }else if (ch->repeat || ch->end_prog) {omap_dma_channel_load (ch); -else { + }else { ch->waiting_end_prog =1 ;omap_dma_deactivate_channel (s, ch); } -if (ch->interrupts &END_BLOCK_INTR ) +if (ch->interrupts &END_BLOCK_INTR ) { ch->status |=END_BLOCK_INTR ; + } }/* Update packet number */
@@ -522,8 +532,10 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma) a->pck_element %= a->pck_elements; } -/* TODO: check if we really need to update anything here or perhaps we -* can skip part of this. */ +/* +* TODO: check if we really need to update anything here or perhaps we +* can skip part of this. +*/ if (dma->update) { a->element += min_elems;
@@ -534,11 +546,14 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma) a->dest += min_elems * a->elem_delta[1 ] + frames * a->frame_delta[1 ];/* If the channel is async, update cpc */ -if (!ch->sync && frames) +if (!ch->sync && frames) { ch->cpc = a->dest &0xffff ; + } -/* TODO: if the destination port is IMIF or EMIFF, set the dirty -* bits on it. */ +/* +* TODO: if the destination port is IMIF or EMIFF, set the dirty +* bits on it. +*/ }omap_dma_interrupts_update (s);
Signature · 1 line
2.43.0
[PULL 06/21] hw/dma/zynq-devcfg: Indicate power-up status of PL
In reply to Peter MaydellFrom: YannickV <[email protected]>
It is assumed, that the programmable logic (PL) is always powered during emulation. Therefor the PCFG_POR_B bit in the MCTRL register is set.
Message-id: [email protected]
--- hw/dma/xlnx-zynq-devcfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/dma/xlnx-zynq-devcfg.c +2 -1
@@ -333,7 +333,8 @@ static const RegisterAccessInfo xlnx_zynq_devcfg_regs_info[] = {/* Silicon 3.0 for version field, the mysterious reserved bit 23 * and QEMU platform identifier. */ - .reset = 0x2 << R_MCTRL_PS_VERSION_SHIFT | 1 << 23 | R_MCTRL_QEMU_MASK, + .reset = 0x2 << R_MCTRL_PS_VERSION_SHIFT | 1 << 23 | + R_MCTRL_PCFG_POR_B_MASK | R_MCTRL_QEMU_MASK, .ro = ~R_MCTRL_INT_PCAP_LPBK_MASK, .rsvd = 0x00f00303, },
Signature · 1 line
2.43.0
[PULL 17/21] target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS
In reply to Peter MaydellFrom: Jason Wright <[email protected]>
Add an .accessfn to the RNDR and RNDRRS system registers that traps reads to EL3 when SCR_EL3.TRNDR is set, as required by FEAT_RNG_TRAP. Mark SCR_EL3.TRNDR (bit 40) as a writable field in scr_write() when the CPU advertises the feature. The pseudocode in DDI0487 revision M.b shows the trap firing from EL0, EL1, EL2, and EL3, so there is no check of arm_current_el().
When FEAT_RNG_TRAP is implemented without FEAT_RNG, an RNDR/RNDRRS read with SCR_EL3.TRNDR=0 should UNDEF rather than succeed; handle that case in access_rndr(). Register the rndr_reginfo CP reg entries whenever either FEAT_RNG or FEAT_RNG_TRAP is implemented, so the accessfn fires even on a FEAT_RNG_TRAP-only CPU.
When SCR_EL3.TRNDR is set, ID_AA64ISAR0_EL1.RNDR reads as 1 regardless of whether FEAT_RNG is implemented; give ID_AA64ISAR0_EL1 a readfn so it reports this at runtime, as we already do for ID_AA64PFR0_EL1.
--- target/arm/cpu-features.h | 5 ++++ target/arm/helper.c | 58 +++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-)
target/arm/cpu-features.h +5 -0
@@ -908,6 +908,11 @@ static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RNDR ) !=0 ; } +static inline bool isar_feature_aa64_rng_trap (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,RNDR_TRAP ) !=0 ; +} +static inline bool isar_feature_aa64_tlbirange (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TLB ) ==2 ;
target/arm/helper.c +53 -5
100 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PULL 17/21] target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS
+ Alexander and qemu-arm (for HVF/arm),
Quoted 132 lines · Peter Maydell
From: Jason Wright <[email protected]>
Add an .accessfn to the RNDR and RNDRRS system registers that traps reads to EL3 when SCR_EL3.TRNDR is set, as required by
FEAT_RNG_TRAP. Mark SCR_EL3.TRNDR (bit 40) as a writable field inscr_write()when the CPU advertises the feature. The pseudocode in DDI0487 revision M.b shows the trap firing from EL0, EL1, EL2, and EL3, so there is no check ofarm_current_el().When
FEAT_RNG_TRAPis implemented withoutFEAT_RNG, an RNDR/RNDRRS read with SCR_EL3.TRNDR=0 should UNDEF rather than succeed; handle that case inaccess_rndr(). Register therndr_reginfoCP reg entries whenever eitherFEAT_RNGorFEAT_RNG_TRAPis implemented, so the accessfn fires even on a FEAT_RNG_TRAP-only CPU.When SCR_EL3.TRNDR is set, ID_AA64ISAR0_EL1.RNDR reads as 1 regardless of whether
FEAT_RNGis implemented; giveID_AA64ISAR0_EL1a readfn so it reports this at runtime, as we already do forID_AA64PFR0_EL1.Suggested-by Richard Henderson <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Jason Wright <[email protected]>Reviewed-by Richard Henderson <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu-features.h | 5 ++++ target/arm/helper.c | 58 +++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-)target/arm/cpu-features.h +5
-0@@ -908,6 +908,11 @@ static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RNDR ) !=0 ; } +static inline bool isar_feature_aa64_rng_trap (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,RNDR_TRAP ) !=0 ; +} +static inline bool isar_feature_aa64_tlbirange (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TLB ) ==2 ;target/arm/helper.c +43
-3@@ -790,6 +790,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)if (cpu_isar_feature (aa64_fpmr, cpu)) { valid_mask |=SCR_ENFPM ; } +if (cpu_isar_feature (aa64_rng_trap, cpu)) { + valid_mask |=SCR_TRNDR ; + } }else { valid_mask &= ~(SCR_RW |SCR_ST );if (cpu_isar_feature (aa32_ras, cpu)) {@@ -5170,6 +5173,21 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) }return pfr0; } + +static uint64_t id_aa64isar0_read (CPUARMState *env,const ARMCPRegInfo *ri) +{ +ARMCPU *cpu =env_archcpu (env); +uint64_t isar0 =GET_IDREG (&cpu->isar,ID_AA64ISAR0 ); + +/* +* When FEAT_RNG_TRAP is active (SCR_EL3.TRNDR set), ID_AA64ISAR0_EL1.RNDR +* reads as 1 regardless of whether FEAT_RNG is implemented. +*/ +if (env->cp15.scr_el3 &SCR_TRNDR ) { + isar0 =FIELD_DP64 (isar0,ID_AA64ISAR0 ,RNDR ,1 ); + } +return isar0; +}#endif /* @@ -5304,6 +5322,22 @@ static const ARMCPRegInfo pauth_reginfo[] = { .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, }; +static CPAccessResult access_rndr (CPUARMState *env,const ARMCPRegInfo *ri, +bool isread) +{ +if (env->cp15.scr_el3 &SCR_TRNDR ) { +return CP_ACCESS_TRAP_EL3 ; + } +/* +* Note that FEAT_RNG_TRAP may be implemented without FEAT_RNG. +* In that case, if the trap is not enabled, the read undefs. +*/ +if (!cpu_isar_feature (aa64_rndr,env_archcpu (env))) { +return CP_ACCESS_UNDEFINED ; + } +return CP_ACCESS_OK ; +} +static uint64_t rndr_readfn (CPUARMState *env,const ARMCPRegInfo *ri) {Error *err =NULL ;@@ -5335,11 +5369,11 @@ static const ARMCPRegInfo rndr_reginfo[] = { { .name = "RNDR", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 0, - .access = PL0_R, .readfn = rndr_readfn }, + .access = PL0_R, .accessfn = access_rndr, .readfn = rndr_readfn }, { .name = "RNDRRS", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 1, - .access = PL0_R, .readfn = rndr_readfn }, + .access = PL0_R, .accessfn = access_rndr, .readfn = rndr_readfn }, }; static void dccvap_writefn(CPUARMState *env, const ARMCPRegInfo *ri,@@ -6522,11 +6556,24 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, .resetvalue = 0 }, +/* +* ID_AA64ISAR0_EL1 is not a plain ARM_CP_CONST in system +* emulation because the RNDR field depends on SCR_EL3.TRNDR +* at read time when FEAT_RNG_TRAP is implemented. +*/ { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, - .access = PL1_R, .type = ARM_CP_CONST, + .access = PL1_R, +#ifdef CONFIG_USER_ONLY
target/arm/helper.c void register_cp_regs_for_features(ARMCPU *cpu) · line 6576
Quoted 10 lines
target/arm/helper.c +8
-1+ .type = ARM_CP_CONST, + .resetvalue =GET_IDREG (isar,ID_AA64ISAR0 ) +#else + .type = ARM_CP_NO_RAW, .accessfn = access_tid3, - .resetvalue = GET_IDREG(isar, ID_AA64ISAR0)}, + .readfn = id_aa64isar0_read, + .writefn = arm_cp_write_ignore +#endif + },
A new assert() was triggered when booting guest on M1 since this change:
Assertion failed: (!(ri->type & ARM_CP_NO_RAW)), function hvf_arch_init_vcpu, file hvf.c, line 1442.
Thanks,
Zenghui
Quoted 13 lines
target/arm/helper.c +2
-1{ .name = "ID_AA64ISAR1_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 1, .access = PL1_R, .type = ARM_CP_CONST,@@ -7454,7 +7501,8 @@ void register_cp_regs_for_features(ARMCPU *cpu)if (cpu_isar_feature (aa64_pauth, cpu)) {define_arm_cp_regs (cpu, pauth_reginfo); } -if (cpu_isar_feature (aa64_rndr, cpu)) { +if (cpu_isar_feature (aa64_rndr, cpu) || +cpu_isar_feature (aa64_rng_trap, cpu)) {define_arm_cp_regs (cpu, rndr_reginfo); }/* Data Cache clean instructions up to PoP */
Re: [PULL 17/21] target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS
Quoted 148 lines · Zenghui Yu
+ Alexander and qemu-arm (for HVF/arm),
Quoted 132 lines · Peter Maydell
From: Jason Wright <[email protected]>
Add an .accessfn to the RNDR and RNDRRS system registers that traps reads to EL3 when SCR_EL3.TRNDR is set, as required by
FEAT_RNG_TRAP. Mark SCR_EL3.TRNDR (bit 40) as a writable field inscr_write()when the CPU advertises the feature. The pseudocode in DDI0487 revision M.b shows the trap firing from EL0, EL1, EL2, and EL3, so there is no check ofarm_current_el().When
FEAT_RNG_TRAPis implemented withoutFEAT_RNG, an RNDR/RNDRRS read with SCR_EL3.TRNDR=0 should UNDEF rather than succeed; handle that case inaccess_rndr(). Register therndr_reginfoCP reg entries whenever eitherFEAT_RNGorFEAT_RNG_TRAPis implemented, so the accessfn fires even on a FEAT_RNG_TRAP-only CPU.When SCR_EL3.TRNDR is set, ID_AA64ISAR0_EL1.RNDR reads as 1 regardless of whether
FEAT_RNGis implemented; giveID_AA64ISAR0_EL1a readfn so it reports this at runtime, as we already do forID_AA64PFR0_EL1.Suggested-by Richard Henderson <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Jason Wright <[email protected]>Reviewed-by Richard Henderson <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu-features.h | 5 ++++ target/arm/helper.c | 58 +++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-)target/arm/cpu-features.h +5
-0@@ -908,6 +908,11 @@ static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RNDR ) !=0 ; } +static inline bool isar_feature_aa64_rng_trap (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,RNDR_TRAP ) !=0 ; +} +static inline bool isar_feature_aa64_tlbirange (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TLB ) ==2 ;target/arm/helper.c +43
-3@@ -790,6 +790,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)if (cpu_isar_feature (aa64_fpmr, cpu)) { valid_mask |=SCR_ENFPM ; } +if (cpu_isar_feature (aa64_rng_trap, cpu)) { + valid_mask |=SCR_TRNDR ; + } }else { valid_mask &= ~(SCR_RW |SCR_ST );if (cpu_isar_feature (aa32_ras, cpu)) {@@ -5170,6 +5173,21 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) }return pfr0; } + +static uint64_t id_aa64isar0_read (CPUARMState *env,const ARMCPRegInfo *ri) +{ +ARMCPU *cpu =env_archcpu (env); +uint64_t isar0 =GET_IDREG (&cpu->isar,ID_AA64ISAR0 ); + +/* +* When FEAT_RNG_TRAP is active (SCR_EL3.TRNDR set), ID_AA64ISAR0_EL1.RNDR +* reads as 1 regardless of whether FEAT_RNG is implemented. +*/ +if (env->cp15.scr_el3 &SCR_TRNDR ) { + isar0 =FIELD_DP64 (isar0,ID_AA64ISAR0 ,RNDR ,1 ); + } +return isar0; +}#endif /* @@ -5304,6 +5322,22 @@ static const ARMCPRegInfo pauth_reginfo[] = { .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, }; +static CPAccessResult access_rndr (CPUARMState *env,const ARMCPRegInfo *ri, +bool isread) +{ +if (env->cp15.scr_el3 &SCR_TRNDR ) { +return CP_ACCESS_TRAP_EL3 ; + } +/* +* Note that FEAT_RNG_TRAP may be implemented without FEAT_RNG. +* In that case, if the trap is not enabled, the read undefs. +*/ +if (!cpu_isar_feature (aa64_rndr,env_archcpu (env))) { +return CP_ACCESS_UNDEFINED ; + } +return CP_ACCESS_OK ; +} +static uint64_t rndr_readfn (CPUARMState *env,const ARMCPRegInfo *ri) {Error *err =NULL ;@@ -5335,11 +5369,11 @@ static const ARMCPRegInfo rndr_reginfo[] = { { .name = "RNDR", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 0, - .access = PL0_R, .readfn = rndr_readfn }, + .access = PL0_R, .accessfn = access_rndr, .readfn = rndr_readfn }, { .name = "RNDRRS", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 1, - .access = PL0_R, .readfn = rndr_readfn }, + .access = PL0_R, .accessfn = access_rndr, .readfn = rndr_readfn }, }; static void dccvap_writefn(CPUARMState *env, const ARMCPRegInfo *ri,@@ -6522,11 +6556,24 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, .resetvalue = 0 }, +/* +* ID_AA64ISAR0_EL1 is not a plain ARM_CP_CONST in system +* emulation because the RNDR field depends on SCR_EL3.TRNDR +* at read time when FEAT_RNG_TRAP is implemented. +*/ { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, - .access = PL1_R, .type = ARM_CP_CONST, + .access = PL1_R, +#ifdef CONFIG_USER_ONLY target/arm/helper.c void register_cp_regs_for_features(ARMCPU *cpu) · line 6576
Quoted 10 lines
target/arm/helper.c +8
-1+ .type = ARM_CP_CONST, + .resetvalue =GET_IDREG (isar,ID_AA64ISAR0 ) +#else + .type = ARM_CP_NO_RAW, .accessfn = access_tid3, - .resetvalue = GET_IDREG(isar, ID_AA64ISAR0)}, + .readfn = id_aa64isar0_read, + .writefn = arm_cp_write_ignore +#endif + },A new
assert()was triggered when booting guest on M1 since this change:
Quoted 5 lines
Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1442.Thanks,
Zenghui
Thanks for the report and the bisect, Zenghui. I can reproduce on M1 with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \
-nographic -display none -bios /dev/null
ID_AA64PFR0_EL1 has the same NO_RAW + readfn shape that the FEAT_RNG_TRAP change gave ID_AA64ISAR0_EL1, and HVF already accommodates it by listing the cpreg in the SYNC_NO_RAW_REGS block in target/arm/hvf/sysreg.c.inc (so the assert loop skips it) and pushing QEMU's value to the vCPU at init time. Mirroring that pattern for ID_AA64ISAR0_EL1 clears the assert without disturbing the readfn semantics that the spec requires if a FEAT_RNG_TRAP-only CPU eventually appears.
I'll send a fix-up as [PATCH] target/arm/hvf shortly.
Re: [PULL 17/21] target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS
Quoted 167 lines · Jason L. Wright
Quoted 148 lines · Zenghui Yu
+ Alexander and qemu-arm (for HVF/arm),
Quoted 132 lines · Peter Maydell
From: Jason Wright <[email protected]>
Add an .accessfn to the RNDR and RNDRRS system registers that traps reads to EL3 when SCR_EL3.TRNDR is set, as required by
FEAT_RNG_TRAP. Mark SCR_EL3.TRNDR (bit 40) as a writable field inscr_write()when the CPU advertises the feature. The pseudocode in DDI0487 revision M.b shows the trap firing from EL0, EL1, EL2, and EL3, so there is no check ofarm_current_el().When
FEAT_RNG_TRAPis implemented withoutFEAT_RNG, an RNDR/RNDRRS read with SCR_EL3.TRNDR=0 should UNDEF rather than succeed; handle that case inaccess_rndr(). Register therndr_reginfoCP reg entries whenever eitherFEAT_RNGorFEAT_RNG_TRAPis implemented, so the accessfn fires even on a FEAT_RNG_TRAP-only CPU.When SCR_EL3.TRNDR is set, ID_AA64ISAR0_EL1.RNDR reads as 1 regardless of whether
FEAT_RNGis implemented; giveID_AA64ISAR0_EL1a readfn so it reports this at runtime, as we already do forID_AA64PFR0_EL1.Suggested-by Richard Henderson <[email protected]>Suggested-by Peter Maydell <[email protected]>Signed-off-by Jason Wright <[email protected]>Reviewed-by Richard Henderson <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu-features.h | 5 ++++ target/arm/helper.c | 58 +++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 5 deletions(-)target/arm/cpu-features.h +5
-0@@ -908,6 +908,11 @@ static inline bool isar_feature_aa64_rndr(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RNDR ) !=0 ; } +static inline bool isar_feature_aa64_rng_trap (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64PFR1 ,RNDR_TRAP ) !=0 ; +} +static inline bool isar_feature_aa64_tlbirange (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,TLB ) ==2 ;target/arm/helper.c +43
-3@@ -790,6 +790,9 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)if (cpu_isar_feature (aa64_fpmr, cpu)) { valid_mask |=SCR_ENFPM ; } +if (cpu_isar_feature (aa64_rng_trap, cpu)) { + valid_mask |=SCR_TRNDR ; + } }else { valid_mask &= ~(SCR_RW |SCR_ST );if (cpu_isar_feature (aa32_ras, cpu)) {@@ -5170,6 +5173,21 @@ static uint64_t id_aa64pfr0_read(CPUARMState *env, const ARMCPRegInfo *ri) }return pfr0; } + +static uint64_t id_aa64isar0_read (CPUARMState *env,const ARMCPRegInfo *ri) +{ +ARMCPU *cpu =env_archcpu (env); +uint64_t isar0 =GET_IDREG (&cpu->isar,ID_AA64ISAR0 ); + +/* +* When FEAT_RNG_TRAP is active (SCR_EL3.TRNDR set), ID_AA64ISAR0_EL1.RNDR +* reads as 1 regardless of whether FEAT_RNG is implemented. +*/ +if (env->cp15.scr_el3 &SCR_TRNDR ) { + isar0 =FIELD_DP64 (isar0,ID_AA64ISAR0 ,RNDR ,1 ); + } +return isar0; +}#endif /* @@ -5304,6 +5322,22 @@ static const ARMCPRegInfo pauth_reginfo[] = { .fieldoffset = offsetof(CPUARMState, keys.apib.hi) }, }; +static CPAccessResult access_rndr (CPUARMState *env,const ARMCPRegInfo *ri, +bool isread) +{ +if (env->cp15.scr_el3 &SCR_TRNDR ) { +return CP_ACCESS_TRAP_EL3 ; + } +/* +* Note that FEAT_RNG_TRAP may be implemented without FEAT_RNG. +* In that case, if the trap is not enabled, the read undefs. +*/ +if (!cpu_isar_feature (aa64_rndr,env_archcpu (env))) { +return CP_ACCESS_UNDEFINED ; + } +return CP_ACCESS_OK ; +} +static uint64_t rndr_readfn (CPUARMState *env,const ARMCPRegInfo *ri) {Error *err =NULL ;@@ -5335,11 +5369,11 @@ static const ARMCPRegInfo rndr_reginfo[] = { { .name = "RNDR", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 0, - .access = PL0_R, .readfn = rndr_readfn }, + .access = PL0_R, .accessfn = access_rndr, .readfn = rndr_readfn }, { .name = "RNDRRS", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_RAW | ARM_CP_SUPPRESS_TB_END | ARM_CP_IO, .opc0 = 3, .opc1 = 3, .crn = 2, .crm = 4, .opc2 = 1, - .access = PL0_R, .readfn = rndr_readfn }, + .access = PL0_R, .accessfn = access_rndr, .readfn = rndr_readfn }, }; static void dccvap_writefn(CPUARMState *env, const ARMCPRegInfo *ri,@@ -6522,11 +6556,24 @@ void register_cp_regs_for_features(ARMCPU *cpu) .access = PL1_R, .type = ARM_CP_CONST, .accessfn = access_tid3, .resetvalue = 0 }, +/* +* ID_AA64ISAR0_EL1 is not a plain ARM_CP_CONST in system +* emulation because the RNDR field depends on SCR_EL3.TRNDR +* at read time when FEAT_RNG_TRAP is implemented. +*/ { .name = "ID_AA64ISAR0_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 0, .crm = 6, .opc2 = 0, - .access = PL1_R, .type = ARM_CP_CONST, + .access = PL1_R, +#ifdef CONFIG_USER_ONLY target/arm/helper.c void register_cp_regs_for_features(ARMCPU *cpu) · line 6576
Quoted 10 lines
target/arm/helper.c +8
-1+ .type = ARM_CP_CONST, + .resetvalue =GET_IDREG (isar,ID_AA64ISAR0 ) +#else + .type = ARM_CP_NO_RAW, .accessfn = access_tid3, - .resetvalue = GET_IDREG(isar, ID_AA64ISAR0)}, + .readfn = id_aa64isar0_read, + .writefn = arm_cp_write_ignore +#endif + },A new
assert()was triggered when booting guest on M1 since this change:Quoted 5 lines
Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1442.Thanks,
ZenghuiThanks for the report and the bisect, Zenghui. I can reproduce on M1 with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \
-nographic -display none -bios/dev/null
ID_AA64PFR0_EL1has the sameNO_RAW+ readfn shape that theFEAT_RNG_TRAPchange gaveID_AA64ISAR0_EL1, and HVF already accommodates it by listing the cpreg in theSYNC_NO_RAW_REGSblock in target/arm/hvf/sysreg.c.inc (so the assert loop skips it) and pushing QEMU's value to the vCPU at init time. Mirroring that pattern forID_AA64ISAR0_EL1clears the assert without disturbing the readfn semantics that the spec requires if a FEAT_RNG_TRAP-only CPU eventually appears.
Quoted 1 line
I'll send a fix-up as [PATCH] target/arm/hvf shortly.
This highlights why we need some bare metal MacOS machines in the CI to exercise this code path.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH 1/1 target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
In reply to Zenghui YuCommit 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS") gave ID_AA64ISAR0_EL1 a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpreg ARM_CP_NO_RAW in the system-emulation path. HVF then trips its hvf_arch_init_vcpu() assertion that no ID register in hvf_sreg_list[] is NO_RAW, aborting on boot on Apple Silicon:
Assertion failed: (!(ri->type & ARM_CP_NO_RAW)), function hvf_arch_init_vcpu, file hvf.c, line 1442.
Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \
-nographic -display none -bios /dev/nullMirror the existing treatment of ID_AA64PFR0_EL1: move HV_SYS_REG_ID_AA64ISAR0_EL1 into the SYNC_NO_RAW_REGS block in sysreg.c.inc so the assert loop skips it, and push QEMU's view of the register to the vCPU at init time. HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is functionally static there.
--- target/arm/hvf/hvf.c | 4 ++++ target/arm/hvf/sysreg.c.inc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
target/arm/hvf/hvf.c +4 -0
@@ -1485,6 +1485,10 @@ int hvf_arch_init_vcpu(CPUState *cpu) ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr);assert_hvf_ok (ret); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64ISAR0_EL1 , +GET_IDREG (&arm_cpu->isar,ID_AA64ISAR0 )); +assert_hvf_ok (ret); +/* We're limited to underlying hardware caps, override internal versions */ ret =hv_vcpu_get_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64MMFR0_EL1 , &arm_cpu->isar.idregs[ID_AA64MMFR0_EL1_IDX ]);
target/arm/hvf/sysreg.c.inc +1 -1
@@ -89,13 +89,13 @@ DEF_SYSREG(HV_SYS_REG_MDCCINT_EL1, 2, 0, 0, 2, 0) DEF_SYSREG(HV_SYS_REG_MIDR_EL1, 3, 0, 0, 0, 0) DEF_SYSREG(HV_SYS_REG_MPIDR_EL1, 3, 0, 0, 0, 5) DEF_SYSREG(HV_SYS_REG_ID_AA64PFR0_EL1, 3, 0, 0, 4, 0) +DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) #endif DEF_SYSREG(HV_SYS_REG_ID_AA64PFR1_EL1, 3, 0, 0, 4, 1) /* Add ID_AA64PFR2_EL1 here when HVF supports it */ DEF_SYSREG(HV_SYS_REG_ID_AA64DFR0_EL1, 3, 0, 0, 5, 0) DEF_SYSREG(HV_SYS_REG_ID_AA64DFR1_EL1, 3, 0, 0, 5, 1) -DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1) #ifdef SYNC_NO_MMFR0
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [PATCH] target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
Quoted 34 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1442.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullMirror the existing treatment of
ID_AA64PFR0_EL1: moveHV_SYS_REG_ID_AA64ISAR0_EL1into theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and push QEMU's view of the register to the vCPU at init time. HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is functionally static there.Reported-by Zenghui Yu <[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright <[email protected]>--- target/arm/hvf/hvf.c | 4 ++++ target/arm/hvf/sysreg.c.inc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)target/arm/hvf/hvf.c +0
-0
target/arm/hvf/hvf.c int hvf_arch_init_vcpu(CPUState *cpu) · line 1491
Quoted 7 lines
target/arm/hvf/hvf.c +4
-0@@ -1485,6 +1485,10 @@ int hvf_arch_init_vcpu(CPUState *cpu) ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr);assert_hvf_ok (ret); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64ISAR0_EL1 , +GET_IDREG (&arm_cpu->isar,ID_AA64ISAR0 )); +assert_hvf_ok (ret); +
For ID_AA64PFR0_EL1, we do "read the value from hvf, update it, write it back", and we do not either read or write the isar.idregs[] entry for it.
For ID_AA64MMFR0_EL1, we read the hvf value into the isar.idregs[] array entry, update it there, and write it back to hvf.
For ID_AA64ISAR0_EL1, we write whatever is in the isar.idregs[] array entry into hvf.
Why do we do three different things for these three registers ?
thanks
-- PMM
Re: [PATCH] target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
Quoted 47 lines · Peter Maydell
Quoted 34 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1442.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullMirror the existing treatment of
ID_AA64PFR0_EL1: moveHV_SYS_REG_ID_AA64ISAR0_EL1into theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and push QEMU's view of the register to the vCPU at init time. HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is functionally static there.Reported-by Zenghui Yu <[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright <[email protected]>--- target/arm/hvf/hvf.c | 4 ++++ target/arm/hvf/sysreg.c.inc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)target/arm/hvf/hvf.c +0
-0target/arm/hvf/hvf.c int hvf_arch_init_vcpu(CPUState *cpu) · line 1491
Quoted 7 lines
target/arm/hvf/hvf.c +4
-0@@ -1485,6 +1485,10 @@ int hvf_arch_init_vcpu(CPUState *cpu) ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr);assert_hvf_ok (ret); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64ISAR0_EL1 , +GET_IDREG (&arm_cpu->isar,ID_AA64ISAR0 )); +assert_hvf_ok (ret); +For
ID_AA64PFR0_EL1, we do "read the value from hvf, update it, write it back", and we do not either read or write the isar.idregs[] entry for it.
Quoted 8 lines
For
ID_AA64MMFR0_EL1, we read the hvf value into the isar.idregs[] array entry, update it there, and write it back to hvf.For
ID_AA64ISAR0_EL1, we write whatever is in the isar.idregs[] array entry into hvf.Why do we do three different things for these three registers ?
I think it's each call doing the minimum work required for that register.
MIDR_EL1 / MPIDR_EL1 are QEMU-defined identity values; HVF has nothing useful to contribute, so we just write.
ID_AA64PFR0_EL1 needs HVF's value as the base (host feature set) and then ORs in the GIC sysreg-iface bit, which depends on env->gicv3state runtime overlay, hence the get/modify/set.
ID_AA64MMFR0_EL1 also needs HVF's value as the base, and the modification (clamping PARANGE to the configured IPA size) consults isar.idregs[], so we read into idregs[] before clamping and then write back.
ID_AA64ISAR0_EL1 in this patch has no runtime overlay on the HVF
path: SCR_EL3.TRNDR is permanently 0 since HVF does not expose EL3, so the readfn is a constant equal to isar.idregs[ID_AA64ISAR0_EL1_IDX], which was already seeded from the host during realize.
The three methods track different requirements, so I matched the closest existing pattern for ID_AA64ISAR0_EL1 and left the others alone.
Re: [PATCH] target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
Quoted 55 lines · Jason L. Wright
Quoted 53 lines · Peter Maydell
Quoted 34 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1442.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullMirror the existing treatment of
ID_AA64PFR0_EL1: moveHV_SYS_REG_ID_AA64ISAR0_EL1into theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and push QEMU's view of the register to the vCPU at init time. HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is functionally static there.Reported-by Zenghui Yu <[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright <[email protected]>--- target/arm/hvf/hvf.c | 4 ++++ target/arm/hvf/sysreg.c.inc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)target/arm/hvf/hvf.c +0
-0target/arm/hvf/hvf.c int hvf_arch_init_vcpu(CPUState *cpu) · line 1491
Quoted 7 lines
target/arm/hvf/hvf.c +4
-0@@ -1485,6 +1485,10 @@ int hvf_arch_init_vcpu(CPUState *cpu) ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr);assert_hvf_ok (ret); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64ISAR0_EL1 , +GET_IDREG (&arm_cpu->isar,ID_AA64ISAR0 )); +assert_hvf_ok (ret); +For
ID_AA64PFR0_EL1, we do "read the value from hvf, update it, write it back", and we do not either read or write the isar.idregs[] entry for it.For
ID_AA64MMFR0_EL1, we read the hvf value into the isar.idregs[] array entry, update it there, and write it back to hvf.For
ID_AA64ISAR0_EL1, we write whatever is in the isar.idregs[] array entry into hvf.
Quoted 7 lines
Quoted 2 lines
Why do we do three different things for these three registers ?
I think it's each call doing the minimum work required for that register.
MIDR_EL1/MPIDR_EL1are QEMU-defined identity values; HVF has nothing useful to contribute, so we just write.
These don't have isar.idregs[] entries either, so it makes sense that they're not quite the same.
Quoted 3 lines
ID_AA64PFR0_EL1needs HVF's value as the base (host feature set) and then ORs in the GIC sysreg-iface bit, which depends onenv->gicv3stateruntime overlay, hence the get/modify/set.
But why do we not update isar.idregs[] to match ?
Quoted 4 lines
ID_AA64MMFR0_EL1also needs HVF's value as the base, and the modification (clamping PARANGE to the configured IPA size) consults isar.idregs[], so we read into idregs[] before clamping and then write back.
But why does the modification consult isar.idregs[] rather than taking a value that it's passed in as an argument ?
Quoted 5 lines
ID_AA64ISAR0_EL1in this patch has no runtime overlay on the HVF
path: SCR_EL3.TRNDR is permanently 0 since HVF does not expose EL3, so the readfn is a constant equal to isar.idregs[ID_AA64ISAR0_EL1_IDX], which was already seeded from the host during realize.
But if the values in isar.idregs[] are seeded from HVF during realize, why do we not trust the isar.idregs[] value when we're handling ID_AA64PFR0_EL1?
Quoted 3 lines
The three methods track different requirements, so I matched the closest existing pattern for
ID_AA64ISAR0_EL1and left the others alone.
It seems to me that you've added a third thing that's different from either of the ways that we handle existing ID registers with an isar.idregs[] field.
I think we need to figure out:
(1) can we trust that the isar.idregs[] values at this point are the ones that hvf uses? If so we don't need to re-read the hvf values. If we can't trust them we should consistently read the hvf values.
(2) do we need to update the isar.idregs[] values when we modify the values to write back to hvf? If so, we should do it consistently for all these regs. If not, we should not update any of them.
Currently ID_AA64PFR0_EL1 neither trusts isar.idregs[] nor updates it; ID_AA64MMFR0_EL1 does not trust isar.idregs[] but does update it; and ID_AA64ISAR0_EL1 trusts isar.idregs[] and has no need to update it.
thanks
-- PMM
Re: [PATCH] target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
Hi,
Quoted 95 lines · Peter Maydell
Quoted 55 lines · Jason L. Wright
Quoted 53 lines · Peter Maydell
Quoted 34 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1442.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullMirror the existing treatment of
ID_AA64PFR0_EL1: moveHV_SYS_REG_ID_AA64ISAR0_EL1into theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and push QEMU's view of the register to the vCPU at init time. HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is functionally static there.Reported-by Zenghui Yu <[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright <[email protected]>--- target/arm/hvf/hvf.c | 4 ++++ target/arm/hvf/sysreg.c.inc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)target/arm/hvf/hvf.c +0
-0target/arm/hvf/hvf.c int hvf_arch_init_vcpu(CPUState *cpu) · line 1491
Quoted 7 lines
target/arm/hvf/hvf.c +4
-0@@ -1485,6 +1485,10 @@ int hvf_arch_init_vcpu(CPUState *cpu) ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr);assert_hvf_ok (ret); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64ISAR0_EL1 , +GET_IDREG (&arm_cpu->isar,ID_AA64ISAR0 )); +assert_hvf_ok (ret); +For
ID_AA64PFR0_EL1, we do "read the value from hvf, update it, write it back", and we do not either read or write the isar.idregs[] entry for it.For
ID_AA64MMFR0_EL1, we read the hvf value into the isar.idregs[] array entry, update it there, and write it back to hvf.For
ID_AA64ISAR0_EL1, we write whatever is in the isar.idregs[] array entry into hvf.Quoted 7 lines
Quoted 2 lines
Why do we do three different things for these three registers ?
I think it's each call doing the minimum work required for that register.
MIDR_EL1/MPIDR_EL1are QEMU-defined identity values; HVF has nothing useful to contribute, so we just write.These don't have isar.idregs[] entries either, so it makes sense that they're not quite the same.
Quoted 3 lines
ID_AA64PFR0_EL1needs HVF's value as the base (host feature set) and then ORs in the GIC sysreg-iface bit, which depends onenv->gicv3stateruntime overlay, hence the get/modify/set.But why do we not update isar.idregs[] to match ?
Quoted 4 lines
ID_AA64MMFR0_EL1also needs HVF's value as the base, and the modification (clamping PARANGE to the configured IPA size) consults isar.idregs[], so we read into idregs[] before clamping and then write back.But why does the modification consult isar.idregs[] rather than taking a value that it's passed in as an argument ?
Quoted 5 lines
ID_AA64ISAR0_EL1in this patch has no runtime overlay on the HVF
path: SCR_EL3.TRNDR is permanently 0 since HVF does not expose EL3, so the readfn is a constant equal to isar.idregs[ID_AA64ISAR0_EL1_IDX], which was already seeded from the host during realize.But if the values in isar.idregs[] are seeded from HVF during realize, why do we not trust the isar.idregs[] value when we're handling
ID_AA64PFR0_EL1?Quoted 3 lines
The three methods track different requirements, so I matched the closest existing pattern for
ID_AA64ISAR0_EL1and left the others alone.
Quoted 5 lines
It seems to me that you've added a third thing that's different from either of the ways that we handle existing ID registers with an isar.idregs[] field.
I think we need to figure out:
Should we revert the commit until this is figured out?
Quoted 19 lines
(1) can we trust that the isar.idregs[] values at this point are the ones that hvf uses? If so we don't need to re-read the hvf values. If we can't trust them we should consistently read the hvf values.
(2) do we need to update the isar.idregs[] values when we modify the values to write back to hvf? If so, we should do it consistently for all these regs. If not, we should not update any of them.
Currently
ID_AA64PFR0_EL1neither trusts isar.idregs[] nor updates it;ID_AA64MMFR0_EL1does not trust isar.idregs[] but does update it; andID_AA64ISAR0_EL1trusts isar.idregs[] and has no need to update it.thanks
-- PMM
Re: [PATCH] target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
Quoted 9 lines · Philippe Mathieu-Daudé
Hi,
Quoted 5 lines · Peter Maydell
Quoted 3 lines · Jason L. Wright
The three methods track different requirements, so I matched the closest existing pattern for
ID_AA64ISAR0_EL1and left the others alone.
Quoted 7 lines
Quoted 5 lines
It seems to me that you've added a third thing that's different from either of the ways that we handle existing ID registers with an isar.idregs[] field.
I think we need to figure out:
Should we revert the commit until this is figured out
I don't think it's difficult. Somebody who cares about hvf should just do it, and submit this patch with whatever the right approach is.
-- PMM
Re: [PATCH] target/arm/hvf: manually sync ID_AA64ISAR0_EL1 on vCPU init
Quoted 15 lines · Peter Maydell
Quoted 13 lines · Philippe Mathieu-Daudé
Hi,
Quoted 9 lines · Peter Maydell
Quoted 3 lines · Jason L. Wright
The three methods track different requirements, so I matched the closest existing pattern for
ID_AA64ISAR0_EL1and left the others alone.It seems to me that you've added a third thing that's different from either of the ways that we handle existing ID registers with an isar.idregs[] field.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
I think we need to figure out:
Should we revert the commit until this is figured out
I don't think it's difficult. Somebody who cares about hvf should just do it, and submit this patch with whatever the right approach is.
I'll have another look at it this week. I think we can unify the approaches, but I need to make sure I understand the other registers better (PFR0 and MMFR0).
--Jason Wright
PATCH v2 1/1 target/arm/hvf: seed NO_RAW ID registers from isar.idregs[] on vCPU init
In reply to Jason WrightCommit 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS") gave ID_AA64ISAR0_EL1 a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpreg ARM_CP_NO_RAW in the system-emulation path. HVF then trips its hvf_arch_init_vcpu() assertion that no ID register in hvf_sreg_list[] is NO_RAW, aborting on boot on Apple Silicon:
Assertion failed: (!(ri->type & ARM_CP_NO_RAW)), function hvf_arch_init_vcpu, file hvf.c, line 1441.
Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \
-nographic -display none -bios /dev/nullFix it the same way ID_AA64PFR0_EL1 already is: list HV_SYS_REG_ID_AA64ISAR0_EL1 in the SYNC_NO_RAW_REGS block in sysreg.c.inc so the assert loop skips it, and seed the vCPU's copy at init time.
While here, unify how the three isar.idregs[]-backed ID registers are seeded. isar.idregs[] already holds QEMU's intended value for each (the host caps, probed once at realize via hv_vcpu_config_get_feature_reg(), plus any QEMU adjustment), so there is no need to read each register back from the vCPU first. Seed PFR0, ISAR0 and MMFR0 directly from isar.idregs[], dropping the two per-vCPU hv_vcpu_get_sys_reg() reads:
- PFR0: take the GIC sysreg-interface bit from env->gicv3state, as the id_aa64pfr0_read() readfn does. Identical to the previous code whenever a GICv3 sysreg interface is present (the configuration HVF runs in practice); it differs only in that a vCPU with no GICv3 now reports ID_AA64PFR0_EL1.GIC == 0 instead of inheriting the host's value, which matches the field's meaning.
- ISAR0: no overlay is needed; HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is constant.
- MMFR0: still clamp PARANGE to the chosen IPA size, updating isar.idregs[] in place because the page-table walker and the ID_AA64MMFR0_EL1 cpreg resetvalue read PARANGE back from there.
---
v1 of this fix-up added a third way of seeding an ID register into the vCPU at init, and Peter asked why hvf_arch_init_vcpu() should now have three different shapes for the isar.idregs[]-backed registers, and whether the existing per-register hv_vcpu_get_sys_reg() re-reads are needed at all.
v2 unifies the three. isar.idregs[] is seeded once at realize from hv_vcpu_config_get_feature_reg() (plus QEMU's own adjustments), so it already holds the value we want to push; the init-time re-reads of PFR0 and MMFR0 are redundant. v2 drops both and seeds PFR0, ISAR0 and MMFR0 directly from isar.idregs[].
I confirmed the re-reads are redundant by logging, at init, the seeded isar.idregs[] value against hv_vcpu_get_sys_reg() for each register on an Apple Silicon host (-cpu host):
PFR0 seed=1101000010110011 live=1101000011110011 (differ in GIC only) MMFR0 seed=000010000f100022 live=000010000f100022 (identical) ISAR0 seed=0221100110212120 live=0221100110212120 (identical)
PFR0 differs only in the GIC field [27:24], which QEMU already overlays from env->gicv3state in id_aa64pfr0_read(); MMFR0 and ISAR0 are identical.
Two things worth flagging:
- PFR0 now takes the GIC bit purely from env->gicv3state rather than OR-ing it onto the host's value. Identical for any guest with a GICv3 sysreg interface (what HVF runs in practice); it only changes a vCPU with no GICv3, which now reports ID_AA64PFR0_EL1.GIC == 0 instead of inheriting the host bit -- arguably the correct value.
- MMFR0 still clamps PARANGE to the chosen IPA size and writes it back into isar.idregs[], because the page-table walker and the ID_AA64MMFR0_EL1 cpreg resetvalue read PARANGE from there. It is the one register that still updates isar.idregs[]; that tracks a real consumer, not an inconsistency.
Tested on macOS arm64 (Darwin 25.5.0), master 20553466cc:
- HVF -cpu host vCPU init: no assertion (was SIGABRT before).
- meson test --suite qtest-aarch64: 29/29 pass (3 skipped).
- checkpatch clean.
v2:
- Unify PFR0/ISAR0/MMFR0 seeding; drop the redundant hv_vcpu_get_sys_reg() re-reads for PFR0 and MMFR0 (Peter Maydell).
- Take PFR0.GIC from env->gicv3state directly.
- Reword the subject and commit message accordingly.
target/arm/hvf/hvf.c | 10 ++++------ target/arm/hvf/sysreg.c.inc | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-)
target/arm/hvf/hvf.c +4 -6
@@ -1478,20 +1478,18 @@ int hvf_arch_init_vcpu(CPUState *cpu) arm_cpu->mp_affinity);assert_hvf_ok (ret); - ret =hv_vcpu_get_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , &pfr); -assert_hvf_ok (ret); + pfr =GET_IDREG (&arm_cpu->isar,ID_AA64PFR0 ); pfr |= env->gicv3state ? (1 <<24 ) :0 ; ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64PFR0_EL1 , pfr);assert_hvf_ok (ret); -/* We're limited to underlying hardware caps, override internal versions */ - ret =hv_vcpu_get_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64MMFR0_EL1 , - &arm_cpu->isar.idregs[ID_AA64MMFR0_EL1_IDX ]); + ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64ISAR0_EL1 , +GET_IDREG (&arm_cpu->isar,ID_AA64ISAR0 ));assert_hvf_ok (ret);clamp_id_aa64mmfr0_parange_to_ipa_size (&arm_cpu->isar); ret =hv_vcpu_set_sys_reg (cpu->accel->fd,HV_SYS_REG_ID_AA64MMFR0_EL1 , - arm_cpu->isar.idregs[ID_AA64MMFR0_EL1_IDX ]); +GET_IDREG (&arm_cpu->isar,ID_AA64MMFR0 ));assert_hvf_ok (ret);if (!hvf_irqchip_in_kernel ()) {
target/arm/hvf/sysreg.c.inc +1 -1
@@ -89,13 +89,13 @@ DEF_SYSREG(HV_SYS_REG_MDCCINT_EL1, 2, 0, 0, 2, 0) DEF_SYSREG(HV_SYS_REG_MIDR_EL1, 3, 0, 0, 0, 0) DEF_SYSREG(HV_SYS_REG_MPIDR_EL1, 3, 0, 0, 0, 5) DEF_SYSREG(HV_SYS_REG_ID_AA64PFR0_EL1, 3, 0, 0, 4, 0) +DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) #endif DEF_SYSREG(HV_SYS_REG_ID_AA64PFR1_EL1, 3, 0, 0, 4, 1) /* Add ID_AA64PFR2_EL1 here when HVF supports it */ DEF_SYSREG(HV_SYS_REG_ID_AA64DFR0_EL1, 3, 0, 0, 5, 0) DEF_SYSREG(HV_SYS_REG_ID_AA64DFR1_EL1, 3, 0, 0, 5, 1) -DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR0_EL1, 3, 0, 0, 6, 0) DEF_SYSREG(HV_SYS_REG_ID_AA64ISAR1_EL1, 3, 0, 0, 6, 1) #ifdef SYNC_NO_MMFR0
Signature · 1 line
2.50.1 (Apple Git-155)
Re: [PATCH v2] target/arm/hvf: seed NO_RAW ID registers from isar.idregs[] on vCPU init
Quoted 37 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1441.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullFix it the same way
ID_AA64PFR0_EL1already is: listHV_SYS_REG_ID_AA64ISAR0_EL1in theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and seed the vCPU's copy at init time.While here, unify how the three isar.idregs[]-backed ID registers are seeded. isar.idregs[] already holds QEMU's intended value for each (the host caps, probed once at realize via
hv_vcpu_config_get_feature_reg(), plus any QEMU adjustment), so there is no need to read each register back from the vCPU first. Seed PFR0, ISAR0 and MMFR0 directly from isar.idregs[], dropping the two per-vCPUhv_vcpu_get_sys_reg()reads:- PFR0: take the GIC sysreg-interface bit from
env->gicv3state, as theid_aa64pfr0_read()readfn does. Identical to the previous code whenever a GICv3 sysreg interface is present (the configuration HVF runs in practice); it differs only in that a vCPU with no GICv3 now reports ID_AA64PFR0_EL1.GIC == 0 instead of inheriting the host's value, which matches the field's meaning.
- ISAR0: no overlay is needed; HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is constant.
- MMFR0: still clamp PARANGE to the chosen IPA size, updating isar.idregs[] in place because the page-table walker and theID_AA64MMFR0_EL1cpreg resetvalue read PARANGE back from there.
Quoted 5 lines
Reported-by Zenghui Yu<[email protected]>Suggested-by Peter Maydell<[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright<[email protected]>---
r~
Re: [PATCH v2] target/arm/hvf: seed NO_RAW ID registers from isar.idregs[] on vCPU init
In reply to Jason WrightQuoted 37 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1441.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullFix it the same way
ID_AA64PFR0_EL1already is: listHV_SYS_REG_ID_AA64ISAR0_EL1in theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and seed the vCPU's copy at init time.While here, unify how the three isar.idregs[]-backed ID registers are seeded. isar.idregs[] already holds QEMU's intended value for each (the host caps, probed once at realize via
hv_vcpu_config_get_feature_reg(), plus any QEMU adjustment), so there is no need to read each register back from the vCPU first. Seed PFR0, ISAR0 and MMFR0 directly from isar.idregs[], dropping the two per-vCPUhv_vcpu_get_sys_reg()reads:- PFR0: take the GIC sysreg-interface bit from
env->gicv3state, as theid_aa64pfr0_read()readfn does. Identical to the previous code whenever a GICv3 sysreg interface is present (the configuration HVF runs in practice); it differs only in that a vCPU with no GICv3 now reports ID_AA64PFR0_EL1.GIC == 0 instead of inheriting the host's value, which matches the field's meaning.
- ISAR0: no overlay is needed; HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is constant.
- MMFR0: still clamp PARANGE to the chosen IPA size, updating isar.idregs[] in place because the page-table walker and theID_AA64MMFR0_EL1cpreg resetvalue read PARANGE back from there.
Quoted 4 lines
Reported-by Zenghui Yu <[email protected]>Suggested-by Peter Maydell <[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright <[email protected]>
Thank you for the fix!
Zenghui
Re: [PATCH v2] target/arm/hvf: seed NO_RAW ID registers from isar.idregs[] on vCPU init
In reply to Jason WrightQuoted 38 lines · Jason Wright
Commit
887eaa8a29("target/arm: implementFEAT_RNG_TRAPfor RNDR/RNDRRS") gaveID_AA64ISAR0_EL1a readfn so the RNDR field can reflect SCR_EL3.TRNDR at read time, and marked the cpregARM_CP_NO_RAWin the system-emulation path. HVF then trips itshvf_arch_init_vcpu()assertion that no ID register in hvf_sreg_list[] isNO_RAW, aborting on boot on Apple Silicon:Assertion failed: (!(ri->type &
ARM_CP_NO_RAW)), functionhvf_arch_init_vcpu, filehvf.c, line 1441.Reproduce with:
qemu-system-aarch64 -M virt,accel=hvf -cpu host \ -nographic -display none -bios /dev/nullFix it the same way
ID_AA64PFR0_EL1already is: listHV_SYS_REG_ID_AA64ISAR0_EL1in theSYNC_NO_RAW_REGSblock in sysreg.c.inc so the assert loop skips it, and seed the vCPU's copy at init time.While here, unify how the three isar.idregs[]-backed ID registers are seeded. isar.idregs[] already holds QEMU's intended value for each (the host caps, probed once at realize via
hv_vcpu_config_get_feature_reg(), plus any QEMU adjustment), so there is no need to read each register back from the vCPU first. Seed PFR0, ISAR0 and MMFR0 directly from isar.idregs[], dropping the two per-vCPUhv_vcpu_get_sys_reg()reads:- PFR0: take the GIC sysreg-interface bit from
env->gicv3state, as theid_aa64pfr0_read()readfn does. Identical to the previous code whenever a GICv3 sysreg interface is present (the configuration HVF runs in practice); it differs only in that a vCPU with no GICv3 now reports ID_AA64PFR0_EL1.GIC == 0 instead of inheriting the host's value, which matches the field's meaning.
- ISAR0: no overlay is needed; HVF does not expose EL3, so SCR_EL3.TRNDR is never set and the readfn is constant.
- MMFR0: still clamp PARANGE to the chosen IPA size, updating isar.idregs[] in place because the page-table walker and theID_AA64MMFR0_EL1cpreg resetvalue read PARANGE back from there.
Quoted 4 lines
Reported-by Zenghui Yu <[email protected]>Suggested-by Peter Maydell <[email protected]>Fixes 887eaa8a29 ("target/arm: implement FEAT_RNG_TRAP for RNDR/RNDRRS")Signed-off-by Jason Wright <[email protected]>
Thanks for respinning this. I've applied it to target-arm.next, so it should get upstream within the next week.
-- PMM
[PULL 10/21] hw/arm/xilinx_zynq: Split xilinx_zynq into header and implementation files
In reply to Peter MaydellFrom: YannickV <[email protected]>
Create xilinx_zynq.h header file to expose ZynqMachineState and related definitions for machine inheritance. This enables creation of derived machines based on the Zynq platform.
Message-id: [email protected]
--- hw/arm/xilinx_zynq.c | 13 +------------ include/hw/arm/xilinx_zynq.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 include/hw/arm/xilinx_zynq.h
hw/arm/xilinx_zynq.c +1 -12
@@ -41,9 +41,7 @@#include "exec/tswap.h" #include "target/arm/cpu-qom.h" #include "qapi/visitor.h" - -#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") -OBJECT_DECLARE_SIMPLE_TYPE (ZynqMachineState,ZYNQ_MACHINE ) +#include "hw/arm/xilinx_zynq.h" /* board base frequency: 33.333333 MHz */ #define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3)
@@ -87,15 +85,6 @@ static const int dma_irqs[8] = {0xe3401000 +ARMV7_IMM16 (extract32 ((val),16 ,16 )),/* movt r1 ... */ \0xe5801000 + (addr ) -#define ZYNQ_MAX_CPUS 2 - -struct ZynqMachineState { -MachineState parent; -Clock *ps_clk; -ARMCPU *cpu[ZYNQ_MAX_CPUS ]; -uint8_t boot_mode; -}; - static void zynq_write_board_setup(ARMCPU *cpu,const struct arm_boot_info *info) {
include/hw/arm/xilinx_zynq.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Xilinx Zynq Baseboard System emulation. +* +* Copyright (c) 2010 Xilinx. +* Copyright (c) 2012 Peter A.G. Crosthwaite ([email protected]) +* Copyright (c) 2012 Petalogix Pty Ltd. +* Written by Haibing Ma +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_ARM_ZYNQ_H +#define QEMU_ARM_ZYNQ_H + +#include "target/arm/cpu-qom.h" +#include "hw/core/qdev-clock.h" + +#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") +OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE) + +#define ZYNQ_MAX_CPUS 2 + +struct ZynqMachineState { +MachineState parent; +Clock *ps_clk; +ARMCPU *cpu[ZYNQ_MAX_CPUS ]; +uint8_t boot_mode; +}; + +#endif /* QEMU_ARM_ZYNQ_H */
Signature · 1 line
2.43.0
[PULL 05/21] hw/dma/zynq-devcfg: Simulate dummy PL reset
In reply to Peter MaydellFrom: YannickV <[email protected]>
Setting PCFG_PROG_B should reset the PL. After a reset PCFG_INIT should indicate that the reset is finished successfully.
In order to add a MMIO-Device as part of the PL in the Zynq, the reset logic must succeed. The PCFG_INIT flag is now set when the PL reset is triggered by PCFG_PROG_B. Indicating the reset was successful.
Message-id: [email protected]
--- hw/dma/xlnx-zynq-devcfg.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/dma/xlnx-zynq-devcfg.c +9 -0
@@ -49,6 +49,7 @@ REG32(CTRL, 0x00) FIELD(CTRL, FORCE_RST, 31, 1) /* Not supported, wr ignored */ + FIELD(CTRL, PCFG_PROG_B, 30, 1) FIELD(CTRL, PCAP_PR, 27, 1) /* Forced to 0 on bad unlock */ FIELD(CTRL, PCAP_MODE, 26, 1)FIELD (CTRL ,MULTIBOOT_EN ,24 ,1 )
@@ -116,6 +117,7 @@ REG32(STATUS, 0x14) FIELD(STATUS, PSS_GTS_USR_B, 11, 1) FIELD(STATUS, PSS_FST_CFG_B, 10, 1) FIELD(STATUS, PSS_CFG_RESET_B, 5, 1) + FIELD(STATUS, PCFG_INIT, 4, 1) REG32(DMA_SRC_ADDR, 0x18)REG32 (DMA_DST_ADDR ,0x1C )
@@ -204,6 +206,13 @@ static uint64_t r_ctrl_pre_write(RegisterInfo *reg, uint64_t val) val |= lock_ctrl_map[i] & s->regs[R_CTRL ]; } } + +if (FIELD_EX32 (val,CTRL ,PCFG_PROG_B )) { + s->regs[R_STATUS ] |=R_STATUS_PCFG_INIT_MASK ; + }else { + s->regs[R_STATUS ] &= ~R_STATUS_PCFG_INIT_MASK ; + } +return val; }
Signature · 1 line
2.43.0
[PULL 11/21] target/arm: Add feature predicate for FEAT_CMPBR
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/cpu-features.h | 5 +++++ 1 file changed, 5 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -1061,6 +1061,11 @@ static inline bool isar_feature_aa64_cssc(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,CSSC ) !=0 ; } +static inline bool isar_feature_aa64_cmpbr (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,CSSC ) >=2 ; +} +static inline bool isar_feature_aa64_lut (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,LUT );
Signature · 1 line
2.43.0
[PULL 13/21] target/arm: Implement CB (immediate)
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/tcg/a64.decode | 2 ++ target/arm/tcg/translate-a64.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
target/arm/tcg/a64.decode +2 -0
@@ -217,6 +217,8 @@ CB_cond 1 1110100 ... ..... 00 ......... ..... @cb esz=3 CB_cond 0 1110100 ... ..... 10 ......... ..... @cb esz=0 # CBB CB_cond 0 1110100 ... ..... 11 ......... ..... @cb esz=1 # CBH +CB_cond_imm sf:1 1110101 cc:3 imm6:6 0 ......... rt:5 %imm9 + BR 1101011 0000 11111 000000 rn:5 00000 &r BLR 1101011 0001 11111 000000 rn:5 00000 &r RET 1101011 0010 11111 000000 rn:5 00000 &r
target/arm/tcg/translate-a64.c +43 -0
49 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 21/21] hw/dma/omap_dma: Fix indentation after ifdef removal
In reply to Peter MaydellSome of the ifdefs in omap_dma_transfer_setup() which we just removed had if() blocks in them. Now that the code inside them is always unconditional it has an extra unnecessary layer of indentation; fix this, as a whitespace only change.
Message-id: [email protected]
--- hw/dma/omap_dma.c | 156 +++++++++++++++++++++++----------------------- 1 file changed, 78 insertions(+), 78 deletions(-)
hw/dma/omap_dma.c +78 -78
@@ -470,91 +470,91 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)/* Set appropriate interrupts and/or deactivate channels */ -/* If the channel is element synchronized, deactivate it */ -if (min_elems == elements[omap_dma_intr_element_sync]) { +/* If the channel is element synchronized, deactivate it */ +if (min_elems == elements[omap_dma_intr_element_sync]) { +omap_dma_deactivate_channel (s, ch); + } + +/* If it is the last frame, set the LAST_FRAME interrupt */ +if (min_elems == elements[omap_dma_intr_last_frame]) { + ch->status |=LAST_FRAME_INTR ; + } + +/* +* If exactly half of the frame was reached, set the HALF_FRAME +* interrupt +*/ +if (min_elems == elements[omap_dma_intr_half_frame]) { + ch->status |=HALF_FRAME_INTR ; + } + +/* If a full packet has been transferred, set the END_PKT interrupt */ +if (min_elems == elements[omap_dma_intr_packet]) { + ch->status |=END_PKT_INTR ; + } + +/* If the channel is packet-synchronized, deactivate it */ +if (min_elems == elements[omap_dma_intr_packet_sync]) { +omap_dma_deactivate_channel (s, ch); + } + +/* If the channel is frame synchronized, deactivate it */ +if (min_elems == elements[omap_dma_intr_frame_sync]) { +omap_dma_deactivate_channel (s, ch); + } + +/* Set the END_FRAME interrupt */ +if (min_elems == elements[omap_dma_intr_frame]) { + ch->status |=END_FRAME_INTR ; + } + +if (min_elems == elements[omap_dma_intr_block]) { +/* End of Block */ +/* Disable the channel */ + +if (!ch->auto_init) { +omap_dma_disable_channel (s, ch); + }else if (ch->repeat || ch->end_prog) { +omap_dma_channel_load (ch); + }else { + ch->waiting_end_prog =1 ;omap_dma_deactivate_channel (s, ch); } -/* If it is the last frame, set the LAST_FRAME interrupt */ -if (min_elems == elements[omap_dma_intr_last_frame]) { - ch->status |=LAST_FRAME_INTR ; +if (ch->interrupts &END_BLOCK_INTR ) { + ch->status |=END_BLOCK_INTR ; + } + } + +/* Update packet number */ +if (ch->fs && ch->bs) { + a->pck_element += min_elems; + a->pck_element %= a->pck_elements; + } + +/* +* TODO: check if we really need to update anything here or perhaps we +* can skip part of this. +*/ +if (dma->update) { + a->element += min_elems; + + frames = a->element / a->elements; + a->element = a->element % a->elements; + a->frame += frames; + a->src += min_elems * a->elem_delta[0 ] + frames * a->frame_delta[0 ]; + a->dest += min_elems * a->elem_delta[1 ] + frames * a->frame_delta[1 ]; + +/* If the channel is async, update cpc */ +if (!ch->sync && frames) { + ch->cpc = a->dest &0xffff ; }/* -* If exactly half of the frame was reached, set the HALF_FRAME -* interrupt +* TODO: if the destination port is IMIF or EMIFF, set the dirty +* bits on it. */ -if (min_elems == elements[omap_dma_intr_half_frame]) { - ch->status |=HALF_FRAME_INTR ; - } - -/* If a full packet has been transferred, set the END_PKT interrupt */ -if (min_elems == elements[omap_dma_intr_packet]) { - ch->status |=END_PKT_INTR ; - } - -/* If the channel is packet-synchronized, deactivate it */ -if (min_elems == elements[omap_dma_intr_packet_sync]) { -omap_dma_deactivate_channel (s, ch); - } - -/* If the channel is frame synchronized, deactivate it */ -if (min_elems == elements[omap_dma_intr_frame_sync]) { -omap_dma_deactivate_channel (s, ch); - } - -/* Set the END_FRAME interrupt */ -if (min_elems == elements[omap_dma_intr_frame]) { - ch->status |=END_FRAME_INTR ; - } - -if (min_elems == elements[omap_dma_intr_block]) { -/* End of Block */ -/* Disable the channel */ - -if (!ch->auto_init) { -omap_dma_disable_channel (s, ch); - }else if (ch->repeat || ch->end_prog) { -omap_dma_channel_load (ch); - }else { - ch->waiting_end_prog =1 ; -omap_dma_deactivate_channel (s, ch); - } - -if (ch->interrupts &END_BLOCK_INTR ) { - ch->status |=END_BLOCK_INTR ; - } - } - -/* Update packet number */ -if (ch->fs && ch->bs) { - a->pck_element += min_elems; - a->pck_element %= a->pck_elements; - } - -/* -* TODO: check if we really need to update anything here or perhaps we -* can skip part of this. -*/ -if (dma->update) { - a->element += min_elems; - - frames = a->element / a->elements; - a->element = a->element % a->elements; - a->frame += frames; - a->src += min_elems * a->elem_delta[0 ] + frames * a->frame_delta[0 ]; - a->dest += min_elems * a->elem_delta[1 ] + frames * a->frame_delta[1 ]; - -/* If the channel is async, update cpc */ -if (!ch->sync && frames) { - ch->cpc = a->dest &0xffff ; - } - -/* -* TODO: if the destination port is IMIF or EMIFF, set the dirty -* bits on it. -*/ - } + }omap_dma_interrupts_update (s); }
Signature · 1 line
2.43.0
[PULL 19/21] hw/dma/omap_dma: Remove unused ifdeffed out code
In reply to Peter MaydellThe OMAP DMA device includes a lot of code which has been disabled via ifdefs for over a decade. Whatever this unfinished development work was, all knowledge of it is long gone, and we're unlikely to be doing any serious work on this device model in future. If we did, we'd likely have to start from scratch.
Remove all the ifdeffed out code. We will fix up the indentation in a followup commit that has only whitespace changes.
Message-id: [email protected]
--- hw/dma/omap_dma.c | 94 ----------------------------------------------- 1 file changed, 94 deletions(-)
hw/dma/omap_dma.c +0 -94
@@ -343,9 +343,6 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma)struct omap_dma_channel_s *ch = dma->opaque;struct omap_dma_reg_set_s *a = &ch->active_set;int bytes = dma->bytes; -#ifdef MULTI_REQ -uint16_t status = ch->status; -#endif do { /* Transfer a single element */
@@ -362,7 +359,6 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma) a->dest += a->elem_delta[1 ]; a->element ++; -#ifndef MULTI_REQ if (a->element == a->elements) {/* End of Frame */ a->element =0 ;
@@ -375,78 +371,6 @@ static void omap_dma_transfer_generic(struct soc_dma_ch_s *dma) ch->cpc = a->dest &0xffff ; } }while ((bytes -= ch->data_type)); -#else -/* If the channel is element synchronized, deactivate it */ -if (ch->sync && !ch->fs && !ch->bs) -omap_dma_deactivate_channel (s, ch); - -/* If it is the last frame, set the LAST_FRAME interrupt */ -if (a->element ==1 && a->frame == a->frames -1 ) -if (ch->interrupts &LAST_FRAME_INTR ) - ch->status |=LAST_FRAME_INTR ; - -/* If the half of the frame was reached, set the HALF_FRAME -interrupt */ -if (a->element == (a->elements >>1 )) -if (ch->interrupts &HALF_FRAME_INTR ) - ch->status |=HALF_FRAME_INTR ; - -if (ch->fs && ch->bs) { - a->pck_element ++; -/* Check if a full packet has been transferred. */ -if (a->pck_element == a->pck_elements) { - a->pck_element =0 ; - -/* Set the END_PKT interrupt */ -if ((ch->interrupts &END_PKT_INTR ) && !ch->src_sync) - ch->status |=END_PKT_INTR ; - -/* If the channel is packet-synchronized, deactivate it */ -if (ch->sync) -omap_dma_deactivate_channel (s, ch); - } - } - -if (a->element == a->elements) { -/* End of Frame */ - a->element =0 ; - a->src += a->frame_delta[0 ]; - a->dest += a->frame_delta[1 ]; - a->frame ++; - -/* If the channel is frame synchronized, deactivate it */ -if (ch->sync && ch->fs && !ch->bs) -omap_dma_deactivate_channel (s, ch); - -/* If the channel is async, update cpc */ -if (!ch->sync) - ch->cpc = a->dest &0xffff ; - -/* Set the END_FRAME interrupt */ -if (ch->interrupts &END_FRAME_INTR ) - ch->status |=END_FRAME_INTR ; - -if (a->frame == a->frames) { -/* End of Block */ -/* Disable the channel */ - -if (!ch->auto_init) -omap_dma_disable_channel (s, ch); -else if (ch->repeat || ch->end_prog) -omap_dma_channel_load (ch); -else { - ch->waiting_end_prog =1 ; -omap_dma_deactivate_channel (s, ch); - } - -if (ch->interrupts &END_BLOCK_INTR ) - ch->status |=END_BLOCK_INTR ; - } - } - }while (status == ch->status && ch->active); - -omap_dma_interrupts_update (s); -#endif }enum {
@@ -475,13 +399,6 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma) dest_p = &s->mpu->port[ch->port[1 ]];if ((!ch->constant_fill && !src_p->addr_valid (s->mpu, a->src)) || (!dest_p->addr_valid (s->mpu, a->dest))) { -#if 0 -/* Bus time-out */ -if (ch->interrupts &TIMEOUT_INTR ) - ch->status |=TIMEOUT_INTR ; -omap_dma_deactivate_channel (s, ch); -continue ; -#endif printf ("%s: Bus time-out in DMA%i operation\n" , __func__, dma->num); }
@@ -552,11 +469,6 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)/* Set appropriate interrupts and/or deactivate channels */ -#ifdef MULTI_REQ -/* TODO: should all of this only be done if dma->update, and otherwise -* inside omap_dma_transfer_generic below - check what's faster. */ -if (dma->update) { -#endif /* If the channel is element synchronized, deactivate it */ if (min_elems == elements[omap_dma_intr_element_sync])
@@ -612,9 +524,7 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)/* TODO: check if we really need to update anything here or perhaps we * can skip part of this. */ -#ifndef MULTI_REQ if (dma->update) { -#endif a->element += min_elems; frames = a->element / a->elements;
@@ -629,11 +539,7 @@ static void omap_dma_transfer_setup(struct soc_dma_ch_s *dma)/* TODO: if the destination port is IMIF or EMIFF, set the dirty * bits on it. */ -#ifndef MULTI_REQ } -#else - } -#endif omap_dma_interrupts_update (s); }
Signature · 1 line
2.43.0
[PULL 18/21] target/arm: advertise FEAT_RNG_TRAP on cortex-max
In reply to Peter MaydellFrom: Jason Wright <[email protected]>
Set ID_AA64PFR1.RNDR_TRAP=1 on the max CPU model so guests and firmware detect FEAT_RNG_TRAP, per the Arm Architecture Reference Manual for A-profile architecture (DDI 0487), and document the feature as emulated in docs/system/arm/emulation.rst.
--- docs/system/arm/emulation.rst | 1 + target/arm/tcg/cpu64.c | 1 + 2 files changed, 2 insertions(+)
docs/system/arm/emulation.rst +1 -0
@@ -136,6 +136,7 @@ the following architecture extensions: - FEAT_RME (Realm Management Extension) (NB: support status in QEMU is experimental) - FEAT_RME_GPC2 (RME Granule Protection Check 2 Extension) - FEAT_RNG (Random number generator) +- FEAT_RNG_TRAP (Trapping support for RNDR/RNDRRS) - FEAT_RPRES (Increased precision of FRECPE and FRSQRTE) - FEAT_S1PIE (Stage 1 permission indirections) - FEAT_S2PIE (Stage 2 permission indirections)
target/arm/tcg/cpu64.c +1 -0
@@ -1292,6 +1292,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64PFR1 ,MTE ,3 );/* FEAT_MTE3 */ t =FIELD_DP64 (t,ID_AA64PFR1 ,RAS_FRAC ,0 );/* FEAT_RASv1p1 + FEAT_DoubleFault */ t =FIELD_DP64 (t,ID_AA64PFR1 ,SME ,2 );/* FEAT_SME2 */ + t =FIELD_DP64 (t,ID_AA64PFR1 ,RNDR_TRAP ,1 );/* FEAT_RNG_TRAP */ t =FIELD_DP64 (t,ID_AA64PFR1 ,CSV2_FRAC ,0 );/* FEAT_CSV2_3 */ t =FIELD_DP64 (t,ID_AA64PFR1 ,NMI ,1 );/* FEAT_NMI */ t =FIELD_DP64 (t,ID_AA64PFR1 ,GCS ,1 );/* FEAT_GCS */
Signature · 1 line
2.43.0
Stefan Hajnoczi
AppliedApplied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.