@@ -25,8 +25,6 @@ struct map_range_data
struct rangeset *irq_ranges;
};
-extern domid_t max_init_domid;
-
void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
size_t estimate_efi_size(unsigned int mem_nr_banks);
@@ -60,8 +60,6 @@ struct cpuinfo_arm __read_mostly system_cpuinfo;
bool __read_mostly acpi_disabled;
#endif
-domid_t __read_mostly max_init_domid;
-
static __used void init_done(void)
{
int rc;
@@ -1,6 +1,4 @@
#ifndef __ASM_PPC_SETUP_H__
#define __ASM_PPC_SETUP_H__
-#define max_init_domid (0)
-
#endif /* __ASM_PPC_SETUP_H__ */
@@ -5,8 +5,6 @@
#include <xen/types.h>
-#define max_init_domid (0)
-
void setup_mm(void);
void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
@@ -69,6 +69,4 @@ extern bool opt_dom0_verbose;
extern bool opt_dom0_cpuid_faulting;
extern bool opt_dom0_msr_relaxed;
-#define max_init_domid (0)
-
#endif
@@ -111,6 +111,29 @@ int domid_alloc(int hint)
return domid;
}
+/*
+ * Retrieve the highest known non-system domain ID.
+ */
+domid_t domid_top(void)
+{
+ struct domain *d;
+ domid_t i = 0;
+
+ spin_lock(&domlist_update_lock);
+
+ for ( d = domain_list;
+ d && (d->domain_id < DOMID_FIRST_RESERVED);
+ d = d->next_in_list )
+ {
+ if ( i < d->domain_id )
+ i = d->domain_id;
+ }
+
+ spin_unlock(&domlist_update_lock);
+
+ return i;
+}
+
/*
* Insert a domain into the domlist/hash. This allows the domain to be looked
* up by domid, and therefore to be the subject of hypercalls/etc.
@@ -472,7 +472,7 @@ static void cf_check dump_console_ring_key(unsigned char key)
*/
static unsigned int __read_mostly console_rx = 0;
-#define max_console_rx (max_init_domid + 1)
+#define max_console_rx (domid_top() + 1)
static struct domain *console_get_domain_by_id(domid_t domid)
{
@@ -35,6 +35,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
void arch_get_domain_info(const struct domain *d,
struct xen_domctl_getdomaininfo *info);
+domid_t domid_top(void);
domid_t get_initial_domain_id(void);
#define DOMID_AUTO (-1)