All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Julian Vetter <julian.vetter@vates.tech>, xen-devel@lists.xenproject.org
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Juergen Gross" <jgross@suse.com>,
	"Andrii Sultanov" <andriy.sultanov@vates.tech>,
	"Guillaume Thouvenin" <guillaume.thouvenin@vates.tech>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Oleksii Moisieiev" <oleksii_moisieiev@epam.com>,
	"Timothy Pearson" <tpearson@raptorengineering.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Connor Davis" <connojdavis@gmail.com>,
	"Oleksii Kurochko" <oleksii.kurochko@gmail.com>,
	"Teddy Astie" <teddy.astie@vates.tech>
Subject: Re: [PATCH v3 4/6] xen/arm: remove XEN_DOMCTL_CONFIG_GIC_NATIVE from the ABI
Date: Tue, 11 Aug 2026 14:54:24 +0100	[thread overview]
Message-ID: <9a3d991c-9b14-4614-8010-e2e03aabcc14@citrix.com> (raw)
In-Reply-To: <1784211105.8631fc262581453bbf619ec5b2062170.19f6b44e7b5000edb5@vates.tech>

On 16/07/2026 3:11 pm, Julian Vetter wrote:
> Now that the toolstack always resolves a concrete GIC_V2 or GIC_V3
> before calling createdomain, nothing on the Xen side needs to resolve
> GIC_NATIVE either:
>
>  * A new gic_domctl_version() helper returns the XEN_DOMCTL_CONFIG_GIC_*
>    value matching the host's gic_hw_version().
>  * arch_sanitise_domain_config() uses it to validate that the requested
>    version is compatible with the hardware, rather than resolving
>    GIC_NATIVE and writing the result back into config->arch.gic_version.
>    There's currently no support to run a guest on a GIC version other
>    than the host's, so this is just an equality check.
>  * create_dom0() and arch_parse_dom0less_node(), which both always want
>    a vGIC that exactly matches the hardware, use the same helper instead
>    of GIC_NATIVE.
>
> With nothing left resolving or relying on it, drop
> XEN_DOMCTL_CONFIG_GIC_NATIVE from the public ABI. Every caller must now
> request a concrete GIC_V2 or GIC_V3.
>
> This is an incompatible change for any toolstack still passing 0
> (formerly GIC_NATIVE) expecting Xen to auto-select a version, so bump
> XEN_DOMCTL_INTERFACE_VERSION and add a CHANGELOG.md entry.

This is an API change, not an ABI change, so you can leave the
XEN_DOMCTL_INTERFACE_VERSION alone.

>
> Signed-off-by: Julian Vetter <julian.vetter@vates.tech>
> ---
> Changes in v3:
> - Second half of previous patch 3, with only the changes to Xen
> ---
>  CHANGELOG.md                   |  3 +++
>  xen/arch/arm/dom0less-build.c  |  3 ++-
>  xen/arch/arm/domain.c          | 25 +++++++++----------------
>  xen/arch/arm/domain_build.c    |  3 ++-
>  xen/arch/arm/gic.c             | 16 ++++++++++++++++
>  xen/arch/arm/include/asm/gic.h |  6 ++++++
>  xen/include/public/arch-arm.h  |  1 -
>  xen/include/public/domctl.h    |  4 ++--
>  8 files changed, 40 insertions(+), 21 deletions(-)
>
> diff --git a/CHANGELOG.md b/CHANGELOG.md
> index 356be88351..74f02e91db 100644
> --- a/CHANGELOG.md
> +++ b/CHANGELOG.md
> @@ -13,6 +13,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
>  ### Added
>  
>  ### Removed
> + - On Arm:
> +   - XEN_DOMCTL_CONFIG_GIC_NATIVE has been removed.  Toolstacks must now
> +     explicitly request GIC_V2 or GIC_V3 when creating a domain.

"Available GIC versions can be queried via XEN_SYSCTL_physinfo."

> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index baa3a5d708..b396d5e615 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -609,23 +609,16 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
>          return -EINVAL;
>      }
>  
> -    /* Fill in the native GIC version, passed back to the toolstack. */
> -    if ( config->arch.gic_version == XEN_DOMCTL_CONFIG_GIC_NATIVE )
> +    /*
> +     * The toolstack must pick a specific GIC version. Xen doesn't choose on
> +     * its behalf. It only checks the requested version matches what the
> +     * hardware actually has. There's currently no support to run a guest on a
> +     * GIC version other than the host's.

This is path is used by Xen too, so "toolstack" isn't right. 

Really, this only wants to be the final sentence.  Everything else is
trivially clear from the following logic.

> +     */
> +    if ( config->arch.gic_version != gic_domctl_version() )
>      {
> -        switch ( gic_hw_version() )
> -        {
> -        case GIC_V2:
> -            config->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_V2;
> -            break;
> -
> -        case GIC_V3:
> -            config->arch.gic_version = XEN_DOMCTL_CONFIG_GIC_V3;
> -            break;
> -
> -        default:
> -            ASSERT_UNREACHABLE();
> -            return -EINVAL;
> -        }
> +        dprintk(XENLOG_INFO, "Unsupported GIC version\n");

"Unsupported GIC version %d\n"

When complaining that a value is wrong, state what it is.  That's far
more useful than "something went wrong".  In particular, finding 0 in
this error message means that some caller hasn't been updated to avoid
passing NATIVE.

> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index 7d6f87e8b2..6987f5bdf4 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -319,7 +319,6 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
>   * struct xen_arch_domainconfig's ABI is covered by
>   * XEN_DOMCTL_INTERFACE_VERSION.
>   */
> -#define XEN_DOMCTL_CONFIG_GIC_NATIVE    0

We tend leave bredcrumbs around when removing constants.

/*      XEN_DOMCTL_CONFIG_GIC_NATIVE    1 - removed in Xen 4.23 */

~Andrew


  reply	other threads:[~2026-08-11 13:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 14:06 [PATCH v3 0/6] Fix ARM domcreate Julian Vetter
2026-07-16 14:11 ` [PATCH v3 1/6] xen/arm: report proper GIC version via XEN_DOMCTL_getdomaininfo Julian Vetter
2026-08-17 12:19   ` Orzel, Michal
     [not found] ` <20260716141138.88265-1-julian.vetter@vates.tech>
2026-07-16 14:11   ` [PATCH v3 2/6] ARM/sysctl: Expose the supported guest GIC modes in physinfo Julian Vetter
2026-08-11 13:38     ` Andrew Cooper
2026-08-17 12:39     ` Orzel, Michal
2026-08-17 13:08       ` Andrew Cooper
2026-08-17 14:36         ` Orzel, Michal
2026-07-16 14:11   ` [PATCH v3 3/6] tools/arm: choose GIC version explicitly instead of relying on GIC_NATIVE Julian Vetter
2026-08-11 13:43     ` Andrew Cooper
2026-07-16 14:11   ` [PATCH v3 4/6] xen/arm: remove XEN_DOMCTL_CONFIG_GIC_NATIVE from the ABI Julian Vetter
2026-08-11 13:54     ` Andrew Cooper [this message]
2026-07-16 14:11   ` [PATCH v3 5/6] xen/arm: report clock_frequency via sysctl physinfo, not createdomain Julian Vetter
2026-07-16 14:38     ` Jan Beulich
2026-07-16 14:11   ` [PATCH v3 6/6] xen: make config argument const Julian Vetter
2026-08-11 13:59     ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a3d991c-9b14-4614-8010-e2e03aabcc14@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=alistair.francis@wdc.com \
    --cc=andriy.sultanov@vates.tech \
    --cc=anthony.perard@vates.tech \
    --cc=bertrand.marquis@arm.com \
    --cc=connojdavis@gmail.com \
    --cc=guillaume.thouvenin@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julian.vetter@vates.tech \
    --cc=julien@xen.org \
    --cc=marmarek@invisiblethingslab.com \
    --cc=michal.orzel@amd.com \
    --cc=oleksii.kurochko@gmail.com \
    --cc=oleksii_moisieiev@epam.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=teddy.astie@vates.tech \
    --cc=tpearson@raptorengineering.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.