|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] tools/arm: Add the trap_unmapped_accesses xl config option
commit d057628757ffe5ead8bf6d27cc8127cb50b9bea7
Author: Edgar E. Iglesias <edgar.iglesias@xxxxxxx>
AuthorDate: Mon Jun 16 17:53:04 2025 +0200
Commit: Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Tue Jun 17 10:59:04 2025 -0700
tools/arm: Add the trap_unmapped_accesses xl config option
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
docs/man/xl.cfg.5.pod.in | 9 +++++++++
tools/include/libxl.h | 7 +++++++
tools/libs/light/libxl_arm.c | 6 +++---
tools/libs/light/libxl_create.c | 3 +++
tools/libs/light/libxl_types.idl | 1 +
tools/libs/light/libxl_x86.c | 6 ++++++
tools/xl/xl_parse.c | 3 +++
7 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in
index c388899306..075e89e6d2 100644
--- a/docs/man/xl.cfg.5.pod.in
+++ b/docs/man/xl.cfg.5.pod.in
@@ -3056,6 +3056,15 @@ will be used for the domain. Otherwise, the value
specified by the `nr_spis`
parameter will be used. The number of SPIs should match the highest interrupt
ID that will be assigned to the domain.
+=item B<trap_unmapped_accesses=BOOLEAN>
+
+An Optional boolean parameter that configures handling of accesses to unmapped
+address ranges. If enabled, guest accesses will trap. If disabled, guest
+accesses will read all bits as ones, e.g 0xFFFFFFFF for a 32bit access and
+writes will be ignored.
+
+This option is only implemented for Arm where the default is enabled.
+
=back
=head3 x86
diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index b7ad7735ca..24c81cf145 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -549,6 +549,13 @@
*/
#define LIBXL_HAVE_VPMU 1
+/*
+ * LIBXL_HAVE_TRAP_UNMAPPED_ACCESSES indicates that libxl_domain_build_info
+ * has a trap_unmapped_accesses parameter, which allows the control of how
+ * accesses to unmapped adresses behave.
+ */
+#define LIBXL_HAVE_TRAP_UNMAPPED_ACCESSES 1
+
/*
* LIBXL_HAVE_PHYSINFO_CAP_GNTTAB indicates that libxl_physinfo has a
* cap_gnttab_v1/2 fields, which indicates the available grant table ABIs.
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index 9530996e72..afc62a5299 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -233,9 +233,6 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
config->arch.sve_vl = d_config->b_info.arch_arm.sve_vl / 128U;
}
- /* Trap accesses to unmapped areas. */
- config->flags |= XEN_DOMCTL_CDF_trap_unmapped_accesses;
-
return 0;
}
@@ -1714,6 +1711,9 @@ int libxl__arch_domain_build_info_setdefault(libxl__gc
*gc,
/* ACPI is disabled by default */
libxl_defbool_setdefault(&b_info->acpi, false);
+ /* Trapping of unmapped accesses enabled by default. */
+ libxl_defbool_setdefault(&b_info->trap_unmapped_accesses, true);
+
/* Sanitise SVE parameter */
if (b_info->arch_arm.sve_vl) {
unsigned int max_sve_vl =
diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index 8bc768b515..625ce5b040 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -605,6 +605,9 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config
*d_config,
if (libxl_defbool_val(b_info->vpmu))
create.flags |= XEN_DOMCTL_CDF_vpmu;
+ if (libxl_defbool_val(b_info->trap_unmapped_accesses))
+ create.flags |= XEN_DOMCTL_CDF_trap_unmapped_accesses;
+
assert(info->passthrough != LIBXL_PASSTHROUGH_DEFAULT);
LOG(DETAIL, "passthrough: %s",
libxl_passthrough_to_string(info->passthrough));
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 1985153830..57ae16ae78 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -736,6 +736,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
("vmtrace_buf_kb", integer),
("vpmu", libxl_defbool),
+ ("trap_unmapped_accesses", libxl_defbool),
], dir=DIR_IN,
copy_deprecated_fn="libxl__domain_build_info_copy_deprecated",
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 867addfcab..60d4e8661c 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -26,6 +26,11 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
if (libxl_defbool_val(d_config->b_info.arch_x86.msr_relaxed))
config->arch.misc_flags |= XEN_X86_MSR_RELAXED;
+ if (libxl_defbool_val(d_config->b_info.trap_unmapped_accesses)) {
+ LOG(ERROR, "trap_unmapped_accesses is not supported on x86\n");
+ return ERROR_FAIL;
+ }
+
return 0;
}
@@ -813,6 +818,7 @@ int libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
{
libxl_defbool_setdefault(&b_info->acpi, true);
libxl_defbool_setdefault(&b_info->arch_x86.msr_relaxed, false);
+ libxl_defbool_setdefault(&b_info->trap_unmapped_accesses, false);
if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
/*
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 219e924779..98b3612d0f 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -2972,6 +2972,9 @@ skip_usbdev:
if (!xlu_cfg_get_long (config, "nr_spis", &l, 0))
b_info->arch_arm.nr_spis = l;
+ xlu_cfg_get_defbool(config, "trap_unmapped_accesses",
+ &b_info->trap_unmapped_accesses, 0);
+
parse_vkb_list(config, d_config);
d_config->virtios = NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |