|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v1 2/2] xen/domain: introduce generic weak function for domain struct allocation
From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
x86 has specific requirements about the allocation of the domain structure,
but that's not the case for ARM or likely other architectures.
Introduce a generic weak function that can be overwritten with an
architecture specific implementation if required.
No functional change intended.
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
Changes:
- Add Reviewed-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>.
- Add empty line before last return in alloc_domain_struct().
---
xen/arch/arm/domain.c | 12 ------------
xen/arch/ppc/stubs.c | 5 -----
xen/arch/riscv/stubs.c | 5 -----
xen/common/domain.c | 14 ++++++++++++++
4 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 45aeb8bddc..29588f869c 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -479,18 +479,6 @@ void startup_cpu_idle_loop(void)
reset_stack_and_jump(idle_loop);
}
-struct domain *alloc_domain_struct(void)
-{
- struct domain *d;
- BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
- d = alloc_xenheap_pages(0, 0);
- if ( d == NULL )
- return NULL;
-
- clear_page(d);
- return d;
-}
-
void free_domain_struct(struct domain *d)
{
free_xenheap_page(d);
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index 671e71aa0a..d999d22718 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -294,11 +294,6 @@ void vcpu_kick(struct vcpu *v)
BUG_ON("unimplemented");
}
-struct domain *alloc_domain_struct(void)
-{
- BUG_ON("unimplemented");
-}
-
struct vcpu *alloc_vcpu_struct(const struct domain *d)
{
BUG_ON("unimplemented");
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index e396b67cd3..155e5a7f58 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -268,11 +268,6 @@ void vcpu_kick(struct vcpu *v)
BUG_ON("unimplemented");
}
-struct domain *alloc_domain_struct(void)
-{
- BUG_ON("unimplemented");
-}
-
struct vcpu *alloc_vcpu_struct(const struct domain *d)
{
BUG_ON("unimplemented");
diff --git a/xen/common/domain.c b/xen/common/domain.c
index e566a18747..c134868e95 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -785,6 +785,20 @@ static int sanitise_domain_config(struct
xen_domctl_createdomain *config)
return arch_sanitise_domain_config(config);
}
+struct domain *__weak alloc_domain_struct(void)
+{
+ struct domain *d = alloc_xenheap_pages(0, 0);
+
+ BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE);
+
+ if ( !d )
+ return NULL;
+
+ clear_page(d);
+
+ return d;
+}
+
struct domain *domain_create(domid_t domid,
struct xen_domctl_createdomain *config,
unsigned int flags)
--
2.49.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |