Commit Graph
19 Commits
Author SHA1 Message Date
Alejandro Vallejo ac4151201b bootfdt: Add createdomain arguments to boot_domain
Add the arguments that create_domain() takes to boot_domain. This creates
a consistent place to drop the outputs of the dom0less bindings.

Not a functional change. Later patches use these fields as the outputs of
the dom0less parsing functions.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Acked-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
2025-07-23 13:35:48 -07:00
Alejandro Vallejo fcf967c59f dom0less: Move asm-generic/dom0less-build.h -> xen/dom0less-build.h
It's meant to be usable by anyone with CONFIG_DOM0LESS_BOOT.

While moving, replace an inclusion of public/domctl.h by a forward
declaration.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-23 13:35:42 -07:00
Alejandro Vallejo 6648d7f919 dt: Add cf_check to device-tree.c function pointers
In preparation for it to be usable on x86 with IBT, tag targets of
function pointers with cf_check

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Acked-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
2025-07-23 13:35:28 -07:00
Alejandro Vallejo 2acc878f77 xen/dt: Allow CONFIG_DEVICE_TREE_PARSE to include device-tree/
This allows bootfdt.c and device-tree.c to be usable without
CONFIG_HAS_DEVICE_TREE_DISCOVERY.

Gate everything else on CONFIG_HAS_DEVICE_TREE_DISCOVERY.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-21 17:17:26 -07:00
Alejandro Vallejo 4df98cabf6 xen/dt: ifdef out DEV_DT-related bits from device_tree.{c,h}
Architectures that don't discover devices via DT may skip anything to
do with device_t during the DT unflattening phase. Make device-tree.c
stop requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY so it may function with
CONFIG_DEVICE_TREE_PARSE alone.

This allows CONFIG_DEVICE_TREE_PARSE to unflatten a DT ignoring its
devices if CONFIG_HAS_DEVICE_TREE_DISCOVERY is not selected.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-21 17:14:07 -07:00
Alejandro Vallejo 215fd869b2 xen: Split HAS_DEVICE_TREE in two
Moving forward the idea is for there to be:

  1. Basic DT support: used by dom0less/hyperlaunch.
  2. Full DT support: used for device discovery and HW setup.

Rename HAS_DEVICE_TREE to HAS_DEVICE_TREE_DISCOVERY to describe (2) and
create a new DEVICE_TREE_PARSE to describe (1).

Have DEVICE_TREE_PARSE selected by both HAS_DEVICE_TREE_DISCOVERY and
DOM0LESS_BOOT.

Add a dependency on STATIC_MEMORY for discovery, as it relies on
the memory map itself being described on the DTB.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com> #iommu
Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> # riscv
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
2025-07-21 17:14:05 -07:00
Alejandro Vallejo ae96841fff xen/dt: Extract helper to map nodes to module kinds
This will be required later by x86 code in order to do early identification
of boot modules when booting off a DTB.

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-21 17:14:04 -07:00
Alejandro Vallejo 7fa7cb95dc xen/dt: Extract bootinfo-independent functions to bootfdt.c
Move all functions independent of "struct bootinfo" back to bootfdt.c

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
2025-07-21 17:14:03 -07:00
Alejandro Vallejo 481f427d5e xen/dt: Rename bootfdt.c -> bootinfo-fdt.c
bootinfo-fdt.c will eventually contain bootfdt helpers that make heavy
use of bootinfo. To simplify git history do the rename here explicitly.
A later patch extracts bootinfo-independent helpers into bootfdt.c.

Doing so here would needlessly pollute the diffs.

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
2025-07-21 17:14:03 -07:00
Alejandro Vallejo ac1fd5b9e3 xen/dt: Move bootinfo functions to a new bootinfo.h
Part of an unpicking process to extract bootfdt contents independent of
bootinfo to a separate file for x86 to take.

With this, bootfdt.h can be cleanly included from x86. A later patch
extracts the definitions so the functions may be called too.

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> # riscv
2025-07-21 17:14:02 -07:00
Alejandro Vallejo f52ff91ebd xen/dt: Move bootfdt functions to xen/bootfdt.h
Part of an unpicking process to extract bootfdt contents independent of bootinfo
to a separate file for x86 to take.

Move functions required for early FDT parsing from device_tree.h and arm's
setup.h onto bootfdt.h

Declaration motion only. Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> # riscv
2025-07-21 17:14:02 -07:00
Alejandro Vallejo 87e0ea6155 x86: Replace arch-specific boot_domain with the common one
No functional change intended.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-07-21 17:14:01 -07:00
Alejandro Vallejo cf52fe3f63 xen: Refactor kernel_info to have a header like boot_domain
Create a struct field within kernel_info with the contents common to
kernel_info and boot_domain, and define that field in common code. This
enables x86 to use that field as-is and drop x86's boot_domain.

Note that x86 mutates the module when releasing it, calculating headroom,
etc. So they must be made non-const on move.

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
2025-07-21 17:14:00 -07:00
Alejandro Vallejo 9a1b705540 x86: Replace arch-specific boot_module with common one
These types resemble each other very closely in layout and intent,
and with "struct boot_module" already in common code it makes perfect
sense to merge them. In order to do so, rename identical fields with
conflicting names.

While doing this, s/BOOTMOD_XSM/BOOTMOD_XSM_POLICY/, as it was on x86.
XSM doesn't support external modules, so don't let the name imply it
through ambiguity.

No functional change intended.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
2025-07-21 17:13:51 -07:00
Alejandro Vallejo cb5dcad327 arm: Remove alloc_dom0_vcpu0()
It's a straight vcpu_create(), so the alloc_dom0_vcpu0() call is
irrelevant.

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-17 17:05:07 -07:00
Alejandro Vallejo 0b8604a71b dom0less: Move single-xenstore check from bindings to set_xs_domain()
Later patches extract the bindings to a separate file, where that global
won't be available. Make the check when calling the function instead so
the bindings remain agnostic.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
Reviewed-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-17 16:54:02 -07:00
Alejandro Vallejo df21f7d172 x86: Prefer d->max_vcpus to dom0_max_vcpus()
These days d->max_vcpus is populated on domain_create(), so use that
instead and avoid a function call.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
2025-07-17 08:57:58 +02:00
Alejandro Vallejo 2da5f616e0 dom0less: Fix LLC coloring when mixing colored and non-colored domains
llc_colors_str being outside the main loop makes domains without
explicit coloring inherit the colors of the last colored domain parsed.

Move it inside so that's no longer the case.

Fixes: 5948dc16759c("xen/arm: add support for cache coloring...")
Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-16 18:05:20 -07:00
Alejandro Vallejo 321de728d2 xen: Conditionally compile out the boot_module.domU
... based on CONFIG_X86. x86 won't depend on it, and it'll only be used
by the domain builder in common/device-tree/

Moving it to an arch-specific subfield (as introduced in a later patch)
is unwieldy, because all other arches depend on it.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Reviewed-by: Denis Mukhin <dmukhin@ford.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2025-07-10 13:41:35 +02:00