xen/arm: introduce legacy dom0less option for xenstore allocation

The new xenstore page allocation scheme might break older unpatched
Linux kernels that do not check for the Xenstore connection status
before proceeding with Xenstore initialization.

Introduce a dom0less configuration option to retain the older behavior.

The older behavior triggered by this option is to allocate the xenstore
page in init-dom0less. That does not work with static-mem guests.
However, it will make it possible to run as regular guests older Linux
kernel versions that are left unpatched.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
Stefano Stabellini committed 2025-03-03 16:05:13 -08:00
1 parent 56b8e80812
commit 0e2bb9d9b1
3 files changed
+48 -16

No files matched your search

+5
View File
@@ -222,6 +222,11 @@ with the following properties:
Xen PV interfaces, including grant-table and xenstore, will be
enabled for the VM.
- "legacy"
Same as above, but the way the xenstore page is allocated is not
compatible with static-mem guests. On the other hand, it works with
older Linux kernels.
- "disabled"
Xen PV interfaces are disabled.
+32 -13
View File
@@ -755,6 +755,30 @@ static int __init alloc_xenstore_page(struct domain *d)
return 0;
}
static int __init alloc_xenstore_params(struct kernel_info *kinfo)
{
struct domain *d = kinfo->d;
int rc = 0;
if ( kinfo->dom0less_feature & (DOM0LESS_XENSTORE | DOM0LESS_XS_LEGACY) )
{
ASSERT(hardware_domain);
rc = alloc_xenstore_evtchn(d);
if ( rc < 0 )
return rc;
d->arch.hvm.params[HVM_PARAM_STORE_PFN] = ~0ULL;
}
if ( kinfo->dom0less_feature & DOM0LESS_XENSTORE )
{
rc = alloc_xenstore_page(d);
if ( rc < 0 )
return rc;
}
return rc;
}
static int __init construct_domU(struct domain *d,
const struct dt_device_node *node)
{
@@ -800,6 +824,13 @@ static int __init construct_domU(struct domain *d,
else
panic("At the moment, Xenstore support requires dom0 to be present\n");
}
else if ( rc == 0 && !strcmp(dom0less_enhanced, "legacy") )
{
if ( hardware_domain )
kinfo.dom0less_feature = DOM0LESS_ENHANCED_LEGACY;
else
panic("At the moment, Xenstore support requires dom0 to be present\n");
}
else if ( rc == 0 && !strcmp(dom0less_enhanced, "no-xenstore") )
kinfo.dom0less_feature = DOM0LESS_ENHANCED_NO_XS;
@@ -849,19 +880,7 @@ static int __init construct_domU(struct domain *d,
if ( rc < 0 )
return rc;
if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE )
{
ASSERT(hardware_domain);
rc = alloc_xenstore_evtchn(d);
if ( rc < 0 )
return rc;
rc = alloc_xenstore_page(d);
if ( rc < 0 )
return rc;
}
return rc;
return alloc_xenstore_params(&kinfo);
}
void __init create_domUs(void)
+11 -3
View File
@@ -17,16 +17,24 @@
* default features (excluding Xenstore) will be
* available. Note that an OS *must* not rely on the
* availability of Xen features if this is not set.
* DOM0LESS_XENSTORE: Xenstore will be enabled for the VM. This feature
* can't be enabled without the
* DOM0LESS_ENHANCED_NO_XS.
* DOM0LESS_XENSTORE: Xenstore will be enabled for the VM. The
* xenstore page allocation is done by Xen at
* domain creation. This feature can't be
* enabled without the DOM0LESS_ENHANCED_NO_XS.
* DOM0LESS_XS_LEGACY Xenstore will be enabled for the VM, the
* xenstore page allocation will happen in
* init-dom0less. This feature can't be enabled
* without the DOM0LESS_ENHANCED_NO_XS.
* DOM0LESS_ENHANCED: Notify the OS it is running on top of Xen. All the
* default features (including Xenstore) will be
* available. Note that an OS *must* not rely on the
* availability of Xen features if this is not set.
* DOM0LESS_ENHANCED_LEGACY: Same as before, but using DOM0LESS_XS_LEGACY.
*/
#define DOM0LESS_ENHANCED_NO_XS BIT(0, U)
#define DOM0LESS_XENSTORE BIT(1, U)
#define DOM0LESS_XS_LEGACY BIT(2, U)
#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XS_LEGACY)
#define DOM0LESS_ENHANCED (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENSTORE)
struct kernel_info {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.