mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen: introduce CONFIG_HAS_DOMAIN_TYPE
As domain type is part of common code now there is no any reason
to have architecture-specific set_domain_type() functions so
it is dropped.
Change the guard around access of kinfo->type to CONFIG_HAS_DOMAIN_TYPE
for consistency. Also, drop and add some parentheses to be aligned
with the similar if() below.
x86 with CONFIG_64BIT=y shouldn't use is_{32,64}bit_domain() as
x86 doesn't have support of CONFIG_HAS_DOMAIN_TYPE. Since x86_32 Xen no
longer builds, the fallback is currently only relevant for arm32.
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
bdb30883f3
commit
9f976dec03
13 files changed
+51
-53
No files matched your search
@@ -7,6 +7,7 @@ config ARM_64
|
||||
def_bool y
|
||||
depends on !ARM_32
|
||||
select 64BIT
|
||||
select HAS_DOMAIN_TYPE
|
||||
select HAS_FAST_MULTIPLY
|
||||
select HAS_VPCI_GUEST_SUPPORT if PCI_PASSTHROUGH
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ static long switch_mode(struct domain *d, enum domain_type type)
|
||||
return -EINVAL;
|
||||
if ( domain_tot_pages(d) != 0 )
|
||||
return -EBUSY;
|
||||
if ( d->arch.type == type )
|
||||
if ( d->type == type )
|
||||
return 0;
|
||||
|
||||
d->arch.type = type;
|
||||
d->type = type;
|
||||
|
||||
if ( is_64bit_domain(d) )
|
||||
for_each_vcpu(d, v)
|
||||
|
||||
@@ -237,20 +237,6 @@ int __init make_arch_nodes(struct kernel_info *kinfo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* TODO: make arch.type generic ? */
|
||||
#ifdef CONFIG_ARM_64
|
||||
void __init set_domain_type(struct domain *d, struct kernel_info *kinfo)
|
||||
{
|
||||
/* type must be set before allocate memory */
|
||||
d->arch.type = kinfo->arch.type;
|
||||
}
|
||||
#else
|
||||
void __init set_domain_type(struct domain *d, struct kernel_info *kinfo)
|
||||
{
|
||||
/* Nothing to do */
|
||||
}
|
||||
#endif
|
||||
|
||||
int __init init_vuart(struct domain *d, struct kernel_info *kinfo,
|
||||
const struct dt_device_node *node)
|
||||
{
|
||||
|
||||
@@ -1771,15 +1771,15 @@ int __init construct_domain(struct domain *d, struct kernel_info *kinfo)
|
||||
BUG_ON(d->vcpu[0] == NULL);
|
||||
BUG_ON(v->is_initialised);
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
/* if aarch32 mode is not supported at EL1 do not allow 32-bit domain */
|
||||
if ( !(cpu_has_el1_32) && kinfo->arch.type == DOMAIN_32BIT )
|
||||
if ( !cpu_has_el1_32 && (kinfo->type == DOMAIN_32BIT) )
|
||||
{
|
||||
printk("Platform does not support 32-bit domain\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ( is_sve_domain(d) && (kinfo->arch.type == DOMAIN_32BIT) )
|
||||
if ( is_sve_domain(d) && (kinfo->type == DOMAIN_32BIT) )
|
||||
{
|
||||
printk("SVE is not available for 32-bit domain\n");
|
||||
return -EINVAL;
|
||||
@@ -1893,10 +1893,8 @@ int __init construct_hwdom(struct kernel_info *kinfo,
|
||||
|
||||
iommu_hwdom_init(d);
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
/* type must be set before allocate_memory */
|
||||
d->arch.type = kinfo->arch.type;
|
||||
#endif
|
||||
set_domain_type(d, kinfo);
|
||||
|
||||
find_gnttab_region(d, kinfo);
|
||||
if ( is_domain_direct_mapped(d) )
|
||||
allocate_memory_11(d, kinfo);
|
||||
|
||||
@@ -18,18 +18,6 @@ struct hvm_domain
|
||||
uint64_t params[HVM_NR_PARAMS];
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
enum domain_type {
|
||||
DOMAIN_32BIT,
|
||||
DOMAIN_64BIT,
|
||||
};
|
||||
#define is_32bit_domain(d) ((d)->arch.type == DOMAIN_32BIT)
|
||||
#define is_64bit_domain(d) ((d)->arch.type == DOMAIN_64BIT)
|
||||
#else
|
||||
#define is_32bit_domain(d) (1)
|
||||
#define is_64bit_domain(d) (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Is the domain using the host memory layout?
|
||||
*
|
||||
@@ -62,10 +50,6 @@ struct paging_domain {
|
||||
|
||||
struct arch_domain
|
||||
{
|
||||
#ifdef CONFIG_ARM_64
|
||||
enum domain_type type;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ARM64_SVE
|
||||
/* max SVE encoded vector length */
|
||||
uint8_t sve_vl;
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
|
||||
struct arch_kernel_info
|
||||
{
|
||||
#ifdef CONFIG_ARM_64
|
||||
enum domain_type type;
|
||||
#endif
|
||||
|
||||
/* Enable pl011 emulation */
|
||||
bool vpl011;
|
||||
};
|
||||
|
||||
@@ -100,8 +100,8 @@ static paddr_t __init kernel_zimage_place(struct kernel_info *info)
|
||||
const struct membanks *mem = kernel_info_get_mem(info);
|
||||
paddr_t load_addr;
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
if ( (info->arch.type == DOMAIN_64BIT) && (info->zimage.start == 0) )
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
if ( (info->type == DOMAIN_64BIT) && (info->zimage.start == 0) )
|
||||
return mem->bank[0].start + info->zimage.text_offset;
|
||||
#endif
|
||||
|
||||
@@ -268,14 +268,14 @@ int __init kernel_uimage_probe(struct kernel_info *info,
|
||||
|
||||
info->load = kernel_zimage_load;
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
switch ( uimage.arch )
|
||||
{
|
||||
case IH_ARCH_ARM:
|
||||
info->arch.type = DOMAIN_32BIT;
|
||||
info->type = DOMAIN_32BIT;
|
||||
break;
|
||||
case IH_ARCH_ARM64:
|
||||
info->arch.type = DOMAIN_64BIT;
|
||||
info->type = DOMAIN_64BIT;
|
||||
break;
|
||||
default:
|
||||
printk(XENLOG_ERR "Unsupported uImage arch type %d\n", uimage.arch);
|
||||
@@ -345,7 +345,7 @@ static int __init kernel_zimage64_probe(struct kernel_info *info,
|
||||
|
||||
info->load = kernel_zimage_load;
|
||||
|
||||
info->arch.type = DOMAIN_64BIT;
|
||||
info->type = DOMAIN_64BIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -396,8 +396,8 @@ static int __init kernel_zimage32_probe(struct kernel_info *info,
|
||||
|
||||
info->load = kernel_zimage_load;
|
||||
|
||||
#ifdef CONFIG_ARM_64
|
||||
info->arch.type = DOMAIN_32BIT;
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
info->type = DOMAIN_32BIT;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -128,6 +128,9 @@ config HAS_DEVICE_TREE_DISCOVERY
|
||||
config HAS_DOM0LESS
|
||||
bool
|
||||
|
||||
config HAS_DOMAIN_TYPE
|
||||
bool
|
||||
|
||||
config HAS_DIT # Data Independent Timing
|
||||
bool
|
||||
|
||||
|
||||
@@ -57,8 +57,6 @@ int init_vuart(struct domain *d, struct kernel_info *kinfo,
|
||||
int make_intc_domU_node(struct kernel_info *kinfo);
|
||||
int make_arch_nodes(struct kernel_info *kinfo);
|
||||
|
||||
void set_domain_type(struct domain *d, struct kernel_info *kinfo);
|
||||
|
||||
int init_intc_phandle(struct kernel_info *kinfo, const char *name,
|
||||
const int node_next, const void *pfdt);
|
||||
|
||||
|
||||
@@ -13,6 +13,19 @@ struct guest_area {
|
||||
void *map;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
enum __packed domain_type {
|
||||
DOMAIN_32BIT,
|
||||
DOMAIN_64BIT,
|
||||
};
|
||||
#define is_32bit_domain(d) ((d)->type == DOMAIN_32BIT)
|
||||
#define is_64bit_domain(d) ((d)->type == DOMAIN_64BIT)
|
||||
#elif !defined(CONFIG_64BIT)
|
||||
/* At the moment on 32-bit-only platforms all domains are 32-bit. */
|
||||
#define is_32bit_domain(d) true
|
||||
#define is_64bit_domain(d) false
|
||||
#endif
|
||||
|
||||
#include <asm/domain.h>
|
||||
|
||||
typedef union {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <xen/device_tree.h>
|
||||
#include <xen/fdt-kernel.h>
|
||||
#include <xen/mm.h>
|
||||
#include <xen/sched.h>
|
||||
#include <xen/types.h>
|
||||
|
||||
struct domain;
|
||||
@@ -69,6 +70,15 @@ static inline uint32_t alloc_phandle(struct kernel_info *kinfo)
|
||||
return kinfo->next_phandle >= GUEST_PHANDLE_GIC ? 0 : kinfo->next_phandle++;
|
||||
}
|
||||
|
||||
static inline void set_domain_type(struct domain *d, const struct kernel_info *kinfo)
|
||||
{
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
/* Type must be set before allocating memory. */
|
||||
ASSERT(!domain_tot_pages(d));
|
||||
d->type = kinfo->type;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __XEN_FDT_DOMAIN_BUILD_H__ */
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <xen/bootinfo.h>
|
||||
#include <xen/device_tree.h>
|
||||
#include <xen/domain.h>
|
||||
#include <xen/types.h>
|
||||
|
||||
#if __has_include(<asm/kernel.h>)
|
||||
@@ -65,6 +66,10 @@ struct kernel_info {
|
||||
} zimage;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
enum domain_type type;
|
||||
#endif
|
||||
|
||||
#if __has_include(<asm/kernel.h>)
|
||||
struct arch_kernel_info arch;
|
||||
#endif
|
||||
|
||||
@@ -386,6 +386,10 @@ struct domain
|
||||
{
|
||||
domid_t domain_id;
|
||||
|
||||
#ifdef CONFIG_HAS_DOMAIN_TYPE
|
||||
enum domain_type type;
|
||||
#endif
|
||||
|
||||
unsigned int max_vcpus;
|
||||
|
||||
uint64_t unique_id; /* Unique domain identifier */
|
||||
|
||||