On Thu Apr 24, 2025 at 5:10 PM BST, Alejandro Vallejo wrote:
> From: "Daniel P. Smith" <dpsm...@apertussolutions.com>
>
> Introduce the ability to assign capabilities to a domain via its definition in
> device tree. The first capability enabled to select is the control domain
> capability. The capability property is a bitfield in both the device tree and
> `struct boot_domain`.
>
> Signed-off-by: Daniel P. Smith <dpsm...@apertussolutions.com>
> Signed-off-by: Jason Andryuk <jason.andr...@amd.com>
> Signed-off-by: Alejandro Vallejo <agarc...@amd.com>
> Reviewed-by: Denis Mukhin <dmuk...@ford.com>
> ---
> v5:
>   * Removed BUILD_CAPS, as DOMAIN_CAPS is now in public/bootfdt.h
>   * Assigned DOMAIN_CAPS_MASK to dom0, rather than only BUILD_CAPS_CONTROL.
>     * So it also gets hardware+xenstore.
> ---
>  xen/arch/x86/include/asm/boot-domain.h |  3 +++
>  xen/arch/x86/setup.c                   |  5 ++++-
>  xen/common/domain-builder/fdt.c        | 23 +++++++++++++++++++++++
>  3 files changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/include/asm/boot-domain.h 
> b/xen/arch/x86/include/asm/boot-domain.h
> index 969c02a6ea..cb5351241a 100644
> --- a/xen/arch/x86/include/asm/boot-domain.h
> +++ b/xen/arch/x86/include/asm/boot-domain.h
> @@ -13,6 +13,9 @@
>  struct boot_domain {
>      domid_t domid;
>  
> +    /* Bitmap. See DOMAIN_CAPS_MASK for a list */
> +    uint32_t capabilities;
> +
>                                            /* On     | Off    */
>  #define BUILD_MODE_PARAVIRT      (1 << 0) /* PV     | PVH/HVM */
>  #define BUILD_MODE_ENABLE_DM     (1 << 1) /* HVM    | PVH     */
> diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> index d4f839146f..960e43c785 100644
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -61,6 +61,7 @@
>  
>  #include <xsm/xsm.h>
>  
> +#include <public/bootfdt.h>
>  #include <public/version.h>
>  #ifdef CONFIG_COMPAT
>  #include <compat/platform.h>
> @@ -1050,7 +1051,8 @@ static struct domain *__init create_dom0(struct 
> boot_info *bi)
>          /* Create initial domain.  Not d0 for pvshim. */
>          bd->domid = get_initial_domain_id();

Self commenting that I missed XEN_DOMCTL_CDF_iommu being passed if
iommu_enabled is set (out of context, a few lines above). That should be
gated on DOMAIN_CAPS_HARDWARE being set too. Just spotted it when
rebasing the RFC series from Daniel.

Cheers,
Alejandro

Reply via email to