ARCH_HAS_DEV_MEM patch for Xwindow on IA64 machine
PATCH 1/1 ARCH_HAS_DEV_MEM patch for Xwindow on IA64 machine
Hi all,
Attached patch modifies common code in files below, so I will post it to xen-devel and xen-ia64-devel.
- drivers/xen/Kconfig
- drivers/xen/Makefile
- drivers/xen/char/mem.c
This patch makes architecture specific memory operations to be available only if ARCH_HAS_DEV_MEM is defined.
Background why I posted the patch is as follows.
We would like to support Xwindow on IA64 by remapping machine address to pseudo physical address at PCI device initialization (pci_acpi_scan_root() in arch/ia64/pci/pci.c) but at "mmap /dev/mem" systemcall. With the new scheme, we need no longer the archtecture specific memory operations described above.
Please see
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-06/msg00167.html
Thanks
-----
Jun Kamada
Virtual Systems Development Div.
Platform Technology Development Unit
Fujitsu Ltd.
[email protected]
# HG changeset patch
# User Jun Kamada <[email protected]>
# Date 1182406401 -32400
# Node ID 40489068407c9c5488100a2c8d54d5c64676aba0
# Parent 6d89642c02d490c24fe7ad39dce4f2622f1ef1cb
Add "#ifdef ARCH_HAS_DEV_MEM" to archtecture specific file_operations.
drivers/xen/Kconfig +4 -0
@@ -273,4 +273,8 @@ config XEN_SMPBOOT default y depends on SMP +config XEN_DEVMEM + bool + default y + endif
drivers/xen/Makefile +1 -1
@@ -5,9 +5,9 @@ obj-y += xenbus/ obj-y += xenbus/ obj-y += gntdev/ obj-y += balloon/ -obj-y += char/ obj-y += util.o +obj-$(CONFIG_XEN_DEVMEM) += char/ obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/ obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/ obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/
drivers/xen/char/mem.c +4 -0
@@ -33,6 +33,7 @@ static inline int valid_phys_addr_range( }#endif +#ifdef ARCH_HAS_DEV_MEM /* * This funcion reads the *physical* memory. The f_pos points directly to the * memory location.
@@ -135,6 +136,7 @@ static ssize_t write_mem(struct file * f *ppos += written; return written; } +#endif #ifndef ARCH_HAS_DEV_MEM_MMAP_MEM static inline int uncached_access (struct file *file)
@@ -194,6 +196,7 @@ static int open_mem(struct inode * inodereturn capable (CAP_SYS_RAWIO ) ?0 : -EPERM ; } +#ifdef ARCH_HAS_DEV_MEM const struct file_operations mem_fops = { .llseek = memory_lseek, .read = read_mem,
@@ -201,3 +204,4 @@ const struct file_operations mem_fops = .mmap = xen_mmap_mem, .open = open_mem, }; +#endif
_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel
Re: [Patch] ARCH_HAS_DEV_MEM patch for Xwindow on IA64machine
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Jun Kamada <[email protected]> 04.07.07 13:43 >>>
We would like to support Xwindow on IA64 by remapping machine address to pseudo physical address at PCI device initialization (
pci_acpi_scan_root()inarch/ia64/pci/pci.c) but at "mmap/dev/mem" systemcall. With the new scheme, we need no longer the archtecture specific memory operations described above.
You only talk about X - isn't it possible that there are other users of this interface?
Also,
Quoted 11 lines
drivers/xen/Kconfig +4
-0@@ -273,4 +273,8 @@ config XEN_SMPBOOT default y depends on SMP +config XEN_DEVMEM + bool + default y +endif
This seems pretty useless unless ia64 doesn't use drivers/xen/Kconfig (which would be a mistake I think).
Quoted 8 lines
drivers/xen/Makefile +0
-0@@ -5,9 +5,9 @@ obj-y += xenbus/obj-y += xenbus/
obj-y += gntdev/
obj-y += balloon/
-obj-y += char/
Quoted 5 lines
obj-y += util.o
+obj-$(CONFIG_XEN_DEVMEM) += char/
obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/
obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/
obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/
This is certainly wrong. Even if driver/xen/char/ currently only has a single file, you should descend into that directory. The conditional (if needed at all) should then be in driver/xen/char/Makefile.
Jan
Re: [Xen-devel] [Patch] ARCH_HAS_DEV_MEM patch for Xwindow onIA64machine
Hi, Jan
Quoted 10 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Jun Kamada <[email protected]> 04.07.07 13:43 >>>
We would like to support Xwindow on IA64 by remapping machine address to pseudo physical address at PCI device initialization (
pci_acpi_scan_root()inarch/ia64/pci/pci.c) but at "mmap/dev/mem" systemcall. With the new scheme, we need no longer the archtecture specific memory operations described above.You only talk about X - isn't it possible that there are other users of this interface?
Yes, you're right.
But if the following kama's patches are applied, Xen-ia64 use drivers/char/mem.c.
So drivers/xen/char/mem.c will not be needed by Xen-ia64.
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-06/msg00167.html
Quoted 8 lines
Also,
Quoted 6 lines
drivers/xen/Kconfig +0
-0@@ -273,4 +273,8 @@ config XEN_SMPBOOT default y depends on SMP
Quoted 8 lines
Quoted 5 lines
drivers/xen/Kconfig +4
-0+config XEN_DEVMEM + bool + default y +endif
This seems pretty useless unless ia64 doesn't use
drivers/xen/Kconfig(which would be a mistake I think).
Please see the following patch.
http://lists.xensource.com/archives/html/xen-ia64-devel/2007-06/msg00169.html
Currently drviers/xen/char is built by all archtecture. But if the above kama's patche is applied, it is not built by ia64.
linux-2.6-xen-sparse/arch/ia64/Kconfig +3 -0
@@ -582,6 +582,9 @@ if XEN if XEN config XEN_SMPBOOT default n + +config XEN_DEVMEM + default n endif source "drivers/xen/Kconfig"
Best Regards,
Akio Takebe
Re: [Patch] ARCH_HAS_DEV_MEM patch for Xwindow on IA64machine
In reply to Jan BeulichHi, Jan-san,
Quoted 8 lines · On Wed, 04 Jul 2007 13:04:50 +0100 "Jan Beulich" <[email protected]> wrote:
Quoted 8 lines
drivers/xen/Makefile +0
-0@@ -5,9 +5,9 @@ obj-y += xenbus/obj-y += xenbus/
obj-y += gntdev/
obj-y += balloon/
-obj-y += char/
Quoted 9 lines
Quoted 5 lines
obj-y += util.o
+obj-$(CONFIG_XEN_DEVMEM) += char/
obj-$(CONFIG_XEN_BLKDEV_BACKEND) += blkback/
obj-$(CONFIG_XEN_BLKDEV_TAP) += blktap/
obj-$(CONFIG_XEN_NETDEV_BACKEND) += netback/This is certainly wrong. Even if driver/xen/char/ currently only has a single file, you should descend into that directory. The conditional (if needed at all) should then be in driver/xen/char/Makefile.
I modified the patch acording to your comment.
Thanks,
-----
Jun Kamada
Linux Technology Development Div.
Server Systems Unit
Fujitsu Ltd.
[email protected]
# HG changeset patch
# User Jun Kamada <[email protected]>
# Date 1183747330 -32400
# Node ID 2ddfe7a08970b5580ef5b53fa1abe0126b9fdf9e
# Parent e9426682eb0c31a8a4d25363eb2d180f493d01d5
Add "#ifdef ARCH_HAS_DEV_MEM" to archtecture specific file_operations.
drivers/xen/Kconfig +4 -0
@@ -274,4 +274,8 @@ config XEN_SMPBOOT default y depends on SMP +config XEN_DEVMEM + bool + default y + endif
drivers/xen/char/Makefile +1 -2
@@ -1,2 +1,1 @@ - -obj-y := mem.o +obj-$(CONFIG_XEN_DEVMEM) := mem.o
drivers/xen/char/mem.c +4 -0
@@ -33,6 +33,7 @@ static inline int valid_phys_addr_range( }#endif +#ifdef ARCH_HAS_DEV_MEM /* * This funcion reads the *physical* memory. The f_pos points directly to the * memory location.
@@ -135,6 +136,7 @@ static ssize_t write_mem(struct file * f *ppos += written; return written; } +#endif #ifndef ARCH_HAS_DEV_MEM_MMAP_MEM static inline int uncached_access (struct file *file)
@@ -194,6 +196,7 @@ static int open_mem(struct inode * inodereturn capable (CAP_SYS_RAWIO ) ?0 : -EPERM ; } +#ifdef ARCH_HAS_DEV_MEM const struct file_operations mem_fops = { .llseek = memory_lseek, .read = read_mem,
@@ -201,3 +204,4 @@ const struct file_operations mem_fops = .mmap = xen_mmap_mem, .open = open_mem, }; +#endif
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel