* [PATCH][XEN][POWERPC] xencomm common code
[not found] <1165344436.11779.27.camel@basalt>
@ 2006-12-08 20:25 ` Hollis Blanchard
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] avoid xc_get_tot_pages() in the prose builder Hollis Blanchard
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] allocate shadow memory for PPC Linux domains Hollis Blanchard
2 siblings, 0 replies; 5+ messages in thread
From: Hollis Blanchard @ 2006-12-08 20:25 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
[-- Attachment #1.1: Type: text/plain, Size: 21812 bytes --]
Move xencomm code out of arch/powerpc so it can be shared with other
architectures. Currently it is only built for PowerPC, leaving IA64's
fork untouched.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 9d83185b4c37 xen/common/xencomm.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/xencomm.c Wed Sep 13 10:04:10 2006 -0600
@@ -0,0 +1,316 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+ * Tristan Gingold <tristan.gingold@bull.net>
+ */
+
+#include <xen/config.h>
+#include <xen/mm.h>
+#include <xen/sched.h>
+#include <xen/xencomm.h>
+#include <public/xen.h>
+#include <public/xencomm.h>
+
+
+#undef DEBUG
+#ifdef DEBUG
+static int xencomm_debug = 1; /* extremely verbose */
+#else
+#define xencomm_debug 0
+#endif
+
+static unsigned long
+xencomm_inline_from_guest(void *to, const void *from, unsigned int n,
+ unsigned int skip)
+{
+ unsigned long src_paddr = xencomm_inline_addr(from);
+
+ src_paddr += skip;
+
+ while (n > 0) {
+ unsigned int chunksz;
+ unsigned long src_maddr;
+ unsigned int bytes;
+
+ chunksz = PAGE_SIZE - (src_paddr % PAGE_SIZE);
+
+ bytes = min(chunksz, n);
+
+ src_maddr = paddr_to_maddr(src_paddr);
+ if (xencomm_debug)
+ printk("%lx[%d] -> %lx\n", src_maddr, bytes, (unsigned long)to);
+ memcpy(to, (void *)src_maddr, bytes);
+ src_paddr += bytes;
+ to += bytes;
+ n -= bytes;
+ }
+
+ /* Always successful. */
+ return 0;
+}
+
+/**
+ * xencomm_copy_from_guest: Copy a block of data from domain space.
+ * @to: Machine address.
+ * @from: Physical address to a xencomm buffer descriptor.
+ * @n: Number of bytes to copy.
+ * @skip: Number of bytes from the start to skip.
+ *
+ * Copy data from domain to hypervisor.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ */
+unsigned long
+xencomm_copy_from_guest(void *to, const void *from, unsigned int n,
+ unsigned int skip)
+{
+ struct xencomm_desc *desc;
+ unsigned int from_pos = 0;
+ unsigned int to_pos = 0;
+ unsigned int i = 0;
+
+ if (xencomm_is_inline(from))
+ return xencomm_inline_from_guest(to, from, n, skip);
+
+ /* first we need to access the descriptor */
+ desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)from);
+ if (desc == NULL)
+ return n;
+
+ if (desc->magic != XENCOMM_MAGIC) {
+ printk("%s: error: %p magic was 0x%x\n",
+ __func__, desc, desc->magic);
+ return n;
+ }
+
+ /* iterate through the descriptor, copying up to a page at a time */
+ while ((to_pos < n) && (i < desc->nr_addrs)) {
+ unsigned long src_paddr = desc->address[i];
+ unsigned int pgoffset;
+ unsigned int chunksz;
+ unsigned int chunk_skip;
+
+ if (src_paddr == XENCOMM_INVALID) {
+ i++;
+ continue;
+ }
+
+ pgoffset = src_paddr % PAGE_SIZE;
+ chunksz = PAGE_SIZE - pgoffset;
+
+ chunk_skip = min(chunksz, skip);
+ from_pos += chunk_skip;
+ chunksz -= chunk_skip;
+ skip -= chunk_skip;
+
+ if (skip == 0) {
+ unsigned long src_maddr;
+ unsigned long dest = (unsigned long)to + to_pos;
+ unsigned int bytes = min(chunksz, n - to_pos);
+
+ src_maddr = paddr_to_maddr(src_paddr + chunk_skip);
+ if (src_maddr == 0)
+ return n - to_pos;
+
+ if (xencomm_debug)
+ printk("%lx[%d] -> %lx\n", src_maddr, bytes, dest);
+ memcpy((void *)dest, (void *)src_maddr, bytes);
+ from_pos += bytes;
+ to_pos += bytes;
+ }
+
+ i++;
+ }
+
+ return n - to_pos;
+}
+
+static unsigned long
+xencomm_inline_to_guest(void *to, const void *from, unsigned int n,
+ unsigned int skip)
+{
+ unsigned long dest_paddr = xencomm_inline_addr(to);
+
+ dest_paddr += skip;
+
+ while (n > 0) {
+ unsigned int chunksz;
+ unsigned long dest_maddr;
+ unsigned int bytes;
+
+ chunksz = PAGE_SIZE - (dest_paddr % PAGE_SIZE);
+
+ bytes = min(chunksz, n);
+
+ dest_maddr = paddr_to_maddr(dest_paddr);
+ if (xencomm_debug)
+ printk("%lx[%d] -> %lx\n", (unsigned long)from, bytes, dest_maddr);
+ memcpy((void *)dest_maddr, (void *)from, bytes);
+ dest_paddr += bytes;
+ from += bytes;
+ n -= bytes;
+ }
+
+ /* Always successful. */
+ return 0;
+}
+
+/**
+ * xencomm_copy_to_guest: Copy a block of data to domain space.
+ * @to: Physical address to xencomm buffer descriptor.
+ * @from: Machine address.
+ * @n: Number of bytes to copy.
+ * @skip: Number of bytes from the start to skip.
+ *
+ * Copy data from hypervisor to domain.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ */
+unsigned long
+xencomm_copy_to_guest(void *to, const void *from, unsigned int n,
+ unsigned int skip)
+{
+ struct xencomm_desc *desc;
+ unsigned int from_pos = 0;
+ unsigned int to_pos = 0;
+ unsigned int i = 0;
+
+ if (xencomm_is_inline(to))
+ return xencomm_inline_to_guest(to, from, n, skip);
+
+ /* first we need to access the descriptor */
+ desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)to);
+ if (desc == NULL)
+ return n;
+
+ if (desc->magic != XENCOMM_MAGIC) {
+ printk("%s error: %p magic was 0x%x\n", __func__, desc, desc->magic);
+ return n;
+ }
+
+ /* iterate through the descriptor, copying up to a page at a time */
+ while ((from_pos < n) && (i < desc->nr_addrs)) {
+ unsigned long dest_paddr = desc->address[i];
+ unsigned int pgoffset;
+ unsigned int chunksz;
+ unsigned int chunk_skip;
+
+ if (dest_paddr == XENCOMM_INVALID) {
+ i++;
+ continue;
+ }
+
+ pgoffset = dest_paddr % PAGE_SIZE;
+ chunksz = PAGE_SIZE - pgoffset;
+
+ chunk_skip = min(chunksz, skip);
+ to_pos += chunk_skip;
+ chunksz -= chunk_skip;
+ skip -= chunk_skip;
+
+ if (skip == 0) {
+ unsigned long dest_maddr;
+ unsigned long source = (unsigned long)from + from_pos;
+ unsigned int bytes = min(chunksz, n - from_pos);
+
+ dest_maddr = paddr_to_maddr(dest_paddr + chunk_skip);
+ if (dest_maddr == 0)
+ return -1;
+
+ if (xencomm_debug)
+ printk("%lx[%d] -> %lx\n", source, bytes, dest_maddr);
+ memcpy((void *)dest_maddr, (void *)source, bytes);
+ from_pos += bytes;
+ to_pos += bytes;
+ }
+
+ i++;
+ }
+
+ return n - from_pos;
+}
+
+static int xencomm_inline_add_offset(void **handle, unsigned int bytes)
+{
+ *handle += bytes;
+ return 0;
+}
+
+/* Offset page addresses in 'handle' to skip 'bytes' bytes. Set completely
+ * exhausted pages to XENCOMM_INVALID. */
+int xencomm_add_offset(void **handle, unsigned int bytes)
+{
+ struct xencomm_desc *desc;
+ int i = 0;
+
+ if (xencomm_is_inline(*handle))
+ return xencomm_inline_add_offset(handle, bytes);
+
+ /* first we need to access the descriptor */
+ desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)*handle);
+ if (desc == NULL)
+ return -1;
+
+ if (desc->magic != XENCOMM_MAGIC) {
+ printk("%s error: %p magic was 0x%x\n", __func__, desc, desc->magic);
+ return -1;
+ }
+
+ /* iterate through the descriptor incrementing addresses */
+ while ((bytes > 0) && (i < desc->nr_addrs)) {
+ unsigned long dest_paddr = desc->address[i];
+ unsigned int pgoffset;
+ unsigned int chunksz;
+ unsigned int chunk_skip;
+
+ pgoffset = dest_paddr % PAGE_SIZE;
+ chunksz = PAGE_SIZE - pgoffset;
+
+ chunk_skip = min(chunksz, bytes);
+ if (chunk_skip == chunksz) {
+ /* exhausted this page */
+ desc->address[i] = XENCOMM_INVALID;
+ } else {
+ desc->address[i] += chunk_skip;
+ }
+ bytes -= chunk_skip;
+ }
+ return 0;
+}
+
+int xencomm_handle_is_null(void *handle)
+{
+ struct xencomm_desc *desc;
+ int i;
+
+ if (xencomm_is_inline(handle))
+ return xencomm_inline_addr(handle) == 0;
+
+ desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)handle);
+ if (desc == NULL)
+ return 1;
+
+ for (i = 0; i < desc->nr_addrs; i++)
+ if (desc->address[i] != XENCOMM_INVALID)
+ return 0;
+
+ return 1;
+}
+
diff -r 9d83185b4c37 xen/include/xen/xencomm.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/include/xen/xencomm.h Wed Sep 13 10:04:10 2006 -0600
@@ -0,0 +1,115 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Copyright (C) IBM Corp. 2006
+ *
+ * Authors: Hollis Blanchard <hollisb@us.ibm.com>
+ */
+
+#ifndef __XENCOMM_H__
+#define __XENCOMM_H__
+
+#include <public/xen.h>
+
+extern unsigned long xencomm_copy_to_guest(void *to, const void *from,
+ unsigned int len, unsigned int skip);
+extern unsigned long xencomm_copy_from_guest(void *to, const void *from,
+ unsigned int len, unsigned int skip);
+extern int xencomm_add_offset(void **handle, unsigned int bytes);
+extern int xencomm_handle_is_null(void *ptr);
+
+
+static inline int xencomm_is_inline(const void *handle)
+{
+ unsigned long addr = (unsigned long)handle;
+ return (addr & XENCOMM_INLINE_FLAG) == XENCOMM_INLINE_FLAG;
+}
+
+static inline unsigned long xencomm_inline_addr(const void *handle)
+{
+ return (unsigned long)handle & ~XENCOMM_INLINE_FLAG;
+}
+
+/* Is the guest handle a NULL reference? */
+#define guest_handle_is_null(hnd) \
+ ((hnd).p == NULL || xencomm_handle_is_null((hnd).p))
+
+/* Offset the given guest handle into the array it refers to. */
+#define guest_handle_add_offset(hnd, nr) ({ \
+ const typeof((hnd).p) _ptr; \
+ xencomm_add_offset((void **)&((hnd).p), nr * sizeof(*_ptr)); \
+})
+
+/* Cast a guest handle to the specified type of handle. */
+#define guest_handle_cast(hnd, type) ({ \
+ type *_x = (hnd).p; \
+ XEN_GUEST_HANDLE(type) _y; \
+ set_xen_guest_handle(_y, _x); \
+ _y; \
+})
+
+/* Since we run in real mode, we can safely access all addresses. That also
+ * means our __routines are identical to our "normal" routines. */
+#define guest_handle_okay(hnd, nr) 1
+
+/*
+ * Copy an array of objects to guest context via a guest handle.
+ * Optionally specify an offset into the guest array.
+ */
+#define copy_to_guest_offset(hnd, idx, ptr, nr) \
+ __copy_to_guest_offset(hnd, idx, ptr, nr)
+
+/* Copy sub-field of a structure to guest context via a guest handle. */
+#define copy_field_to_guest(hnd, ptr, field) \
+ __copy_field_to_guest(hnd, ptr, field)
+
+/*
+ * Copy an array of objects from guest context via a guest handle.
+ * Optionally specify an offset into the guest array.
+ */
+#define copy_from_guest_offset(ptr, hnd, idx, nr) \
+ __copy_from_guest_offset(ptr, hnd, idx, nr)
+
+/* Copy sub-field of a structure from guest context via a guest handle. */
+#define copy_field_from_guest(ptr, hnd, field) \
+ __copy_field_from_guest(ptr, hnd, field)
+
+#define __copy_to_guest_offset(hnd, idx, ptr, nr) ({ \
+ const typeof(ptr) _x = (hnd).p; \
+ const typeof(ptr) _y = (ptr); \
+ xencomm_copy_to_guest(_x, _y, sizeof(*_x)*(nr), sizeof(*_x)*(idx)); \
+})
+
+#define __copy_field_to_guest(hnd, ptr, field) ({ \
+ const int _off = offsetof(typeof(*ptr), field); \
+ const typeof(&(ptr)->field) _x = &(hnd).p->field; \
+ const typeof(&(ptr)->field) _y = &(ptr)->field; \
+ xencomm_copy_to_guest(_x, _y, sizeof(*_x), sizeof(*_x)*(_off)); \
+})
+
+#define __copy_from_guest_offset(ptr, hnd, idx, nr) ({ \
+ const typeof(ptr) _x = (hnd).p; \
+ const typeof(ptr) _y = (ptr); \
+ xencomm_copy_from_guest(_y, _x, sizeof(*_x)*(nr), sizeof(*_x)*(idx)); \
+})
+
+#define __copy_field_from_guest(ptr, hnd, field) ({ \
+ const int _off = offsetof(typeof(*ptr), field); \
+ const typeof(&(ptr)->field) _x = &(hnd).p->field; \
+ const typeof(&(ptr)->field) _y = &(ptr)->field; \
+ xencomm_copy_to_guest(_y, _x, sizeof(*_x), sizeof(*_x)*(_off)); \
+})
+
+#endif /* __XENCOMM_H__ */
diff -r 9d83185b4c37 xen/common/Makefile
--- a/xen/common/Makefile Fri Dec 01 19:11:02 2006 -0500
+++ b/xen/common/Makefile Tue Dec 05 12:56:32 2006 -0600
@@ -31,5 +31,7 @@ obj-$(crash_debug) += gdbstub.o
obj-$(crash_debug) += gdbstub.o
obj-$(xenoprof) += xenoprof.o
+obj-$(CONFIG_XENCOMM) += xencomm.o
+
# Object file contains changeset and compiler information.
version.o: $(BASEDIR)/include/xen/compile.h
diff -r 9d83185b4c37 config/powerpc64.mk
--- a/config/powerpc64.mk Fri Dec 01 19:11:02 2006 -0500
+++ b/config/powerpc64.mk Tue Dec 05 12:56:11 2006 -0600
@@ -1,5 +1,7 @@ CONFIG_POWERPC := y
CONFIG_POWERPC := y
CONFIG_POWERPC_$(XEN_OS) := y
+CONFIG_XENCOMM := y
+
CFLAGS += -DELFSIZE=64
LIBDIR := lib
diff -r 9d83185b4c37 xen/arch/powerpc/usercopy.c
--- a/xen/arch/powerpc/usercopy.c Fri Dec 01 19:11:02 2006 -0500
+++ b/xen/arch/powerpc/usercopy.c Fri Dec 01 17:18:45 2006 -0600
@@ -18,24 +18,14 @@
* Authors: Hollis Blanchard <hollisb@us.ibm.com>
*/
-#include <xen/config.h>
-#include <xen/mm.h>
#include <xen/sched.h>
+#include <xen/lib.h>
#include <asm/current.h>
-#include <asm/uaccess.h>
+#include <asm/page.h>
#include <asm/debugger.h>
-#include <public/xen.h>
-#include <public/xencomm.h>
-
-#undef DEBUG
-#ifdef DEBUG
-static int xencomm_debug = 1; /* extremely verbose */
-#else
-#define xencomm_debug 0
-#endif
/* XXX need to return error, not panic, if domain passed a bad pointer */
-static unsigned long paddr_to_maddr(unsigned long paddr)
+unsigned long paddr_to_maddr(unsigned long paddr)
{
struct vcpu *v = get_current();
struct domain *d = v->domain;
@@ -58,208 +48,3 @@ static unsigned long paddr_to_maddr(unsi
return pa;
}
-
-/**
- * xencomm_copy_from_guest: Copy a block of data from domain space.
- * @to: Machine address.
- * @from: Physical address to a xencomm buffer descriptor.
- * @n: Number of bytes to copy.
- * @skip: Number of bytes from the start to skip.
- *
- * Copy data from domain to hypervisor.
- *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
- */
-unsigned long
-xencomm_copy_from_guest(void *to, const void *from, unsigned int n,
- unsigned int skip)
-{
- struct xencomm_desc *desc;
- unsigned int from_pos = 0;
- unsigned int to_pos = 0;
- unsigned int i = 0;
-
- /* first we need to access the descriptor */
- desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)from);
- if (desc == NULL)
- return n;
-
- if (desc->magic != XENCOMM_MAGIC) {
- printk("%s: error: %p magic was 0x%x\n",
- __func__, desc, desc->magic);
- return n;
- }
-
- /* iterate through the descriptor, copying up to a page at a time */
- while ((to_pos < n) && (i < desc->nr_addrs)) {
- unsigned long src_paddr = desc->address[i];
- unsigned int pgoffset;
- unsigned int chunksz;
- unsigned int chunk_skip;
-
- if (src_paddr == XENCOMM_INVALID) {
- i++;
- continue;
- }
-
- pgoffset = src_paddr % PAGE_SIZE;
- chunksz = PAGE_SIZE - pgoffset;
-
- chunk_skip = min(chunksz, skip);
- from_pos += chunk_skip;
- chunksz -= chunk_skip;
- skip -= chunk_skip;
-
- if (skip == 0) {
- unsigned long src_maddr;
- unsigned long dest = (unsigned long)to + to_pos;
- unsigned int bytes = min(chunksz, n - to_pos);
-
- src_maddr = paddr_to_maddr(src_paddr + chunk_skip);
- if (src_maddr == 0)
- return n - to_pos;
-
- if (xencomm_debug)
- printk("%lx[%d] -> %lx\n", src_maddr, bytes, dest);
- memcpy((void *)dest, (void *)src_maddr, bytes);
- from_pos += bytes;
- to_pos += bytes;
- }
-
- i++;
- }
-
- return n - to_pos;
-}
-
-/**
- * xencomm_copy_to_guest: Copy a block of data to domain space.
- * @to: Physical address to xencomm buffer descriptor.
- * @from: Machine address.
- * @n: Number of bytes to copy.
- * @skip: Number of bytes from the start to skip.
- *
- * Copy data from hypervisor to domain.
- *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
- */
-unsigned long
-xencomm_copy_to_guest(void *to, const void *from, unsigned int n,
- unsigned int skip)
-{
- struct xencomm_desc *desc;
- unsigned int from_pos = 0;
- unsigned int to_pos = 0;
- unsigned int i = 0;
-
- /* first we need to access the descriptor */
- desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)to);
- if (desc == NULL)
- return n;
-
- if (desc->magic != XENCOMM_MAGIC) {
- printk("%s error: %p magic was 0x%x\n", __func__, desc, desc->magic);
- return n;
- }
-
- /* iterate through the descriptor, copying up to a page at a time */
- while ((from_pos < n) && (i < desc->nr_addrs)) {
- unsigned long dest_paddr = desc->address[i];
- unsigned int pgoffset;
- unsigned int chunksz;
- unsigned int chunk_skip;
-
- if (dest_paddr == XENCOMM_INVALID) {
- i++;
- continue;
- }
-
- pgoffset = dest_paddr % PAGE_SIZE;
- chunksz = PAGE_SIZE - pgoffset;
-
- chunk_skip = min(chunksz, skip);
- to_pos += chunk_skip;
- chunksz -= chunk_skip;
- skip -= chunk_skip;
-
- if (skip == 0) {
- unsigned long dest_maddr;
- unsigned long source = (unsigned long)from + from_pos;
- unsigned int bytes = min(chunksz, n - from_pos);
-
- dest_maddr = paddr_to_maddr(dest_paddr + chunk_skip);
- if (dest_maddr == 0)
- return -1;
-
- if (xencomm_debug)
- printk("%lx[%d] -> %lx\n", source, bytes, dest_maddr);
- memcpy((void *)dest_maddr, (void *)source, bytes);
- from_pos += bytes;
- to_pos += bytes;
- }
-
- i++;
- }
-
- return n - from_pos;
-}
-
-/* Offset page addresses in 'handle' to skip 'bytes' bytes. Set completely
- * exhausted pages to XENCOMM_INVALID. */
-int xencomm_add_offset(void *handle, unsigned int bytes)
-{
- struct xencomm_desc *desc;
- int i = 0;
-
- /* first we need to access the descriptor */
- desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)handle);
- if (desc == NULL)
- return -1;
-
- if (desc->magic != XENCOMM_MAGIC) {
- printk("%s error: %p magic was 0x%x\n", __func__, desc, desc->magic);
- return -1;
- }
-
- /* iterate through the descriptor incrementing addresses */
- while ((bytes > 0) && (i < desc->nr_addrs)) {
- unsigned long dest_paddr = desc->address[i];
- unsigned int pgoffset;
- unsigned int chunksz;
- unsigned int chunk_skip;
-
- if (dest_paddr == XENCOMM_INVALID) {
- i++;
- continue;
- }
-
- pgoffset = dest_paddr % PAGE_SIZE;
- chunksz = PAGE_SIZE - pgoffset;
-
- chunk_skip = min(chunksz, bytes);
- if (chunk_skip == chunksz) {
- /* exhausted this page */
- desc->address[i] = XENCOMM_INVALID;
- } else {
- desc->address[i] += chunk_skip;
- }
- bytes -= chunk_skip;
-
- i++;
- }
- return 0;
-}
-
-int xencomm_handle_is_null(void *ptr)
-{
- struct xencomm_desc *desc;
-
- desc = (struct xencomm_desc *)paddr_to_maddr((unsigned long)ptr);
- if (desc == NULL)
- return 1;
-
- return (desc->nr_addrs == 0);
-}
-
--
Hollis Blanchard
IBM Linux Technology Center
[-- Attachment #1.2: Type: text/html, Size: 36081 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH][XEN][POWERPC] avoid xc_get_tot_pages() in the prose builder
[not found] <1165344436.11779.27.camel@basalt>
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] xencomm common code Hollis Blanchard
@ 2006-12-08 20:25 ` Hollis Blanchard
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] allocate shadow memory for PPC Linux domains Hollis Blanchard
2 siblings, 0 replies; 5+ messages in thread
From: Hollis Blanchard @ 2006-12-08 20:25 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
[-- Attachment #1.1: Type: text/plain, Size: 2046 bytes --]
Avoid xc_get_tot_pages() in the prose builder.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 9d83185b4c37 tools/libxc/powerpc64/xc_prose_build.c
--- a/tools/libxc/powerpc64/xc_prose_build.c Fri Dec 01 19:11:02 2006 -0500
+++ b/tools/libxc/powerpc64/xc_prose_build.c Fri Dec 01 17:18:44 2006 -0600
@@ -230,6 +230,7 @@ static void free_page_array(xen_pfn_t *p
int xc_prose_build(int xc_handle,
uint32_t domid,
+ unsigned int mem_mb,
const char *image_name,
const char *initrd_name,
const char *cmdline,
@@ -257,8 +258,7 @@ int xc_prose_build(int xc_handle,
DPRINTF("cmdline=%s\n", cmdline);
- DPRINTF("xc_get_tot_pages\n");
- nr_pages = xc_get_tot_pages(xc_handle, domid);
+ nr_pages = mem_mb << (20 - PAGE_SHIFT);
DPRINTF("nr_pages 0x%lx\n", nr_pages);
rma_pages = get_rma_pages(devtree);
diff -r 9d83185b4c37 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h Fri Dec 01 19:11:02 2006 -0500
+++ b/tools/libxc/xenguest.h Tue Dec 05 10:45:10 2006 -0600
@@ -124,6 +124,7 @@ int xc_get_hvm_param(
int xc_prose_build(int xc_handle,
uint32_t domid,
+ unsigned int mem_mb,
const char *image_name,
const char *ramdisk_name,
const char *cmdline,
diff -r 9d83185b4c37 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py Fri Dec 01 19:11:02 2006 -0500
+++ b/tools/python/xen/xend/image.py Tue Dec 05 10:44:22 2006 -0600
@@ -273,6 +282,7 @@ class PPC_ProseImageHandler(LinuxImageHa
devtree = FlatDeviceTree.build(self)
return xc.prose_build(dom = self.vm.getDomid(),
+ memsize = mem_mb,
image = self.kernel,
store_evtchn = store_evtchn,
console_evtchn = console_evtchn,
--
Hollis Blanchard
IBM Linux Technology Center
[-- Attachment #1.2: Type: text/html, Size: 4889 bytes --]
[-- Attachment #2: Type: text/plain, Size: 149 bytes --]
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH][XEN][POWERPC] allocate shadow memory for PPC Linux domains
[not found] <1165344436.11779.27.camel@basalt>
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] xencomm common code Hollis Blanchard
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] avoid xc_get_tot_pages() in the prose builder Hollis Blanchard
@ 2006-12-08 20:25 ` Hollis Blanchard
2006-12-09 13:53 ` Keir Fraser
2 siblings, 1 reply; 5+ messages in thread
From: Hollis Blanchard @ 2006-12-08 20:25 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
[-- Attachment #1.1: Type: text/plain, Size: 1033 bytes --]
Allocate shadow memory for PPC Linux domains.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
diff -r 9d83185b4c37 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py Fri Dec 01 19:11:02 2006 -0500
+++ b/tools/python/xen/xend/image.py Tue Dec 05 10:44:22 2006 -0600
@@ -246,6 +246,15 @@ class PPC_LinuxImageHandler(LinuxImageHa
features = self.vm.getFeatures(),
arch_args = devtree.to_bin())
+ def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
+ """@param shadow_mem_kb The configured shadow memory, in KiB.
+ @param maxmem_kb The configured maxmem, in KiB.
+ @return The corresponding required amount of shadow memory, also in
+ KiB.
+ PowerPC currently uses "shadow memory" to refer to the hash table."""
+ return max(maxmem_kb / 64, shadow_mem_kb)
+
+
class PPC_ProseImageHandler(LinuxImageHandler):
ostype = "prose"
--
Hollis Blanchard
IBM Linux Technology Center
[-- Attachment #1.2: Type: text/html, Size: 2754 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][XEN][POWERPC] allocate shadow memory for PPC Linux domains
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] allocate shadow memory for PPC Linux domains Hollis Blanchard
@ 2006-12-09 13:53 ` Keir Fraser
2006-12-12 20:23 ` [Xen-devel] Please pull Hollis Blanchard
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2006-12-09 13:53 UTC (permalink / raw)
To: Hollis Blanchard, Keir Fraser; +Cc: xen-devel, xen-ppc-devel
[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]
On 8/12/06 8:25 pm, "Hollis Blanchard" <hollisb@us.ibm.com> wrote:
> Allocate shadow memory for PPC Linux domains.
>
> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
Just check all these patches into the PPC tree and I¹ll merge them into
unstable with the rest. I always check the diff when I merge anyway.
-- Keir
[-- Attachment #1.2: Type: text/html, Size: 865 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xen-devel] Please pull
2006-12-09 13:53 ` Keir Fraser
@ 2006-12-12 20:23 ` Hollis Blanchard
0 siblings, 0 replies; 5+ messages in thread
From: Hollis Blanchard @ 2006-12-12 20:23 UTC (permalink / raw)
To: Keir Fraser; +Cc: xen-devel, xen-ppc-devel
On Sat, 2006-12-09 at 13:53 +0000, Keir Fraser wrote:
>
> Just check all these patches into the PPC tree and I’ll merge them
> into unstable with the rest. I always check the diff when I merge
> anyway.
OK, they are now committed.
Please hg pull http://xenbits.xensource.com/xenppc-unstable-merge.hg and
let me know if you have any issues or questions.
--
Hollis Blanchard
IBM Linux Technology Center
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-12-12 20:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1165344436.11779.27.camel@basalt>
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] xencomm common code Hollis Blanchard
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] avoid xc_get_tot_pages() in the prose builder Hollis Blanchard
2006-12-08 20:25 ` [PATCH][XEN][POWERPC] allocate shadow memory for PPC Linux domains Hollis Blanchard
2006-12-09 13:53 ` Keir Fraser
2006-12-12 20:23 ` [Xen-devel] Please pull Hollis Blanchard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.