target-arm queue
Hi; here's the first target-arm pull for 10.2. Other than Arm stuff I have included my update of kernel-doc to the new upstream Python implementation.
thanks
-- PMM
The following changes since commit ca18b336e12c8433177a3cd639c5bf757952adaa:
Merge tag 'pull-lu-20250828' of https://gitlab.com/rth7680/qemu into staging (2025-08-28 09:24:36 +1000)
are available in the Git repository at:
https://gitlab.com/pm215/qemu.git tags/pull-target-arm-20250828
for you to fetch changes up to fd0b04e944df2e308a95ce9933ca4c04b3875a11:
hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects (2025-08-28 10:26:25 +0100)
----------------------------------------------------------------
target-arm queue:
* Implement FEAT_SCTLR2
* Implement FEAT_TCR2
* Implement FEAT_CSSC
* Implement FEAT_LSE128
* Clean up of register field definitions
* Trap PMCR when MDCR_EL2.TPMCR is set
* tests/functional: update aarch64 RME test images
* hw/intc/arm_gicv3_kvm: preserve pending interrupts during cpr
* hw/arm: add static NVDIMMs in device tree
* hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects
* scripts/kernel-doc: Avoid new Perl precedence warning
* scripts/kernel-doc: Update to kernel's new Python implementation
----------------------------------------------------------------
Gustavo Romero (3):
target/arm: Clean up of register field definitions target/arm: Implement FEAT_SCTLR2 and enable with -cpu max target/arm: Implement FEAT_TCR2 and enable with -cpu max
Manos Pitsidianakis (1):
hw/arm: add static NVDIMMs in device tree
Peter Maydell (12):
target/arm: Implement CTZ, CNT, ABS
scripts/kernel-doc: Avoid new Perl precedence warning docs/sphinx/kerneldoc.py: Handle new LINENO syntax tests/qtest/libqtest.h: Remove stray space from doc comment
scripts: Import Python kerneldoc from Linux kernel scripts/kernel-doc: strip QEMU_ from function definitions scripts/kernel-doc: tweak for QEMU coding standards scripts/kerneldoc: Switch to the Python kernel-doc script scripts/kernel-doc: Delete the old Perl kernel-doc script
MAINTAINERS: Put kernel-doc under the "docs build machinery" section target/arm: Correct condition of aa64_atomics feature function hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects
Pierrick Bouvier (2):
tests/functional/test_aarch64_device_passthrough: update image tests/functional/test_aarch64_rme: update image
Richard Henderson (12):
target/arm: Add feature predicate for FEAT_CSSC target/arm: Implement MIN/MAX (immediate)
target/arm: Implement MIN/MAX (register)
target/arm: Split out gen_wrap2_i32 helper
target/arm: Enable FEAT_CSSC for -cpu max
qemu/atomic: Finish renaming atomic128-cas.h headers qemu/atomic: Add atomic16 primitives for xchg, fetch_and, fetch_or accel/tcg: Add cpu_atomic_*_mmu for 16-byte xchg, fetch_and, fetch_or
tcg: Add tcg_gen_atomic_{xchg,fetch_and,fetch_or}_i128 target/arm: Rename isar_feature_aa64_atomics
target/arm: Implement FEAT_LSE128
target/arm: Enable FEAT_LSE128 for -cpu max
Smail AIDER (1):
target/arm: Trap PMCR when MDCR_EL2.TPMCR is set
Steve Sistare (1):
hw/intc/arm_gicv3_kvm: preserve pending interrupts during cpr
MAINTAINERS | 3 + docs/conf.py | 4 +- docs/sphinx/kerneldoc.py | 7 +- docs/system/arm/emulation.rst | 4 + accel/tcg/atomic_template.h | 80 +- accel/tcg/tcg-runtime.h | 12 + host/include/aarch64/host/atomic128-cas.h | 45 - include/accel/tcg/cpu-ldst-common.h | 13 +- include/hw/arm/stm32f205_soc.h | 2 +- include/hw/intc/arm_gicv3_common.h | 3 + include/tcg/tcg-op-common.h | 7 + include/tcg/tcg-op.h | 3 + target/arm/cpu-features.h | 24 +- target/arm/cpu.h | 17 + target/arm/internals.h | 28 +- tests/qtest/libqtest.h | 2 +- host/include/aarch64/host/atomic128-cas.h.inc | 102 + host/include/generic/host/atomic128-cas.h.inc | 96 + target/arm/tcg/a64.decode | 26 + hw/arm/boot.c | 42 + hw/arm/stm32f205_soc.c | 10 +- hw/arm/virt.c | 8 +- hw/intc/arm_gicv3_kvm.c | 15 + linux-user/aarch64/elfload.c | 4 +- target/arm/cpregs-pmu.c | 34 +- target/arm/cpu.c | 6 + target/arm/helper.c | 168 +- target/arm/ptw.c | 8 +- target/arm/tcg/cpu64.c | 9 +- target/arm/tcg/translate-a64.c | 195 +- tcg/tcg-op-ldst.c | 97 +- accel/tcg/atomic_common.c.inc | 9 + .editorconfig | 2 +- scripts/kernel-doc | 2442 -------------------- scripts/kernel-doc.py | 325 +++ scripts/lib/kdoc/kdoc_files.py | 291 +++ scripts/lib/kdoc/kdoc_item.py | 42 + scripts/lib/kdoc/kdoc_output.py | 749 ++++++ scripts/lib/kdoc/kdoc_parser.py | 1670 +++++++++++++ scripts/lib/kdoc/kdoc_re.py | 270 +++ .../functional/aarch64/test_device_passthrough.py | 27 +- tests/functional/aarch64/test_rme_sbsaref.py | 64 +- tests/functional/aarch64/test_rme_virt.py | 85 +- 43 files changed, 4388 insertions(+), 2662 deletions(-) delete mode 100644 host/include/aarch64/host/atomic128-cas.h create mode 100644 host/include/aarch64/host/atomic128-cas.h.inc delete mode 100755 scripts/kernel-doc create mode 100755 scripts/kernel-doc.py create mode 100644 scripts/lib/kdoc/kdoc_files.py create mode 100644 scripts/lib/kdoc/kdoc_item.py create mode 100644 scripts/lib/kdoc/kdoc_output.py create mode 100644 scripts/lib/kdoc/kdoc_parser.py create mode 100644 scripts/lib/kdoc/kdoc_re.py
[PULL 17/32] tests/qtest/libqtest.h: Remove stray space from doc comment
The doc comment for qtest_cb_for_every_machine has a stray space at the start of its description, which makes kernel-doc think that this line is part of the documentation of the skip_old_versioned argument. The result is that the HTML doesn't have a "Description" section and the text is instead put in the wrong place.
Remove the stray space.
Message-id: [email protected]
--- tests/qtest/libqtest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qtest/libqtest.h +1 -1
@@ -977,7 +977,7 @@ void qtest_qmp_fds_assert_success(QTestState *qts, int *fds, size_t nfds,* @cb: Pointer to the callback function * @skip_old_versioned: true if versioned old machine types should be skipped * -* Call a callback function for every name of all available machines. +* Call a callback function for every name of all available machines. */ void qtest_cb_for_every_machine (void (*cb)(const char *machine),bool skip_old_versioned);
Signature · 1 line
2.43.0
[PULL 19/32] scripts/kernel-doc: strip QEMU_ from function definitions
In reply to Peter MaydellThis commit is the Python version of our older commit b30df2751e5 ("scripts/kernel-doc: strip QEMU_ from function definitions").
Some versions of Sphinx get confused if function attributes are left on the C code from kernel-doc; strip out any QEMU_* prefixes from function prototypes.
Message-id: [email protected]
--- scripts/lib/kdoc/kdoc_parser.py | 1 + 1 file changed, 1 insertion(+)
scripts/lib/kdoc/kdoc_parser.py +1 -0
@@ -907,6 +907,7 @@ def dump_function(self, ln, prototype): (r"^__always_inline +", "", 0), (r"^noinline +", "", 0), (r"^__FORTIFY_INLINE +", "", 0), + (r"QEMU_[A-Z_]+ +", "", 0), (r"__init +", "", 0), (r"__init_or_module +", "", 0), (r"__deprecated +", "", 0),
Signature · 1 line
2.43.0
[PULL 14/32] hw/arm: add static NVDIMMs in device tree
In reply to Peter MaydellFrom: Manos Pitsidianakis <[email protected]>
NVDIMM is used for fast rootfs with EROFS, for example by kata containers. To allow booting with static NVDIMM memory, add them to the device tree in arm virt machine.
This allows users to boot directly with nvdimm memory devices without having to rely on ACPI and hotplug.
Verified to work with command invocation:
./qemu-system-aarch64 \
-M virt,nvdimm=on \
-cpu cortex-a57 \
-m 4G,slots=2,maxmem=8G \
-object memory-backend-file,id=mem1,share=on,mem-path=/tmp/nvdimm,size=4G,readonly=off \
-device nvdimm,id=nvdimm1,memdev=mem1,unarmed=off \
-drive file=./debian-12-nocloud-arm64-commited.qcow2,format=qcow2 \
-kernel ./vmlinuz-6.1.0-13-arm64 \
-append "root=/dev/vda1 console=ttyAMA0,115200 acpi=off"
-initrd ./initrd.img-6.1.0-13-arm64 \
-nographic \
-serial mon:stdio
Message-id: [email protected]
--- hw/arm/boot.c | 42 ++++++++++++++++++++++++++++++++++++++++++ hw/arm/virt.c | 8 +++++--- 2 files changed, 47 insertions(+), 3 deletions(-)
hw/arm/boot.c +42 -0
@@ -25,6 +25,7 @@#include "hw/boards.h" #include "system/reset.h" #include "hw/loader.h" +#include "hw/mem/memory-device.h" #include "elf.h" #include "system/device_tree.h" #include "qemu/config-file.h"
@@ -515,6 +516,29 @@ static void fdt_add_psci_node(void *fdt, ARMCPU *armcpu)qemu_fdt_setprop_cell (fdt,"/psci" ,"migrate" , migrate_fn); } +static int fdt_add_pmem_node (void *fdt,uint32_t acells,uint32_t scells, +int64_t mem_base,int64_t size,int64_t node) +{ +int ret; + + g_autofree char *nodename = g_strdup_printf("/pmem@%" PRIx64, mem_base); + +qemu_fdt_add_subnode (fdt, nodename); +qemu_fdt_setprop_string (fdt, nodename,"compatible" ,"pmem-region" ); + ret =qemu_fdt_setprop_sized_cells (fdt, nodename,"reg" , acells, + mem_base, scells, size); +if (ret) { +return ret; + } + +if (node >=0 ) { +return qemu_fdt_setprop_cell (fdt, nodename,"numa-node-id" , + node); + } + +return 0 ; +} +int arm_load_dtb (hwaddr addr,const struct arm_boot_info *binfo,hwaddr addr_limit,AddressSpace *as,MachineState *ms,ARMCPU *cpu)
@@ -525,6 +549,7 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo,unsigned int i;hwaddr mem_base, mem_len;char **node_path; + g_autofree MemoryDeviceInfoList *md_list = NULL;Error *err =NULL ;if (binfo->dtb_filename) {
@@ -628,6 +653,23 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, } } + md_list =qmp_memory_device_list (); +for (MemoryDeviceInfoList *m = md_list; m !=NULL ; m = m->next) { +MemoryDeviceInfo *mi = m->value; + +if (mi->type ==MEMORY_DEVICE_INFO_KIND_NVDIMM ) { +PCDIMMDeviceInfo *di = mi->u.nvdimm.data; + + rc =fdt_add_pmem_node (fdt, acells, scells, + di->addr, di->size, di->node); +if (rc <0 ) { +fprintf (stderr,"couldn't add NVDIMM /pmem@%" PRIx64" node\n" , + di->addr); + goto fail; + } + } + } + rc =fdt_path_offset (fdt,"/chosen" );if (rc <0 ) {qemu_fdt_add_subnode (fdt,"/chosen" );
hw/arm/virt.c +5 -3
@@ -2917,7 +2917,7 @@ static void virt_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *dev,const MachineState *ms =MACHINE (hotplug_dev);const bool is_nvdimm =object_dynamic_cast (OBJECT (dev),TYPE_NVDIMM ); -if (!vms->acpi_dev) { +if (!vms->acpi_dev && !(is_nvdimm && !dev->hotplugged)) {error_setg (errp,"memory hotplug is not enabled: missing acpi-ged device" );return ;
@@ -2949,8 +2949,10 @@ static void virt_memory_plug(HotplugHandler *hotplug_dev,nvdimm_plug (ms->nvdimms_state); } -hotplug_handler_plug (HOTPLUG_HANDLER (vms->acpi_dev), - dev, &error_abort); +if (vms->acpi_dev) { +hotplug_handler_plug (HOTPLUG_HANDLER (vms->acpi_dev), + dev, &error_abort); + } } static void virt_machine_device_pre_plug_cb(HotplugHandler *hotplug_dev,
Signature · 1 line
2.43.0
[PULL 20/32] scripts/kernel-doc: tweak for QEMU coding standards
In reply to Peter MaydellThis commit makes the equivalent changes to the Python script that we had for the old Perl script in commit 4cf41794411f ("docs: tweak kernel-doc for QEMU coding standards"). To repeat the rationale from that commit:
Surprisingly, QEMU does have a pretty consistent doc comment style and it is not very different from the Linux kernel's. Of the documentation "sigils", only "#" separates the QEMU doc comment style from Linux's, and it has 200+ instances vs. 6 for the kernel's '&struct foo' (all in accel/tcg/translate-all.c), so it's clear that the two standards are different in this respect. In addition, our structs are typedefed and recognized by CamelCase names.
Note that in 4cf41794411f we used '(?!)' as our type_fallback regex; this is strictly not quite a replacement for the upstream '\&([_\w]+)', because the latter includes a group that can later be matched with \1, and the former does not. The old perl script did not care about this, but the python version does, so we must include the extra set of brackets to ensure we have a group.
This commit does not include all the same changes that 4cf41794411f did. Of the missing pieces, some had already gone in an earlier kernel-doc update; the parts we still had but do not include here are:
@@ -2057,7 +2060,7 @@
}
elsif (/$doc_decl/o) {
$identifier = $1;
- if (/\s*([\w\s]+?)(\(\))?\s*-/) {
+ if (/\s*([\w\s]+?)(\s*-|:)/) {
$identifier = $1;
}
@@ -2067,7 +2070,7 @@
$contents = "";
$section = $section_default;
$new_start_line = $. + 1;
- if (/-(.*)/) {
+ if (/[-:](.*)/) {
# strip leading/trailing/multiple spaces
$descr= $1;
$descr =~ s/^\s*//;The second of these is already in the upstream version: the line r = KernRe("[-:](.*)") in process_name() matches the regex we have. The first change has been refactored into the doc_begin_data and doc_begin_func changes. Since the output HTML for QEMU's documentation has no relevant changes with the new kerneldoc, we assume that this too has been handled upstream.
Message-id: [email protected]
--- scripts/lib/kdoc/kdoc_output.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
scripts/lib/kdoc/kdoc_output.py +6 -6
@@ -38,12 +38,12 @@ type_fp_param2 = KernRe(r"\@(\w+->\S+)\(\)", cache=False) type_env = KernRe(r"(\$\w+)", cache=False) -type_enum = KernRe(r"\&(enum\s*([_\w]+))", cache=False) -type_struct = KernRe(r"\&(struct\s*([_\w]+))", cache=False) -type_typedef = KernRe(r"\&(typedef\s*([_\w]+))", cache=False) -type_union = KernRe(r"\&(union\s*([_\w]+))", cache=False) -type_member = KernRe(r"\&([_\w]+)(\.|->)([_\w]+)", cache=False) -type_fallback = KernRe(r"\&([_\w]+)", cache=False) +type_enum = KernRe(r"#(enum\s*([_\w]+))", cache=False) +type_struct = KernRe(r"#(struct\s*([_\w]+))", cache=False) +type_typedef = KernRe(r"#(([A-Z][_\w]*))", cache=False) +type_union = KernRe(r"#(union\s*([_\w]+))", cache=False) +type_member = KernRe(r"#([_\w]+)(\.|->)([_\w]+)", cache=False) +type_fallback = KernRe(r"((?!))", cache=False) # this never matches type_member_func = type_member + KernRe(r"\(\)", cache=False)
Signature · 1 line
2.43.0
[PULL 27/32] accel/tcg: Add cpu_atomic_*_mmu for 16-byte xchg, fetch_and, fetch_or
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- accel/tcg/atomic_template.h | 80 +++++++++++++++++++++++++++-- include/accel/tcg/cpu-ldst-common.h | 13 +++-- 2 files changed, 86 insertions(+), 7 deletions(-)
accel/tcg/atomic_template.h +76 -4
@@ -100,7 +100,6 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, vaddr addr,return ret; } -#if DATA_SIZE <16 ABI_TYPE ATOMIC_NAME (xchg )(CPUArchState *env,vaddr addr,ABI_TYPE val,MemOpIdx oi,uintptr_t retaddr) {
@@ -108,7 +107,11 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, vaddr addr, ABI_TYPE val, DATA_SIZE, retaddr);DATA_TYPE ret; +#if DATA_SIZE ==16 + ret =atomic16_xchg (haddr, val); +#else ret =qatomic_xchg__nocheck (haddr, val); +#endif ATOMIC_MMU_CLEANUP ; atomic_trace_rmw_post(env, addr, VALUE_LOW(ret),
@@ -119,6 +122,39 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, vaddr addr, ABI_TYPE val,return ret; } +#if DATA_SIZE ==16 +ABI_TYPE ATOMIC_NAME (fetch_and )(CPUArchState *env,vaddr addr,ABI_TYPE val, +MemOpIdx oi,uintptr_t retaddr) +{ +DATA_TYPE *haddr =atomic_mmu_lookup (env_cpu (env), addr, oi, +DATA_SIZE , retaddr); +DATA_TYPE ret =atomic16_fetch_and (haddr, val); +ATOMIC_MMU_CLEANUP ; +atomic_trace_rmw_post (env, addr, +VALUE_LOW (ret), +VALUE_HIGH (ret), +VALUE_LOW (val), +VALUE_HIGH (val), + oi); +return ret; +} + +ABI_TYPE ATOMIC_NAME (fetch_or )(CPUArchState *env,vaddr addr,ABI_TYPE val, +MemOpIdx oi,uintptr_t retaddr) +{ +DATA_TYPE *haddr =atomic_mmu_lookup (env_cpu (env), addr, oi, +DATA_SIZE , retaddr); +DATA_TYPE ret =atomic16_fetch_or (haddr, val); +ATOMIC_MMU_CLEANUP ; +atomic_trace_rmw_post (env, addr, +VALUE_LOW (ret), +VALUE_HIGH (ret), +VALUE_LOW (val), +VALUE_HIGH (val), + oi); +return ret; +} +#else #define GEN_ATOMIC_HELPER (X ) \ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, vaddr addr, \ ABI_TYPE val, MemOpIdx oi, uintptr_t retaddr) \
@@ -188,7 +224,7 @@ GEN_ATOMIC_HELPER_FN(smax_fetch, MAX, SDATA_TYPE, new) GEN_ATOMIC_HELPER_FN(umax_fetch, MAX, DATA_TYPE, new)#undef GEN_ATOMIC_HELPER_FN -#endif /* DATA SIZE < 16 */ +#endif /* DATA SIZE == 16 */ #undef END
@@ -225,7 +261,6 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, vaddr addr,return BSWAP (ret); } -#if DATA_SIZE <16 ABI_TYPE ATOMIC_NAME (xchg )(CPUArchState *env,vaddr addr,ABI_TYPE val,MemOpIdx oi,uintptr_t retaddr) {
@@ -233,7 +268,11 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, vaddr addr, ABI_TYPE val, DATA_SIZE, retaddr);ABI_TYPE ret; +#if DATA_SIZE ==16 + ret =atomic16_xchg (haddr,BSWAP (val)); +#else ret =qatomic_xchg__nocheck (haddr,BSWAP (val)); +#endif ATOMIC_MMU_CLEANUP ; atomic_trace_rmw_post(env, addr, VALUE_LOW(ret),
@@ -244,6 +283,39 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, vaddr addr, ABI_TYPE val,return BSWAP (ret); } +#if DATA_SIZE ==16 +ABI_TYPE ATOMIC_NAME (fetch_and )(CPUArchState *env,vaddr addr,ABI_TYPE val, +MemOpIdx oi,uintptr_t retaddr) +{ +DATA_TYPE *haddr =atomic_mmu_lookup (env_cpu (env), addr, oi, +DATA_SIZE , retaddr); +DATA_TYPE ret =atomic16_fetch_and (haddr,BSWAP (val)); +ATOMIC_MMU_CLEANUP ; +atomic_trace_rmw_post (env, addr, +VALUE_LOW (ret), +VALUE_HIGH (ret), +VALUE_LOW (val), +VALUE_HIGH (val), + oi); +return BSWAP (ret); +} + +ABI_TYPE ATOMIC_NAME (fetch_or )(CPUArchState *env,vaddr addr,ABI_TYPE val, +MemOpIdx oi,uintptr_t retaddr) +{ +DATA_TYPE *haddr =atomic_mmu_lookup (env_cpu (env), addr, oi, +DATA_SIZE , retaddr); +DATA_TYPE ret =atomic16_fetch_or (haddr,BSWAP (val)); +ATOMIC_MMU_CLEANUP ; +atomic_trace_rmw_post (env, addr, +VALUE_LOW (ret), +VALUE_HIGH (ret), +VALUE_LOW (val), +VALUE_HIGH (val), + oi); +return BSWAP (ret); +} +#else #define GEN_ATOMIC_HELPER (X ) \ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, vaddr addr, \ ABI_TYPE val, MemOpIdx oi, uintptr_t retaddr) \
@@ -317,7 +389,7 @@ GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new)#undef ADD#undef GEN_ATOMIC_HELPER_FN -#endif /* DATA_SIZE < 16 */ +#endif /* DATA_SIZE == 16 */ #undef END#endif /* DATA_SIZE > 1 */
include/accel/tcg/cpu-ldst-common.h +10 -3
@@ -100,9 +100,6 @@ GEN_ATOMIC_HELPER_ALL(umax_fetch)GEN_ATOMIC_HELPER_ALL (xchg) -#undef GEN_ATOMIC_HELPER_ALL -#undef GEN_ATOMIC_HELPER - Int128 cpu_atomic_cmpxchgo_le_mmu(CPUArchState *env, vaddr addr, Int128 cmpv, Int128 newv, MemOpIdx oi,uintptr_t retaddr);
@@ -110,6 +107,16 @@ Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, vaddr addr, Int128 cmpv, Int128 newv, MemOpIdx oi, uintptr_t retaddr); +GEN_ATOMIC_HELPER(xchg, Int128, o_le) +GEN_ATOMIC_HELPER(xchg, Int128, o_be) +GEN_ATOMIC_HELPER(fetch_and, Int128, o_le) +GEN_ATOMIC_HELPER(fetch_and, Int128, o_be) +GEN_ATOMIC_HELPER(fetch_or, Int128, o_le) +GEN_ATOMIC_HELPER(fetch_or, Int128, o_be) + +#undef GEN_ATOMIC_HELPER_ALL +#undef GEN_ATOMIC_HELPER +uint8_t cpu_ldb_code_mmu (CPUArchState *env,vaddr addr,MemOpIdx oi,uintptr_t ra); uint16_t cpu_ldw_code_mmu(CPUArchState *env, vaddr addr,
Signature · 1 line
2.43.0
[PULL 28/32] tcg: Add tcg_gen_atomic_{xchg,fetch_and,fetch_or}_i128
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- accel/tcg/tcg-runtime.h | 12 +++++ include/tcg/tcg-op-common.h | 7 +++ include/tcg/tcg-op.h | 3 ++ tcg/tcg-op-ldst.c | 97 +++++++++++++++++++++++++++++++++-- accel/tcg/atomic_common.c.inc | 9 ++++ 5 files changed, 125 insertions(+), 3 deletions(-)
accel/tcg/tcg-runtime.h +12 -0
@@ -63,6 +63,18 @@ DEF_HELPER_FLAGS_5(atomic_cmpxchgo_be, TCG_CALL_NO_WG, i128, env, i64, i128, i128, i32) DEF_HELPER_FLAGS_5(atomic_cmpxchgo_le, TCG_CALL_NO_WG, i128, env, i64, i128, i128, i32) +DEF_HELPER_FLAGS_4(atomic_xchgo_be, TCG_CALL_NO_WG, + i128, env, i64, i128, i32) +DEF_HELPER_FLAGS_4(atomic_xchgo_le, TCG_CALL_NO_WG, + i128, env, i64, i128, i32) +DEF_HELPER_FLAGS_4(atomic_fetch_ando_be, TCG_CALL_NO_WG, + i128, env, i64, i128, i32) +DEF_HELPER_FLAGS_4(atomic_fetch_ando_le, TCG_CALL_NO_WG, + i128, env, i64, i128, i32) +DEF_HELPER_FLAGS_4(atomic_fetch_oro_be, TCG_CALL_NO_WG, + i128, env, i64, i128, i32) +DEF_HELPER_FLAGS_4(atomic_fetch_oro_le, TCG_CALL_NO_WG, + i128, env, i64, i128, i32)#endif DEF_HELPER_FLAGS_5(nonatomic_cmpxchgo, TCG_CALL_NO_WG,
include/tcg/tcg-op-common.h +7 -0
@@ -344,6 +344,8 @@ void tcg_gen_atomic_xchg_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32, TCGArg, MemOp, TCGType);void tcg_gen_atomic_xchg_i64_chk (TCGv_i64 ,TCGTemp *,TCGv_i64 ,TCGArg ,MemOp ,TCGType ); +void tcg_gen_atomic_xchg_i128_chk (TCGv_i128 ,TCGTemp *,TCGv_i128 , +TCGArg ,MemOp ,TCGType );void tcg_gen_atomic_fetch_add_i32_chk (TCGv_i32 ,TCGTemp *,TCGv_i32 ,TCGArg ,MemOp ,TCGType );
@@ -411,6 +413,11 @@ void tcg_gen_atomic_umax_fetch_i32_chk(TCGv_i32, TCGTemp *, TCGv_i32,void tcg_gen_atomic_umax_fetch_i64_chk (TCGv_i64 ,TCGTemp *,TCGv_i64 ,TCGArg ,MemOp ,TCGType ); +void tcg_gen_atomic_fetch_and_i128_chk (TCGv_i128 ,TCGTemp *,TCGv_i128 , +TCGArg ,MemOp ,TCGType ); +void tcg_gen_atomic_fetch_or_i128_chk (TCGv_i128 ,TCGTemp *,TCGv_i128 , +TCGArg ,MemOp ,TCGType ); +/* Vector ops */ void tcg_gen_mov_vec (TCGv_vec ,TCGv_vec );
include/tcg/tcg-op.h +3 -0
@@ -134,13 +134,16 @@ DEF_ATOMIC3(tcg_gen_nonatomic_cmpxchg, i128) DEF_ATOMIC2(tcg_gen_atomic_xchg, i32) DEF_ATOMIC2(tcg_gen_atomic_xchg, i64) +DEF_ATOMIC2(tcg_gen_atomic_xchg, i128) DEF_ATOMIC2(tcg_gen_atomic_fetch_add, i32) DEF_ATOMIC2(tcg_gen_atomic_fetch_add, i64) DEF_ATOMIC2(tcg_gen_atomic_fetch_and, i32) DEF_ATOMIC2(tcg_gen_atomic_fetch_and, i64) +DEF_ATOMIC2(tcg_gen_atomic_fetch_and, i128) DEF_ATOMIC2(tcg_gen_atomic_fetch_or, i32) DEF_ATOMIC2(tcg_gen_atomic_fetch_or, i64) +DEF_ATOMIC2(tcg_gen_atomic_fetch_or, i128) DEF_ATOMIC2(tcg_gen_atomic_fetch_xor, i32) DEF_ATOMIC2(tcg_gen_atomic_fetch_xor, i64)DEF_ATOMIC2 (tcg_gen_atomic_fetch_smin, i32)
tcg/tcg-op-ldst.c +94 -3
120 lines not on this page · raw message
accel/tcg/atomic_common.c.inc +9 -0
@@ -122,5 +122,14 @@ GEN_ATOMIC_HELPERS(umax_fetch) GEN_ATOMIC_HELPERS(xchg) +#if HAVE_CMPXCHG128 +ATOMIC_HELPER(xchgo_be, Int128) +ATOMIC_HELPER(xchgo_le, Int128) +ATOMIC_HELPER(fetch_ando_be, Int128) +ATOMIC_HELPER(fetch_ando_le, Int128) +ATOMIC_HELPER(fetch_oro_be, Int128) +ATOMIC_HELPER(fetch_oro_le, Int128) +#endif + #undef ATOMIC_HELPER #undef GEN_ATOMIC_HELPERS
Signature · 1 line
2.43.0
[PULL 16/32] docs/sphinx/kerneldoc.py: Handle new LINENO syntax
In reply to Peter MaydellThe new upstream kernel-doc that we plan to update to uses a different syntax for the LINENO directives that the Sphinx extension parses:
instead of
#define LINENO 86
it has
.. LINENO 86
Update the kerneldoc.py extension to handle both syntaxes, so that it will work with both the old and the new kernel-doc.
Message-id: [email protected]
--- docs/sphinx/kerneldoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
docs/sphinx/kerneldoc.py +1 -1
@@ -127,7 +127,7 @@ def run(self): result = ViewList() lineoffset = 0; - line_regex = re.compile("^#define LINENO ([0-9]+)$") + line_regex = re.compile(r"^(?:\.\.|#define) LINENO ([0-9]+)$") for line in lines: match = line_regex.search(line) if match:
Signature · 1 line
2.43.0
[PULL 29/32] target/arm: Rename isar_feature_aa64_atomics
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
This is FEAT_LSE -- rename the predicate to match.
Message-id: [email protected]
--- target/arm/cpu-features.h | 2 +- linux-user/aarch64/elfload.c | 2 +- target/arm/tcg/translate-a64.c | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-)
target/arm/cpu-features.h +1 -1
@@ -406,7 +406,7 @@ static inline bool isar_feature_aa64_crc32(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,CRC32 ) !=0 ; } -static inline bool isar_feature_aa64_atomics (const ARMISARegisters *id) +static inline bool isar_feature_aa64_lse (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,ATOMIC ) >=2 ; }
linux-user/aarch64/elfload.c +1 -1
@@ -151,7 +151,7 @@ abi_ulong get_elf_hwcap(CPUState *cs)GET_FEATURE_ID (aa64_sm3,ARM_HWCAP_A64_SM3 );GET_FEATURE_ID (aa64_sm4,ARM_HWCAP_A64_SM4 );GET_FEATURE_ID (aa64_fp16,ARM_HWCAP_A64_FPHP |ARM_HWCAP_A64_ASIMDHP ); -GET_FEATURE_ID (aa64_atomics,ARM_HWCAP_A64_ATOMICS ); +GET_FEATURE_ID (aa64_lse,ARM_HWCAP_A64_ATOMICS );GET_FEATURE_ID (aa64_lse2,ARM_HWCAP_A64_USCAT );GET_FEATURE_ID (aa64_rdm,ARM_HWCAP_A64_ASIMDRDM );GET_FEATURE_ID (aa64_dp,ARM_HWCAP_A64_ASIMDDP );
target/arm/tcg/translate-a64.c +12 -12
@@ -3237,7 +3237,7 @@ static bool trans_LDXP(DisasContext *s, arg_stxr *a)static bool trans_CASP (DisasContext *s,arg_CASP *a) { -if (!dc_isar_feature (aa64_atomics, s)) { +if (!dc_isar_feature (aa64_lse, s)) {return false; }if (((a->rt | a->rs) &1 ) !=0 ) {
@@ -3250,7 +3250,7 @@ static bool trans_CASP(DisasContext *s, arg_CASP *a)static bool trans_CAS (DisasContext *s,arg_CAS *a) { -if (!dc_isar_feature (aa64_atomics, s)) { +if (!dc_isar_feature (aa64_lse, s)) {return false; }gen_compare_and_swap (s, a->rs, a->rt, a->rn, a->sz);
@@ -3743,15 +3743,15 @@ static bool do_atomic_ld(DisasContext *s, arg_atomic *a, AtomicThreeOpFn *fn,return true; } -TRANS_FEAT(LDADD, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_add_i64, 0, false) -TRANS_FEAT(LDCLR, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_and_i64, 0, true) -TRANS_FEAT(LDEOR, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_xor_i64, 0, false) -TRANS_FEAT(LDSET, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_or_i64, 0, false) -TRANS_FEAT(LDSMAX, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_smax_i64, MO_SIGN, false) -TRANS_FEAT(LDSMIN, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_smin_i64, MO_SIGN, false) -TRANS_FEAT(LDUMAX, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_umax_i64, 0, false) -TRANS_FEAT(LDUMIN, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_fetch_umin_i64, 0, false) -TRANS_FEAT(SWP, aa64_atomics, do_atomic_ld, a, tcg_gen_atomic_xchg_i64, 0, false) +TRANS_FEAT(LDADD, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_add_i64, 0, false) +TRANS_FEAT(LDCLR, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_and_i64, 0, true) +TRANS_FEAT(LDEOR, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_xor_i64, 0, false) +TRANS_FEAT(LDSET, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_or_i64, 0, false) +TRANS_FEAT(LDSMAX, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_smax_i64, MO_SIGN, false) +TRANS_FEAT(LDSMIN, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_smin_i64, MO_SIGN, false) +TRANS_FEAT(LDUMAX, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_umax_i64, 0, false) +TRANS_FEAT(LDUMIN, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_fetch_umin_i64, 0, false) +TRANS_FEAT(SWP, aa64_lse, do_atomic_ld, a, tcg_gen_atomic_xchg_i64, 0, false)static bool trans_LDAPR (DisasContext *s,arg_LDAPR *a) {
@@ -3759,7 +3759,7 @@ static bool trans_LDAPR(DisasContext *s, arg_LDAPR *a)TCGv_i64 clean_addr;MemOp mop; -if (!dc_isar_feature (aa64_atomics, s) || +if (!dc_isar_feature (aa64_lse, s) || !dc_isar_feature (aa64_rcpc_8_3, s)) {return false; }
Signature · 1 line
2.43.0
Re: [PULL 29/32] target/arm: Rename isar_feature_aa64_atomics
Quoted 6 lines · Peter Maydell
From: Richard Henderson <[email protected]>
This is
FEAT_LSE-- rename the predicate to match.Signed-off-by Richard Henderson <[email protected]>Reviewed-by Peter Maydell <[email protected]>
Quoted 7 lines
Message-id: [email protected]
Signed-off-by Peter Maydell <[email protected]>--- target/arm/cpu-features.h | 2 +- linux-user/aarch64/elfload.c | 2 +- target/arm/tcg/translate-a64.c | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-)
Doh. I failed to rename the usage in bsd-user.
../bsd-user/aarch64/target_arch_elf.h:117:5: error: call to undeclared function 'isar_feature_aa64_atomics'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
117 | GET_FEATURE_ID(aa64_atomics, ARM_HWCAP_A64_ATOMICS);
Sorry about that.
r~
[PULL 31/32] target/arm: Enable FEAT_LSE128 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
@@ -89,6 +89,7 @@ the following architecture extensions: - FEAT_LRCPC2 (Load-acquire RCpc instructions v2) - FEAT_LSE (Large System Extensions) - FEAT_LSE2 (Large System Extensions v2) +- FEAT_LSE128 (128-bit Atomics) - FEAT_LVA (Large Virtual Address space) - FEAT_MixedEnd (Mixed-endian support) - FEAT_MixedEndEL0 (Mixed-endian support at EL0)
linux-user/aarch64/elfload.c +1 -0
@@ -213,6 +213,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs)GET_FEATURE_ID (aa64_sme_f16f16,ARM_HWCAP2_A64_SME_F16F16 );GET_FEATURE_ID (aa64_sve_b16b16,ARM_HWCAP2_A64_SVE_B16B16 );GET_FEATURE_ID (aa64_cssc,ARM_HWCAP2_A64_CSSC ); +GET_FEATURE_ID (aa64_lse128,ARM_HWCAP2_A64_LSE128 );return hwcaps; }
target/arm/tcg/cpu64.c +1 -1
@@ -1145,7 +1145,7 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64ISAR0 ,SHA1 ,1 );/* FEAT_SHA1 */ t =FIELD_DP64 (t,ID_AA64ISAR0 ,SHA2 ,2 );/* FEAT_SHA512 */ t =FIELD_DP64 (t,ID_AA64ISAR0 ,CRC32 ,1 );/* FEAT_CRC32 */ - t =FIELD_DP64 (t,ID_AA64ISAR0 ,ATOMIC ,2 );/* FEAT_LSE */ + t =FIELD_DP64 (t,ID_AA64ISAR0 ,ATOMIC ,3 );/* FEAT_LSE, FEAT_LSE128 */ t =FIELD_DP64 (t,ID_AA64ISAR0 ,RDM ,1 );/* FEAT_RDM */ t =FIELD_DP64 (t,ID_AA64ISAR0 ,SHA3 ,1 );/* FEAT_SHA3 */ t =FIELD_DP64 (t,ID_AA64ISAR0 ,SM3 ,1 );/* FEAT_SM3 */
Signature · 1 line
2.43.0
[PULL 03/32] tests/functional/test_aarch64_rme: update image
In reply to Peter MaydellFrom: Pierrick Bouvier <[email protected]>
TF-A needs to be patched to enable support for FEAT_TCR2 and FEAT_SCTLR2. This new image contains updated firmware.
Message-id: [email protected]
Message-ID: <[email protected]> [PMM: switch to os.makedirs(..., exist_ok=True) to improve
robustness when re-run after test was cancelled midway]
--- tests/functional/aarch64/test_rme_sbsaref.py | 64 ++++++++------- tests/functional/aarch64/test_rme_virt.py | 85 +++++++------------- 2 files changed, 66 insertions(+), 83 deletions(-)
tests/functional/aarch64/test_rme_sbsaref.py +36 -28
@@ -10,21 +10,23 @@ # SPDX-License-Identifier: GPL-2.0-or-later import os +from os.path import join +import shutil from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern from qemu_test import exec_command_and_wait_for_pattern -from test_rme_virt import test_realms_guest class Aarch64RMESbsaRefMachine(QemuSystemTest): - # Stack is built with OP-TEE build environment from those instructions: + # Stack is inspired from: # https://linaro.atlassian.net/wiki/spaces/QEMU/pages/29051027459/ - # https://github.com/pbo-linaro/qemu-rme-stack + # https://github.com/pbo-linaro/qemu-linux-stack/tree/rme_sbsa_release + # ./build.sh && ./archive_artifacts.sh out.tar.xz ASSET_RME_STACK_SBSA = Asset( - ('https://fileserver.linaro.org/s/KJyeBxL82mz2r7F/' - 'download/rme-stack-op-tee-4.2.0-cca-v4-sbsa.tar.gz'), - 'dd9ab28ec869bdf3b5376116cb3689103b43433fd5c4bca0f4a8d8b3c104999e') + ('https://github.com/pbo-linaro/qemu-linux-stack/' + 'releases/download/build/rme_sbsa_release-a7f02cf.tar.xz'), + '27d8400b11befb828d6db0cab97e7ae102d0992c928d3dfbf38b24b6cf6c324c') # This tests the FEAT_RME cpu implementation, by booting a VM supporting it, # and launching a nested VM using it.
@@ -35,35 +37,41 @@ def test_aarch64_rme_sbsaref(self): self.vm.set_console() - stack_path_tar_gz = self.ASSET_RME_STACK_SBSA.fetch() - self.archive_extract(stack_path_tar_gz, format="tar") + stack_path_tar = self.ASSET_RME_STACK_SBSA.fetch() + self.archive_extract(stack_path_tar, format="tar") - rme_stack = self.scratch_file('rme-stack-op-tee-4.2.0-cca-v4-sbsa') - pflash0 = os.path.join(rme_stack, 'images', 'SBSA_FLASH0.fd') - pflash1 = os.path.join(rme_stack, 'images', 'SBSA_FLASH1.fd') - virtual = os.path.join(rme_stack, 'images', 'disks', 'virtual') - drive = os.path.join(rme_stack, 'out-br', 'images', 'rootfs.ext4') + rme_stack = self.scratch_file('.') + pflash0 = join(rme_stack, 'out', 'SBSA_FLASH0.fd') + pflash1 = join(rme_stack, 'out', 'SBSA_FLASH1.fd') + rootfs = join(rme_stack, 'out', 'host.ext4') - self.vm.add_args('-cpu', 'max,x-rme=on,pauth-impdef=on') + efi = join(rme_stack, 'out', 'EFI') + os.makedirs(efi, exist_ok=True) + shutil.copyfile(join(rme_stack, 'out', 'Image'), join(efi, 'Image')) + with open(join(efi, 'startup.nsh'), 'w') as startup: + startup.write('fs0:Image nokaslr root=/dev/vda rw init=/init --' + ' /host/out/lkvm run --realm' + ' -m 256m' + ' --restricted_mem' + ' --kernel /host/out/Image' + ' --disk /host/out/guest.ext4' + ' --params "root=/dev/vda rw init=/init"') + + self.vm.add_args('-cpu', 'max,x-rme=on') + self.vm.add_args('-smp', '2') self.vm.add_args('-m', '2G') self.vm.add_args('-M', 'sbsa-ref') self.vm.add_args('-drive', f'file={pflash0},format=raw,if=pflash') self.vm.add_args('-drive', f'file={pflash1},format=raw,if=pflash') - self.vm.add_args('-drive', f'file=fat:rw:{virtual},format=raw') - self.vm.add_args('-drive', f'format=raw,if=none,file={drive},id=hd0') - self.vm.add_args('-device', 'virtio-blk-pci,drive=hd0') - self.vm.add_args('-device', 'virtio-9p-pci,fsdev=shr0,mount_tag=shr0') - self.vm.add_args('-fsdev', f'local,security_model=none,path={rme_stack},id=shr0') - self.vm.add_args('-device', 'virtio-net-pci,netdev=net0') - self.vm.add_args('-netdev', 'user,id=net0') - + self.vm.add_args('-drive', f'file=fat:rw:{efi},format=raw') + self.vm.add_args('-drive', f'format=raw,file={rootfs},if=virtio') + self.vm.add_args('-virtfs', + f'local,path={rme_stack}/,mount_tag=host,' + 'security_model=mapped,readonly=off') self.vm.launch() - # Wait for host VM boot to complete. - wait_for_console_pattern(self, 'Welcome to Buildroot', - failure_message='Synchronous Exception at') - exec_command_and_wait_for_pattern(self, 'root', '#') - - test_realms_guest(self) + # Wait for host and guest VM boot to complete. + wait_for_console_pattern(self, 'root@guest', + failure_message='Kernel panic') if __name__ == '__main__': QemuSystemTest.main()
tests/functional/aarch64/test_rme_virt.py +30 -55
118 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 22/32] scripts/kernel-doc: Delete the old Perl kernel-doc script
In reply to Peter MaydellWe can now delete the old Perl kernel-doc script. For posterity, this is a complete diff of the local changes that we were carrying between the kernel's Perl script as of kernel commit 72b97d0b911872ba (the last time we synced it) and our local copy:
kernel-doc 2025-02-17 10:44:34.528421457 +0000 renamed from tmp/kdoc 2025-08-14 10:42:47.620331939 +0100 +12 -9
@@ -1,5 +1,5 @@ #!/usr/bin/env perl -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: GPL-2.0-only use warnings; use strict;
@@ -224,12 +224,12 @@ my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params my $type_fp_param2 = '\@(\w+->\S+)\(\)'; # Special RST handling for structs with func ptr params my $type_env = '(\$\w+)'; -my $type_enum = '\&(enum\s*([_\w]+))'; -my $type_struct = '\&(struct\s*([_\w]+))'; -my $type_typedef = '\&(typedef\s*([_\w]+))'; -my $type_union = '\&(union\s*([_\w]+))'; -my $type_member = '\&([_\w]+)(\.|->)([_\w]+)'; -my $type_fallback = '\&([_\w]+)'; +my $type_enum = '#(enum\s*([_\w]+))'; +my $type_struct = '#(struct\s*([_\w]+))'; +my $type_typedef = '#(([A-Z][_\w]*))'; +my $type_union = '#(union\s*([_\w]+))'; +my $type_member = '#([_\w]+)(\.|->)([_\w]+)'; +my $type_fallback = '(?!)'; # this never matches my $type_member_func = $type_member . '\(\)'; # Output conversion substitutions.
@@ -1745,6 +1745,9 @@ )+ \)\)\s+//x; + # Strip QEMU specific compiler annotations + $prototype =~ s/QEMU_[A-Z_]+ +//; + # Yes, this truly is vile. We are looking for: # 1. Return type (may be nothing if we're looking at a macro) # 2. Function name
@@ -2057,7 +2060,7 @@ } elsif (/$doc_decl/o) { $identifier = $1; - if (/\s*([\w\s]+?)(\(\))?\s*-/) { + if (/\s*([\w\s]+?)(\s*-|:)/) { $identifier = $1; }
@@ -2067,7 +2070,7 @@ $contents = ""; $section = $section_default; $new_start_line = $. + 1; - if (/-(.*)/) { + if (/[-:](.*)/) { # strip leading/trailing/multiple spaces $descr= $1; $descr =~ s/^\s*//;
These changes correspond to:06e2329636f license: Update deprecated SPDX tag GPL-2.0 to GPL-2.0-only (a bulk change which we won't bother to re-apply to this third-party script) b30df2751e5 scripts/kernel-doc: strip QEMU_ from function definitions 4cf41794411 docs: tweak kernel-doc for QEMU coding standards
We have already applied the equivalent of these changes to the Python code in libs/kdoc/ in the preceding commits.
--- .editorconfig | 2 +- scripts/kernel-doc | 2441 -------------------------------------------- 2 files changed, 1 insertion(+), 2442 deletions(-) delete mode 100755 scripts/kernel-doc
.editorconfig +1 -1
@@ -55,7 +55,7 @@ indent_size = 4 emacs_mode = perl # but user kernel "style" for imported scripts -[scripts/{kernel-doc,get_maintainer.pl,checkpatch.pl}] +[scripts/{get_maintainer.pl,checkpatch.pl}] indent_style = tab indent_size = 8 emacs_mode = perl
scripts/kernel-doc deleted +0 -2441
2,441 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 30/32] target/arm: Implement FEAT_LSE128
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
This feature contains the LDCLRP, LDSETP, and SWPP instructions.
Message-id: [email protected]
--- target/arm/cpu-features.h | 5 ++++ target/arm/tcg/a64.decode | 7 +++++ target/arm/tcg/translate-a64.c | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+)
target/arm/cpu-features.h +5 -0
@@ -411,6 +411,11 @@ static inline bool isar_feature_aa64_lse(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,ATOMIC ) >=2 ; } +static inline bool isar_feature_aa64_lse128 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,ATOMIC ) >=3 ; +} +static inline bool isar_feature_aa64_rdm (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,RDM ) !=0 ;
target/arm/tcg/a64.decode +7 -0
@@ -546,6 +546,13 @@ SWP .. 111 0 00 . . 1 ..... 1000 00 ..... ..... @atomic LDAPR sz:2 111 0 00 1 0 1 11111 1100 00 rn:5 rt:5 +# Atomic 128-bit memory operations +&atomic128 rn rt rt2 a r +@atomic128 ........ a:1 r:1 . rt2:5 ...... rn:5 rt:5 &atomic128 +LDCLRP 00011001 . . 1 ..... 000100 ..... ..... @atomic128 +LDSETP 00011001 . . 1 ..... 001100 ..... ..... @atomic128 +SWPP 00011001 . . 1 ..... 100000 ..... ..... @atomic128 + # Load/store register (pointer authentication) # LDRA immediate is 10 bits signed and scaled, but the bits aren't all contiguous
target/arm/tcg/translate-a64.c +49 -0
55 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 04/32] target/arm: Implement FEAT_SCTLR2 and enable with -cpu max
In reply to Peter MaydellFrom: Gustavo Romero <[email protected]>
Add FEAT_SCTLR2, which introduces the SCTLR2_EL1, SCTLR2_EL2, and SCTLR2_EL3 registers. These registers are extensions of the SCTLR_ELx ones.
Message-id: [email protected]
Message-ID: <[email protected]>
--- docs/system/arm/emulation.rst | 1 + target/arm/cpu-features.h | 5 ++ target/arm/cpu.h | 15 ++++++ target/arm/internals.h | 1 + target/arm/cpu.c | 3 ++ target/arm/helper.c | 97 ++++++++++++++++++++++++++++++++--- target/arm/tcg/cpu64.c | 5 +- 7 files changed, 119 insertions(+), 8 deletions(-)
docs/system/arm/emulation.rst +1 -0
@@ -121,6 +121,7 @@ the following architecture extensions: - FEAT_RPRES (Increased precision of FRECPE and FRSQRTE) - FEAT_S2FWB (Stage 2 forced Write-Back) - FEAT_SB (Speculation Barrier) +- FEAT_SCTLR2 (Extension to SCTLR_ELx) - FEAT_SEL2 (Secure EL2) - FEAT_SHA1 (SHA1 instructions) - FEAT_SHA256 (SHA256 instructions)
target/arm/cpu-features.h +5 -0
@@ -904,6 +904,11 @@ static inline bool isar_feature_aa64_nv2(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,NV ) >=2 ; } +static inline bool isar_feature_aa64_sctlr2 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64MMFR3 ,SCTLRX ) !=0 ; +} +static inline bool isar_feature_aa64_pmuv3p1 (const ARMISARegisters *id) { return FIELD_EX64_IDREG(id, ID_AA64DFR0, PMUVER) >= 4 &&
target/arm/cpu.h +15 -0
@@ -337,6 +337,7 @@ typedef struct CPUArchState { };uint64_t sctlr_el[4 ]; }; +uint64_t sctlr2_el[4 ];/* Extension to System control register. */ uint64_t vsctlr;/* Virtualization System control register. */ uint64_t cpacr_el1;/* Architectural feature access control register */ uint64_t cptr_el[4 ];/* ARMv8 feature trap registers */
@@ -1420,6 +1421,19 @@ void pmu_init(ARMCPU *cpu);#define SCTLR_SPINTMASK (1ULL << 62)/* FEAT_NMI */ #define SCTLR_TIDCP (1ULL << 63)/* FEAT_TIDCP1 */ +#define SCTLR2_EMEC (1ULL << 1)/* FEAT_MEC */ +#define SCTLR2_NMEA (1ULL << 2)/* FEAT_DoubleFault2 */ +#define SCTLR2_ENADERR (1ULL << 3)/* FEAT_ADERR */ +#define SCTLR2_ENANERR (1ULL << 4)/* FEAT_ANERR */ +#define SCTLR2_EASE (1ULL << 5)/* FEAT_DoubleFault2 */ +#define SCTLR2_ENIDCP128 (1ULL << 6)/* FEAT_SYSREG128 */ +#define SCTLR2_ENPACM (1ULL << 7)/* FEAT_PAuth_LR */ +#define SCTLR2_ENPACM0 (1ULL << 8)/* FEAT_PAuth_LR */ +#define SCTLR2_CPTA (1ULL << 9)/* FEAT_CPA2 */ +#define SCTLR2_CPTA0 (1ULL << 10)/* FEAT_CPA2 */ +#define SCTLR2_CPTM (1ULL << 11)/* FEAT_CPA2 */ +#define SCTLR2_CPTM0 (1ULL << 12)/* FEAT_CAP2 */ +#define CPSR_M (0x1fU)#define CPSR_T (1U << 5)#define CPSR_F (1U << 6)
@@ -1712,6 +1726,7 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)#define SCR_HXEN (1ULL << 38)#define SCR_TRNDR (1ULL << 40)#define SCR_ENTP2 (1ULL << 41) +#define SCR_SCTLR2EN (1ULL << 44)#define SCR_GPF (1ULL << 48)#define SCR_NSE (1ULL << 62)
target/arm/internals.h +1 -0
@@ -230,6 +230,7 @@ FIELD(VSTCR, SA, 30, 1)#define HCRX_CMOW (1ULL << 9)#define HCRX_MCE2 (1ULL << 10)#define HCRX_MSCEN (1ULL << 11) +#define HCRX_SCTLR2EN (1ULL << 15)#define HPFAR_NS (1ULL << 63)
target/arm/cpu.c +3 -0
@@ -644,6 +644,9 @@ void arm_emulate_firmware_reset(CPUState *cpustate, int target_el)if (cpu_isar_feature (aa64_fgt, cpu)) { env->cp15.scr_el3 |=SCR_FGTEN ; } +if (cpu_isar_feature (aa64_sctlr2, cpu)) { + env->cp15.scr_el3 |=SCR_SCTLR2EN ; + } }if (target_el ==2 ) {
target/arm/helper.c +90 -7
148 lines not on this page · raw message
target/arm/tcg/cpu64.c +4 -1
@@ -1247,7 +1247,10 @@ void aarch64_max_tcg_initfn(Object *obj) t =FIELD_DP64 (t,ID_AA64MMFR2 ,E0PD ,1 );/* FEAT_E0PD */ SET_IDREG (isar,ID_AA64MMFR2 , t); -FIELD_DP64_IDREG (isar,ID_AA64MMFR3 ,SPEC_FPACC ,1 );/* FEAT_FPACC_SPEC */ + t =GET_IDREG (isar,ID_AA64MMFR3 ); + t =FIELD_DP64 (t,ID_AA64MMFR3 ,SCTLRX ,1 );/* FEAT_SCTLR2 */ + t =FIELD_DP64 (t,ID_AA64MMFR3 ,SPEC_FPACC ,1 );/* FEAT_FPACC_SPEC */ +SET_IDREG (isar,ID_AA64MMFR3 , t); t =GET_IDREG (isar,ID_AA64ZFR0 ); t =FIELD_DP64 (t,ID_AA64ZFR0 ,SVEVER ,2 );/* FEAT_SVE2p1 */
Signature · 1 line
2.43.0
[PULL 24/32] target/arm: Correct condition of aa64_atomics feature function
In reply to Peter MaydellThe ARMv8.1-Atomics feature (renamed FEAT_LSE in more modern versions of the Arm ARM) has always ben indicated by ID_AA64ISAR0.ATOMIC being 0b0010 or greater; 0b0001 is a reserved unused value.
We were incorrectly checking for != 0; this had no harmful effects because all the CPUs set their value for this field to either 0 (for not having the feature) or 2 (if they do have it), but it's better to match what the architecture specifies here.
Message-id: [email protected]
--- target/arm/cpu-features.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/arm/cpu-features.h +1 -1
@@ -408,7 +408,7 @@ static inline bool isar_feature_aa64_crc32(const ARMISARegisters *id)static inline bool isar_feature_aa64_atomics (const ARMISARegisters *id) { -return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,ATOMIC ) !=0 ; +return FIELD_EX64_IDREG (id,ID_AA64ISAR0 ,ATOMIC ) >=2 ; }static inline bool isar_feature_aa64_rdm (const ARMISARegisters *id)
Signature · 1 line
2.43.0
[PULL 12/32] target/arm: Implement CTZ, CNT, ABS
In reply to Peter MaydellMessage-id: [email protected]
--- target/arm/tcg/a64.decode | 4 ++++ target/arm/tcg/translate-a64.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
target/arm/tcg/a64.decode +4 -0
@@ -726,6 +726,10 @@ REV64 1 10 11010110 00000 000011 ..... ..... @rr CLZ . 10 11010110 00000 000100 ..... ..... @rr_sf CLS . 10 11010110 00000 000101 ..... ..... @rr_sf +CTZ . 10 11010110 00000 000110 ..... ..... @rr_sf +CNT . 10 11010110 00000 000111 ..... ..... @rr_sf +ABS . 10 11010110 00000 001000 ..... ..... @rr_sf + &pacaut rd rn z @pacaut . .. ........ ..... .. z:1 ... rn:5 rd:5 &pacaut
target/arm/tcg/translate-a64.c +31 -0
@@ -8308,6 +8308,37 @@ static void gen_cls32(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn) TRANS(CLZ, gen_rr, a->rd, a->rn, a->sf ? gen_clz64 : gen_clz32) TRANS(CLS, gen_rr, a->rd, a->rn, a->sf ? tcg_gen_clrsb_i64 : gen_cls32) +static void gen_ctz32 (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) +{ +TCGv_i32 t32 =tcg_temp_new_i32 (); + +tcg_gen_extrl_i64_i32 (t32, tcg_rn); +tcg_gen_ctzi_i32 (t32, t32,32 ); +tcg_gen_extu_i32_i64 (tcg_rd, t32); +} + +static void gen_ctz64 (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) +{ +tcg_gen_ctzi_i64 (tcg_rd, tcg_rn,64 ); +} + +static void gen_cnt32 (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) +{ +gen_wrap2_i32 (tcg_rd, tcg_rn, tcg_gen_ctpop_i32); +} + +static void gen_abs32 (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) +{ +gen_wrap2_i32 (tcg_rd, tcg_rn, tcg_gen_abs_i32); +} + +TRANS_FEAT (CTZ , aa64_cssc, gen_rr, a->rd, a->rn, + a->sf ? gen_ctz64 : gen_ctz32) +TRANS_FEAT (CNT , aa64_cssc, gen_rr, a->rd, a->rn, + a->sf ? tcg_gen_ctpop_i64 : gen_cnt32) +TRANS_FEAT (ABS , aa64_cssc, gen_rr, a->rd, a->rn, + a->sf ? tcg_gen_abs_i64 : gen_abs32) +static bool gen_pacaut (DisasContext *s,arg_pacaut *a,NeonGenTwo64OpEnvFn fn) {TCGv_i64 tcg_rd, tcg_rn;
Signature · 1 line
2.43.0
[PULL 25/32] qemu/atomic: Finish renaming atomic128-cas.h headers
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
The aarch64 header was not renamed with the others, meaning it was skipped in favor of the generic version.
Message-id: [email protected]
---
.../include/aarch64/host/{atomic128-cas.h => atomic128-cas.h.inc} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename host/include/aarch64/host/{atomic128-cas.h => atomic128-cas.h.inc} (100%)host/include/aarch64/host/atomic128-cas.h.inc renamed from host/include/aarch64/host/atomic128-cas.h +0 -0
Signature · 1 line
2.43.0
[PULL 02/32] tests/functional/test_aarch64_device_passthrough: update image
In reply to Peter MaydellFrom: Pierrick Bouvier <[email protected]>
TF-A needs to be patched to enable support for FEAT_TCR2 and FEAT_SCTLR2. This new image contains updated firmware.
Message-id: [email protected]
Message-ID: <[email protected]>
--- .../aarch64/test_device_passthrough.py | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-)
tests/functional/aarch64/test_device_passthrough.py +14 -13
@@ -9,7 +9,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later -import os +from os.path import join from qemu_test import QemuSystemTest, Asset from qemu_test import exec_command, wait_for_console_pattern
@@ -77,15 +77,16 @@ class Aarch64DevicePassthrough(QemuSystemTest): - # https://github.com/pbo-linaro/qemu-linux-stack + # https://github.com/pbo-linaro/qemu-linux-stack/tree/device_passthrough + # $ ./build.sh && ./archive_artifacts.sh out.tar.xz # # Linux kernel is compiled with defconfig + # IOMMUFD + VFIO_DEVICE_CDEV + ARM_SMMU_V3_IOMMUFD # https://docs.kernel.org/driver-api/vfio.html#vfio-device-cde ASSET_DEVICE_PASSTHROUGH_STACK = Asset( - ('https://fileserver.linaro.org/s/fx5DXxBYme8dw2G/' - 'download/device_passthrough.tar.xz'), - '812750b664d61c2986f2b149939ae28cafbd60d53e9c7e4b16e97143845e196d') + ('https://github.com/pbo-linaro/qemu-linux-stack/' + 'releases/download/build/device_passthrough-c3fb84a.tar.xz'), + '15ac2b02bed0c0ea8e3e007de0bcfdaf6fd51c1ba98213f841dc7d01d6f72f04') # This tests the device passthrough implementation, by booting a VM # supporting it with two nvme disks attached, and launching a nested VM
@@ -96,16 +97,16 @@ def test_aarch64_device_passthrough(self): self.vm.set_console() - stack_path_tar_gz = self.ASSET_DEVICE_PASSTHROUGH_STACK.fetch() - self.archive_extract(stack_path_tar_gz, format="tar") + stack_path_tar = self.ASSET_DEVICE_PASSTHROUGH_STACK.fetch() + self.archive_extract(stack_path_tar, format="tar") stack = self.scratch_file('out') - kernel = os.path.join(stack, 'Image.gz') - rootfs_host = os.path.join(stack, 'host.ext4') - disk_vfio = os.path.join(stack, 'disk_vfio') - disk_iommufd = os.path.join(stack, 'disk_iommufd') - guest_cmd = os.path.join(stack, 'guest.sh') - nested_guest_cmd = os.path.join(stack, 'nested_guest.sh') + kernel = join(stack, 'Image.gz') + rootfs_host = join(stack, 'host.ext4') + disk_vfio = join(stack, 'disk_vfio') + disk_iommufd = join(stack, 'disk_iommufd') + guest_cmd = join(stack, 'guest.sh') + nested_guest_cmd = join(stack, 'nested_guest.sh') # we generate two random disks with open(disk_vfio, "wb") as d: d.write(randbytes(512)) with open(disk_iommufd, "wb") as d: d.write(randbytes(1024))
Signature · 1 line
2.43.0
[PULL 08/32] target/arm: Add feature predicate for FEAT_CSSC
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
@@ -604,6 +604,11 @@ static inline bool isar_feature_aa64_rpres(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,RPRES ); } +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_lut (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64ISAR2 ,LUT );
Signature · 1 line
2.43.0
[PULL 26/32] qemu/atomic: Add atomic16 primitives for xchg, fetch_and, fetch_or
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- host/include/aarch64/host/atomic128-cas.h.inc | 57 +++++++++++ host/include/generic/host/atomic128-cas.h.inc | 96 +++++++++++++++++++ 2 files changed, 153 insertions(+)
host/include/aarch64/host/atomic128-cas.h.inc +57 -0
@@ -38,6 +38,63 @@ static inline Int128 atomic16_cmpxchg(Int128 *ptr, Int128 cmp, Int128 new) return int128_make128(oldl, oldh); } +static inline Int128 atomic16_xchg(Int128 *ptr, Int128 new) +{ + uint64_t newl = int128_getlo(new), newh = int128_gethi(new); + uint64_t oldl, oldh; + uint32_t tmp; + + asm("0: ldaxp %[oldl], %[oldh], %[mem]\n\t" + "stlxp %w[tmp], %[newl], %[newh], %[mem]\n\t" + "cbnz %w[tmp], 0b" + : [mem] "+m"(*ptr), [tmp] "=&r"(tmp), + [oldl] "=&r"(oldl), [oldh] "=&r"(oldh) + : [newl] "r"(newl), [newh] "r"(newh) + : "memory"); + + return int128_make128(oldl, oldh); +} + +static inline Int128 atomic16_fetch_and(Int128 *ptr, Int128 new) +{ + uint64_t newl = int128_getlo(new), newh = int128_gethi(new); + uint64_t oldl, oldh, tmpl, tmph; + uint32_t tmp; + + asm("0: ldaxp %[oldl], %[oldh], %[mem]\n\t" + "and %[tmpl], %[oldl], %[newl]\n\t" + "and %[tmph], %[oldh], %[newh]\n\t" + "stlxp %w[tmp], %[tmpl], %[tmph], %[mem]\n\t" + "cbnz %w[tmp], 0b" + : [mem] "+m"(*ptr), [tmp] "=&r"(tmp), + [oldl] "=&r"(oldl), [oldh] "=&r"(oldh) + : [newl] "r"(newl), [newh] "r"(newh), + [tmpl] "r"(tmpl), [tmph] "r"(tmph) + : "memory"); + + return int128_make128(oldl, oldh); +} + +static inline Int128 atomic16_fetch_or(Int128 *ptr, Int128 new) +{ + uint64_t newl = int128_getlo(new), newh = int128_gethi(new); + uint64_t oldl, oldh, tmpl, tmph; + uint32_t tmp; + + asm("0: ldaxp %[oldl], %[oldh], %[mem]\n\t" + "orr %[tmpl], %[oldl], %[newl]\n\t" + "orr %[tmph], %[oldh], %[newh]\n\t" + "stlxp %w[tmp], %[tmpl], %[tmph], %[mem]\n\t" + "cbnz %w[tmp], 0b" + : [mem] "+m"(*ptr), [tmp] "=&r"(tmp), + [oldl] "=&r"(oldl), [oldh] "=&r"(oldh) + : [newl] "r"(newl), [newh] "r"(newh), + [tmpl] "r"(tmpl), [tmph] "r"(tmph) + : "memory"); + + return int128_make128(oldl, oldh); +} + # define CONFIG_CMPXCHG128 1 # define HAVE_CMPXCHG128 1 #endif
host/include/generic/host/atomic128-cas.h.inc +96 -0
108 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 15/32] scripts/kernel-doc: Avoid new Perl precedence warning
In reply to Peter MaydellNewer versions of Perl (5.41.x and up) emit a warning for code in
kernel-doc:
Possible precedence problem between ! and pattern match (m//) at /scripts/kernel-doc line 1597.
This is because the code does:
if (!$param =~ /\w\.\.\.$/) {In Perl, the ! operator has higher precedence than the =~ pattern-match binding, so the effect of this condition is to first logically-negate the string $param into a true-or-false value and then try to pattern match it against the regex, which in this case will always fail. This is almost certainly not what the author intended.
In the new Python version of kernel-doc in the Linux kernel, the equivalent code is written:
if KernRe(r'\w\.\.\.$').search(param):
# For named variable parameters of the form x..., # remove the dots
param = param[:-3]
else:
# Handles unnamed variable parameters param = "..."
which is a more sensible way of writing the behaviour you would get if you put in brackets to make the regex match first and then negate the result.
Take this as the intended behaviour, and update the Perl to match.
For QEMU, this produces no change in output, presumably because we never used the "unnamed variable parameters" syntax.
Message-id: [email protected]
--- scripts/kernel-doc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
scripts/kernel-doc +4 -5
@@ -1594,13 +1594,12 @@ sub push_parameter($$$$$) { if ($type eq "" && $param =~ /\.\.\.$/) { - if (!$param =~ /\w\.\.\.$/) { - # handles unnamed variable parameters - $param = "..."; - } - elsif ($param =~ /\w\.\.\.$/) { + if ($param =~ /\w\.\.\.$/) { # for named variable parameters of the form `x...`, remove the dots $param =~ s/\.\.\.$//; + } else { + # handles unnamed variable parameters + $param = "..."; } if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") { $parameterdescs{$param} = "variable arguments";
Signature · 1 line
2.43.0
[PULL 01/32] target/arm: Clean up of register field definitions
In reply to Peter MaydellFrom: Gustavo Romero <[email protected]>
Clean up the definitions of NSW and NSA fields in the VTCR register. These two fields are already defined properly using FIELD() so they are actually duplications. Also, define the NSW and NSA fields in the VSTCR register using FIELD() and remove their definitions based on VTCR fields.
Message-id: [email protected]
--- target/arm/internals.h | 8 +++----- target/arm/ptw.c | 8 ++++---- 2 files changed, 7 insertions(+), 9 deletions(-)
target/arm/internals.h +3 -5
@@ -113,11 +113,6 @@ FIELD(DBGWCR, WT, 20, 1) FIELD(DBGWCR, MASK, 24, 5)FIELD (DBGWCR ,SSCE ,29 ,1 ) -#define VTCR_NSW (1u << 29) -#define VTCR_NSA (1u << 30) -#define VSTCR_SW VTCR_NSW -#define VSTCR_SA VTCR_NSA - /* Bit definitions for CPACR (AArch32 only) */ FIELD(CPACR, CP10, 20, 2)FIELD (CPACR ,CP11 ,22 ,2 )
@@ -220,6 +215,9 @@ FIELD(VTCR, NSA, 30, 1) FIELD(VTCR, DS, 32, 1) FIELD(VTCR, SL2, 33, 1) +FIELD(VSTCR, SW, 29, 1) +FIELD(VSTCR, SA, 30, 1) +#define HCRX_ENAS0 (1ULL << 0)#define HCRX_ENALS (1ULL << 1)#define HCRX_ENASR (1ULL << 2)
target/arm/ptw.c +4 -4
@@ -193,9 +193,9 @@ static ARMMMUIdx ptw_idx_for_stage_2(CPUARMState *env, ARMMMUIdx stage2idx)return ARMMMUIdx_Phys_Realm;case ARMSS_Secure:if (stage2idx == ARMMMUIdx_Stage2_S) { - s2walk_secure = !(env->cp15.vstcr_el2 &VSTCR_SW ); + s2walk_secure = !(env->cp15.vstcr_el2 &R_VSTCR_SW_MASK ); }else { - s2walk_secure = !(env->cp15.vtcr_el2 &VTCR_NSW ); + s2walk_secure = !(env->cp15.vtcr_el2 &R_VTCR_NSW_MASK ); }return s2walk_secure ? ARMMMUIdx_Phys_S : ARMMMUIdx_Phys_NS;default :
@@ -3372,9 +3372,9 @@ static bool get_phys_addr_twostage(CPUARMState *env, S1Translate *ptw,*/ if (in_space == ARMSS_Secure) { result->f.attrs.secure = - !(env->cp15.vstcr_el2 & (VSTCR_SA |VSTCR_SW )) + !(env->cp15.vstcr_el2 & (R_VSTCR_SA_MASK |R_VSTCR_SW_MASK )) && (ipa_secure - || !(env->cp15.vtcr_el2 & (VTCR_NSA |VTCR_NSW ))); + || !(env->cp15.vtcr_el2 & (R_VTCR_NSA_MASK |R_VTCR_NSW_MASK ))); result->f.attrs.space =arm_secure_to_space (result->f.attrs.secure); }
Signature · 1 line
2.43.0
[PULL 11/32] target/arm: Split out gen_wrap2_i32 helper
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Wrapper to extract the low 32 bits, perform an operation, and zero-extend back to 64 bits.
Message-id: [email protected]
--- target/arm/tcg/translate-a64.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)
target/arm/tcg/translate-a64.c +15 -10
@@ -8231,13 +8231,22 @@ static bool gen_rr(DisasContext *s, int rd, int rn, ArithOneOp fn)return true; } +/* +* Perform 32-bit operation fn on the low half of n; +* the high half of the output is zeroed. +*/ +static void gen_wrap2_i32 (TCGv_i64 d,TCGv_i64 n,NeonGenOneOpFn fn) +{ +TCGv_i32 t =tcg_temp_new_i32 (); + +tcg_gen_extrl_i64_i32 (t, n); +fn (t, t); +tcg_gen_extu_i32_i64 (d, t); +} +static void gen_rbit32 (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) { -TCGv_i32 t32 =tcg_temp_new_i32 (); - -tcg_gen_extrl_i64_i32 (t32, tcg_rn); -gen_helper_rbit (t32, t32); -tcg_gen_extu_i32_i64 (tcg_rd, t32); +gen_wrap2_i32 (tcg_rd, tcg_rn, gen_helper_rbit); }static void gen_rev16_xx (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn,TCGv_i64 mask)
@@ -8293,11 +8302,7 @@ static void gen_clz64(TCGv_i64 tcg_rd, TCGv_i64 tcg_rn)static void gen_cls32 (TCGv_i64 tcg_rd,TCGv_i64 tcg_rn) { -TCGv_i32 t32 =tcg_temp_new_i32 (); - -tcg_gen_extrl_i64_i32 (t32, tcg_rn); -tcg_gen_clrsb_i32 (t32, t32); -tcg_gen_extu_i32_i64 (tcg_rd, t32); +gen_wrap2_i32 (tcg_rd, tcg_rn, tcg_gen_clrsb_i32); }TRANS (CLZ , gen_rr, a->rd, a->rn, a->sf ? gen_clz64 : gen_clz32)
Signature · 1 line
2.43.0
[PULL 23/32] MAINTAINERS: Put kernel-doc under the "docs build machinery" section
In reply to Peter MaydellWe never had a MAINTAINERS entry for the old kernel-doc script; add the files for the new Python kernel-doc under "Sphinx documentation configuration and build machinery", as the most appropriate subsection.
Mauro has kindly volunteered to help with maintenance/review of this area of the codebase, so add him as a maintainer.
Message-id: [email protected]
--- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
@@ -4441,6 +4441,7 @@ F: po/*.po Sphinx documentation configuration and build machinery M: John Snow <[email protected]> M: Peter Maydell <[email protected]> +M: Mauro Carvalho Chehab <[email protected]> S: Maintained F: docs/conf.py F: docs/*/conf.py
@@ -4449,6 +4450,8 @@ F: docs/sphinx/ F: docs/_templates/ F: docs/devel/docs.rst F: docs/devel/qapi-domain.rst +F: scripts/kernel-doc +F: scripts/lib/kdoc/ Rust build system integration M: Manos Pitsidianakis <[email protected]>
Signature · 1 line
2.43.0
[PULL 09/32] target/arm: Implement MIN/MAX (immediate)
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/tcg/a64.decode | 10 ++++++++ target/arm/tcg/translate-a64.c | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
target/arm/tcg/a64.decode +10 -0
@@ -156,6 +156,16 @@ MOVZ . 10 100101 .. ................ ..... @movw_32 MOVK . 11 100101 .. ................ ..... @movw_64 MOVK . 11 100101 .. ................ ..... @movw_32 +# Min/Max (immediate) + +@minmaxi_s sf:1 .. ........... imm:s8 rn:5 rd:5 &rri_sf +@minmaxi_u sf:1 .. ........... imm:8 rn:5 rd:5 &rri_sf + +SMAX_i . 00 1000111 0000 ........ ..... ..... @minmaxi_s +SMIN_i . 00 1000111 0010 ........ ..... ..... @minmaxi_s +UMAX_i . 00 1000111 0001 ........ ..... ..... @minmaxi_u +UMIN_i . 00 1000111 0011 ........ ..... ..... @minmaxi_u + # Bitfield &bitfield rd rn sf immr imms
target/arm/tcg/translate-a64.c +44 -0
50 lines not on this page · raw message
Signature · 1 line
2.43.0
[PULL 21/32] scripts/kerneldoc: Switch to the Python kernel-doc script
In reply to Peter MaydellChange the Sphinx config to run the new Python kernel-doc script instead of the Perl one. The only difference between the two is that the new script does not handle the -sphinx-version option, instead assuming that Sphinx is always at least version 3: so we must delete the code that passes that option to avoid the Python script complaining about an unknown option.
QEMU's minimum Sphinx version is already 3.4.3, so this doesn't change the set of versions we can handle.
Message-id: [email protected]
--- docs/conf.py | 4 +++- docs/sphinx/kerneldoc.py | 5 ----- 2 files changed, 3 insertions(+), 6 deletions(-)
docs/conf.py +3 -1
@@ -341,7 +341,9 @@ # We use paths starting from qemu_docdir here so that you can run # sphinx-build from anywhere and the kerneldoc extension can still # find everything. -kerneldoc_bin = ['perl', os.path.join(qemu_docdir, '../scripts/kernel-doc')] +# Since kernel-doc is now a Python script, we should run it with whatever +# Python this sphinx is using (rather than letting it find one via env) +kerneldoc_bin = [sys.executable, os.path.join(qemu_docdir, '../scripts/kernel-doc.py')] kerneldoc_srctree = os.path.join(qemu_docdir, '..') hxtool_srctree = os.path.join(qemu_docdir, '..') qapidoc_srctree = os.path.join(qemu_docdir, '..')
docs/sphinx/kerneldoc.py +0 -5
@@ -63,11 +63,6 @@ def run(self): env = self.state.document.settings.env cmd = env.config.kerneldoc_bin + ['-rst', '-enable-lineno'] - # Pass the version string to kernel-doc, as it needs to use a different - # dialect, depending what the C domain supports for each specific - # Sphinx versions - cmd += ['-sphinx-version', sphinx.__version__] - # Pass through the warnings-as-errors flag if env.config.kerneldoc_werror: cmd += ['-Werror']
Signature · 1 line
2.43.0
[PULL 13/32] target/arm: Enable FEAT_CSSC 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 | 1 + 3 files changed, 3 insertions(+)
docs/system/arm/emulation.rst +1 -0
@@ -30,6 +30,7 @@ the following architecture extensions: - FEAT_CMOW (Control for cache maintenance permission) - FEAT_CRC32 (CRC32 instructions) - FEAT_Crypto (Cryptographic Extension) +- FEAT_CSSC (Common Short Sequence Compression instructions) - FEAT_CSV2 (Cache speculation variant 2) - FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1) - FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2)
linux-user/aarch64/elfload.c +1 -0
@@ -212,6 +212,7 @@ abi_ulong get_elf_hwcap2(CPUState *cs)GET_FEATURE_ID (aa64_sme_b16b16,ARM_HWCAP2_A64_SME_B16B16 );GET_FEATURE_ID (aa64_sme_f16f16,ARM_HWCAP2_A64_SME_F16F16 );GET_FEATURE_ID (aa64_sve_b16b16,ARM_HWCAP2_A64_SVE_B16B16 ); +GET_FEATURE_ID (aa64_cssc,ARM_HWCAP2_A64_CSSC );return hwcaps; }
target/arm/tcg/cpu64.c +1 -0
@@ -1178,6 +1178,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 */ SET_IDREG (isar,ID_AA64ISAR2 , t); t =GET_IDREG (isar,ID_AA64PFR0 );
Signature · 1 line
2.43.0
[PULL 10/32] target/arm: Implement MIN/MAX (register)
In reply to Peter MaydellFrom: Richard Henderson <[email protected]>
Message-id: [email protected]
--- target/arm/tcg/a64.decode | 5 +++++ target/arm/tcg/translate-a64.c | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+)
target/arm/tcg/a64.decode +5 -0
@@ -708,6 +708,11 @@ GMI 1 00 11010110 ..... 000101 ..... ..... @rrr PACGA 1 00 11010110 ..... 001100 ..... ..... @rrr +SMAX . 00 11010110 ..... 011000 ..... ..... @rrr_sf +SMIN . 00 11010110 ..... 011010 ..... ..... @rrr_sf +UMAX . 00 11010110 ..... 011001 ..... ..... @rrr_sf +UMIN . 00 11010110 ..... 011011 ..... ..... @rrr_sf + # Data Processing (1-source) @rr . .......... ..... ...... rn:5 rd:5 &rr
target/arm/tcg/translate-a64.c +22 -0
@@ -8201,6 +8201,28 @@ static bool trans_PACGA(DisasContext *s, arg_rrr *a)return false; } +static bool gen_rrr (DisasContext *s,arg_rrr_sf *a,ArithTwoOp fn) +{ +TCGv_i64 tcg_rm =cpu_reg (s, a->rm); +TCGv_i64 tcg_rn =cpu_reg (s, a->rn); +TCGv_i64 tcg_rd =cpu_reg (s, a->rd); + +fn (tcg_rd, tcg_rn, tcg_rm); +if (!a->sf) { +tcg_gen_ext32u_i64 (tcg_rd, tcg_rd); + } +return true; +} + +TRANS_FEAT (SMAX , aa64_cssc, gen_rrr, a, + a->sf ? tcg_gen_smax_i64 : gen_smax32_i64) +TRANS_FEAT (SMIN , aa64_cssc, gen_rrr, a, + a->sf ? tcg_gen_smin_i64 : gen_smin32_i64) +TRANS_FEAT (UMAX , aa64_cssc, gen_rrr, a, + a->sf ? tcg_gen_umax_i64 : gen_umax32_i64) +TRANS_FEAT (UMIN , aa64_cssc, gen_rrr, a, + a->sf ? tcg_gen_umin_i64 : gen_umin32_i64) +typedef void ArithOneOp (TCGv_i64 ,TCGv_i64 );static bool gen_rr (DisasContext *s,int rd,int rn,ArithOneOp fn)
Signature · 1 line
2.43.0
[PULL 32/32] hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects
In reply to Peter MaydellIn stm32f250_soc_initfn() we mostly use the standard pattern for child objects of calling object_initialize_child(). However for s->adc_irqs we call object_new() and then later qdev_realize(), and we never unref the object on deinit. This causes a leak, detected by ASAN on the device-introspect-test:
Indirect leak of 10 byte(s) in 1 object(s) allocated from:
#0 0x5b9fc4789de3 in malloc (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/qemu-system-arm+0x21f1de3) (BuildId: 267a2619a026ed91c78a07b1eb2ef15381538efe)
#1 0x740de3f28b09 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x62b09) (BuildId: 1eb6131419edb83b2178b682829a6913cf682d75)
#2 0x740de3f3e4d8 in g_strdup (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x784d8) (BuildId: 1eb6131419edb83b2178b682829a6913cf682d75)
#3 0x5b9fc70159e1 in g_strdup_inline /usr/include/glib-2.0/glib/gstrfuncs.h:321:10
#4 0x5b9fc70159e1 in object_property_try_add /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:1276:18
#5 0x5b9fc7015f94 in object_property_add /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:1294:12
#6 0x5b9fc701b900 in object_add_link_prop /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:2021:10
#7 0x5b9fc701b3fc in object_property_add_link /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:2037:12
#8 0x5b9fc4c299fb in qdev_init_gpio_out_named /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/gpio.c:90:9
#9 0x5b9fc4c29b26 in qdev_init_gpio_out /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/gpio.c:101:5
#10 0x5b9fc4c0f77a in or_irq_init /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/or-irq.c:70:5
#11 0x5b9fc70257e1 in object_init_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:428:9
#12 0x5b9fc700cd4b in object_initialize_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:570:5
#13 0x5b9fc700e66d in object_new_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:774:5
#14 0x5b9fc700e750 in object_new /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:789:12
#15 0x5b9fc68b2162 in stm32f205_soc_initfn /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/arm/stm32f205_soc.c:69:26Switch to using object_initialize_child() like all our other child objects for this SoC object.
Message-id: [email protected]
--- include/hw/arm/stm32f205_soc.h | 2 +- hw/arm/stm32f205_soc.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
include/hw/arm/stm32f205_soc.h +1 -1
@@ -59,7 +59,7 @@ struct STM32F205State {STM32F2XXADCState adc[STM_NUM_ADCS ];STM32F2XXSPIState spi[STM_NUM_SPIS ]; -OrIRQState *adc_irqs; +OrIRQState adc_irqs;MemoryRegion sram;MemoryRegion flash;
hw/arm/stm32f205_soc.c +5 -5
@@ -66,7 +66,7 @@ static void stm32f205_soc_initfn(Object *obj) TYPE_STM32F2XX_TIMER); } - s->adc_irqs =OR_IRQ (object_new (TYPE_OR_IRQ )); +object_initialize_child (obj,"adc-irq-orgate" , &s->adc_irqs,TYPE_OR_IRQ );for (i =0 ; i <STM_NUM_ADCS ; i++) {object_initialize_child (obj,"adc[*]" , &s->adc[i],TYPE_STM32F2XX_ADC );
@@ -171,12 +171,12 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) }/* ADC 1 to 3 */ -object_property_set_int (OBJECT (s->adc_irqs),"num-lines" ,STM_NUM_ADCS , +object_property_set_int (OBJECT (&s->adc_irqs),"num-lines" ,STM_NUM_ADCS , &error_abort); -if (!qdev_realize (DEVICE (s->adc_irqs),NULL , errp)) { +if (!qdev_realize (DEVICE (&s->adc_irqs),NULL , errp)) {return ; } -qdev_connect_gpio_out (DEVICE (s->adc_irqs),0 , +qdev_connect_gpio_out (DEVICE (&s->adc_irqs),0 ,qdev_get_gpio_in (armv7m,ADC_IRQ ));for (i =0 ; i <STM_NUM_ADCS ; i++) {
@@ -187,7 +187,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, Error **errp) busdev =SYS_BUS_DEVICE (dev);sysbus_mmio_map (busdev,0 , adc_addr[i]);sysbus_connect_irq (busdev,0 , -qdev_get_gpio_in (DEVICE (s->adc_irqs), i)); +qdev_get_gpio_in (DEVICE (&s->adc_irqs), i)); }/* SPI 1 and 2 */
Signature · 1 line
2.43.0
[PULL 18/32] scripts: Import Python kerneldoc from Linux kernel
In reply to Peter MaydellWe last synced our copy of kerneldoc with Linux back in 2020. In the interim, upstream has entirely rewritten the script in Python, and the new Python version is split into a main script plus some libraries in the kernel's scripts/lib/kdoc.
Import all these files. These are the versions as of kernel commit 0cc53520e68be, with no local changes.
We use the same lib/kdoc/ directory as the kernel does here, so we can avoid having to edit the top-level script just to adjust a pathname, even though it is probably not the naming we would have picked if this was a purely QEMU script.
The Sphinx conf.py still points at the Perl version of the script, so this Python code will not be invoked to build the docs yet.
NB: checkpatch complains about many things in this commit, including the use of "GPL-2.0" rather than "GPL-2.0-only" in the SPDX tags, but since this is a third party import we can ignore this.
Message-id: [email protected]
--- scripts/kernel-doc.py | 325 ++++++ scripts/lib/kdoc/kdoc_files.py | 291 ++++++ scripts/lib/kdoc/kdoc_item.py | 42 + scripts/lib/kdoc/kdoc_output.py | 749 ++++++++++++++ scripts/lib/kdoc/kdoc_parser.py | 1669 +++++++++++++++++++++++++++++++ scripts/lib/kdoc/kdoc_re.py | 270 +++++ 6 files changed, 3346 insertions(+) create mode 100755 scripts/kernel-doc.py create mode 100644 scripts/lib/kdoc/kdoc_files.py create mode 100644 scripts/lib/kdoc/kdoc_item.py create mode 100644 scripts/lib/kdoc/kdoc_output.py create mode 100644 scripts/lib/kdoc/kdoc_parser.py create mode 100644 scripts/lib/kdoc/kdoc_re.py
scripts/kernel-doc.py new file +325 -0
@@ -0,0 +1,325 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 +# Copyright(c) 2025: Mauro Carvalho Chehab <[email protected]>. +# +# pylint: disable=C0103,R0915 +# +# Converted from the kernel-doc script originally written in Perl +# under GPLv2, copyrighted since 1998 by the following authors: +# +# Aditya Srivastava <[email protected]> +# Akira Yokosawa <[email protected]> +# Alexander A. Klimov <[email protected]> +# Alexander Lobakin <[email protected]> +# André Almeida <[email protected]> +# Andy Shevchenko <[email protected]> +# Anna-Maria Behnsen <[email protected]> +# Armin Kuster <[email protected]> +# Bart Van Assche <[email protected]> +# Ben Hutchings <[email protected]> +# Borislav Petkov <[email protected]> +# Chen-Yu Tsai <[email protected]> +# Coco Li <[email protected]> +# Conchúr Navid <[email protected]> +# Daniel Santos <[email protected]> +# Danilo Cesar Lemes de Paula <[email protected]> +# Dan Luedtke <[email protected]> +# Donald Hunter <[email protected]> +# Gabriel Krisman Bertazi <[email protected]> +# Greg Kroah-Hartman <[email protected]> +# Harvey Harrison <[email protected]> +# Horia Geanta <[email protected]> +# Ilya Dryomov <[email protected]> +# Jakub Kicinski <[email protected]> +# Jani Nikula <[email protected]> +# Jason Baron <[email protected]> +# Jason Gunthorpe <[email protected]> +# Jérémy Bobbio <[email protected]> +# Johannes Berg <[email protected]> +# Johannes Weiner <[email protected]> +# Jonathan Cameron <[email protected]> +# Jonathan Corbet <[email protected]> +# Jonathan Neuschäfer <[email protected]> +# Kamil Rytarowski <[email protected]> +# Kees Cook <[email protected]> +# Laurent Pinchart <[email protected]> +# Levin, Alexander (Sasha Levin) <[email protected]> +# Linus Torvalds <[email protected]> +# Lucas De Marchi <[email protected]> +# Mark Rutland <[email protected]> +# Markus Heiser <[email protected]> +# Martin Waitz <[email protected]> +# Masahiro Yamada <[email protected]> +# Matthew Wilcox <[email protected]> +# Mauro Carvalho Chehab <[email protected]> +# Michal Wajdeczko <[email protected]> +# Michael Zucchi +# Mike Rapoport <[email protected]> +# Niklas Söderlund <[email protected]> +# Nishanth Menon <[email protected]> +# Paolo Bonzini <[email protected]> +# Pavan Kumar Linga <[email protected]> +# Pavel Pisa <[email protected]> +# Peter Maydell <[email protected]> +# Pierre-Louis Bossart <[email protected]> +# Randy Dunlap <[email protected]> +# Richard Kennedy <[email protected]> +# Rich Walker <[email protected]> +# Rolf Eike Beer <[email protected]> +# Sakari Ailus <[email protected]> +# Silvio Fricke <[email protected]> +# Simon Huggins +# Tim Waugh <[email protected]> +# Tomasz Warniełło <[email protected]> +# Utkarsh Tripathi <[email protected]> +# [email protected] <[email protected]> +# Vegard Nossum <[email protected]> +# Will Deacon <[email protected]> +# Yacine Belkadi <[email protected]> +# Yujie Liu <[email protected]> + +""" +kernel_doc +========== + +Print formatted kernel documentation to stdout + +Read C language source or header FILEs, extract embedded +documentation comments, and print formatted documentation +to standard output. + +The documentation comments are identified by the "/**" +opening comment mark. + +See Documentation/doc-guide/kernel-doc.rst for the +documentation comment syntax. +""" + +import argparse +import logging +import os +import sys + +# Import Python modules + +LIB_DIR = "lib/kdoc" +SRC_DIR = os.path.dirname(os.path.realpath(__file__)) + +sys.path.insert(0, os.path.join(SRC_DIR, LIB_DIR)) + +from kdoc_files import KernelFiles # pylint: disable=C0413 +from kdoc_output import RestFormat, ManFormat # pylint: disable=C0413 + +DESC = """ +Read C language source or header FILEs, extract embedded documentation comments, +and print formatted documentation to standard output. + +The documentation comments are identified by the "/**" opening comment mark. + +See Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax. +""" + +EXPORT_FILE_DESC = """ +Specify an additional FILE in which to look for EXPORT_SYMBOL information. + +May be used multiple times. +""" + +EXPORT_DESC = """ +Only output documentation for the symbols that have been +exported using EXPORT_SYMBOL() and related macros in any input +FILE or -export-file FILE. +""" + +INTERNAL_DESC = """ +Only output documentation for the symbols that have NOT been +exported using EXPORT_SYMBOL() and related macros in any input +FILE or -export-file FILE. +""" + +FUNCTION_DESC = """ +Only output documentation for the given function or DOC: section +title. All other functions and DOC: sections are ignored. + +May be used multiple times. +""" + +NOSYMBOL_DESC = """ +Exclude the specified symbol from the output documentation. + +May be used multiple times. +""" + +FILES_DESC = """ +Header and C source files to be parsed. +""" + +WARN_CONTENTS_BEFORE_SECTIONS_DESC = """ +Warns if there are contents before sections (deprecated). + +This option is kept just for backward-compatibility, but it does nothing, +neither here nor at the original Perl script. +""" + + +class MsgFormatter(logging.Formatter): + """Helper class to format warnings on a similar way to kernel-doc.pl""" + + def format(self, record): + record.levelname = record.levelname.capitalize() + return logging.Formatter.format(self, record) + +def main(): + """Main program""" + + parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, + description=DESC) + + # Normal arguments + + parser.add_argument("-v", "-verbose", "--verbose", action="store_true", + help="Verbose output, more warnings and other information.") + + parser.add_argument("-d", "-debug", "--debug", action="store_true", + help="Enable debug messages") + + parser.add_argument("-M", "-modulename", "--modulename", + default="Kernel API", + help="Allow setting a module name at the output.") + + parser.add_argument("-l", "-enable-lineno", "--enable_lineno", + action="store_true", + help="Enable line number output (only in ReST mode)") + + # Arguments to control the warning behavior + + parser.add_argument("-Wreturn", "--wreturn", action="store_true", + help="Warns about the lack of a return markup on functions.") + + parser.add_argument("-Wshort-desc", "-Wshort-description", "--wshort-desc", + action="store_true", + help="Warns if initial short description is missing") + + parser.add_argument("-Wcontents-before-sections", + "--wcontents-before-sections", action="store_true", + help=WARN_CONTENTS_BEFORE_SECTIONS_DESC) + + parser.add_argument("-Wall", "--wall", action="store_true", + help="Enable all types of warnings") + + parser.add_argument("-Werror", "--werror", action="store_true", + help="Treat warnings as errors.") + + parser.add_argument("-export-file", "--export-file", action='append', + help=EXPORT_FILE_DESC) + + # Output format mutually-exclusive group + + out_group = parser.add_argument_group("Output format selection (mutually exclusive)") + + out_fmt = out_group.add_mutually_exclusive_group() + + out_fmt.add_argument("-m", "-man", "--man", action="store_true", + help="Output troff manual page format.") + out_fmt.add_argument("-r", "-rst", "--rst", action="store_true", + help="Output reStructuredText format (default).") + out_fmt.add_argument("-N", "-none", "--none", action="store_true", + help="Do not output documentation, only warnings.") + + # Output selection mutually-exclusive group + + sel_group = parser.add_argument_group("Output selection (mutually exclusive)") + sel_mut = sel_group.add_mutually_exclusive_group() + + sel_mut.add_argument("-e", "-export", "--export", action='store_true', + help=EXPORT_DESC) + + sel_mut.add_argument("-i", "-internal", "--internal", action='store_true', + help=INTERNAL_DESC) + + sel_mut.add_argument("-s", "-function", "--symbol", action='append', + help=FUNCTION_DESC) + + # Those are valid for all 3 types of filter + parser.add_argument("-n", "-nosymbol", "--nosymbol", action='append', + help=NOSYMBOL_DESC) + + parser.add_argument("-D", "-no-doc-sections", "--no-doc-sections", + action='store_true', help="Don't outputt DOC sections") + + parser.add_argument("files", metavar="FILE", + nargs="+", help=FILES_DESC) + + args = parser.parse_args() + + if args.wall: + args.wreturn = True + args.wshort_desc = True + args.wcontents_before_sections = True + + logger = logging.getLogger() + + if not args.debug: + logger.setLevel(logging.INFO) + else: + logger.setLevel(logging.DEBUG) + + formatter = MsgFormatter('%(levelname)s: %(message)s') + + handler = logging.StreamHandler() + handler.setFormatter(formatter) + + logger.addHandler(handler) + + python_ver = sys.version_info[:2] + if python_ver < (3,6): + logger.warning("Python 3.6 or later is required by kernel-doc") + + # Return 0 here to avoid breaking compilation + sys.exit(0) + + if python_ver < (3,7): + logger.warning("Python 3.7 or later is required for correct results") + + if args.man: + out_style = ManFormat(modulename=args.modulename) + elif args.none: + out_style = None + else: + out_style = RestFormat() + + kfiles = KernelFiles(verbose=args.verbose, + out_style=out_style, werror=args.werror, + wreturn=args.wreturn, wshort_desc=args.wshort_desc, + wcontents_before_sections=args.wcontents_before_sections) + + kfiles.parse(args.files, export_file=args.export_file) + + for t in kfiles.msg(enable_lineno=args.enable_lineno, export=args.export, + internal=args.internal, symbol=args.symbol, + nosymbol=args.nosymbol, export_file=args.export_file, + no_doc_sections=args.no_doc_sections): + msg = t[1] + if msg: + print(msg) + + error_count = kfiles.errors + if not error_count: + sys.exit(0) + + if args.werror: + print(f"{error_count} warnings as errors") + sys.exit(error_count) + + if args.verbose: + print(f"{error_count} errors") + + if args.none: + sys.exit(0) + + sys.exit(error_count) + + +# Call main method +if __name__ == "__main__": + main()
scripts/lib/kdoc/kdoc_files.py new file +291 -0
291 lines not on this page · raw message
scripts/lib/kdoc/kdoc_item.py new file +42 -0
42 lines not on this page · raw message
scripts/lib/kdoc/kdoc_output.py new file +749 -0
749 lines not on this page · raw message
scripts/lib/kdoc/kdoc_parser.py new file +1669 -0
1,593 lines not on this page · raw message
scripts/lib/kdoc/kdoc_re.py new file +270 -0
270 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
[PULL 06/32] hw/intc/arm_gicv3_kvm: preserve pending interrupts during cpr
In reply to Peter MaydellFrom: Steve Sistare <[email protected]>
Close a race condition that causes cpr-transfer to lose VFIO interrupts on ARM.
CPR stops VCPUs but does not disable VFIO interrupts, which may continue to arrive throughout the transition to new QEMU.
CPR calls kvm_irqchip_remove_irqfd_notifier_gsi in old QEMU to force future interrupts to the producer eventfd, where they are preserved. Old QEMU then destroys the old KVM instance. However, interrupts may already be pending in KVM state. To preserve them, call ioctl KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES to flush them to guest RAM, where they will be picked up when the new KVM+VCPU instance is created.
Message-id: [email protected]
--- include/hw/intc/arm_gicv3_common.h | 3 +++ hw/intc/arm_gicv3_kvm.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+)
include/hw/intc/arm_gicv3_common.h +3 -0
@@ -27,6 +27,7 @@#include "hw/sysbus.h" #include "hw/intc/arm_gic_common.h" #include "qom/object.h" +#include "qemu/notify.h" /* * Maximum number of possible interrupts, determined by the GIC architecture.
@@ -271,6 +272,8 @@ struct GICv3State {GICv3CPUState *cpu;/* List of all ITSes connected to this GIC */ GPtrArray *itslist; + +NotifierWithReturn cpr_notifier; };#define GICV3_BITMAP_ACCESSORS (BMP ) \
hw/intc/arm_gicv3_kvm.c +15 -0
@@ -31,6 +31,7 @@#include "gicv3_internal.h" #include "vgic_common.h" #include "migration/blocker.h" +#include "migration/misc.h" #include "qom/object.h" #include "target/arm/cpregs.h"
@@ -776,6 +777,17 @@ static void vm_change_state_handler(void *opaque, bool running, } } +static int kvm_arm_gicv3_notifier (NotifierWithReturn *notifier, +MigrationEvent *e,Error **errp) +{ +if (e->type ==MIG_EVENT_PRECOPY_DONE ) { +GICv3State *s =container_of (notifier, GICv3State, cpr_notifier); +return kvm_device_access (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL , +KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES , +NULL , true, errp); + } +return 0 ; +}static void kvm_arm_gicv3_realize (DeviceState *dev,Error **errp) {
@@ -917,6 +929,9 @@ static void kvm_arm_gicv3_realize(DeviceState *dev, Error **errp)if (kvm_device_check_attr (s->dev_fd,KVM_DEV_ARM_VGIC_GRP_CTRL ,KVM_DEV_ARM_VGIC_SAVE_PENDING_TABLES )) {qemu_add_vm_change_state_handler (vm_change_state_handler, s); +migration_add_notifier_mode (&s->cpr_notifier, + kvm_arm_gicv3_notifier, +MIG_MODE_CPR_TRANSFER ); } }
Signature · 1 line
2.43.0
[PULL 05/32] target/arm: Implement FEAT_TCR2 and enable with -cpu max
In reply to Peter MaydellFrom: Gustavo Romero <[email protected]>
Add FEAT_TCR2, which introduces the TCR2_EL1 and TCR2_EL2 registers. These registers are extensions of the TCR_ELx registers and provide top-level control of the EL10 and EL20 translation regimes.
Message-id: [email protected]
Message-ID: <[email protected]>
--- docs/system/arm/emulation.rst | 1 + target/arm/cpu-features.h | 5 +++ target/arm/cpu.h | 2 + target/arm/internals.h | 19 ++++++++++ target/arm/cpu.c | 3 ++ target/arm/helper.c | 71 +++++++++++++++++++++++++++++++++++ target/arm/tcg/cpu64.c | 1 + 7 files changed, 102 insertions(+)
docs/system/arm/emulation.rst +1 -0
@@ -149,6 +149,7 @@ the following architecture extensions: - FEAT_SPECRES (Speculation restriction instructions) - FEAT_SSBS (Speculative Store Bypass Safe) - FEAT_SSBS2 (MRS and MSR instructions for SSBS version 2) +- FEAT_TCR2 (Support for TCR2_ELx) - FEAT_TGran16K (Support for 16KB memory translation granule size at stage 1) - FEAT_TGran4K (Support for 4KB memory translation granule size at stage 1) - FEAT_TGran64K (Support for 64KB memory translation granule size at stage 1)
target/arm/cpu-features.h +5 -0
@@ -904,6 +904,11 @@ static inline bool isar_feature_aa64_nv2(const ARMISARegisters *id)return FIELD_EX64_IDREG (id,ID_AA64MMFR2 ,NV ) >=2 ; } +static inline bool isar_feature_aa64_tcr2 (const ARMISARegisters *id) +{ +return FIELD_EX64_IDREG (id,ID_AA64MMFR3 ,TCRX ) !=0 ; +} +static inline bool isar_feature_aa64_sctlr2 (const ARMISARegisters *id) {return FIELD_EX64_IDREG (id,ID_AA64MMFR3 ,SCTLRX ) !=0 ;
target/arm/cpu.h +2 -0
@@ -366,6 +366,7 @@ typedef struct CPUArchState {uint64_t vsttbr_el2;/* Secure Virtualization Translation Table. */ /* MMU translation table base control. */ uint64_t tcr_el[4 ]; +uint64_t tcr2_el[3 ];uint64_t vtcr_el2;/* Virtualization Translation Control. */ uint64_t vstcr_el2;/* Secure Virtualization Translation Control. */ uint32_t c2_data;/* MPU data cacheable bits. */
@@ -1726,6 +1727,7 @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)#define SCR_HXEN (1ULL << 38)#define SCR_TRNDR (1ULL << 40)#define SCR_ENTP2 (1ULL << 41) +#define SCR_TCR2EN (1ULL << 43)#define SCR_SCTLR2EN (1ULL << 44)#define SCR_GPF (1ULL << 48)#define SCR_NSE (1ULL << 62)
target/arm/internals.h +19 -0
@@ -196,6 +196,24 @@ FIELD(CPTR_EL3, TCPAC, 31, 1)#define TTBCR_SH1 (1U << 28)#define TTBCR_EAE (1U << 31) +#define TCR2_PNCH (1ULL << 0) +#define TCR2_PIE (1ULL << 1) +#define TCR2_E0POE (1ULL << 2) +#define TCR2_POE (1ULL << 3) +#define TCR2_AIE (1ULL << 4) +#define TCR2_D128 (1ULL << 5) +#define TCR2_PTTWI (1ULL << 10) +#define TCR2_HAFT (1ULL << 11) +#define TCR2_AMEC0 (1ULL << 12) +#define TCR2_AMEC1 (1ULL << 13) +#define TCR2_DISCH0 (1ULL << 14) +#define TCR2_DISCH1 (1ULL << 15) +#define TCR2_A2 (1ULL << 16) +#define TCR2_FNG0 (1ULL << 17) +#define TCR2_FNG1 (1ULL << 18) +#define TCR2_FNGNA0 (1ULL << 20) +#define TCR2_FNGNA1 (1ULL << 21) + FIELD(VTCR, T0SZ, 0, 6) FIELD(VTCR, SL0, 6, 2)FIELD (VTCR ,IRGN0 ,8 ,2 )
@@ -230,6 +248,7 @@ FIELD(VSTCR, SA, 30, 1)#define HCRX_CMOW (1ULL << 9)#define HCRX_MCE2 (1ULL << 10)#define HCRX_MSCEN (1ULL << 11) +#define HCRX_TCR2EN (1ULL << 14)#define HCRX_SCTLR2EN (1ULL << 15)#define HPFAR_NS (1ULL << 63)
target/arm/cpu.c +3 -0
@@ -644,6 +644,9 @@ void arm_emulate_firmware_reset(CPUState *cpustate, int target_el)if (cpu_isar_feature (aa64_fgt, cpu)) { env->cp15.scr_el3 |=SCR_FGTEN ; } +if (cpu_isar_feature (aa64_tcr2, cpu)) { + env->cp15.scr_el3 |=SCR_TCR2EN ; + }if (cpu_isar_feature (aa64_sctlr2, cpu)) { env->cp15.scr_el3 |=SCR_SCTLR2EN ; }
target/arm/helper.c +71 -0
107 lines not on this page · raw message
target/arm/tcg/cpu64.c +1 -0
@@ -1248,6 +1248,7 @@ void aarch64_max_tcg_initfn(Object *obj)SET_IDREG (isar,ID_AA64MMFR2 , t); t =GET_IDREG (isar,ID_AA64MMFR3 ); + t =FIELD_DP64 (t,ID_AA64MMFR3 ,TCRX ,1 );/* FEAT_TCR2 */ t =FIELD_DP64 (t,ID_AA64MMFR3 ,SCTLRX ,1 );/* FEAT_SCTLR2 */ t =FIELD_DP64 (t,ID_AA64MMFR3 ,SPEC_FPACC ,1 );/* FEAT_FPACC_SPEC */ SET_IDREG (isar,ID_AA64MMFR3 , t);
Signature · 1 line
2.43.0
[PULL 07/32] target/arm: Trap PMCR when MDCR_EL2.TPMCR is set
In reply to Peter MaydellFrom: Smail AIDER <[email protected]>
Trap PMCR_EL0 or PMCR accesses to EL2 when MDCR_EL2.TPMCR is set. Similar to MDCR_EL2.TPM, MDCR_EL2.TPMCR allows trapping EL0 and EL1 accesses to the PMCR register to EL2.
Message-id: [email protected]
Message-Id: <[email protected]>
--- target/arm/cpregs-pmu.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
target/arm/cpregs-pmu.c +26 -8
@@ -228,22 +228,27 @@ static bool event_supported(uint16_t number)return supported_event_map[number] !=UNSUPPORTED_EVENT ; } -static CPAccessResult pmreg_access (CPUARMState *env,const ARMCPRegInfo *ri, -bool isread) +static CPAccessResult do_pmreg_access (CPUARMState *env,bool is_pmcr) {/* * Performance monitor registers user accessibility is controlled -* by PMUSERENR. MDCR_EL2.TPM and MDCR_EL3.TPM allow configurable +* by PMUSERENR. MDCR_EL2.TPM/TPMCR and MDCR_EL3.TPM allow configurable * trapping to EL2 or EL3 for other accesses. */ int el =arm_current_el (env); -uint64_t mdcr_el2 =arm_mdcr_el2_eff (env);if (el ==0 && !(env->cp15.c9_pmuserenr &1 )) {return CP_ACCESS_TRAP_EL1 ; } -if (el <2 && (mdcr_el2 &MDCR_TPM )) { -return CP_ACCESS_TRAP_EL2 ; +if (el <2 ) { +uint64_t mdcr_el2 =arm_mdcr_el2_eff (env); + +if (mdcr_el2 &MDCR_TPM ) { +return CP_ACCESS_TRAP_EL2 ; + } +if (is_pmcr && (mdcr_el2 &MDCR_TPMCR )) { +return CP_ACCESS_TRAP_EL2 ; + } }if (el <3 && (env->cp15.mdcr_el3 &MDCR_TPM )) {return CP_ACCESS_TRAP_EL3 ;
@@ -252,6 +257,19 @@ static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri,return CP_ACCESS_OK ; } +static CPAccessResult pmreg_access (CPUARMState *env,const ARMCPRegInfo *ri, +bool isread) +{ +return do_pmreg_access (env, false); +} + +static CPAccessResult pmreg_access_pmcr (CPUARMState *env, +const ARMCPRegInfo *ri, +bool isread) +{ +return do_pmreg_access (env, true); +} +static CPAccessResult pmreg_access_xevcntr (CPUARMState *env,const ARMCPRegInfo *ri,bool isread)
@@ -1187,14 +1205,14 @@ void define_pm_cpregs(ARMCPU *cpu) .fgt = FGT_PMCR_EL0, .type = ARM_CP_IO | ARM_CP_ALIAS, .fieldoffset = offsetoflow32(CPUARMState, cp15.c9_pmcr), - .accessfn = pmreg_access, + .accessfn = pmreg_access_pmcr, .readfn = pmcr_read, .raw_readfn = raw_read, .writefn = pmcr_write, .raw_writefn = raw_write, };const ARMCPRegInfo pmcr64 = { .name ="PMCR_EL0" , .state =ARM_CP_STATE_AA64 , .opc0 =3 , .opc1 =3 , .crn =9 , .crm =12 , .opc2 =0 , - .access =PL0_RW , .accessfn = pmreg_access, + .access =PL0_RW , .accessfn = pmreg_access_pmcr, .fgt =FGT_PMCR_EL0 , .type =ARM_CP_IO , .fieldoffset = offsetof(CPUARMState, cp15.c9_pmcr),
Signature · 1 line
2.43.0