[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN v4 1/3] xen/arm: Introduce CONFIG_PARTIAL_EMULATION and "partial-emulation" cmd option


  • To: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 31 Jan 2024 13:43:02 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oAAwLouGsxv8hR1ylp4tn+X91JS9RJNCjxgIsTPoptE=; b=Ij2ZjxBxv2+r+g6G1W4CoEmUm0SCgCPvOEsJchNdyJVnKzqRSTafvRivegGJi3ImpT/p0wLT4waT9nlqBoDcwLGJkvi9EdhRt+HGm6yA5ARKhKt0SCF6WS6klLSfPdJzx30myHvJwRjBAOU3L1kWGnfzjr8mYm8ZEzE1iNFS7D/CLeBlXyGBOKC6QAeEllRKeT7pW9xBLgqLY3eJut/YK2jTmhwWXMlGEOqQ4yvuEE8BWve/cqog664c7zKLaYtyQPbcM1n/eMD/bBIxd8S1ShISoVsuNOztVD20HsbAGy1nwT51UZwGDmjwiGcFf0BIJwpj5l+TNFM8E9ai32Yn7A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oQdZsN5l6WlGx3lYVp7+JSppFP9W520946lPQ0Gwz72+eEOhg8xnlfjft/W0wW/XhaI4S6bU9H6wiSWH45kGBKd1XKzfNUHMalYhbTBpHyvm5VKkSpFASRPFTM4chEDtFK83wkxN4ndUCMCV1tCZMFeg0oCGZKKYcb49mdmGyddMni5KC9ry06FJanxS92JDsY3bfHfrjSBI2f2NLEnDK3mCxp86ervLXYXjeHLQTdRIWH86lgJnwZJCXe/lhv6NQQ5ql077A4mpfbuR2MXcvRKSDNmO2TkOrsdxdB18bPkdAzVTIzNycGoC+yZJiLdg/ae8ducVJx/LvR+wPlTslw==
  • Cc: <sstabellini@xxxxxxxxxx>, <stefano.stabellini@xxxxxxx>, <julien@xxxxxxx>, <Volodymyr_Babchuk@xxxxxxxx>, <bertrand.marquis@xxxxxxx>, <luca.fancellu@xxxxxxx>
  • Delivery-date: Wed, 31 Jan 2024 12:43:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Ayan,

On 31/01/2024 13:10, Ayan Kumar Halder wrote:
> There can be situations when the registers cannot be emulated to their full
> functionality. This can be due to the complexity involved. In such cases, one
> can emulate those registers as RAZ/WI for example. We call them as partial
> emulation.
> 
> Some registers are non-optional and as such there is nothing preventing an OS
> from accessing them.
> Instead of injecting undefined exception (thus crashing a guest), one may want
> to prefer a partial emulation to let the guest running (in some cases 
> accepting
> the fact that it might result in unwanted behavior).
> 
> A suitable example of this (as seen in subsequent patches) is emulation of
> DBGDTRTX_EL0 (on Arm64) and DBGDTRTXINT(on Arm32). These non-optional
> registers can be emulated as RAZ/WI and they can be enclosed within
> CONFIG_PARTIAL_EMULATION.
> 
> Further, "partial-emulation" command line option allows us to
> enable/disable partial emulation at run time. While CONFIG_PARTIAL_EMULATION
> enables support for partial emulation at compile time (i.e. adds code for
> partial emulation), this option may be enabled or disabled by Yocto or other
> build systems. However if the build system turns this option on, users
> can use scripts like Imagebuilder to generate uboot-script which will append
> "partial-emulation=false" to xen command line to turn off the partial
NIT: given that the option is false by default, it would make more sense to 
give example
with setting it to true to enable it.

> emulation. Thus, it helps to avoid rebuilding xen.
> 
> By default, "CONFIG_PARTIAL_EMULATION=y" and "partial-emulation=false".
> This is done so that Xen supports partial emulation. However, customers are
> fully aware when they enable partial emulation. It's important to note that
> enabling such support might result in unwanted/non-spec compliant behavior.
> 
> Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
> ---
> Changes from v1 :-
> 1. New patch introduced in v2.
> 
> v2 :-
> 1. Reordered the patches so that the config and command line option is
> introduced in the first patch.
> 
> v3 :-
> 1. Defined a macro 'partial_emulation' to reduce if-defs.
> 2. Fixed style issues.
> 
>  docs/misc/xen-command-line.pandoc | 11 +++++++++++
>  xen/arch/arm/Kconfig              |  9 +++++++++
>  xen/arch/arm/include/asm/traps.h  |  6 ++++++
>  xen/arch/arm/traps.c              |  9 +++++++++
>  4 files changed, 35 insertions(+)
> 
> diff --git a/docs/misc/xen-command-line.pandoc 
> b/docs/misc/xen-command-line.pandoc
> index 8e65f8bd18..22c0d7c9f6 100644
> --- a/docs/misc/xen-command-line.pandoc
> +++ b/docs/misc/xen-command-line.pandoc
> @@ -1949,6 +1949,17 @@ This option is ignored in **pv-shim** mode.
>  
>  > Default: `on`
>  
> +### partial-emulation (arm)
> +> `= <boolean>`
> +
> +> Default: `false`
> +
> +Flag to enable or disable partial emulation of system/coprocessor registers.
> +Only effective if CONFIG_PARTIAL_EMULATION is enabled.
> +
> +**WARNING: Enabling this option might result in unwanted/non-spec compliant
> +behavior.**
> +
>  ### pci
>      = List of [ serr=<bool>, perr=<bool> ]
>  
> diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
> index 50e9bfae1a..8d8f668e7f 100644
> --- a/xen/arch/arm/Kconfig
> +++ b/xen/arch/arm/Kconfig
> @@ -225,6 +225,15 @@ config STATIC_EVTCHN
>         This option enables establishing static event channel communication
>         between domains on a dom0less system (domU-domU as well as domU-dom0).
>  
> +config PARTIAL_EMULATION
> +     bool "Enable partial emulation of system/coprocessor registers"
> +     default y
> +     help
> +       This option enables partial emulation of registers to prevent guests
> +       crashing when accessing registers which are not optional but have not 
> been
> +       emulated to its complete functionality. Enabling this might result in
NIT: s/its/their

Other than that:
Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.