management tools portability
PATCH 1/1 management tools portability
These three patches allow me to use 32-bit libxc (and xend and xm) with a 64-bit PPC hypervisor.
This is a resend. I've updated to the latest xen-unstable tree, and changed the privcmd types from uint64_t to __u64 at Chris Wright's request.
Please apply.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
37 files changed, 263 insertions(+), 255 deletions(-) Config.mk | 14 --- config/ia64.mk | 5 + config/x86_32.mk | 9 ++ config/x86_64.mk | 9 ++ extras/mini-os/Makefile | 3 linux-2.6-xen-sparse/include/xen/public/privcmd.h | 16 ++-- tools/Makefile | 45 ++++++------ tools/Rules.mk | 2 tools/debugger/libxendebug/xendebug.c | 2 tools/ioemu/hw/cirrus_vga.c | 12 +-- tools/ioemu/vl.c | 15 ++-- tools/libxc/Makefile | 75 ++++++++------------- tools/libxc/xc_core.c | 10 +- tools/libxc/xc_domain.c | 10 +- tools/libxc/xc_hvm_build.c | 6 - tools/libxc/xc_ia64_stubs.c | 12 +-- tools/libxc/xc_linux.c | 2 tools/libxc/xc_linux_build.c | 29 +++----- tools/libxc/xc_linux_restore.c | 14 +-- tools/libxc/xc_linux_save.c | 28 +++---- tools/libxc/xc_load_aout9.c | 4 - tools/libxc/xc_load_bin.c | 4 - tools/libxc/xc_load_elf.c | 16 +--- tools/libxc/xc_private.c | 39 +++++----- tools/libxc/xenctrl.h | 16 ++-- tools/libxc/xg_private.h | 4 - tools/libxc/xg_save_restore.h | 12 +-- tools/misc/Makefile | 2 tools/python/xen/lowlevel/xc/xc.c | 4 + xen/common/memory.c | 20 +++-- xen/include/public/arch-ia64.h | 3 xen/include/public/arch-x86_32.h | 3 xen/include/public/arch-x86_64.h | 3 xen/include/public/dom0_ops.h | 56 +++++++-------- xen/include/public/memory.h | 8 +- xen/tools/Makefile | 3 xen/tools/figlet/Makefile | 3
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
PATCH 1/1 Use a global build configuration file, and rework libxc Makefile for PowerPC
15 files changed, 90 insertions(+), 102 deletions(-) Config.mk | 14 ------ config/ia64.mk | 5 ++ config/x86_32.mk | 9 ++++ config/x86_64.mk | 9 ++++ extras/mini-os/Makefile | 3 - tools/Makefile | 45 ++++++++++------------ tools/Rules.mk | 2 tools/libxc/Makefile | 75 +++++++++++++++---------------------- tools/libxc/xc_core.c | 2 tools/libxc/xc_linux_build.c | 8 --- tools/libxc/xc_load_elf.c | 8 --- tools/misc/Makefile | 2 tools/python/xen/lowlevel/xc/xc.c | 4 + xen/tools/Makefile | 3 - xen/tools/figlet/Makefile | 3 -
# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Node ID 93e96a7b38df8b168c8ed0386abaf64fbc5f7ddb
# Parent 22d92d7fa04ac6b9ef1028658b7128a8bb1cd056
Use a global build configuration file, and rework libxc Makefile for PowerPC.
Config.mk +1 -13
@@ -38,19 +38,7 @@ CFLAGS += -g CFLAGS += -g endif -ifeq ($(XEN_TARGET_ARCH),x86_32) -CFLAGS += -m32 -march=i686 -endif - -ifeq ($(XEN_TARGET_ARCH),x86_64) -CFLAGS += -m64 -endif - -ifeq ($(XEN_TARGET_ARCH),x86_64) -LIBDIR = lib64 -else -LIBDIR = lib -endif +include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
extras/mini-os/Makefile +2 -1
@@ -1,7 +1,8 @@ debug ?= y debug ?= y pae ?= n -include $(CURDIR)/../../Config.mk +XEN_ROOT = ../.. +include $(XEN_ROOT)/Config.mk # Set TARGET_ARCH override TARGET_ARCH := $(XEN_TARGET_ARCH)
tools/Makefile +22 -23
75 lines not on this page · raw message
tools/Rules.mk +2 -0
@@ -4,6 +4,8 @@ all: all: include $(XEN_ROOT)/Config.mk + +CONFIG_$(shell uname -s) := y XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc XEN_LIBXC = $(XEN_ROOT)/tools/libxc
tools/libxc/Makefile +31 -44
111 lines not on this page · raw message
tools/libxc/xc_core.c +0 -2
@@ -1,6 +1,4 @@#include "xg_private.h" -#define ELFSIZE 32 -#include "xc_elf.h" #include <stdlib.h> #include <unistd.h>
tools/libxc/xc_linux_build.c +0 -8
@@ -5,14 +5,6 @@#include "xg_private.h" #include "xc_private.h" #include <xenctrl.h> - -#if defined(__i386__) -#define ELFSIZE 32 -#endif - -#if defined(__x86_64__) || defined(__ia64__) -#define ELFSIZE 64 -#endif #include "xc_elf.h" #include "xc_aout9.h"
tools/libxc/xc_load_elf.c +0 -8
@@ -3,14 +3,6 @@*/ #include "xg_private.h" - -#if defined(__i386__) -#define ELFSIZE 32 -#endif -#if defined(__x86_64__) || defined(__ia64__) -#define ELFSIZE 64 -#endif -#include "xc_elf.h" #include <stdlib.h> #include <endian.h>
tools/misc/Makefile +1 -1
@@ -25,7 +25,7 @@ build: $(TARGETS) build: $(TARGETS) $(MAKE) -C miniterm $(MAKE) -C cpuperf -ifneq ($(XEN_TARGET_ARCH),ia64) +ifeq ($(CONFIG_MBOOTPACK),y) $(MAKE) -C mbootpack endif $(MAKE) -C lomount
tools/python/xen/lowlevel/xc/xc.c +4 -0
@@ -359,6 +359,7 @@ static PyObject *pyxc_linux_build(XcObje "console_mfn", console_mfn); } +#ifdef CONFIG_HVM static PyObject *pyxc_hvm_build (XcObject *self,PyObject *args,PyObject *kwds)
@@ -387,6 +388,7 @@ static PyObject *pyxc_hvm_build(XcObject return Py_BuildValue("{s:i}", "store_mfn", store_mfn); } +#endif static PyObject *pyxc_bvtsched_global_set (XcObject *self,PyObject *args) {
@@ -1012,6 +1014,7 @@ static PyMethodDef pyxc_methods[] = { " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, +#ifdef CONFIG_HVM {"hvm_build" , (PyCFunction )pyxc_hvm_build,METH_VARARGS |METH_KEYWORDS ,"\n"
@@ -1020,6 +1023,7 @@ static PyMethodDef pyxc_methods[] = { " image [str]: Name of HVM loader image file.\n" " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, +#endif { "bvtsched_global_set", (PyCFunction)pyxc_bvtsched_global_set,
xen/tools/Makefile +2 -1
@@ -1,5 +1,6 @@ -include $(BASEDIR)/../Config.mk +XEN_ROOT = $(BASEDIR)/.. +include $(XEN_ROOT)/Config.mk .PHONY: default default:
xen/tools/figlet/Makefile +2 -1
@@ -1,5 +1,6 @@ -include $(BASEDIR)/../Config.mk +XEN_ROOT = $(BASEDIR)/.. +include $(XEN_ROOT)/Config.mk figlet: figlet.c $(HOSTCC) -o $@ $<
config/ia64.mk new file +5 -0
@@ -0,0 +1,5 @@ +CONFIG_IA64 := y +CONFIG_IOEMU := y + +CFLAGS += -DELFSIZE=64 -DCONFIG_HVM +LIBDIR := lib
config/x86_32.mk new file +9 -0
@@ -0,0 +1,9 @@ +CONFIG_X86 := y +CONFIG_PLAN9 := y +CONFIG_HVM := y +CONFIG_MIGRATE := y +CONFIG_IOEMU := y +CONFIG_MBOOTPACK := y + +CFLAGS += -m32 -march=i686 -DELFSIZE=32 -DCONFIG_HVM +LIBDIR := lib
config/x86_64.mk new file +9 -0
@@ -0,0 +1,9 @@ +CONFIG_X86 := y +CONFIG_PLAN9 := y +CONFIG_HVM := y +CONFIG_MIGRATE := y +CONFIG_IOEMU := y +CONFIG_MBOOTPACK := y + +CFLAGS += -m64 -DELFSIZE=64 -DCONFIG_HVM +LIBDIR = lib64
PATCH 1/1 Represent PFNs with their own type, rather than 'unsigned long'
In reply to Hollis Blanchard25 files changed, 138 insertions(+), 120 deletions(-) linux-2.6-xen-sparse/include/xen/public/privcmd.h | 2 - tools/debugger/libxendebug/xendebug.c | 2 - tools/ioemu/hw/cirrus_vga.c | 12 +++--- tools/ioemu/vl.c | 15 ++++---- tools/libxc/xc_core.c | 8 ++-- tools/libxc/xc_domain.c | 10 ++--- tools/libxc/xc_hvm_build.c | 6 +-- tools/libxc/xc_ia64_stubs.c | 12 +++--- tools/libxc/xc_linux.c | 2 - tools/libxc/xc_linux_build.c | 21 +++++------ tools/libxc/xc_linux_restore.c | 14 +++---- tools/libxc/xc_linux_save.c | 28 +++++++-------- tools/libxc/xc_load_aout9.c | 4 +- tools/libxc/xc_load_bin.c | 4 +- tools/libxc/xc_load_elf.c | 8 ++-- tools/libxc/xc_private.c | 39 ++++++++++----------- tools/libxc/xenctrl.h | 16 ++++---- tools/libxc/xg_private.h | 4 +- tools/libxc/xg_save_restore.h | 12 +++--- xen/common/memory.c | 20 +++++++--- xen/include/public/arch-ia64.h | 3 + xen/include/public/arch-x86_32.h | 3 + xen/include/public/arch-x86_64.h | 3 + xen/include/public/dom0_ops.h | 2 - xen/include/public/memory.h | 8 ++--
# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Node ID f03f168a4e2d42e85b62ba4c4e7ef349f27476bc
# Parent eee70cbfa20adcc8cdc1c9215fbea79d1386d9f9 Represent PFNs with their own type, rather than 'unsigned long'. ('long' changes size and alignment between 32- and 64-bit ABIs.)
linux-2.6-xen-sparse/include/xen/public/privcmd.h +1 -1
@@ -59,7 +59,7 @@ typedef struct privcmd_mmapbatch {int num;/* number of pages to populate */ domid_t dom;/* target domain */ unsigned long addr;/* virtual address */ -unsigned long __user *arr;/* array of mfns - top nibble set on err */ +xen_pfn_t __user *arr;/* array of mfns - top nibble set on err */ } privcmd_mmapbatch_t;/*
tools/debugger/libxendebug/xendebug.c +1 -1
@@ -57,7 +57,7 @@ typedef struct domain_contextvcpu_guest_context_t context[MAX_VIRT_CPUS ];long total_pages; -unsigned long *page_array; +xen_pfn_t *page_array;unsigned long cr3_phys[MAX_VIRT_CPUS ];unsigned long *cr3_virt[MAX_VIRT_CPUS ];
tools/ioemu/hw/cirrus_vga.c +6 -6
@@ -2463,7 +2463,7 @@ extern FILE *logfile;#if defined(__i386__) || defined (__x86_64__)static void *set_vram_mapping (unsigned long begin,unsigned long end) { -unsigned long * extent_start =NULL ; +xen_pfn_t *extent_start =NULL ;unsigned long nr_extents;void *vram_pointer =NULL ;int i;
@@ -2474,14 +2474,14 @@ static void * set_vram_mapping(unsigned end = (end +TARGET_PAGE_SIZE -1 ) &TARGET_PAGE_MASK ; nr_extents = (end - begin) >>TARGET_PAGE_BITS ; - extent_start =malloc (sizeof (unsigned long ) * nr_extents ); + extent_start =malloc (sizeof (xen_pfn_t) * nr_extents );if (extent_start ==NULL ) {fprintf (stderr,"Failed malloc on set_vram_mapping\n" );return NULL ; } -memset (extent_start,0 ,sizeof (unsigned long ) * nr_extents); +memset (extent_start,0 ,sizeof (xen_pfn_t) * nr_extents);for (i =0 ; i < nr_extents; i++) {
@@ -2509,7 +2509,7 @@ static void * set_vram_mapping(unsignedstatic int unset_vram_mapping (unsigned long begin,unsigned long end) { -unsigned long * extent_start =NULL ; +xen_pfn_t *extent_start =NULL ;unsigned long nr_extents;int i;
@@ -2520,7 +2520,7 @@ static int unset_vram_mapping(unsigned l end = (end +TARGET_PAGE_SIZE -1 ) &TARGET_PAGE_MASK ; nr_extents = (end - begin) >>TARGET_PAGE_BITS ; - extent_start =malloc (sizeof (unsigned long ) * nr_extents ); + extent_start =malloc (sizeof (xen_pfn_t) * nr_extents );if (extent_start ==NULL ) {
@@ -2528,7 +2528,7 @@ static int unset_vram_mapping(unsigned lreturn -1 ; } -memset (extent_start,0 ,sizeof (unsigned long ) * nr_extents); +memset (extent_start,0 ,sizeof (xen_pfn_t) * nr_extents);for (i =0 ; i < nr_extents; i++) extent_start[i] = (begin + (i *TARGET_PAGE_SIZE )) >>TARGET_PAGE_BITS ;
tools/ioemu/vl.c +8 -7
@@ -2457,7 +2457,7 @@ int unset_mm_mapping(int xc_handle,uint32_t domid, unsigned long nr_pages, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err = 0;xc_dominfo_t info;
@@ -2490,7 +2490,7 @@ int set_mm_mapping(int xc_handle,uint32_t domid, unsigned long nr_pages, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { xc_dominfo_t info;int err =0 ;
@@ -2556,7 +2556,8 @@ int main(int argc, char **argv)int serial_device_index;char qemu_dm_logfilename[64 ];const char *loadvm =NULL ; -unsigned long nr_pages, *page_array; +unsigned long nr_pages; +xen_pfn_t *page_array;extern void *shared_page;#if !defined(CONFIG_SOFTMMU )
@@ -3022,8 +3023,8 @@ int main(int argc, char **argv) xc_handle =xc_interface_open (); -if ( (page_array = (unsigned long *) -malloc (nr_pages *sizeof (unsigned long ))) ==NULL ) +if ( (page_array = (xen_pfn_t *) +malloc (nr_pages *sizeof (xen_pfn_t))) ==NULL ) {fprintf (logfile,"malloc returned error %d\n" , errno);exit (-1 );
@@ -3078,8 +3079,8 @@ int main(int argc, char **argv) page_array[0]);#endif -fprintf (logfile,"shared page at pfn:%lx, mfn: %lx\n" , (nr_pages-1 ), - (page_array[nr_pages -1 ])); +fprintf (logfile,"shared page at pfn:%lx, mfn: %" PRIx64"\n" , (nr_pages-1 ), + (uint64_t )(page_array[nr_pages -1 ]));/* we always create the cdrom drive, even if no disk is there */ bdrv_init ();
tools/libxc/xc_core.c +4 -4
@@ -28,7 +28,7 @@ xc_domain_dumpcore_via_callback(int xc_h dumpcore_rtn_t dump_rtn) {unsigned long nr_pages; -unsigned long *page_array =NULL ; +xen_pfn_t *page_array =NULL ;xc_dominfo_t info;int i, nr_vcpus =0 ;char *dump_mem, *dump_mem_start =NULL ;
@@ -70,7 +70,7 @@ xc_domain_dumpcore_via_callback(int xc_hsizeof (vcpu_guest_context_t)*nr_vcpus; dummy_len = (sizeof (struct xc_core_header ) + (sizeof (vcpu_guest_context_t) * nr_vcpus) + - (nr_pages *sizeof (unsigned long ))); + (nr_pages *sizeof (xen_pfn_t))); header.xch_pages_offset =round_pgup (dummy_len); sts =dump_rtn (args, (char *)&header,sizeof (struct xc_core_header ));
@@ -81,7 +81,7 @@ xc_domain_dumpcore_via_callback(int xc_hif ( sts !=0 ) goto error_out; -if ( (page_array =malloc (nr_pages *sizeof (unsigned long ))) ==NULL ) +if ( (page_array =malloc (nr_pages *sizeof (xen_pfn_t))) ==NULL ) {printf ("Could not allocate memory\n" ); goto error_out;
@@ -91,7 +91,7 @@ xc_domain_dumpcore_via_callback(int xc_hprintf ("Could not get the page frame list\n" ); goto error_out; } - sts =dump_rtn (args, (char *)page_array, nr_pages *sizeof (unsigned long )); + sts =dump_rtn (args, (char *)page_array, nr_pages *sizeof (xen_pfn_t));if ( sts !=0 ) goto error_out;
tools/libxc/xc_domain.c +5 -5
@@ -291,7 +291,7 @@ int xc_domain_memory_increase_reservatiounsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = {
@@ -324,7 +324,7 @@ int xc_domain_memory_decrease_reservatiouint32_t domid, unsigned long nr_extents, unsigned int extent_order, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = {
@@ -363,7 +363,7 @@ int xc_domain_memory_populate_physmap(inunsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = {
@@ -392,8 +392,8 @@ int xc_domain_translate_gpfn_list(int xcint xc_domain_translate_gpfn_list (int xc_handle,uint32_t domid,unsigned long nr_gpfns, -unsigned long *gpfn_list, -unsigned long *mfn_list) +xen_pfn_t *gpfn_list, +xen_pfn_t *mfn_list) {struct xen_translate_gpfn_list op = { .domid = domid,
tools/libxc/xc_hvm_build.c +3 -3
@@ -135,7 +135,7 @@ static void set_hvm_info_checksum(struct* hvmloader will use this info to set BIOS accordingly */ static int set_hvm_info (int xc_handle,uint32_t dom, -unsigned long *pfn_list,unsigned int vcpus, +xen_pfn_t *pfn_list,unsigned int vcpus,unsigned int pae,unsigned int acpi,unsigned int apic) {char *va_map;
@@ -178,7 +178,7 @@ static int setup_guest(int xc_handle,unsigned int store_evtchn, unsigned long *store_mfn) { - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL;unsigned long count, i;unsigned long long ptr;xc_mmu_t *mmu =NULL ;
@@ -223,7 +223,7 @@ static int setup_guest(int xc_handle, goto error_out; } -if ( (page_array =malloc (nr_pages *sizeof (unsigned long ))) ==NULL ) +if ( (page_array =malloc (nr_pages *sizeof (xen_pfn_t))) ==NULL ) {PERROR ("Could not allocate memory.\n" ); goto error_out;
tools/libxc/xc_ia64_stubs.c +6 -6
@@ -57,7 +57,7 @@ xc_plan9_build(int xc_handle,int xc_ia64_get_pfn_list (int xc_handle,uint32_t domid, -unsigned long *pfn_buf, +xen_pfn_t *pfn_buf,unsigned int start_page,unsigned int nr_pages) {
@@ -65,7 +65,7 @@ int xc_ia64_get_pfn_list(int xc_handle,int num_pfns,ret;unsigned int __start_page, __nr_pages;unsigned long max_pfns; -unsigned long *__pfn_buf; +xen_pfn_t *__pfn_buf; __start_page = start_page; __nr_pages = nr_pages;
@@ -80,7 +80,7 @@ int xc_ia64_get_pfn_list(int xc_handle,set_xen_guest_handle (op.u.getmemlist.buffer, __pfn_buf);if ( (max_pfns !=-1UL ) - &&mlock (__pfn_buf, __nr_pages *sizeof (unsigned long )) !=0 ) + &&mlock (__pfn_buf, __nr_pages *sizeof (xen_pfn_t)) !=0 ) {PERROR ("Could not lock pfn list buffer" );return -1 ;
@@ -89,7 +89,7 @@ int xc_ia64_get_pfn_list(int xc_handle, ret =do_dom0_op (xc_handle, &op);if (max_pfns !=-1UL ) - (void )munlock (__pfn_buf, __nr_pages *sizeof (unsigned long )); + (void )munlock (__pfn_buf, __nr_pages *sizeof (xen_pfn_t));if (max_pfns ==-1UL )return 0 ;
@@ -122,10 +122,10 @@ int xc_ia64_copy_to_domain_pages(int xc_ {// N.B. gva should be page aligned -unsigned long *page_array =NULL ; +xen_pfn_t *page_array =NULL ;int i; -if ( (page_array =malloc (nr_pages *sizeof (unsigned long ))) ==NULL ){ +if ( (page_array =malloc (nr_pages *sizeof (xen_pfn_t))) ==NULL ){PERROR ("Could not allocate memory" ); goto error_out; }
tools/libxc/xc_linux.c +1 -1
@@ -28,7 +28,7 @@ int xc_interface_close(int xc_handle) }void *xc_map_foreign_batch (int xc_handle,uint32_t dom,int prot, -unsigned long *arr,int num) +xen_pfn_t *arr,int num) {privcmd_mmapbatch_t ioctlx;void *addr;
tools/libxc/xc_linux_build.c +11 -10
@@ -10,6 +10,7 @@#include "xc_aout9.h" #include <stdlib.h> #include <unistd.h> +#include <inttypes.h> #include <zlib.h> #if defined(__i386__)
@@ -136,7 +137,7 @@ int load_initrd(int xc_handle, domid_t dint load_initrd (int xc_handle,domid_t dom,struct initrd_info *initrd,unsigned long physbase, -unsigned long *phys_to_mach) +xen_pfn_t *phys_to_mach) {char page[PAGE_SIZE ];unsigned long pfn_start, pfn, nr_pages;
@@ -189,7 +190,7 @@ static int setup_pg_tables(int xc_handlevcpu_guest_context_t *ctxt, unsigned long dsi_v_start, unsigned long v_end, - unsigned long *page_array, + xen_pfn_t *page_array, unsigned long vpt_start, unsigned long vpt_end, unsigned shadow_mode_enabled)
@@ -251,7 +252,7 @@ static int setup_pg_tables_pae(int xc_havcpu_guest_context_t *ctxt, unsigned long dsi_v_start, unsigned long v_end, - unsigned long *page_array, + xen_pfn_t *page_array, unsigned long vpt_start, unsigned long vpt_end, unsigned shadow_mode_enabled)
@@ -340,7 +341,7 @@ static int setup_pg_tables_64(int xc_hanvcpu_guest_context_t *ctxt, unsigned long dsi_v_start, unsigned long v_end, - unsigned long *page_array, + xen_pfn_t *page_array, unsigned long vpt_start, unsigned long vpt_end, int shadow_mode_enabled)
@@ -451,7 +452,7 @@ static int setup_guest(int xc_handle, unsigned int console_evtchn, unsigned long *console_mfn, uint32_t required_features[XENFEAT_NR_SUBMAPS]) { - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL;struct load_funcs load_funcs;struct domain_setup_info dsi;unsigned long vinitrd_start;
@@ -478,7 +479,7 @@ static int setup_guest(int xc_handle, start_page = dsi.v_start >>PAGE_SHIFT ; pgnr = (v_end - dsi.v_start) >>PAGE_SHIFT ; -if ( (page_array =malloc (pgnr *sizeof (unsigned long ))) ==NULL ) +if ( (page_array =malloc (pgnr *sizeof (xen_pfn_t))) ==NULL ) {PERROR ("Could not allocate memory" ); goto error_out;
@@ -606,7 +607,7 @@ static int setup_guest(int xc_handle, unsigned int console_evtchn, unsigned long *console_mfn, uint32_t required_features[XENFEAT_NR_SUBMAPS]) { - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL;unsigned long count, i, hypercall_pfn;start_info_t *start_info;shared_info_t *shared_info;
@@ -617,7 +618,7 @@ static int setup_guest(int xc_handle,unsigned long nr_pt_pages;unsigned long physmap_pfn; -unsigned long *physmap, *physmap_e; +xen_pfn_t *physmap, *physmap_e;struct load_funcs load_funcs;struct domain_setup_info dsi;
@@ -865,8 +866,8 @@ static int setup_guest(int xc_handle, ((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, count) ) { -fprintf (stderr,"m2p update failure p=%lx m=%lx\n" , - count, page_array[count]); +fprintf (stderr,"m2p update failure p=%lx m=%" PRIx64"\n" , + count, (uint64_t )page_array[count]);munmap (physmap,PAGE_SIZE ); goto error_out; }
tools/libxc/xc_linux_restore.c +7 -7
@@ -25,10 +25,10 @@ static unsigned long max_pfn;static unsigned long max_pfn;/* Live mapping of the table mapping each PFN to its current MFN. */ -static unsigned long *live_p2m =NULL ; +static xen_pfn_t *live_p2m =NULL ;/* A table mapping each PFN to its new MFN. */ -static unsigned long *p2m =NULL ; +static xen_pfn_t *p2m =NULL ; static ssize_t
@@ -126,7 +126,7 @@ int xc_linux_restore(int xc_handle, intunsigned long *pfn_type =NULL ;/* A table of MFNs to map in the current region */ -unsigned long *region_mfn =NULL ; +xen_pfn_t *region_mfn =NULL ;/* Types of the pfns in the current region */ unsigned long region_pfn_type[MAX_BATCH_SIZE ];
@@ -135,7 +135,7 @@ int xc_linux_restore(int xc_handle, intunsigned long *page =NULL ;/* A copy of the pfn-to-mfn table frame list. */ -unsigned long *p2m_frame_list =NULL ; +xen_pfn_t *p2m_frame_list =NULL ;/* A temporary mapping of the guest's start_info page. */ start_info_t *start_info;
@@ -183,9 +183,9 @@ int xc_linux_restore(int xc_handle, int/* We want zeroed memory so use calloc rather than malloc. */ - p2m =calloc (max_pfn,sizeof (unsigned long )); + p2m =calloc (max_pfn,sizeof (xen_pfn_t)); pfn_type =calloc (max_pfn,sizeof (unsigned long )); - region_mfn =calloc (MAX_BATCH_SIZE ,sizeof (unsigned long )); + region_mfn =calloc (MAX_BATCH_SIZE ,sizeof (xen_pfn_t));if ((p2m ==NULL ) || (pfn_type ==NULL ) || (region_mfn ==NULL )) {ERR ("memory alloc failed" );
@@ -193,7 +193,7 @@ int xc_linux_restore(int xc_handle, int goto out; } -if (mlock (region_mfn,sizeof (unsigned long ) *MAX_BATCH_SIZE )) { +if (mlock (region_mfn,sizeof (xen_pfn_t) *MAX_BATCH_SIZE )) {ERR ("Could not mlock region_mfn" ); goto out; }
tools/libxc/xc_linux_save.c +14 -14
@@ -40,10 +40,10 @@ static unsigned long max_pfn;static unsigned long max_pfn;/* Live mapping of the table mapping each PFN to its current MFN. */ -static unsigned long *live_p2m =NULL ; +static xen_pfn_t *live_p2m =NULL ;/* Live mapping of system MFN to PFN table. */ -static unsigned long *live_m2p =NULL ; +static xen_pfn_t *live_m2p =NULL ;/* grep fodder: machine_to_phys */
@@ -501,22 +501,22 @@ void canonicalize_pagetable(unsigned lon -static unsigned long *xc_map_m2p (int xc_handle, +static xen_pfn_t *xc_map_m2p (int xc_handle,unsigned long max_mfn,int prot) {struct xen_machphys_mfn_list xmml;privcmd_mmap_entry_t *entries;unsigned long m2p_chunks, m2p_size; -unsigned long *m2p; -unsigned long *extent_start; +xen_pfn_t *m2p; +xen_pfn_t *extent_start;int i, rc; m2p_size =M2P_SIZE (max_mfn); m2p_chunks =M2P_CHUNKS (max_mfn); xmml.max_extents = m2p_chunks; -if (!(extent_start =malloc (m2p_chunks *sizeof (unsigned long )))) { +if (!(extent_start =malloc (m2p_chunks *sizeof (xen_pfn_t)))) {ERR ("failed to allocate space for m2p mfns" );return NULL ; }
@@ -583,11 +583,11 @@ int xc_linux_save(int xc_handle, int io_char page[PAGE_SIZE ];/* Double and single indirect references to the live P2M table */ -unsigned long *live_p2m_frame_list_list =NULL ; -unsigned long *live_p2m_frame_list =NULL ; +xen_pfn_t *live_p2m_frame_list_list =NULL ; +xen_pfn_t *live_p2m_frame_list =NULL ;/* A copy of the pfn-to-mfn table frame list. */ -unsigned long *p2m_frame_list =NULL ; +xen_pfn_t *p2m_frame_list =NULL ;/* Live mapping of shared info structure */ shared_info_t *live_shinfo =NULL ;
@@ -712,11 +712,11 @@ int xc_linux_save(int xc_handle, int io_memcpy (p2m_frame_list, live_p2m_frame_list,P2M_FL_SIZE );/* Canonicalise the pfn-to-mfn table frame-number list. */ -for (i =0 ; i < max_pfn; i += ulpp) { -if (!translate_mfn_to_pfn (&p2m_frame_list[i/ulpp])) { +for (i =0 ; i < max_pfn; i += fpp) { +if (!translate_mfn_to_pfn (&p2m_frame_list[i/fpp])) {ERR ("Frame# in pfn-to-mfn frame list is not in pseudophys" ); -ERR ("entry %d: p2m_frame_list[%ld] is 0x%lx" , i, i/ulpp, - p2m_frame_list[i/ulpp]); +ERR ("entry %d: p2m_frame_list[%ld] is 0x%" PRIx64, i, i/fpp, + (uint64_t )p2m_frame_list[i/fpp]); goto out; } }
@@ -818,7 +818,7 @@ int xc_linux_save(int xc_handle, int io_/* Start writing out the saved-domain record. */ -if (!write_exact (io_fd, &max_pfn,sizeof (unsigned long ))) { +if (!write_exact (io_fd, &max_pfn,sizeof (xen_pfn_t))) {ERR ("write: max_pfn" ); goto out; }
tools/libxc/xc_load_aout9.c +2 -2
@@ -17,7 +17,7 @@#define KOFFSET (_p) ((_p)&~KZERO)static int parseaout9image (const char *,unsigned long ,struct domain_setup_info *); -static int loadaout9image (const char *,unsigned long ,int ,uint32_t ,unsigned long *,struct domain_setup_info *); +static int loadaout9image (const char *,unsigned long ,int ,uint32_t ,xen_pfn_t *,struct domain_setup_info *);static void copyout (int ,uint32_t ,unsigned long *,unsigned long ,const char *,int );struct Exec *get_header (const char *,unsigned long ,struct Exec *);
@@ -79,7 +79,7 @@ loadaout9image(const char *image, unsigned long image_size, int xch, uint32_t dom, - unsigned long *parray, + xen_pfn_t *parray, struct domain_setup_info *dsi) { struct Exec ehdr;
tools/libxc/xc_load_bin.c +2 -2
@@ -107,7 +107,7 @@ static intstatic int loadbinimage (const char *image,unsigned long image_size,int xch,uint32_t dom, -unsigned long *parray,struct domain_setup_info *dsi); +xen_pfn_t *parray,struct domain_setup_info *dsi); int probe_bin(const char *image, unsigned long image_size,
@@ -235,7 +235,7 @@ static intstatic int loadbinimage (const char *image,unsigned long image_size,int xch,uint32_t dom, -unsigned long *parray,struct domain_setup_info *dsi) +xen_pfn_t *parray,struct domain_setup_info *dsi) {unsigned long size;char *va;
tools/libxc/xc_load_elf.c +4 -4
@@ -17,10 +17,10 @@ static intstatic int loadelfimage (const char *image,unsigned long image_size,int xch,uint32_t dom, -unsigned long *parray,struct domain_setup_info *dsi); +xen_pfn_t *parray,struct domain_setup_info *dsi);static int loadelfsymtab ( -const char *image,int xch,uint32_t dom,unsigned long *parray, +const char *image,int xch,uint32_t dom,xen_pfn_t *parray,struct domain_setup_info *dsi); int probe_elf(const char *image,
@@ -220,7 +220,7 @@ static intstatic int loadelfimage (const char *image,unsigned long elfsize,int xch,uint32_t dom, -unsigned long *parray,struct domain_setup_info *dsi) +xen_pfn_t *parray,struct domain_setup_info *dsi) {Elf_Ehdr *ehdr = (Elf_Ehdr *)image;Elf_Phdr *phdr;
@@ -274,7 +274,7 @@ loadelfimage(static int loadelfsymtab ( -const char *image,int xch,uint32_t dom,unsigned long *parray, +const char *image,int xch,uint32_t dom,xen_pfn_t *parray,struct domain_setup_info *dsi) {Elf_Ehdr *ehdr = (Elf_Ehdr *)image, *sym_ehdr;
tools/libxc/xc_private.c +20 -19
@@ -4,6 +4,7 @@* Helper functions for the rest of the library. */ +#include <inttypes.h> #include "xc_private.h" /* NB: arr must be mlock'ed */
@@ -134,9 +135,9 @@ int xc_memory_op(int xc_handle,struct xen_memory_reservation *reservation = arg;struct xen_machphys_mfn_list *xmml = arg;struct xen_translate_gpfn_list *trans = arg; -unsigned long *extent_start; -unsigned long *gpfn_list; -unsigned long *mfn_list; +xen_pfn_t *extent_start; +xen_pfn_t *gpfn_list; +xen_pfn_t *mfn_list;long ret = -EINVAL ; hypercall.op = __HYPERVISOR_memory_op;
@@ -156,7 +157,7 @@ int xc_memory_op(int xc_handle,get_xen_guest_handle (extent_start, reservation->extent_start);if ( (extent_start !=NULL ) && (mlock (extent_start, - reservation->nr_extents *sizeof (unsigned long )) !=0 ) ) + reservation->nr_extents *sizeof (xen_pfn_t)) !=0 ) ) {PERROR ("Could not mlock" );safe_munlock (reservation,sizeof (*reservation));
@@ -171,7 +172,7 @@ int xc_memory_op(int xc_handle, }get_xen_guest_handle (extent_start, xmml->extent_start);if (mlock (extent_start, - xmml->max_extents *sizeof (unsigned long )) !=0 ) + xmml->max_extents *sizeof (xen_pfn_t)) !=0 ) {PERROR ("Could not mlock" );safe_munlock (xmml,sizeof (*xmml));
@@ -192,17 +193,17 @@ int xc_memory_op(int xc_handle, goto out1; }get_xen_guest_handle (gpfn_list, trans->gpfn_list); -if (mlock (gpfn_list, trans->nr_gpfns *sizeof (long )) !=0 ) +if (mlock (gpfn_list, trans->nr_gpfns *sizeof (xen_pfn_t)) !=0 ) {PERROR ("Could not mlock" );safe_munlock (trans,sizeof (*trans)); goto out1; }get_xen_guest_handle (mfn_list, trans->mfn_list); -if (mlock (mfn_list, trans->nr_gpfns *sizeof (long )) !=0 ) - { -PERROR ("Could not mlock" ); -safe_munlock (gpfn_list, trans->nr_gpfns *sizeof (long )); +if (mlock (mfn_list, trans->nr_gpfns *sizeof (xen_pfn_t)) !=0 ) + { +PERROR ("Could not mlock" ); +safe_munlock (gpfn_list, trans->nr_gpfns *sizeof (xen_pfn_t));safe_munlock (trans,sizeof (*trans)); goto out1; }
@@ -220,22 +221,22 @@ int xc_memory_op(int xc_handle,get_xen_guest_handle (extent_start, reservation->extent_start);if ( extent_start !=NULL )safe_munlock (extent_start, - reservation->nr_extents *sizeof (unsigned long )); + reservation->nr_extents *sizeof (xen_pfn_t));break ;case XENMEM_machphys_mfn_list:safe_munlock (xmml,sizeof (*xmml));get_xen_guest_handle (extent_start, xmml->extent_start);safe_munlock (extent_start, - xmml->max_extents *sizeof (unsigned long )); + xmml->max_extents *sizeof (xen_pfn_t));break ;case XENMEM_add_to_physmap:safe_munlock (arg,sizeof (struct xen_add_to_physmap ));break ;case XENMEM_translate_gpfn_list:get_xen_guest_handle (mfn_list, trans->mfn_list); -safe_munlock (mfn_list, trans->nr_gpfns *sizeof (long )); +safe_munlock (mfn_list, trans->nr_gpfns *sizeof (xen_pfn_t));get_xen_guest_handle (gpfn_list, trans->gpfn_list); -safe_munlock (gpfn_list, trans->nr_gpfns *sizeof (long )); +safe_munlock (gpfn_list, trans->nr_gpfns *sizeof (xen_pfn_t));safe_munlock (trans,sizeof (*trans));break ; }
@@ -263,7 +264,7 @@ long long xc_domain_get_cpu_usage( int xint xc_get_pfn_list (int xc_handle,uint32_t domid, -unsigned long *pfn_buf, +xen_pfn_t *pfn_buf,unsigned long max_pfns) {DECLARE_DOM0_OP ;
@@ -274,10 +275,10 @@ int xc_get_pfn_list(int xc_handle,set_xen_guest_handle (op.u.getmemlist.buffer, pfn_buf);#ifdef VALGRIND -memset (pfn_buf,0 , max_pfns *sizeof (unsigned long )); +memset (pfn_buf,0 , max_pfns *sizeof (xen_pfn_t));#endif -if (mlock (pfn_buf, max_pfns *sizeof (unsigned long )) !=0 ) +if (mlock (pfn_buf, max_pfns *sizeof (xen_pfn_t)) !=0 ) {PERROR ("xc_get_pfn_list: pfn_buf mlock failed" );return -1 ;
@@ -285,7 +286,7 @@ int xc_get_pfn_list(int xc_handle, ret =do_dom0_op (xc_handle, &op); -safe_munlock (pfn_buf, max_pfns *sizeof (unsigned long )); +safe_munlock (pfn_buf, max_pfns *sizeof (xen_pfn_t));#if 0 #ifdef DEBUG
@@ -364,7 +365,7 @@ unsigned long xc_get_filesz(int fd) }void xc_map_memcpy (unsigned long dst,const char *src,unsigned long size, -int xch,uint32_t dom,unsigned long *parray, +int xch,uint32_t dom,xen_pfn_t *parray,unsigned long vstart) {char *va;
tools/libxc/xenctrl.h +8 -8
@@ -420,26 +420,26 @@ int xc_domain_memory_increase_reservatiounsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start); + xen_pfn_t *extent_start);int xc_domain_memory_decrease_reservation (int xc_handle,uint32_t domid,unsigned long nr_extents,unsigned int extent_order, -unsigned long *extent_start); +xen_pfn_t *extent_start);int xc_domain_memory_populate_physmap (int xc_handle,uint32_t domid,unsigned long nr_extents,unsigned int extent_order,unsigned int address_bits, -unsigned long *extent_start); +xen_pfn_t *extent_start);int xc_domain_translate_gpfn_list (int xc_handle,uint32_t domid,unsigned long nr_gpfns, -unsigned long *gpfn_list, -unsigned long *mfn_list); +xen_pfn_t *gpfn_list, +xen_pfn_t *mfn_list); int xc_domain_ioport_permission(int xc_handle, uint32_t domid,
@@ -489,7 +489,7 @@ void *xc_map_foreign_range(int xc_handle unsigned long mfn );void *xc_map_foreign_batch (int xc_handle,uint32_t dom,int prot, -unsigned long *arr,int num ); +xen_pfn_t *arr,int num );/** * Translates a virtual address in the context of a given domain and
@@ -504,11 +504,11 @@ unsigned long xc_translate_foreign_addreunsigned long xc_translate_foreign_address (int xc_handle,uint32_t dom,int vcpu,unsigned long long virt); -int xc_get_pfn_list (int xc_handle,uint32_t domid,unsigned long *pfn_buf, +int xc_get_pfn_list (int xc_handle,uint32_t domid,xen_pfn_t *pfn_buf,unsigned long max_pfns);int xc_ia64_get_pfn_list (int xc_handle,uint32_t domid, -unsigned long *pfn_buf, +xen_pfn_t *pfn_buf,unsigned int start_page,unsigned int nr_pages); int xc_copy_to_domain_page(int xc_handle, uint32_t domid,
tools/libxc/xg_private.h +2 -2
@@ -162,7 +162,7 @@ typedef int (*parseimagefunc)(const char struct domain_setup_info *dsi);typedef int (*loadimagefunc )(const char *image,unsigned long image_size,int xch, -uint32_t dom,unsigned long *parray, +uint32_t dom,xen_pfn_t *parray,struct domain_setup_info *dsi);struct load_funcs
@@ -190,7 +190,7 @@ unsigned long xc_get_filesz(int fd);unsigned long xc_get_filesz (int fd);void xc_map_memcpy (unsigned long dst,const char *src,unsigned long size, -int xch,uint32_t dom,unsigned long *parray, +int xch,uint32_t dom,xen_pfn_t *parray,unsigned long vstart); int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
tools/libxc/xg_save_restore.h +6 -6
@@ -105,23 +105,23 @@ static int get_platform_info(int xc_hand*/ #define M2P_SHIFT L2_PAGETABLE_SHIFT_PAE#define M2P_CHUNK_SIZE (1 << M2P_SHIFT) -#define M2P_SIZE (_m) ROUNDUP(((_m) * sizeof(unsigned long)), M2P_SHIFT) +#define M2P_SIZE (_m) ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT)#define M2P_CHUNKS (_m) (M2P_SIZE((_m)) >> M2P_SHIFT)/* Size in bytes of the P2M (rounded up to the nearest PAGE_SIZE bytes) */ -#define P2M_SIZE ROUNDUP((max_pfn * sizeof(unsigned long)), PAGE_SHIFT) +#define P2M_SIZE ROUNDUP((max_pfn * sizeof(xen_pfn_t)), PAGE_SHIFT) -/* Number of unsigned longs in a page */ -#define ulpp (PAGE_SIZE/sizeof(unsigned long)) +/* Number of xen_pfn_t in a page */ +#define fpp (PAGE_SIZE/sizeof(xen_pfn_t))/* Number of entries in the pfn_to_mfn_frame_list */ -#define P2M_FL_ENTRIES (((max_pfn)+ulpp-1)/ulpp) +#define P2M_FL_ENTRIES (((max_pfn)+fpp-1)/fpp)/* Size in bytes of the pfn_to_mfn_frame_list */ #define P2M_FL_SIZE ((P2M_FL_ENTRIES)*sizeof(unsigned long))/* Number of entries in the pfn_to_mfn_frame_list_list */ -#define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp)) +#define P2M_FLL_ENTRIES (((max_pfn)+(fpp*fpp)-1)/(fpp*fpp))/* Current guests allow 8MB 'slack' in their P2M */ #define NR_SLACK_ENTRIES ((8 * 1024 * 1024) / PAGE_SIZE)
xen/common/memory.c +13 -7
@@ -31,14 +31,15 @@ static longstatic long increase_reservation (struct domain *d, -XEN_GUEST_HANDLE (ulong) extent_list, +XEN_GUEST_HANDLE (xen_pfn_t) extent_list,unsigned int nr_extents,unsigned int extent_order,unsigned int flags,int *preempted) {struct page_info *page; -unsigned long i, mfn; +unsigned long i; +xen_pfn_t mfn;if ( !guest_handle_is_null (extent_list) && !guest_handle_okay (extent_list, nr_extents) )
@@ -80,14 +81,16 @@ static longstatic long populate_physmap (struct domain *d, -XEN_GUEST_HANDLE (ulong) extent_list, +XEN_GUEST_HANDLE (xen_pfn_t) extent_list,unsigned int nr_extents,unsigned int extent_order,unsigned int flags,int *preempted) {struct page_info *page; -unsigned long i, j, gpfn, mfn; +unsigned long i, j; +xen_pfn_t gpfn; +xen_pfn_t mfn;if ( !guest_handle_okay (extent_list, nr_extents) )return 0 ;
@@ -177,13 +180,14 @@ static longstatic long decrease_reservation (struct domain *d, -XEN_GUEST_HANDLE (ulong) extent_list, +XEN_GUEST_HANDLE (xen_pfn_t) extent_list,unsigned int nr_extents,unsigned int extent_order,unsigned int flags,int *preempted) { -unsigned long i, j, gmfn; +unsigned long i, j; +xen_pfn_t gmfn;if ( !guest_handle_okay (extent_list, nr_extents) )return 0 ;
@@ -214,7 +218,9 @@ translate_gpfn_list( XEN_GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress) { struct xen_translate_gpfn_list op; -unsigned long i, gpfn, mfn; +unsigned long i; +xen_pfn_t gpfn; +xen_pfn_t mfn;struct domain *d;if (copy_from_guest (&op, uop,1 ) )
xen/include/public/arch-ia64.h +3 -0
@@ -26,6 +26,9 @@ DEFINE_XEN_GUEST_HANDLE(int);DEFINE_XEN_GUEST_HANDLE (int);DEFINE_XEN_GUEST_HANDLE (long);DEFINE_XEN_GUEST_HANDLE (void); + +typedef unsigned long xen_pfn_t ; +DEFINE_XEN_GUEST_HANDLE (xen_pfn_t);#endif /* Arch specific VIRQs definition */
xen/include/public/arch-x86_32.h +3 -0
@@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(int);DEFINE_XEN_GUEST_HANDLE (int);DEFINE_XEN_GUEST_HANDLE (long);DEFINE_XEN_GUEST_HANDLE (void); + +typedef unsigned long xen_pfn_t ; +DEFINE_XEN_GUEST_HANDLE (xen_pfn_t);#endif /*
xen/include/public/arch-x86_64.h +3 -0
@@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(int);DEFINE_XEN_GUEST_HANDLE (int);DEFINE_XEN_GUEST_HANDLE (long);DEFINE_XEN_GUEST_HANDLE (void); + +typedef unsigned long xen_pfn_t ; +DEFINE_XEN_GUEST_HANDLE (xen_pfn_t);#endif /*
xen/include/public/dom0_ops.h +1 -1
@@ -28,7 +28,7 @@ struct dom0_getmemlist {/* IN variables. */ domid_t domain;unsigned long max_pfns; -XEN_GUEST_HANDLE (ulong) buffer; +XEN_GUEST_HANDLE (xen_pfn_t) buffer;/* OUT variables. */ unsigned long num_pfns; };
xen/include/public/memory.h +4 -4
@@ -29,7 +29,7 @@ struct xen_memory_reservation {* OUT: GMFN bases of extents that were allocated * (NB. This command also updates the mach_to_phys translation table) */ -XEN_GUEST_HANDLE (ulong) extent_start; +XEN_GUEST_HANDLE (xen_pfn_t) extent_start;/* Number of extents, and size/alignment of each (2^extent_order pages). */ unsigned long nr_extents;
@@ -87,7 +87,7 @@ struct xen_machphys_mfn_list {* any large discontiguities in the machine address space, 2MB gaps in * the machphys table will be represented by an MFN base of zero. */ -XEN_GUEST_HANDLE (ulong) extent_start; +XEN_GUEST_HANDLE (xen_pfn_t) extent_start;/* * Number of extents written to the above array. This will be smaller
@@ -135,13 +135,13 @@ struct xen_translate_gpfn_list {unsigned long nr_gpfns;/* List of GPFNs to translate. */ -XEN_GUEST_HANDLE (ulong) gpfn_list; +XEN_GUEST_HANDLE (xen_pfn_t) gpfn_list;/* * Output list to contain MFN translations. May be the same as the input * list (in which case each input GPFN is overwritten with the output MFN). */ -XEN_GUEST_HANDLE (ulong) mfn_list; +XEN_GUEST_HANDLE (xen_pfn_t) mfn_list; };typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t ;DEFINE_XEN_GUEST_HANDLE (xen_translate_gpfn_list_t);
PATCH 1/1 Use explicitly-sized types in the dom0_ops and privcmd structures
In reply to Hollis Blanchard2 files changed, 35 insertions(+), 33 deletions(-) linux-2.6-xen-sparse/include/xen/public/privcmd.h | 14 +++-- xen/include/public/dom0_ops.h | 54 ++++++++++-----------
# HG changeset patch
# User Hollis Blanchard <[email protected]>
# Node ID 84a066cea84cb24c62d1cc5f66ebd0130fb2f180
# Parent 5e77ab7d66927f82e03f54128a0c19ce71db1552
Use explicitly-sized types in the dom0_ops and privcmd structures. As discussed previously, the these operations are not performance-sensitive, so the additional cache footprint shouldn't be an issue.
linux-2.6-xen-sparse/include/xen/public/privcmd.h +8 -6
@@ -33,20 +33,22 @@ #ifndef __LINUX_PUBLIC_PRIVCMD_H__ #define __LINUX_PUBLIC_PRIVCMD_H__ +#include <linux/types.h> + #ifndef __user #define __user #endif typedef struct privcmd_hypercall { - unsigned long op; - unsigned long arg[5]; + __u64 op; + __u64 arg[5]; } privcmd_hypercall_t; typedef struct privcmd_mmap_entry { - unsigned long va; - unsigned long mfn; - unsigned long npages; + __u64 va; + __u64 mfn; + __u64 npages; } privcmd_mmap_entry_t; typedef struct privcmd_mmap {
@@ -58,7 +60,7 @@ typedef struct privcmd_mmapbatch {typedef struct privcmd_mmapbatch {int num;/* number of pages to populate */ domid_t dom;/* target domain */ -unsigned long addr;/* virtual address */ +__u64 addr;/* virtual address */ xen_pfn_t __user *arr;/* array of mfns - top nibble set on err */ }privcmd_mmapbatch_t ;
xen/include/public/dom0_ops.h +27 -27
134 lines not on this page · raw message
Quoted 6 lines · Hollis Blanchard
These three patches allow me to use 32-bit libxc (and xend and xm) with a 64-bit PPC hypervisor.
This is a resend. I've updated to the latest xen-unstable tree, and changed the privcmd types from
uint64_tto__u64at Chris Wright's request.
Hi guys, I've heard that you're discussing patches 2 and 3 in this series (I saw that patch 1 went in; thanks).
However, I haven't seen any thoughts from you on the subject. Could you summarize some of the issues you're discussing? What are the different approaches that are being advocated?
Since the patches touch a lot of code, it's easy for other checkins to cause conflicts and so it's difficult to maintain the patches out of tree.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 3 lines · Hollis Blanchard
Since the patches touch a lot of code, it's easy for other checkins to cause conflicts and so it's difficult to maintain the patches out of tree.
Is this the last set of interface munging we need to do for ppc, or is there more in the pipeline? If these two patches are all that is now required, I'm inclined just to take them.
Apart from that, patch 3/3 changes lots of mfn fields to u64. Shouldn't they properly use your new xen_pfn_t type? There are a few other frame numbers dotted around the public headers that perhaps ought also to be converted?
-- Keir
Quoted 9 lines · Keir Fraser
Quoted 3 lines · Hollis Blanchard
Since the patches touch a lot of code, it's easy for other checkins to cause conflicts and so it's difficult to maintain the patches out of tree.
Is this the last set of interface munging we need to do for ppc, or is there more in the pipeline? If these two patches are all that is now required, I'm inclined just to take them.
These are the only patches I know of. I think it's likely there's a corner or two I missed, but these patches alone get things working for me.
Quoted 4 lines
Apart from that, patch 3/3 changes lots of mfn fields to u64. Shouldn't they properly use your new
xen_pfn_ttype? There are a few other frame numbers dotted around the public headers that perhaps ought also to be converted?
I believe the agreement we reached earlier was that *internally* (on any side of any interface), passing around a single PFN can be type 'unsigned long', since on 32-bit systems that still lets you manage 42 bits of physical memory, and that "should be good enough for anybody."
Unrelated to that, I converted all 'unsigned long' in the *interface* to be u64. The one exception is that PFN arrays (not single PFNs) became 'xen_pfn_t'.
Does that make sense?
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 5 lines
I believe the agreement we reached earlier was that *internally* (on any side of any interface), passing around a single PFN can be type 'unsigned long', since on 32-bit systems that still lets you manage 42 bits of physical memory, and that "should be good enough for anybody."
Yes. It's only the interface we want to change.
Quoted 5 lines
Unrelated to that, I converted all 'unsigned long' in the *interface* to be u64. The one exception is that PFN arrays (not single PFNs) became '
xen_pfn_t'.Does that make sense?
It seems weird/arbitrary to me to change the type only of PFNs that are array elements.
-- Keir
Quoted 4 lines
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 9 lines · Keir Fraser
Quoted 2 lines
Unrelated to that, I converted all 'unsigned long' in the
*interface*
Quoted 2 lines
to
be u64. The one exception is that PFN arrays (not single PFNs)became
Quoted 1 line
'
xen_pfn_t'.It seems weird/arbitrary to me to change the type only of PFNs that are array elements.
I agree, but I thought that was the preference at the time. Would you like me to regenerate the patch and resubmit, or will you do that?
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 2 lines · Hollis Blanchard
I agree, but I thought that was the preference at the time. Would you like me to regenerate the patch and resubmit, or will you do that?
Since it interacts with the dom0_ops patch (making some of it redundant) please resubmit both.
-- Keir