# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 2cab08ac143b73db874fc8691e9d9f8580ca7cc2
# Parent 35f2341bfac8bb74ad2ca7e7f71f6c0663bb3e36
[IA64] support DOMID_XEN and DOMID_IO of foreign domain page mapping
support of foreign domain page mapping of DOMID_XEN and DOMID_IO.
This patch is needed for xentrace and xenmon.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
xen/arch/ia64/xen/domain.c | 62 +++++++++++++++++++++++++++++++++++++++---
xen/arch/ia64/xen/xensetup.c | 1
xen/include/asm-ia64/domain.h | 3 ++
xen/include/asm-ia64/mm.h | 3 +-
4 files changed, 65 insertions(+), 4 deletions(-)
diff -r 35f2341bfac8 -r 2cab08ac143b xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c Wed May 24 09:59:04 2006 -0600
+++ b/xen/arch/ia64/xen/domain.c Wed May 24 10:39:55 2006 -0600
@@ -80,6 +80,41 @@ static void try_to_clear_PGC_allocate(st
static void try_to_clear_PGC_allocate(struct domain* d,
struct page_info* page);
+#ifdef CONFIG_XEN_IA64_DOM0_VP
+static struct domain *dom_xen, *dom_io;
+
+// followings are stolen from arch_init_memory() @ xen/arch/x86/mm.c
+void
+alloc_dom_xen_and_dom_io(void)
+{
+ /*
+ * Initialise our DOMID_XEN domain.
+ * Any Xen-heap pages that we will allow to be mapped will have
+ * their domain field set to dom_xen.
+ */
+ dom_xen = alloc_domain();
+ BUG_ON(dom_xen == NULL);
+ spin_lock_init(&dom_xen->page_alloc_lock);
+ INIT_LIST_HEAD(&dom_xen->page_list);
+ INIT_LIST_HEAD(&dom_xen->xenpage_list);
+ atomic_set(&dom_xen->refcnt, 1);
+ dom_xen->domain_id = DOMID_XEN;
+
+ /*
+ * Initialise our DOMID_IO domain.
+ * This domain owns I/O pages that are within the range of the page_info
+ * array. Mappings occur at the priv of the caller.
+ */
+ dom_io = alloc_domain();
+ BUG_ON(dom_io == NULL);
+ spin_lock_init(&dom_io->page_alloc_lock);
+ INIT_LIST_HEAD(&dom_io->page_list);
+ INIT_LIST_HEAD(&dom_io->xenpage_list);
+ atomic_set(&dom_io->refcnt, 1);
+ dom_io->domain_id = DOMID_IO;
+}
+#endif
+
/* this belongs in include/asm, but there doesn't seem to be a suitable place
*/
void arch_domain_destroy(struct domain *d)
{
@@ -612,6 +647,12 @@ share_xen_page_with_guest(struct page_in
spin_unlock(&d->page_alloc_lock);
}
+void
+share_xen_page_with_privileged_guests(struct page_info *page, int readonly)
+{
+ share_xen_page_with_guest(page, dom_xen, readonly);
+}
+
//XXX !xxx_present() should be used instread of !xxx_none()?
static pte_t*
lookup_alloc_domain_pte(struct domain* d, unsigned long mpaddr)
@@ -1166,9 +1207,24 @@ dom0vp_add_physmap(struct domain* d, uns
struct domain* rd;
rd = find_domain_by_id(domid);
if (unlikely(rd == NULL)) {
- error = -EINVAL;
- goto out0;
- }
+ switch (domid) {
+ case DOMID_XEN:
+ rd = dom_xen;
+ break;
+ case DOMID_IO:
+ rd = dom_io;
+ break;
+ default:
+ DPRINTK("d 0x%p domid %d "
+ "pgfn 0x%lx mfn 0x%lx flags 0x%lx domid %d\n",
+ d, d->domain_id, gpfn, mfn, flags, domid);
+ error = -ESRCH;
+ goto out0;
+ }
+ BUG_ON(rd == NULL);
+ get_knownalive_domain(rd);
+ }
+
if (unlikely(rd == d)) {
error = -EINVAL;
goto out1;
diff -r 35f2341bfac8 -r 2cab08ac143b xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c Wed May 24 09:59:04 2006 -0600
+++ b/xen/arch/ia64/xen/xensetup.c Wed May 24 10:39:55 2006 -0600
@@ -337,6 +337,7 @@ printk("About to call scheduler_init()\n
BUG_ON(idle_domain == NULL);
late_setup_arch((char **) &cmdline);
+ alloc_dom_xen_and_dom_io();
setup_per_cpu_areas();
mem_init();
diff -r 35f2341bfac8 -r 2cab08ac143b xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h Wed May 24 09:59:04 2006 -0600
+++ b/xen/include/asm-ia64/domain.h Wed May 24 10:39:55 2006 -0600
@@ -118,11 +118,14 @@ void assign_domain_page(struct domain *d
void assign_domain_page(struct domain *d, unsigned long mpaddr, unsigned long
physaddr);
void assign_domain_io_page(struct domain *d, unsigned long mpaddr, unsigned
long flags);
#ifdef CONFIG_XEN_IA64_DOM0_VP
+void alloc_dom_xen_and_dom_io(void);
unsigned long assign_domain_mmio_page(struct domain *d, unsigned long mpaddr,
unsigned long size);
unsigned long assign_domain_mach_page(struct domain *d, unsigned long mpaddr,
unsigned long size);
unsigned long do_dom0vp_op(unsigned long cmd, unsigned long arg0, unsigned
long arg1, unsigned long arg2, unsigned long arg3);
unsigned long dom0vp_zap_physmap(struct domain *d, unsigned long gpfn,
unsigned int extent_order);
unsigned long dom0vp_add_physmap(struct domain* d, unsigned long gpfn,
unsigned long mfn, unsigned int flags, domid_t domid);
+#else
+#define alloc_dom_xen_and_dom_io() do { } while (0)
#endif
#include <asm/uaccess.h> /* for KERNEL_DS */
diff -r 35f2341bfac8 -r 2cab08ac143b xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Wed May 24 09:59:04 2006 -0600
+++ b/xen/include/asm-ia64/mm.h Wed May 24 10:39:55 2006 -0600
@@ -132,7 +132,8 @@ static inline u32 pickle_domptr(struct d
#define XENSHARE_readonly 1
void share_xen_page_with_guest(struct page_info *page,
struct domain *d, int readonly);
-#define share_xen_page_with_privileged_guests(p, r) do { } while (0)
+void share_xen_page_with_privileged_guests(struct page_info *page,
+ int readonly);
extern struct page_info *frame_table;
extern unsigned long frame_table_size;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|