target-arm queue
Subsystems (2)
Hi; this is a small pullreq of little things that I forgot about but which I hope will still make it into rc1... The only big patch in here is the new ccid-card-emulated test case.
thanks
-- PMM
The following changes since commit 97c88c61d45dee6e1f9bc160a338048189846d28:
Merge tag 'docs-security-devices-pull-request' of https://gitlab.com/berrange/qemu into staging (2026-11-16 15:48:48 -0800)
are available in the Git repository at:
https://gitlab.com/pm215/qemu.git tags/pull-target-arm-20261117
for you to fetch changes up to 81641446c0b5aefdc814131f0ce7435b9f5787ca:
tests/functional/x86_64: Add test for ccid-card-emulated (2026-11-17 13:06:01 +0000)
----------------------------------------------------------------
target-arm queue:
* Revert recent qemu version.h handling changes
* target/arm: Get HVC UNDEF cases for Secure mode right
* target/riscv: Fix RCsc ordering of Zalasr store-release
* target/arm: Fix RCsc ordering of store-release instructions
* target/arm: Fix barrier polarity of A32 LDA load-acquire
* hw/i386/amd_iommu: Mask address when calculating large PTE page size
* tests/functional/x86_64: Add test for ccid-card-emulated
----------------------------------------------------------------
LIU Zhiwei (3):
target/riscv: Fix RCsc ordering of Zalasr store-release target/arm: Fix RCsc ordering of store-release instructions target/arm: Fix barrier polarity of A32 LDA load-acquire
Peter Maydell (5):
Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build" Revert "include: introduce qemu/version.h"
target/arm: Get HVC UNDEF cases for Secure mode right hw/i386/amd_iommu: Mask address when calculating large PTE page size tests/functional/x86_64: Add test for ccid-card-emulated
meson.build | 29 ++-- hw/i386/amd_iommu.h | 3 +- include/qemu/version.h | 20 --- bsd-user/main.c | 2 +- linux-user/main.c | 2 +- monitor/qmp-cmds-control.c | 2 +- qemu-img.c | 2 +- qemu-io.c | 2 +- qemu-nbd.c | 2 +- qga/main.c | 2 +- scsi/qemu-pr-helper.c | 2 +- storage-daemon/qemu-storage-daemon.c | 2 +- system/vl.c | 2 +- target/arm/tcg/op_helper.c | 21 ++- target/arm/tcg/translate-a64.c | 13 ++ target/arm/tcg/translate.c | 8 +- tools/i386/qemu-vmsr-helper.c | 3 +- tools/qemu-vnc/qemu-vnc.c | 2 +- util/module.c | 2 +- target/riscv/tcg/insn_trans/trans_rvzalasr.c.inc | 8 ++ scripts/qemu-version.h.in | 1 - scripts/qemu-version.sh | 25 ++++ tests/functional/x86_64/meson.build | 1 + tests/functional/x86_64/test_ccid_emulated.py | 167 +++++++++++++++++++++++ ui/cocoa.m | 2 +- 25 files changed, 261 insertions(+), 64 deletions(-) delete mode 100644 include/qemu/version.h delete mode 100644 scripts/qemu-version.h.in create mode 100755 scripts/qemu-version.sh create mode 100755 tests/functional/x86_64/test_ccid_emulated.py
[PULL 7/8] hw/i386/amd_iommu: Mask address when calculating large PTE page size
The amd_iommu handling of the "large PTE page size" (where Next Level bits are 0b111) case is not correct. We calculate the page size using the address in the descriptor (as per table 14 of the spec), but we don't explicitly pick out the Page Address field, instead passing the whole PTE word to cto64(). This means that a PTE which incorrectly sets all the reserved high bits can cause cto64() to return 63 or 64, and we will try to shift by an out of range amount, which is undefined behaviour.
Mask the PTE with AMDVI_DEV_PT_ROOT_MASK to get the page address (matching how we do it to get the address for the next page table level in NEXT_PTE_ADDR).
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3618
Message-id: [email protected]
--- hw/i386/amd_iommu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/i386/amd_iommu.h +2 -1
@@ -216,7 +216,8 @@/* * Take a PTE value with mode=0x07 and return the page size it encodes. */ -#define PTE_LARGE_PAGE_SIZE (pte) (1ULL << (1 + cto64(((pte) | 0xfffULL)))) +#define PTE_LARGE_PAGE_SIZE (pte) \ + (1ULL << (1 + cto64((((pte) & AMDVI_DEV_PT_ROOT_MASK) | 0xfffULL))))/* Return number of PTEs to use for a given page size (expected power of 2) */ #define PAGE_SIZE_PTE_COUNT (pgsz) (1ULL << ((ctz64(pgsz) - 12) % 9))
Signature · 1 line
2.43.0
[PULL 1/8] Revert "meson: rewrite scripts/qemu-version.sh directly in meson.build"
In reply to Peter MaydellThis reverts commit ab78ac76f44a1241e76fd32d248df62d83f1ea58.
The change to create the version header in meson.build loses the dependency needed for the header file to be built when it doesn't exist. This means that:
* if you delete the build/qemu-version.h file, an incremental rebuild fails, rather than recreating it
* if you do an incremental rebuild from a build tree that pre-dates ab78ac76f44a, it doesn't have qemu-version.h, and the rebuild fails
Revert the commit so we can think about how we want to address this.
Message-id: [email protected]
--- meson.build | 29 +++++++++-------------------- include/qemu/version.h | 8 -------- scripts/qemu-version.h.in | 1 - scripts/qemu-version.sh | 25 +++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 29 deletions(-) delete mode 100644 scripts/qemu-version.h.in create mode 100755 scripts/qemu-version.sh
meson.build +9 -20
@@ -78,7 +78,6 @@ have_user = have_linux_user or have_bsd_user ############ sh = find_program('sh') -git = find_program('git', required: false) python = import('python').find_installation() cc = meson.get_compiler('c')
@@ -3561,25 +3560,15 @@ tracetool_depends = files( 'scripts/tracetool/__init__.py', ) -qemu_pkgversion = get_option('pkgversion') -git_describe_version = [git, 'describe', '--match', 'v*', '--dirty'] -if qemu_pkgversion == '' and git.found() and fs.exists('.git') and \ - run_command(git_describe_version, check: false).returncode() == 0 - # Refresh the version at build time, so that "make" after a commit updates it. - qemu_version = vcs_tag(input: 'scripts/qemu-version.h.in', - output: 'qemu-version.h', - command: git_describe_version, - fallback: '') -else - # Unlike vcs_tag(), which always defines QEMU_PKGVERSION, leave it out if - # empty. include/qemu/version.h then omits the parentheses from - # QEMU_FULL_VERSION. - qemu_version_data = configuration_data() - if qemu_pkgversion != '' - qemu_version_data.set_quoted('QEMU_PKGVERSION', qemu_pkgversion) - endif - qemu_version = configure_file(output: 'qemu-version.h', configuration: qemu_version_data) -endif +qemu_version_cmd = [find_program('scripts/qemu-version.sh'), + meson.current_source_dir(), + get_option('pkgversion'), meson.project_version()] +qemu_version = custom_target('qemu-version.h', + output: 'qemu-version.h', + command: qemu_version_cmd, + capture: true, + build_by_default: true, + build_always_stale: true) genh += qemu_version hxdep = []
include/qemu/version.h +0 -8
@@ -7,14 +7,6 @@#ifndef QEMU_VERSION_H #define QEMU_VERSION_H -/* qemu-version.h defines QEMU_PKGVERSION only if it is not empty. */ #include "qemu-version.h" -#ifdef QEMU_PKGVERSION -#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")" -#else -#define QEMU_PKGVERSION "" -#define QEMU_FULL_VERSION QEMU_VERSION -#endif -#endif
scripts/qemu-version.h.in deleted +0 -1
@@ -1 +0,0 @@ -#define QEMU_PKGVERSION "@VCS_TAG@"
scripts/qemu-version.sh new file +25 -0
@@ -0,0 +1,25 @@ +#!/bin/sh + +set -eu + +dir="$1" +pkgversion="$2" +version="$3" + +if [ -z "$pkgversion" ]; then + cd "$dir" + if [ -e .git ]; then + pkgversion=$(git describe --match 'v*' --dirty) || : + fi +fi + +if [ -n "$pkgversion" ]; then + fullversion="$version ($pkgversion)" +else + fullversion="$version" +fi + +cat <<EOF +#define QEMU_PKGVERSION "$pkgversion" +#define QEMU_FULL_VERSION "$fullversion" +EOF
Signature · 1 line
2.43.0
[PULL 3/8] target/arm: Get HVC UNDEF cases for Secure mode right
In reply to Peter MaydellIn the pre_hvc helper, we have a "bool secure = false" and a FIXME comment that we should use the actual Secure state. This is a signpost to the fact that we're not getting the UNDEF cases right. Specifically, we get most of them correct but are missing the ones related to Secure state:
* For A64: HVC must UNDEF at EL1 if EL2 is not enabled in the current Security state
* For v8 A32/T32, HVC must UNDEF in Secure state, if EL2 is not enabled in the current Security state
* For v7, HVC must UNDEF in Secure state
The v7 requirement is identical to the v8 A32/T32 one, since there is no Secure EL2 in v7.
This fixes a bug where HVC should have UNDEFed but instead trapped when in Secure state with Secure EL2 disabled. The bug is unlikely to affect real-world code, because only test code puts itself in a situation where HVC should UNDEF and then executes HVC and requires it to UNDEF.
This was noticed by Coverity, because the "if (secure && ...)" check was dead code.
CID: 1689834
Message-id: [email protected]
--- target/arm/tcg/op_helper.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
target/arm/tcg/op_helper.c +14 -7
@@ -1302,8 +1302,6 @@ void HELPER(pre_hvc)(CPUARMState *env) {ARMCPU *cpu =env_archcpu (env);int cur_el =arm_current_el (env); -/* FIXME: Use actual secure state. */ -bool secure = false;bool undef;if (arm_is_psci_call (cpu,EXCP_HVC )) {
@@ -1313,6 +1311,8 @@ void HELPER(pre_hvc)(CPUARMState *env)return ; } +/* Note that we have already UNDEFed HVC from EL0 at translation time */ +if (!arm_feature (env,ARM_FEATURE_EL2 )) {/* If EL2 doesn't exist, HVC always UNDEFs */ undef = true;
@@ -1323,12 +1323,19 @@ void HELPER(pre_hvc)(CPUARMState *env) undef = env->cp15.hcr_el2 &HCR_HCD ; } -/* In ARMv7 and ARMv8/AArch32, HVC is undef in secure state. -* For ARMv8/AArch64, HVC is allowed in EL3. -* Note that we've already trapped HVC from EL0 at translation -* time. +/* +* In ARMv7 and ARMv8/AArch32, HVC is undef in Secure state if +* EL2 is not enabled in the current security state (which is +* always for Secure in v7, as Secure EL2 doesn't exist there). +* +* For ARMv8/AArch64, HVC is undef at EL1 if EL2 is not enabled in +* the current security state. +* +* Because we've already dealt with "EL2 not implemented" above, +* arm_is_el2_enabled() is effectively always true here in NonSecure, +* and we don't need to explicitly also check for secure/non-secure. */ -if (secure && (!is_a64 (env) || cur_el ==1 )) { +if (!arm_is_el2_enabled (env) && (!is_a64 (env) || cur_el ==1 )) { undef = true; }
Signature · 1 line
2.43.0
[PULL 6/8] target/arm: Fix barrier polarity of A32 LDA load-acquire
In reply to Peter MaydellFrom: LIU Zhiwei <[email protected]>
The A32 and T32 load-acquire instructions LDA, LDAB and LDAH must be ordered before the memory accesses that follow them, so their translator has to emit a trailing barrier. op_lda() emits that barrier with TCG_BAR_STRL instead of TCG_BAR_LDAQ, inverting the polarity:TCG_BAR_STRL annotates a leading barrier ("previous ops will not be delayed") and TCG_BAR_LDAQ a trailing one ("following ops will not come forward"), as documented in include/tcg/tcg-mo.h.
The x86 and aarch64 backends only look at the TCG_MO_* bits, which the wrong annotation does not affect, so the generated host code is unchanged on those hosts. The annotation is still wrong: it violates the TCG barrier contract, it lets the optimizer's barrier merging in fold_mb() combine the barriers of an "LDA; STL" pair into a weaker one than the correctly annotated form (STRL|STRL stays STRL instead of LDAQ|STRL = SC), and it diverges from every other load-acquire translation in the target, which all use TCG_BAR_LDAQ.
Fix the polarity.
--- target/arm/tcg/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/tcg/translate.c +1 -1
@@ -4458,7 +4458,7 @@ static bool op_lda(DisasContext *s, arg_LDA *a, MemOp mop)disas_set_da_iss (s, mop, a->rt | ISSIsAcqRel);store_reg (s, a->rt, tmp); -tcg_gen_mb (TCG_MO_ALL |TCG_BAR_STRL ); +tcg_gen_mb (TCG_MO_ALL |TCG_BAR_LDAQ );return true; }
Signature · 1 line
2.43.0
[PULL 2/8] Revert "include: introduce qemu/version.h"
In reply to Peter MaydellThis reverts commit fc35f24387703da027c242ff17382b89ed5a269f.
This commit was made as a pre-requisite for ab78ac76f44a124; now we've reverted that, revert this one as well so we return to the previous version header setup.
Message-id: [email protected]
--- include/qemu/version.h | 12 ------------ bsd-user/main.c | 2 +- linux-user/main.c | 2 +- monitor/qmp-cmds-control.c | 2 +- qemu-img.c | 2 +- qemu-io.c | 2 +- qemu-nbd.c | 2 +- qga/main.c | 2 +- scsi/qemu-pr-helper.c | 2 +- storage-daemon/qemu-storage-daemon.c | 2 +- system/vl.c | 2 +- tools/i386/qemu-vmsr-helper.c | 3 ++- tools/qemu-vnc/qemu-vnc.c | 2 +- util/module.c | 2 +- ui/cocoa.m | 2 +- 15 files changed, 15 insertions(+), 26 deletions(-) delete mode 100644 include/qemu/version.h
include/qemu/version.h deleted +0 -12
@@ -1,12 +0,0 @@ -/* -* QEMU version strings -* -* SPDX-License-Identifier: GPL-2.0-or-later -*/ - -#ifndef QEMU_VERSION_H -#define QEMU_VERSION_H - -#include "qemu-version.h" - -#endif
bsd-user/main.c +1 -1
@@ -25,7 +25,7 @@#include "qemu/help-texts.h" #include "qemu/units.h" #include "qemu/accel.h" -#include "qemu/version.h" +#include "qemu-version.h" #include <machine/trap.h> #include "qapi/error.h"
linux-user/main.c +1 -1
@@ -21,7 +21,7 @@#include "qemu/help-texts.h" #include "qemu/units.h" #include "qemu/accel.h" -#include "qemu/version.h" +#include "qemu-version.h" #include <sys/syscall.h> #include <sys/resource.h> #include <sys/shm.h>
monitor/qmp-cmds-control.c +1 -1
@@ -25,7 +25,7 @@#include "qemu/osdep.h" #include "monitor-internal.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qapi-commands-control.h"
qemu-img.c +1 -1
@@ -27,7 +27,7 @@#include "qemu/help-texts.h" #include "qemu/qemu-progress.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "qapi/error.h" #include "qapi/qapi-commands-block-core.h" #include "qapi/qapi-visit-block-core.h"
qemu-io.c +1 -1
@@ -34,7 +34,7 @@#include "block/block_int.h" #include "trace/control.h" #include "crypto/init.h" -#include "qemu/version.h" +#include "qemu-version.h" #define CMD_NOFILE_OK 0x01
qemu-nbd.c +1 -1
@@ -46,7 +46,7 @@#include "crypto/init.h" #include "crypto/tlscreds.h" #include "trace/control.h" -#include "qemu/version.h" +#include "qemu-version.h" #ifdef CONFIG_SELINUX #include <selinux/selinux.h>
qga/main.c +1 -1
@@ -30,7 +30,7 @@#include "qemu/help_option.h" #include "qemu/sockets.h" #include "qemu/systemd.h" -#include "qemu/version.h" +#include "qemu-version.h" #ifdef _WIN32#include <windows.h> #include <objbase.h>
scsi/qemu-pr-helper.c +1 -1
@@ -50,7 +50,7 @@#include "qobject/qstring.h" #include "io/channel-socket.h" #include "trace/control.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "block/thread-pool.h"
storage-daemon/qemu-storage-daemon.c +1 -1
@@ -43,7 +43,7 @@#include "qapi/qobject-input-visitor.h" #include "qemu/help-texts.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "qemu/cutils.h" #include "qemu/config-file.h" #include "qemu/error-report.h"
system/vl.c +1 -1
@@ -37,7 +37,7 @@#include "qobject/qdict.h" #include "qobject/qstring.h" #include "qobject/qjson.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "qemu/cutils.h" #include "qemu/help_option.h" #include "qemu/hw-version.h"
tools/i386/qemu-vmsr-helper.c +2 -1
@@ -34,7 +34,7 @@#include "qemu/module.h" #include "qemu/error-report.h" #include "qemu/config-file.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "qemu/log.h"
@@ -42,6 +42,7 @@#include "io/channel.h" #include "io/channel-socket.h" #include "trace/control.h" +#include "qemu-version.h" #include "rapl-msr-index.h" #define MSR_PATH_TEMPLATE "/dev/cpu/%u/msr"
tools/qemu-vnc/qemu-vnc.c +1 -1
@@ -15,7 +15,7 @@#include "qemu/option.h" #include "qemu/log.h" #include "qemu/main-loop.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "ui/vnc.h" #include "crypto/secret.h" #include "crypto/tlscredsx509.h"
util/module.c +1 -1
@@ -23,7 +23,7 @@#include "qemu/config-file.h" #include "qapi/error.h" #ifdef CONFIG_MODULE_UPGRADES -#include "qemu/version.h" +#include "qemu-version.h" #endif #include "trace.h"
ui/cocoa.m +1 -1
@@ -44,7 +44,7 @@ #include "qapi/qapi-commands-machine.h" #include "qapi/qapi-commands-misc.h" #include "system/blockdev.h" -#include "qemu/version.h" +#include "qemu-version.h" #include "qemu/cutils.h" #include "qemu/main-loop.h" #include "qemu/module.h"
Signature · 1 line
2.43.0
[PULL 4/8] target/riscv: Fix RCsc ordering of Zalasr store-release
In reply to Peter MaydellFrom: LIU Zhiwei <[email protected]>
The Zalasr load-acquire instructions carry an acquire-RCsc annotation and the store-release instructions carry a release-RCsc annotation; the extension has no RCpc variant (Zalasr specification, chapter 2).
Per Rule 7 of the RVWMO preserved program order rules ("a and b both have RCsc annotations"), a Zalasr store-release must precede any subsequent RCsc memory operation of the same hart in the global memory order. In particular "sw.rl X=1; lw.aq r1=Y" must be ordered, which is what forbids the [0,0] outcome of a Store Buffering litmus test that runs this pair on two harts.
gen_store_release() only emits a barrier before the store, which orders the memory operations preceding the store before the store itself (Rule 6, release semantics). Nothing prevents the store from being reordered with the memory operations that follow it, so under MTTCG the host CPU may execute the load-acquire that immediately follows a store-release before the store has left its store buffer:
* on an x86 host (TSO), store-load is the only reordering the hardware may perform, and it is exactly the ordering that is missing here;
* on an aarch64 host, no dmb follows the store either.
The defect is easily observed with a bare-metal Store Buffering litmus test on a 4 vCPU guest: "sw.rl X=1; lw.aq r1=Y" on hart 0 and "sw.rl Y=1; lw.aq r2=X" on hart 1 produce the architecturally forbidden [0,0] result in 89881 out of 100000 iterations.
Fix this by emitting a full barrier after the store as well, which mirrors the FENCE translation. The TCG_MO_ST_LD bit included in TCG_MO_ALL makes the x86 backend emit a serializing lock-prefixed instruction after the store, draining the store buffer before any subsequent load executes, and the aarch64 backend emit dmb ish; the store therefore becomes globally visible before any subsequent memory operation of the same vCPU, and Rule 7 is satisfied. This is stronger than Rule 7 strictly requires, since the barrier also orders the store with respect to subsequent non-RCsc operations, but this matches how QEMU already implements FENCE and keeps the fix simple.
The load-acquire side needs no change: the barrier emitted after the load already orders it with all subsequent memory operations, which covers Rule 5 and the remaining Rule 7 combinations (load-load and load-store).
--- target/riscv/tcg/insn_trans/trans_rvzalasr.c.inc | 8 ++++++++ 1 file changed, 8 insertions(+)
target/riscv/tcg/insn_trans/trans_rvzalasr.c.inc +8 -0
@@ -86,6 +86,14 @@ static bool gen_store_release(DisasContext *ctx, arg_sb_aqrl *a, MemOp memop) tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL | bar); tcg_gen_qemu_st_tl(data, addr, ctx->mem_idx, memop); + + /* + * Zalasr annotations are always RCsc: per RVWMO Rule 7, the store + * must also be ordered before any subsequent memory operation, + * e.g. a load-acquire in a Store Buffering litmus test. The + * barrier above only orders previous memory ops before the store. + */ + tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC); return true; }
Signature · 1 line
2.43.0
[PULL 5/8] target/arm: Fix RCsc ordering of store-release instructions
In reply to Peter MaydellFrom: LIU Zhiwei <[email protected]>
The Armv8 memory model has no RCpc store: every store-release in the architecture, including the AArch64 STLR and STLPUR and the A32/T32 STL, STLB and STLH, carries RCsc semantics (Arm Architecture Reference Manual, DDI 0487, section B2.3.8 "Acquire and release semantics"). The architecture therefore orders a Store-Release tagged RCsc before any subsequent Load-Acquire tagged RCsc of the same shareability domain, which is what forbids the [0,0] outcome of a Store Buffering litmus test that pairs "STLR X=1; LDAR Y" on one PE with "STLR Y=1; LDAR X" on another.
The translators only emit a barrier before the store, which orders the memory operations preceding the store before the store itself (release semantics). Nothing prevents the store from being reordered with the memory operations that follow it, so under MTTCG the host CPU may execute the load-acquire that immediately follows a store-release before the store has left its store buffer:
* on an x86 host (TSO), store-load is the only reordering the hardware may perform, and it is exactly the ordering that is missing here;
* on an aarch64 host, no dmb follows the store either.
The defect is easily observed with a bare-metal Store Buffering litmus test on a 2 vCPU virt guest: "STLR X=1; LDAR Y" on CPU 0 and "STLR Y=1; LDAR X" on CPU 1 produce the architecturally forbidden [0,0] result in 6 to 7 out of 100000 iterations, while inserting a DMB ISH between the store and the load on each CPU brings the number to 0, which validates the harness.
Fix this by emitting a full barrier after the store as well, for STLR/STLLR and STLPUR on the AArch64 side and STL/STLB/STLH on the A32/T32 side. The TCG_MO_ST_LD bit included in TCG_MO_ALL makes the x86 backend emit a serializing lock-prefixed instruction after the store, draining the store buffer before any subsequent load executes, and the aarch64 backend emit dmb ish; the store therefore becomes globally visible before any subsequent memory operation of the same vCPU, and the RCsc store->load ordering is satisfied. This is stronger than the architecture strictly requires, since the barrier also orders the store with respect to subsequent RCpc operations such as LDAPR, but this matches how QEMU already implements FENCE-like ordering and keeps the fix simple. After the fix the litmus test no longer produces the forbidden outcome.
The load-acquire side needs no change: the barrier emitted after an RCsc LDAR already orders it with all subsequent memory operations, and QEMU deliberately implements the RCpc LDAPR family as full load-acquire.
Cc: [email protected]
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/4872
--- target/arm/tcg/translate-a64.c | 13 +++++++++++++ target/arm/tcg/translate.c | 6 ++++++ 2 files changed, 19 insertions(+)
target/arm/tcg/translate-a64.c +13 -0
@@ -3686,6 +3686,13 @@ static bool trans_STLR(DisasContext *s, arg_stlr *a) true, a->rn != 31, memop);do_gpr_st (s,cpu_reg (s, a->rt), clean_addr, memop, true, a->rt, iss_sf, a->lasr); +/* +* STLR is an RCsc store-release: the Armv8 architecture orders it +* before any subsequent RCsc load-acquire, which is what forbids the +* store-buffering litmus test. The barrier above only orders +* previous accesses before the store. +*/ +tcg_gen_mb (TCG_MO_ALL |TCG_BAR_SC );return true; }
@@ -4429,6 +4436,12 @@ static bool trans_STLR_i(DisasContext *s, arg_ldapr_stlr_i *a)/* Store-Release semantics */ tcg_gen_mb (TCG_MO_ALL |TCG_BAR_STRL );do_gpr_st (s,cpu_reg (s, a->rt), clean_addr, mop, true, a->rt, iss_sf, true); +/* +* Like STLR, STLPUR is an RCsc store-release and must be ordered +* before any subsequent RCsc load-acquire, so it needs a barrier +* after the store as well. +*/ +tcg_gen_mb (TCG_MO_ALL |TCG_BAR_SC );return true; }
target/arm/tcg/translate.c +6 -0
@@ -4296,6 +4296,12 @@ static bool op_stl(DisasContext *s, arg_STL *a, MemOp mop) tmp =load_reg (s, a->rt);tcg_gen_mb (TCG_MO_ALL |TCG_BAR_STRL );gen_aa32_st_i32 (s, tmp, addr,get_mem_index (s), mop |MO_ALIGN ); +/* +* STL has the same RCsc store-release semantics as the AArch64 STLR +* and must be ordered before a subsequent RCsc load-acquire (LDA). +* The barrier above only orders previous accesses before the store. +*/ +tcg_gen_mb (TCG_MO_ALL |TCG_BAR_SC );disas_set_da_iss (s, mop, a->rt | ISSIsAcqRel | ISSIsWrite);return true;
Signature · 1 line
2.43.0
[PULL 8/8] tests/functional/x86_64: Add test for ccid-card-emulated
In reply to Peter MaydellAdd a functional test for ccid-card-emulated. This roughly follows the usage procedure we document in system/devices/ccid.rst of creating some fake certificates, pointing the device at them, and then inside the guest querying the smartcard for the certificates and checking they validate. It deviates slightly from the suggested commands in the docs because the buildroot based rootfs doesn't have glibc and so "NSS-based smartcard integration with coolkey plus certutil" doesn't work. Instead we use opensc's pkcs15-tool to read the certs off the card and check them with openssl.
Message-id: [email protected]
--- tests/functional/x86_64/meson.build | 1 + tests/functional/x86_64/test_ccid_emulated.py | 167 ++++++++++++++++++ 2 files changed, 168 insertions(+) create mode 100755 tests/functional/x86_64/test_ccid_emulated.py
tests/functional/x86_64/meson.build +1 -0
@@ -35,6 +35,7 @@ endif tests_x86_64_system_thorough = [ 'acpi_bits', + 'ccid_emulated', 'hotplug_blk', 'hotplug_scsi', 'hotplug_cpu',
tests/functional/x86_64/test_ccid_emulated.py new file +167 -0
167 lines not on this page · raw message
Signature · 1 line
2.43.0
Richard Henderson
AppliedQuoted 19 lines · Peter Maydell
Hi; this is a small pullreq of little things that I forgot about but which I hope will still make it into rc1... The only big patch in here is the new ccid-card-emulated test case.
thanks
-- PMMThe following changes since commit
97c88c61d45dee6e1f9bc160a338048189846d28:Merge tag 'docs-security-devices-pull-request' ofhttps://gitlab.com/berrange/qemu into staging (2026-11-16 15:48:48 -0800)are available in the Git repository at:
https://gitlab.com/pm215/qemu.git tags/pull-target-arm-20261117for you to fetch changes up to
81641446c0b5aefdc814131f0ce7435b9f5787ca:tests/functional/x86_64: Add test for ccid-card-emulated (2026-11-17 13:06:01 +0000)
Quoted 9 lines
----------------------------------------------------------------
target-arm queue:
* Revert recent qemuversion.hhandling changes
* target/arm: Get HVC UNDEF cases for Secure mode right
* target/riscv: Fix RCsc ordering of Zalasr store-release
* target/arm: Fix RCsc ordering of store-release instructions
* target/arm: Fix barrier polarity of A32 LDA load-acquire
* hw/i386/amd_iommu: Mask address when calculating large PTE page size
* tests/functional/x86_64: Add test for ccid-card-emulated
Applied, thanks.
r~