Nothing changed. Only some functions declaration are moved to asm-generic
header as they are expected to be used by common code of domain builing or
dom0less.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
xen/arch/arm/include/asm/domain_build.h | 19 ++----------
xen/include/asm-generic/domain-build.h | 41 +++++++++++++++++++++++++
2 files changed, 43 insertions(+), 17 deletions(-)
create mode 100644 xen/include/asm-generic/domain-build.h
diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include/asm/domain_build.h
index 5d77af2e8b..ad5a3ddc37 100644
--- a/xen/arch/arm/include/asm/domain_build.h
+++ b/xen/arch/arm/include/asm/domain_build.h
@@ -4,28 +4,13 @@
#include <xen/sched.h>
#include <asm/kernel.h>
+#include <asm-generic/domain-build.h>
+
typedef __be32 gic_interrupt_t[3];
-typedef bool (*alloc_domheap_mem_cb)(struct domain *d, struct page_info *pg,
- unsigned int order, void *extra);
-bool allocate_domheap_memory(struct domain *d, paddr_t tot_size,
- alloc_domheap_mem_cb cb, void *extra);
-bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
- paddr_t tot_size);
-void allocate_memory(struct domain *d, struct kernel_info *kinfo);
-int construct_domain(struct domain *d, struct kernel_info *kinfo);
int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
-int make_chosen_node(const struct kernel_info *kinfo);
-int make_cpus_node(const struct domain *d, void *fdt);
-int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo,
- int addrcells, int sizecells);
-int make_memory_node(const struct kernel_info *kinfo, int addrcells,
- int sizecells, const struct membanks *mem);
int make_psci_node(void *fdt);
-int make_timer_node(const struct kernel_info *kinfo);
void evtchn_allocate(struct domain *d);
-unsigned int get_allocation_size(paddr_t size);
-
/*
* handle_device_interrupts retrieves the interrupts configuration from
* a device tree node and maps those interrupts to the target domain.
diff --git a/xen/include/asm-generic/domain-build.h b/xen/include/asm-generic/domain-build.h
new file mode 100644
index 0000000000..237f94d0c3
--- /dev/null
+++ b/xen/include/asm-generic/domain-build.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __ASM_GENERIC_DOMAIN_BUILD_H__
+#define __ASM_GENERIC_DOMAIN_BUILD_H__
+
+#include <xen/types.h>
+
+struct domain;
+struct page_info;
+struct kernel_info;
+struct membanks;
+
+typedef bool (*alloc_domheap_mem_cb)(struct domain *d, struct page_info *pg,
+ unsigned int order, void *extra);
+bool allocate_domheap_memory(struct domain *d, paddr_t tot_size,
+ alloc_domheap_mem_cb cb, void *extra);
+
+bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn,
+ paddr_t tot_size);
+void allocate_memory(struct domain *d, struct kernel_info *kinfo);
+int construct_domain(struct domain *d, struct kernel_info *kinfo);
+int make_chosen_node(const struct kernel_info *kinfo);
+int make_cpus_node(const struct domain *d, void *fdt);
+int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo,
+ int addrcells, int sizecells);
+int make_memory_node(const struct kernel_info *kinfo, int addrcells,
+ int sizecells, const struct membanks *mem);
+int make_timer_node(const struct kernel_info *kinfo);
+
+unsigned int get_allocation_size(paddr_t size);
+
+
+#endif /* __ASM_GENERIC_DOMAIN_BUILD_H__ */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
2.47.1
On 08.01.2025 12:13, Oleksii Kurochko wrote: > Nothing changed. Only some functions declaration are moved to asm-generic > header as they are expected to be used by common code of domain builing or > dom0less. > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> > --- > xen/arch/arm/include/asm/domain_build.h | 19 ++---------- > xen/include/asm-generic/domain-build.h | 41 +++++++++++++++++++++++++ > 2 files changed, 43 insertions(+), 17 deletions(-) > create mode 100644 xen/include/asm-generic/domain-build.h Again I question this movement under this name. "Domain building" is a pretty generic thing, yes, but what you move would e.g. be entirely inapplicable on x86 (as it is now). For example ... > --- /dev/null > +++ b/xen/include/asm-generic/domain-build.h > @@ -0,0 +1,41 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef __ASM_GENERIC_DOMAIN_BUILD_H__ > +#define __ASM_GENERIC_DOMAIN_BUILD_H__ > + > +#include <xen/types.h> > + > +struct domain; > +struct page_info; > +struct kernel_info; > +struct membanks; > + > +typedef bool (*alloc_domheap_mem_cb)(struct domain *d, struct page_info *pg, > + unsigned int order, void *extra); > +bool allocate_domheap_memory(struct domain *d, paddr_t tot_size, > + alloc_domheap_mem_cb cb, void *extra); > + > +bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn, > + paddr_t tot_size); ... the term "bank" seems pretty closely tied to DT. Other stuff ... > +void allocate_memory(struct domain *d, struct kernel_info *kinfo); > +int construct_domain(struct domain *d, struct kernel_info *kinfo); > +int make_chosen_node(const struct kernel_info *kinfo); > +int make_cpus_node(const struct domain *d, void *fdt); > +int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo, > + int addrcells, int sizecells); > +int make_memory_node(const struct kernel_info *kinfo, int addrcells, > + int sizecells, const struct membanks *mem); > +int make_timer_node(const struct kernel_info *kinfo); ... here also falls in this category. Stuff like this may well live under asm-generic/, but the file name chosen then needs to reflect constraints. > +unsigned int get_allocation_size(paddr_t size); > + > + Nit: As before - no double blank lines please. Jan
On 1/27/25 12:23 PM, Jan Beulich wrote: > On 08.01.2025 12:13, Oleksii Kurochko wrote: >> Nothing changed. Only some functions declaration are moved to asm-generic >> header as they are expected to be used by common code of domain builing or >> dom0less. >> >> Signed-off-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> >> --- >> xen/arch/arm/include/asm/domain_build.h | 19 ++---------- >> xen/include/asm-generic/domain-build.h | 41 +++++++++++++++++++++++++ >> 2 files changed, 43 insertions(+), 17 deletions(-) >> create mode 100644 xen/include/asm-generic/domain-build.h > Again I question this movement under this name. "Domain building" is a pretty > generic thing, yes, but what you move would e.g. be entirely inapplicable on > x86 (as it is now). For example ... > >> --- /dev/null >> +++ b/xen/include/asm-generic/domain-build.h >> @@ -0,0 +1,41 @@ >> +/* SPDX-License-Identifier: GPL-2.0-only */ >> +#ifndef __ASM_GENERIC_DOMAIN_BUILD_H__ >> +#define __ASM_GENERIC_DOMAIN_BUILD_H__ >> + >> +#include <xen/types.h> >> + >> +struct domain; >> +struct page_info; >> +struct kernel_info; >> +struct membanks; >> + >> +typedef bool (*alloc_domheap_mem_cb)(struct domain *d, struct page_info *pg, >> + unsigned int order, void *extra); >> +bool allocate_domheap_memory(struct domain *d, paddr_t tot_size, >> + alloc_domheap_mem_cb cb, void *extra); >> + >> +bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn, >> + paddr_t tot_size); > ... the term "bank" seems pretty closely tied to DT. Other stuff ... > >> +void allocate_memory(struct domain *d, struct kernel_info *kinfo); >> +int construct_domain(struct domain *d, struct kernel_info *kinfo); >> +int make_chosen_node(const struct kernel_info *kinfo); >> +int make_cpus_node(const struct domain *d, void *fdt); >> +int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo, >> + int addrcells, int sizecells); >> +int make_memory_node(const struct kernel_info *kinfo, int addrcells, >> + int sizecells, const struct membanks *mem); >> +int make_timer_node(const struct kernel_info *kinfo); > ... here also falls in this category. Stuff like this may well live > under asm-generic/, but the file name chosen then needs to reflect > constraints. Unfortunately, at least at the moment, this is not applicable to x86. Partially, domain_build.h was chosen to have less changes in Arm code. Would it be better to use domain-build-dt.h? ~ Oleksii
On 03.02.2025 16:50, Oleksii Kurochko wrote: > On 1/27/25 12:23 PM, Jan Beulich wrote: >> On 08.01.2025 12:13, Oleksii Kurochko wrote: >>> Nothing changed. Only some functions declaration are moved to asm-generic >>> header as they are expected to be used by common code of domain builing or >>> dom0less. >>> >>> Signed-off-by: Oleksii Kurochko<oleksii.kurochko@gmail.com> >>> --- >>> xen/arch/arm/include/asm/domain_build.h | 19 ++---------- >>> xen/include/asm-generic/domain-build.h | 41 +++++++++++++++++++++++++ >>> 2 files changed, 43 insertions(+), 17 deletions(-) >>> create mode 100644 xen/include/asm-generic/domain-build.h >> Again I question this movement under this name. "Domain building" is a pretty >> generic thing, yes, but what you move would e.g. be entirely inapplicable on >> x86 (as it is now). For example ... >> >>> --- /dev/null >>> +++ b/xen/include/asm-generic/domain-build.h >>> @@ -0,0 +1,41 @@ >>> +/* SPDX-License-Identifier: GPL-2.0-only */ >>> +#ifndef __ASM_GENERIC_DOMAIN_BUILD_H__ >>> +#define __ASM_GENERIC_DOMAIN_BUILD_H__ >>> + >>> +#include <xen/types.h> >>> + >>> +struct domain; >>> +struct page_info; >>> +struct kernel_info; >>> +struct membanks; >>> + >>> +typedef bool (*alloc_domheap_mem_cb)(struct domain *d, struct page_info *pg, >>> + unsigned int order, void *extra); >>> +bool allocate_domheap_memory(struct domain *d, paddr_t tot_size, >>> + alloc_domheap_mem_cb cb, void *extra); >>> + >>> +bool allocate_bank_memory(struct kernel_info *kinfo, gfn_t sgfn, >>> + paddr_t tot_size); >> ... the term "bank" seems pretty closely tied to DT. Other stuff ... >> >>> +void allocate_memory(struct domain *d, struct kernel_info *kinfo); >>> +int construct_domain(struct domain *d, struct kernel_info *kinfo); >>> +int make_chosen_node(const struct kernel_info *kinfo); >>> +int make_cpus_node(const struct domain *d, void *fdt); >>> +int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo, >>> + int addrcells, int sizecells); >>> +int make_memory_node(const struct kernel_info *kinfo, int addrcells, >>> + int sizecells, const struct membanks *mem); >>> +int make_timer_node(const struct kernel_info *kinfo); >> ... here also falls in this category. Stuff like this may well live >> under asm-generic/, but the file name chosen then needs to reflect >> constraints. > > Unfortunately, at least at the moment, this is not applicable to x86. > > Partially, domain_build.h was chosen to have less changes in Arm code. > > Would it be better to use domain-build-dt.h? That would at least be a more specific name. Yet then - why put such under asm-generic/ ? This stuff isn't truly generic (as in: any arch can fall back to using this). Personally I'd rather expect such stuff to live under e.g. include/xen/device-tree/. That would make it clear that environments using DT may consider using it, but other environment shouldn't. Jan
© 2016 - 2025 Red Hat, Inc.