[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 08/23] vixen: allow dom0 to be created with a domid != 0
From: Anthony Liguori <aliguori@xxxxxxxxxx> Some older guests special case domid=0 instead of checking the shared info flags so in order to get PV drivers loaded properly, we need to make the guest always appear with a domid != 0. While the Vixen domain is the hardware domain, we don't want it to behave that way so we also modify the is_hardware_domain() check. Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx> --- v1 -> v2 - allow vixen domain id to be overridden via the Xen command line --- xen/arch/x86/dom0_build.c | 2 +- xen/arch/x86/guest/vixen.c | 7 +++++++ xen/arch/x86/setup.c | 2 +- xen/common/domain.c | 4 ++-- xen/include/asm-arm/guest/vixen.h | 5 +++++ xen/include/asm-x86/guest/vixen.h | 2 ++ xen/include/xen/sched.h | 6 +++++- 7 files changed, 23 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index bf992fe..88810db 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -469,7 +469,7 @@ int __init construct_dom0(struct domain *d, const module_t *image, int rc; /* Sanity! */ - BUG_ON(d->domain_id != 0); + BUG_ON(d->domain_id != dom0_domid); BUG_ON(d->vcpu[0] == NULL); BUG_ON(d->vcpu[0]->is_initialised); diff --git a/xen/arch/x86/guest/vixen.c b/xen/arch/x86/guest/vixen.c index d82e68f..c0a81dd 100644 --- a/xen/arch/x86/guest/vixen.c +++ b/xen/arch/x86/guest/vixen.c @@ -22,9 +22,16 @@ #include <asm/guest/vixen.h> static int in_vixen; +static int vixen_domid = 1; + +integer_param("vixen_domid", vixen_domid); bool is_vixen(void) { return in_vixen > 0; } +int vixen_get_domid(void) +{ + return vixen_domid; +} diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 7627c3f..f9d087e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1591,7 +1591,7 @@ void __init noreturn __start_xen(unsigned long mbi_p) } /* Create initial domain 0. */ - dom0 = domain_create(0, domcr_flags, 0, &config); + dom0 = domain_create(dom0_domid, domcr_flags, 0, &config); if ( IS_ERR(dom0) || (alloc_dom0_vcpu0(dom0) == NULL) ) panic("Error creating domain 0"); diff --git a/xen/common/domain.c b/xen/common/domain.c index 7af8d12..b4d679e 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -202,7 +202,7 @@ static int late_hwdom_init(struct domain *d) struct domain *dom0; int rv; - if ( d != hardware_domain || d->domain_id == 0 ) + if ( d != hardware_domain || d->domain_id == dom0_domid ) return 0; rv = xsm_init_hardware_domain(XSM_HOOK, d); @@ -310,7 +310,7 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags, else d->guest_type = guest_type_pv; - if ( domid == 0 || domid == hardware_domid ) + if ( domid == dom0_domid || domid == hardware_domid ) { if ( hardware_domid < 0 || hardware_domid >= DOMID_FIRST_RESERVED ) panic("The value of hardware_dom must be a valid domain ID"); diff --git a/xen/include/asm-arm/guest/vixen.h b/xen/include/asm-arm/guest/vixen.h index ade6724..cb51698 100644 --- a/xen/include/asm-arm/guest/vixen.h +++ b/xen/include/asm-arm/guest/vixen.h @@ -78,4 +78,9 @@ static inline bool vixen_ring_process(uint16_t port) return false; } +static inline int vixen_get_domid(void) +{ + return 0; +} + #endif diff --git a/xen/include/asm-x86/guest/vixen.h b/xen/include/asm-x86/guest/vixen.h index be90c46..4e80b76 100644 --- a/xen/include/asm-x86/guest/vixen.h +++ b/xen/include/asm-x86/guest/vixen.h @@ -70,4 +70,6 @@ HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args) bool is_vixen(void); +int vixen_get_domid(void); + #endif diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 002ba29..5ddf6a2 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -27,6 +27,8 @@ #include <public/vcpu.h> #include <public/vm_event.h> #include <public/event_channel.h> +#include <asm/guest.h> +#include <asm/guest/vixen.h> #ifdef CONFIG_COMPAT #include <compat/vcpu.h> @@ -54,6 +56,8 @@ extern domid_t hardware_domid; #define hardware_domid 0 #endif +#define dom0_domid (is_vixen() ? vixen_get_domid() : 0) + #ifndef CONFIG_COMPAT #define BITS_PER_EVTCHN_WORD(d) BITS_PER_XEN_ULONG #else @@ -873,7 +877,7 @@ void watchdog_domain_destroy(struct domain *d); * (that is, this would not be suitable for a driver domain) * - There is never a reason to deny the hardware domain access to this */ -#define is_hardware_domain(_d) ((_d) == hardware_domain) +#define is_hardware_domain(_d) (!is_vixen() && ((_d) == hardware_domain)) /* This check is for functionality specific to a control domain */ #define is_control_domain(_d) ((_d)->is_privileged) -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |