On 5/5/25 12:46 PM, Oleksii Kurochko wrote:


On 5/2/25 10:53 PM, Stefano Stabellini wrote:
On Fri, 2 May 2025, Oleksii Kurochko wrote:
Part of Arm's dom0less-build.c could be common between architectures which are
using device tree files to create guest domains. Thereby move some parts of
Arm's dom0less-build.c to common code with minor changes.

As a part of theses changes the following changes are introduced:
- Introduce make_arch_nodes() to cover arch-specific nodes. For example, in
   case of Arm, it is PSCI and vpl011 nodes.
- Introduce set_domain_type() to abstract a way how setting of domain type
   happens. For example, RISC-V won't have this member of arch_domain structure
   as vCPUs will always have the same bitness as hypervisor. In case of Arm, it
   is possible that Arm64 could create 32-bit and 64-bit domains.
- Introduce init_vuart() to cover details of virtual uart initialization.
- Introduce init_intc_phandle() to cover some details of interrupt controller
   phandle initialization. As an example, RISC-V could have different name for
   interrupt controller node ( APLIC, PLIC, IMSIC, etc ) but the code in
   domain_handle_dtb_bootmodule() could handle only one interrupt controller
   node name.
- s/make_gic_domU_node/make_intc_domU_node as GIC is Arm specific naming and
   add prototype of make_intc_domU_node() to dom0less-build.h

The following functions are moved to xen/common/device-tree:
- Functions which are moved as is:
   - domain_p2m_pages().
   - handle_passthrough_prop().
   - handle_prop_pfdt().
   - scan_pfdt_node().
   - check_partial_fdt().
- Functions which are moved with some minor changes:
   - alloc_xenstore_evtchn():
     - ifdef-ing by CONFIG_HVM accesses to hvm.params.
   - prepare_dtb_domU():
     - ifdef-ing access to gnttab_{start,size} by CONFIG_GRANT_TABLE.
     - s/make_gic_domU_node/make_intc_domU_node.
     - Add call of make_arch_nodes().
- domain_handle_dtb_bootmodule():
   - hide details of interrupt controller phandle initialization by calling
     init_intc_phandle().
   - Update the comment above init_intc_phandle(): s/gic/interrupt controller.
- construct_domU():
   - ifdef-ing by CONFIG_HVM accesses to hvm.params.
   - Call init_vuart() to hide Arm's vpl011_init() details there.
   - Add call of set_domain_type() instead of setting kinfo->arch.type 
explicitly.

Some parts of dom0less-build.c are wraped by #ifdef CONFIG_STATIC_{SHMEM,MEMORY}
as not all archs support these configs.

Signed-off-by: Oleksii Kurochko<oleksii.kuroc...@gmail.com>
FYI for a possible follow-up patch (doesn't have to be done in this
patch), the following functions could now be static:

alloc_dom0_vcpu0
dom0_max_vcpus
I will make them static in follow-up patch in the next patch series version.

Oh, I just noticed that we can't make them static as there is none static 
declaration in
xen/domain.h

~ Oleksii

Reply via email to