md: raid5: fix clearing of biofill operations

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4ae3f847e49e3787eca91bced31f8fd328d50496
Commit: 4ae3f847e49e3787eca91bced31f8fd328d50496
Parent: 85bfb4da8cad483a4e550ec89060d05a4daf895b
Author: Dan Williams [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 20:45:11 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:06 2007 -0700

md: raid5: fix clearing of biofill operations

ops_complete_biofill() runs outside of spin_lock(sh-lock) and clears the
'pending' and 'ack' bits.  Since the test_and_ack_op() macro only checks
against 'complete' it can get an inconsistent snapshot of pending work.

Move the clearing of these bits to handle_stripe5(), under the lock.

Signed-off-by: Dan Williams [EMAIL PROTECTED]
Tested-by: Joel Bertrand [EMAIL PROTECTED]
Signed-off-by: Neil Brown [EMAIL PROTECTED]
Cc: Stable [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/md/raid5.c |   17 ++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 8ee181a..80a67d7 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -376,7 +376,12 @@ static unsigned long get_stripe_work(struct stripe_head 
*sh)
ack++;
 
sh-ops.count -= ack;
-   BUG_ON(sh-ops.count  0);
+   if (unlikely(sh-ops.count  0)) {
+   printk(KERN_ERR pending: %#lx ops.pending: %#lx ops.ack: %#lx 
+   ops.complete: %#lx\n, pending, sh-ops.pending,
+   sh-ops.ack, sh-ops.complete);
+   BUG();
+   }
 
return pending;
 }
@@ -550,8 +555,7 @@ static void ops_complete_biofill(void *stripe_head_ref)
}
}
}
-   clear_bit(STRIPE_OP_BIOFILL, sh-ops.ack);
-   clear_bit(STRIPE_OP_BIOFILL, sh-ops.pending);
+   set_bit(STRIPE_OP_BIOFILL, sh-ops.complete);
 
return_io(return_bi);
 
@@ -2893,6 +2897,13 @@ static void handle_stripe6(struct stripe_head *sh, 
struct page *tmp_page)
s.expanded = test_bit(STRIPE_EXPAND_READY, sh-state);
/* Now to look around and see what can be done */
 
+   /* clean-up completed biofill operations */
+   if (test_bit(STRIPE_OP_BIOFILL, sh-ops.complete)) {
+   clear_bit(STRIPE_OP_BIOFILL, sh-ops.pending);
+   clear_bit(STRIPE_OP_BIOFILL, sh-ops.ack);
+   clear_bit(STRIPE_OP_BIOFILL, sh-ops.complete);
+   }
+
rcu_read_lock();
for (i=disks; i--; ) {
mdk_rdev_t *rdev;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


fix mprotect vma_wants_writenotify prot

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1ddd439ef987c9f0209e6ce824b67518f2afe67b
Commit: 1ddd439ef987c9f0209e6ce824b67518f2afe67b
Parent: 4ae3f847e49e3787eca91bced31f8fd328d50496
Author: Hugh Dickins [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 20:45:12 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:06 2007 -0700

fix mprotect vma_wants_writenotify prot

Fix mprotect bug in recent commit 3ed75eb8f1cd89565966599c4f77d2edb086d5b0
(setup vma-vm_page_prot by vm_get_page_prot()): the vma_wants_writenotify
case was setting the same prot as when not.

Nothing wrong with the use of protection_map[] in mmap_region(),
but use vm_get_page_prot() there too in the same ~VM_SHARED way.

Signed-off-by: Hugh Dickins [EMAIL PROTECTED]
Cc: Coly Li [EMAIL PROTECTED]
Cc: Tony Luck [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 mm/mmap.c |3 +--
 mm/mprotect.c |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 7a30c49..facc1a7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1171,8 +1171,7 @@ munmap_back:
vm_flags = vma-vm_flags;
 
if (vma_wants_writenotify(vma))
-   vma-vm_page_prot =
-   protection_map[vm_flags  (VM_READ|VM_WRITE|VM_EXEC)];
+   vma-vm_page_prot = vm_get_page_prot(vm_flags  ~VM_SHARED);
 
if (!file || !vma_merge(mm, prev, addr, vma-vm_end,
vma-vm_flags, NULL, file, pgoff, vma_policy(vma))) {
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 5522784..4de5468 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -194,7 +194,7 @@ success:
vma-vm_flags = newflags;
vma-vm_page_prot = vm_get_page_prot(newflags);
if (vma_wants_writenotify(vma)) {
-   vma-vm_page_prot = vm_get_page_prot(newflags);
+   vma-vm_page_prot = vm_get_page_prot(newflags  ~VM_SHARED);
dirty_accountable = 1;
}
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Char: cyclades, fix potential NULL dereference

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7fa57a0cd98bdd163eeb5f15cbe234c3a0cf68a1
Commit: 7fa57a0cd98bdd163eeb5f15cbe234c3a0cf68a1
Parent: 1ddd439ef987c9f0209e6ce824b67518f2afe67b
Author: Jiri Slaby [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 20:45:13 2007 -0700
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:06 2007 -0700

Char: cyclades, fix potential NULL dereference

ztxdone is jumped to even if tty is NULL and tty_wakeup placed after
this label doesn't expect NULLed parameter, so this will cause an oops
in some situations (why they scheduled a wakeup there before remove
bottom half processing patch?).

wakeup only in the case when we have non-null tty struct.

Spotted by Adrian Bunk.

Signed-off-by: Jiri Slaby [EMAIL PROTECTED]
Cc: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/char/cyclades.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index d1bd0f0..e4f579c 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1602,8 +1602,8 @@ static void cyz_handle_tx(struct cyclades_port *info,
info-icount.tx++;
}
 #endif
-ztxdone:
tty_wakeup(tty);
+ztxdone:
/* Update tx_put */
cy_writel(buf_ctrl-tx_put, tx_put);
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: improve code formating FEC driver

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f909b1ef8ce3e93d1cf66f33313d8ed11102e87f
Commit: f909b1ef8ce3e93d1cf66f33313d8ed11102e87f
Parent: 7fa57a0cd98bdd163eeb5f15cbe234c3a0cf68a1
Author: Philippe De Muyter [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: improve code formating FEC driver

Indent all the `else' the same way.
Remove some unecesary white space.

Signed-off-by: Philippe De Muyter [EMAIL PROTECTED]
Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/net/fec.c |   17 +
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 2b57820..e0d8755 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -751,13 +751,11 @@ mii_queue(struct net_device *dev, int regval, void 
(*func)(uint, struct net_devi
if (mii_head) {
mii_tail-mii_next = mip;
mii_tail = mip;
-   }
-   else {
+   } else {
mii_head = mii_tail = mip;
fep-hwp-fec_mii_data = regval;
}
-   }
-   else {
+   } else {
retval = 1;
}
 
@@ -792,7 +790,6 @@ static void mii_parse_sr(uint mii_reg, struct net_device 
*dev)
status |= PHY_STAT_FAULT;
if (mii_reg  0x0020)
status |= PHY_STAT_ANC;
-
*s = status;
 }
 
@@ -1239,7 +1236,6 @@ mii_link_interrupt(int irq, void * dev_id);
 #endif
 
 #if defined(CONFIG_M5272)
-
 /*
  * Code specific to Coldfire 5272 setup.
  */
@@ -2020,8 +2016,7 @@ static void mii_relink(struct work_struct *work)
 (PHY_STAT_100FDX | PHY_STAT_10FDX))
duplex = 1;
fec_restart(dev, duplex);
-   }
-   else
+   } else
fec_stop(dev);
 
 #if 0
@@ -2119,8 +2114,7 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
fep-phy_id = phytype  16;
mii_queue(dev, mk_mii_read(MII_REG_PHYIR2),
mii_discover_phy3);
-   }
-   else {
+   } else {
fep-phy_addr++;
mii_queue(dev, mk_mii_read(MII_REG_PHYIR1),
mii_discover_phy);
@@ -2574,8 +2568,7 @@ fec_restart(struct net_device *dev, int duplex)
if (duplex) {
fecp-fec_r_cntrl = OPT_FRAME_SIZE | 0x04;/* MII enable */
fecp-fec_x_cntrl = 0x04; /* FD enable */
-   }
-   else {
+   } else {
/* MII enable|No Rcv on Xmit */
fecp-fec_r_cntrl = OPT_FRAME_SIZE | 0x06;
fecp-fec_x_cntrl = 0x00;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: fix syscall tracing

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=151941a800fd9598d38f8b5a73de0471afe66507
Commit: 151941a800fd9598d38f8b5a73de0471afe66507
Parent: f909b1ef8ce3e93d1cf66f33313d8ed11102e87f
Author: Matt Waddel [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: fix syscall tracing

Fix the system call code for handling syscall tracing, so strace
and gdbserver work properly.

This fix originally developed by Philippe De Muyter and Stuart Hughes.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/platform/5307/entry.S |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/m68knommu/platform/5307/entry.S 
b/arch/m68knommu/platform/5307/entry.S
index a8cd867..b333731 100644
--- a/arch/m68knommu/platform/5307/entry.S
+++ b/arch/m68knommu/platform/5307/entry.S
@@ -74,7 +74,8 @@ ENTRY(system_call)
movel   %sp,%d2 /* get thread_info pointer */
andl#-THREAD_SIZE,%d2   /* at start of kernel stack */
movel   %d2,%a0
-   movel   %sp,%a0@(THREAD_ESP0)   /* save top of frame */
+   movel   %a0@,%a1/* save top of frame */
+   movel   %sp,%a1@(TASK_THREAD+THREAD_ESP0)
btst#(TIF_SYSCALL_TRACE%8),%a0@(TI_FLAGS+(31-TIF_SYSCALL_TRACE)/8)
bnes1f
 
@@ -83,6 +84,8 @@ ENTRY(system_call)
movel   %d0,%sp@(PT_D0) /* save the return value */
jra ret_from_exception
 1:
+   movel   #-ENOSYS,%d2/* strace needs -ENOSYS in PT_D0 */
+   movel   %d2,PT_D0(%sp)  /* on syscall entry */
subql   #4,%sp
SAVE_SWITCH_STACK
jbsrsyscall_trace
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: define __clear_user macro

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fa2eae93a591b392d1056f95024516cede916ad4
Commit: fa2eae93a591b392d1056f95024516cede916ad4
Parent: 151941a800fd9598d38f8b5a73de0471afe66507
Author: Matt Waddel [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: define __clear_user macro

Define __clear_user macro, consistent with other architectures.
fs/signalfd.c won't compile without it.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/asm-m68knommu/uaccess.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/asm-m68knommu/uaccess.h b/include/asm-m68knommu/uaccess.h
index 9ed9169..68bbe9b 100644
--- a/include/asm-m68knommu/uaccess.h
+++ b/include/asm-m68knommu/uaccess.h
@@ -170,10 +170,12 @@ static inline long strnlen_user(const char *src, long n)
  */
 
 static inline unsigned long
-clear_user(void *to, unsigned long n)
+__clear_user(void *to, unsigned long n)
 {
memset(to, 0, n);
return 0;
 }
 
+#defineclear_user(to,n)__clear_user(to,n)
+
 #endif /* _M68KNOMMU_UACCESS_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: local module/elf definitions

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f186c9ad181ab9ba35e28cc9bbaafe226dbaec8c
Commit: f186c9ad181ab9ba35e28cc9bbaafe226dbaec8c
Parent: fa2eae93a591b392d1056f95024516cede916ad4
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: local module/elf definitions

Up to now m68knommu has been using the asm-m68k/module.h instead of
defining its own. There are recent changes there that we don't need
(fixups specifically). We don't need much support here so it makes
sense to have an m68knommu specific one now.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 include/asm-m68knommu/module.h |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/include/asm-m68knommu/module.h b/include/asm-m68knommu/module.h
index 57e95cc..2e45ab5 100644
--- a/include/asm-m68knommu/module.h
+++ b/include/asm-m68knommu/module.h
@@ -1 +1,11 @@
-#include asm-m68k/module.h
+#ifndef ASM_M68KNOMMU_MODULE_H
+#define ASM_M68KNOMMU_MODULE_H
+
+struct mod_arch_specific {
+};
+
+#define Elf_Shdr Elf32_Shdr
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+
+#endif /* ASM_M68KNOMMU_MODULE_H */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: updated defconfig

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a65c1ec666f2557f3486dbe729411dfc0f6d888f
Commit: a65c1ec666f2557f3486dbe729411dfc0f6d888f
Parent: f186c9ad181ab9ba35e28cc9bbaafe226dbaec8c
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: updated defconfig

Updated defconfig with new options for m68knommu.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/defconfig |  325 --
 1 files changed, 114 insertions(+), 211 deletions(-)

diff --git a/arch/m68knommu/defconfig b/arch/m68knommu/defconfig
index 3891de0..5a0ecaa 100644
--- a/arch/m68knommu/defconfig
+++ b/arch/m68knommu/defconfig
@@ -1,41 +1,48 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.17
-# Tue Jun 27 12:57:06 2006
+# Linux kernel version: 2.6.23
+# Thu Oct 18 13:17:38 2007
 #
 CONFIG_M68K=y
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
+CONFIG_ZONE_DMA=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_TIME_LOW_RES=y
+CONFIG_NO_IOPORT=y
+CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_BROKEN_ON_SMP=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
 CONFIG_LOCALVERSION=
 CONFIG_LOCALVERSION_AUTO=y
 # CONFIG_SYSVIPC is not set
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
 # CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=
-CONFIG_UID16=y
+# CONFIG_BLK_DEV_INITRD is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
 CONFIG_EMBEDDED=y
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
 # CONFIG_KALLSYMS is not set
 # CONFIG_HOTPLUG is not set
 CONFIG_PRINTK=y
@@ -44,20 +51,25 @@ CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 # CONFIG_FUTEX is not set
 # CONFIG_EPOLL is not set
+# CONFIG_SIGNALFD is not set
+# CONFIG_EVENTFD is not set
+# CONFIG_VM_EVENT_COUNTERS is not set
 CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
 CONFIG_TINY_SHMEM=y
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# Block layer
-#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -99,6 +111,7 @@ CONFIG_CLOCK_DIV=1
 #
 # Platform
 #
+# CONFIG_UC5272 is not set
 CONFIG_M5272C3=y
 # CONFIG_COBRA5272 is not set
 # CONFIG_CANCam is not set
@@ -107,7 +120,6 @@ CONFIG_M5272C3=y
 # CONFIG_CPU16B is not set
 # CONFIG_MOD5272 is not set
 CONFIG_FREESCALE=y
-# CONFIG_LARGE_ALLOCS is not set
 CONFIG_4KSTACKS=y
 
 #
@@ -121,6 +133,11 @@ CONFIG_RAMAUTOBIT=y
 # CONFIG_RAM8BIT is not set
 # CONFIG_RAM16BIT is not set
 # CONFIG_RAM32BIT is not set
+
+#
+# ROM configuration
+#
+# CONFIG_ROM is not set
 CONFIG_RAMKERNEL=y
 # CONFIG_ROMKERNEL is not set
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -131,20 +148,19 @@ CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_VIRT_TO_BUS=y
 
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
 # CONFIG_PCI is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 
 #
 # PCCARD (PCMCIA/CardBus) support
 #
-# CONFIG_PCCARD is not set
-
-#
-# PCI Hotplug Support
-#
 
 #
 # Executable file formats
@@ -168,7 +184,6 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -187,27 +202,21 @@ CONFIG_IP_FIB_HASH=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
-CONFIG_TCP_CONG_BIC=y
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG=cubic
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
 # CONFIG_INET6_XFRM_TUNNEL is not set
 # CONFIG_INET6_TUNNEL is not set
+# CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is 

m68knommu: add config support for Savant/Rosie1 board

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c1057c6500b6c5508c095f0022402cb63b747d5d
Commit: c1057c6500b6c5508c095f0022402cb63b747d5d
Parent: a65c1ec666f2557f3486dbe729411dfc0f6d888f
Author: Wilson Callan [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: add config support for Savant/Rosie1 board

Add configure support for the Savant/Rosie1 board.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/Kconfig |   13 -
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index f52c627..f4b582c 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -451,6 +451,12 @@ config MOD5272
help
  Support for the Netburner MOD-5272 board.
 
+config SAVANTrosie1
+   bool Savant Rosie1 board support
+   depends on M523x
+   help
+ Support for the Savant Rosie1 board.
+
 config ROMFS_FROM_ROM
bool ROMFS image not RAM resident
depends on (NETtel || SNAPGEAR)
@@ -492,7 +498,12 @@ config SNEHA
 bool
default y
depends on CPU16B
-   
+
+config SAVANT
+   bool
+   default y
+   depends on SAVANTrosie1
+
 config AVNET
bool
default y
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: no separate stack region to report at startup

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=775ecf871413e72a07c26af7154ca67728e17798
Commit: 775ecf871413e72a07c26af7154ca67728e17798
Parent: c1057c6500b6c5508c095f0022402cb63b747d5d
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: no separate stack region to report at startup

There is no separate stack region addresses to print at startup time,
so remove it from the debug listing

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/kernel/setup.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index 3f86ade..b2355eb 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -188,11 +188,9 @@ void setup_arch(char **cmdline_p)
BSS=0x%06x-0x%06x\n, (int) _stext, (int) _etext,
(int) _sdata, (int) _edata,
(int) _sbss, (int) _ebss);
-   printk(KERN_DEBUG KERNEL - ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x 
-   STACK=0x%06x-0x%06x\n,
+   printk(KERN_DEBUG MEMORY - ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x\n ,
(int) _ebss, (int) memory_start,
-   (int) memory_start, (int) memory_end,
-   (int) memory_end, (int) _ramend);
+   (int) memory_start, (int) memory_end);
 #endif
 
/* Keep a copy of command line */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: add make support for Savant/Rosie1 board

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ada8d218cc951c424e677845a44f72b4ab55a7a7
Commit: ada8d218cc951c424e677845a44f72b4ab55a7a7
Parent: 775ecf871413e72a07c26af7154ca67728e17798
Author: Wilson Callan [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: add make support for Savant/Rosie1 board

Add make support for the Savant/Rosie1 board.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index 92227aa..1235f80 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -48,6 +48,7 @@ board-$(CONFIG_SNEHA) := SNEHA
 board-$(CONFIG_M5208EVB)   := M5208EVB
 board-$(CONFIG_MOD5272):= MOD5272
 board-$(CONFIG_AVNET)   := AVNET
+board-$(CONFIG_SAVANT) := SAVANT
 BOARD := $(board-y)
 
 model-$(CONFIG_RAMKERNEL)  := ram
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: fix syscall restart handling

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dbf18c8f62cd87473d6db8c16afe4207bc370d3e
Commit: dbf18c8f62cd87473d6db8c16afe4207bc370d3e
Parent: ada8d218cc951c424e677845a44f72b4ab55a7a7
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:07 2007 -0700

m68knommu: fix syscall restart handling

Fix system call restart handling. We can call directly to the
restart handler, no need to back track through trap that isn't
even implemented on m68knommu.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/kernel/signal.c |   10 +-
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index 437f8c6..7037137 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -781,15 +781,7 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs 
*regs)
/* Did we come from a system call? */
if (regs-orig_d0 = 0) {
/* Restart the system call - no handlers present */
-   if (regs-d0 == -ERESTARTNOHAND
-   || regs-d0 == -ERESTARTSYS
-   || regs-d0 == -ERESTARTNOINTR) {
-   regs-d0 = regs-orig_d0;
-   regs-pc -= 2;
-   } else if (regs-d0 == -ERESTART_RESTARTBLOCK) {
-   regs-d0 = __NR_restart_syscall;
-   regs-pc -= 2;
-   }
+   handle_restart(regs, NULL, 0);
}
return 0;
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: remove use of undefined symbols in setup.c

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=293dba4b4acdfed75f92600792b5a00a942edc60
Commit: 293dba4b4acdfed75f92600792b5a00a942edc60
Parent: be6cb66da76fe089a4032a85c3825223a2216beb
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:34 2007 -0700

m68knommu: remove use of undefined symbols in setup.c

Remove use of undefined symbols CONFIG_TELOS, CONFIG_M68EZ328ADS
and CONFIG_ALMA_ANS.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/kernel/setup.c |   12 
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index b2355eb..de77329 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -151,27 +151,15 @@ void setup_arch(char **cmdline_p)
 #ifdef CONFIG_ELITE
printk(KERN_INFO Modified for M5206eLITE by Rob Scott, [EMAIL 
PROTECTED]);
 #endif
-#ifdef CONFIG_TELOS
-   printk(KERN_INFO Modified for Omnia ToolVox by James D. Schettine, 
[EMAIL PROTECTED]);
-#endif
 #endif
printk(KERN_INFO Flat model support (C) 1998,1999 Kenneth Albanowski, 
D. Jeff Dionne\n);
 
 #if defined( CONFIG_PILOT )  defined( CONFIG_M68328 )
printk(KERN_INFO TRG SuperPilot FLASH card support [EMAIL 
PROTECTED]\n);
 #endif
-
 #if defined( CONFIG_PILOT )  defined( CONFIG_M68EZ328 )
printk(KERN_INFO PalmV support by Lineo Inc. [EMAIL PROTECTED]\n);
 #endif
-
-#ifdef CONFIG_M68EZ328ADS
-   printk(KERN_INFO M68EZ328ADS board support (C) 1999 Vladimir Gurevich 
[EMAIL PROTECTED]\n);
-#endif
-
-#ifdef CONFIG_ALMA_ANS
-   printk(KERN_INFO Alma Electronics board support (C) 1999 Vladimir 
Gurevich [EMAIL PROTECTED]\n);
-#endif
 #if defined (CONFIG_M68360)
printk(KERN_INFO QUICC port done by SED Systems [EMAIL 
PROTECTED],\n);
printk(KERN_INFO based on 2.0.38 port by Lineo Inc. [EMAIL 
PROTECTED].\n);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: fix make archclean

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c48f484b9b7c8444247706b3ad9050245b8062f9
Commit: c48f484b9b7c8444247706b3ad9050245b8062f9
Parent: 293dba4b4acdfed75f92600792b5a00a942edc60
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:34 2007 -0700

m68knommu: fix make archclean

Remove build reference to arch/m68knommu/boot directory, it doesn't
exist.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/Makefile |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index 1235f80..30aa255 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -118,4 +118,4 @@ core-y  += arch/m68knommu/kernel/ \
 libs-y += arch/m68knommu/lib/
 
 archclean:
-   $(Q)$(MAKE) $(clean)=arch/m68knommu/boot
+
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: new style ColdFire UART driver

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=49aa49bfd40d718095669c1c70c9d167b814e29b
Commit: 49aa49bfd40d718095669c1c70c9d167b814e29b
Parent: c48f484b9b7c8444247706b3ad9050245b8062f9
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:34 2007 -0700

m68knommu: new style ColdFire UART driver

A new style serial driver for the Freescale ColdFire UART to replace
the old style one currently in the tree (drivers/serial/mcfserial.c).

Currently this UART is only found in the ColdFire CPU family of parts
(thus I prefixed this patch [M68KNOMMU]).

This has been around for a long while now, tested on all available
platforms.

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 drivers/serial/mcf.c |  653 ++
 1 files changed, 653 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/mcf.c b/drivers/serial/mcf.c
new file mode 100644
index 000..a7d4360
--- /dev/null
+++ b/drivers/serial/mcf.c
@@ -0,0 +1,653 @@
+//
+
+/*
+ * mcf.c -- Freescale ColdFire UART driver
+ *
+ * (C) Copyright 2003-2007, Greg Ungerer [EMAIL PROTECTED]
+ *
+ * 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.
+ */
+
+//
+
+#include linux/kernel.h
+#include linux/init.h
+#include linux/interrupt.h
+#include linux/module.h
+#include linux/console.h
+#include linux/tty.h
+#include linux/tty_flip.h
+#include linux/serial.h
+#include linux/serial_core.h
+#include linux/io.h
+#include asm/coldfire.h
+#include asm/mcfsim.h
+#include asm/mcfuart.h
+#include asm/nettel.h
+
+//
+
+/*
+ * Some boards implement the DTR/DCD lines using GPIO lines, most
+ * don't. Dummy out the access macros for those that don't. Those
+ * that do should define these macros somewhere in there board
+ * specific inlude files.
+ */
+#if !defined(mcf_getppdcd)
+#definemcf_getppdcd(p) (1)
+#endif
+#if !defined(mcf_getppdtr)
+#definemcf_getppdtr(p) (1)
+#endif
+#if !defined(mcf_setppdtr)
+#definemcf_setppdtr(p, v)  do { } while (0)
+#endif
+
+//
+
+/*
+ * Local per-uart structure.
+ */
+struct mcf_uart {
+   struct uart_portport;
+   unsigned intsigs;   /* Local copy of line sigs */
+   unsigned char   imr;/* Local IMR mirror */
+};
+
+//
+
+static unsigned int mcf_tx_empty(struct uart_port *port)
+{
+   return (readb(port-membase + MCFUART_USR)  MCFUART_USR_TXEMPTY) ?
+   TIOCSER_TEMT : 0;
+}
+
+//
+
+static unsigned int mcf_get_mctrl(struct uart_port *port)
+{
+   struct mcf_uart *pp = (struct mcf_uart *) port;
+   unsigned long flags;
+   unsigned int sigs;
+
+   spin_lock_irqsave(port-lock, flags);
+   sigs = (readb(port-membase + MCFUART_UIPR)  MCFUART_UIPR_CTS) ?
+   0 : TIOCM_CTS;
+   sigs |= (pp-sigs  TIOCM_RTS);
+   sigs |= (mcf_getppdcd(port-line) ? TIOCM_CD : 0);
+   sigs |= (mcf_getppdtr(port-line) ? TIOCM_DTR : 0);
+   spin_unlock_irqrestore(port-lock, flags);
+   return sigs;
+}
+
+//
+
+static void mcf_set_mctrl(struct uart_port *port, unsigned int sigs)
+{
+   struct mcf_uart *pp = (struct mcf_uart *) port;
+   unsigned long flags;
+
+   spin_lock_irqsave(port-lock, flags);
+   pp-sigs = sigs;
+   mcf_setppdtr(port-line, (sigs  TIOCM_DTR));
+   if (sigs  TIOCM_RTS)
+   writeb(MCFUART_UOP_RTS, port-membase + MCFUART_UOP1);
+   else
+   writeb(MCFUART_UOP_RTS, port-membase + MCFUART_UOP0);
+   spin_unlock_irqrestore(port-lock, flags);
+}
+
+//
+
+static void mcf_start_tx(struct uart_port *port)
+{
+   struct mcf_uart *pp = (struct mcf_uart *) port;
+   unsigned long flags;
+
+   spin_lock_irqsave(port-lock, flags);
+   pp-imr |= MCFUART_UIR_TXREADY;
+   writeb(pp-imr, port-membase + MCFUART_UIMR);
+   spin_unlock_irqrestore(port-lock, flags);
+}
+

m68knommu: cleanup m68knommu timer code

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2f2c2679893c963bd90c5e1c0669b97fd87d1c4a
Commit: 2f2c2679893c963bd90c5e1c0669b97fd87d1c4a
Parent: 49aa49bfd40d718095669c1c70c9d167b814e29b
Author: Greg Ungerer [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 14:37:54 2007 +1000
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:32:35 2007 -0700

m68knommu: cleanup m68knommu timer code

Reduce the function pointer mess of the m68knommu timer code by calling
directly to the local hardware's timer setup, and expose the local
common timer interrupt handler to the lower level hardware timer.

Ultimately this will save definitions of all these functions across all
the platform code to setup the function pointers (which for any given
m68knommu CPU family member can be only one set of hardware timer
functions).

Signed-off-by: Greg Ungerer [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 arch/m68knommu/kernel/setup.c  |9 -
 arch/m68knommu/kernel/time.c   |   22 --
 arch/m68knommu/platform/5206/config.c  |9 -
 arch/m68knommu/platform/5206e/config.c |   10 --
 arch/m68knommu/platform/520x/config.c  |8 +---
 arch/m68knommu/platform/523x/config.c  |8 
 arch/m68knommu/platform/5249/config.c  |   10 --
 arch/m68knommu/platform/5272/config.c  |   10 --
 arch/m68knommu/platform/527x/config.c  |8 
 arch/m68knommu/platform/528x/config.c  |8 
 arch/m68knommu/platform/5307/config.c  |   10 --
 arch/m68knommu/platform/5307/pit.c |   15 +--
 arch/m68knommu/platform/5307/timers.c  |   19 +++
 arch/m68knommu/platform/532x/config.c  |   10 --
 arch/m68knommu/platform/5407/config.c  |   10 --
 15 files changed, 29 insertions(+), 137 deletions(-)

diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index de77329..74bf949 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -273,12 +273,3 @@ struct seq_operations cpuinfo_op = {
.show   = show_cpuinfo,
 };
 
-void arch_gettod(int *year, int *mon, int *day, int *hour,
-int *min, int *sec)
-{
-   if (mach_gettod)
-   mach_gettod(year, mon, day, hour, min, sec);
-   else
-   *year = *mon = *day = *hour = *min = *sec = 0;
-}
-
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
index 467053d..77e5375 100644
--- a/arch/m68knommu/kernel/time.c
+++ b/arch/m68knommu/kernel/time.c
@@ -27,7 +27,6 @@
 
 #defineTICK_SIZE (tick_nsec / 1000)
 
-
 static inline int set_rtc_mmss(unsigned long nowtime)
 {
if (mach_set_clock_mmss)
@@ -39,15 +38,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the do_timer() routine every clocktick
  */
-static irqreturn_t timer_interrupt(int irq, void *dummy)
+irqreturn_t arch_timer_interrupt(int irq, void *dummy)
 {
/* last time the cmos clock got updated */
static long last_rtc_update=0;
 
-   /* may need to kick the hardware timer */
-   if (mach_tick)
- mach_tick();
-
write_seqlock(xtime_lock);
 
do_timer(1);
@@ -103,10 +98,10 @@ void time_init(void)
 {
unsigned int year, mon, day, hour, min, sec;
 
-   extern void arch_gettod(int *year, int *mon, int *day, int *hour,
-   int *min, int *sec);
-
-   arch_gettod(year, mon, day, hour, min, sec);
+   if (mach_gettod)
+   mach_gettod(year, mon, day, hour, min, sec);
+   else
+   year = mon = day = hour = min = sec = 0;
 
if ((year += 1900)  1970)
year += 100;
@@ -114,7 +109,7 @@ void time_init(void)
xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec = -xtime.tv_sec;
 
-   mach_sched_init(timer_interrupt);
+   hw_timer_init();
 }
 
 /*
@@ -128,7 +123,7 @@ void do_gettimeofday(struct timeval *tv)
 
do {
seq = read_seqbegin_irqsave(xtime_lock, flags);
-   usec = mach_gettimeoffset ? mach_gettimeoffset() : 0;
+   usec = hw_timer_offset();
sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
} while (read_seqretry_irqrestore(xtime_lock, seq, flags));
@@ -160,8 +155,7 @@ int do_settimeofday(struct timespec *tv)
 * Discover what correction gettimeofday
 * would have done, and then undo it!
 */
-   if (mach_gettimeoffset)
-   nsec -= (mach_gettimeoffset() * 1000);
+   nsec -= (hw_timer_offset() * 1000);
 
wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
diff --git 

[ALSA] hda-codec - Fix AD1986A Lenovo auto-mute

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=53eb1b85402f108d5151338cff4430f30fd9727f
Commit: 53eb1b85402f108d5151338cff4430f30fd9727f
Parent: 9823adf632c57e9728d651707abd324eb4454eb9
Author: Takashi Iwai [EMAIL PROTECTED]
AuthorDate: Wed Oct 17 10:09:32 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:30 2007 +0200

[ALSA] hda-codec - Fix AD1986A Lenovo auto-mute

The jack detection bit on AD1986A Lenovo N100 seems inverse from
the standard definition.  Now fixed the detection properly.

Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/hda/patch_analog.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 54cfd45..9bf38f9 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -612,7 +612,8 @@ static void ad1986a_hp_automute(struct hda_codec *codec)
unsigned int present;
 
present = snd_hda_codec_read(codec, 0x1a, 0, AC_VERB_GET_PIN_SENSE, 0);
-   spec-jack_present = (present  0x8000) != 0;
+   /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
+   spec-jack_present = !(present  0x8000);
ad1986a_update_hp(codec);
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] bt87x - Fix section mismatch

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e5ab3a7c00e682e0e24677203856769df1b9b0cb
Commit: e5ab3a7c00e682e0e24677203856769df1b9b0cb
Parent: 53eb1b85402f108d5151338cff4430f30fd9727f
Author: Takashi Iwai [EMAIL PROTECTED]
AuthorDate: Wed Oct 17 10:35:58 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:32 2007 +0200

[ALSA] bt87x - Fix section mismatch

const and __devinit aren't a good pair, resulting in a section
mismatch error.  Let's remove const as a temporary solution.

Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/bt87x.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index 91f9e6a..f960b82 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -165,7 +165,7 @@ struct snd_bt87x_board {
unsigned no_digital:1;  /* No digital input */
 };
 
-static const __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = {
+static __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = {
[SND_BT87X_BOARD_UNKNOWN] = {
.dig_rate = 32000, /* just a guess */
},
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] protect Dreamcast PCM driver (AICA) from G2 bus effects

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=44e0b6821d7eacb4f93d2c131d436f96e500aa08
Commit: 44e0b6821d7eacb4f93d2c131d436f96e500aa08
Parent: e5ab3a7c00e682e0e24677203856769df1b9b0cb
Author: Adrian McMenamin [EMAIL PROTECTED]
AuthorDate: Thu Oct 18 10:46:59 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:33 2007 +0200

[ALSA] protect Dreamcast PCM driver (AICA) from G2 bus effects

The G2 bus on the SEGA Dreamcast connects both the maple peripheral
bus and the AICA sound memory. DMA requests on one can cause the other
to timeout on memory operations.
This patch prevents maple interrupts from causing hiccoughs in the
AICA sound (maple bus code will land in 2.6.24).
There are other cleanups for this (AICA) code - but this is in effect
a regression fix rather than a cleanup.

Signed-off-by: Adrian McMenamin [EMAIL PROTECTED]
Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/sh/aica.c |   31 +--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 131ec48..88dc840 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -106,11 +106,14 @@ static void spu_write_wait(void)
 static void spu_memset(u32 toi, u32 what, int length)
 {
int i;
+   unsigned long flags;
snd_assert(length % 4 == 0, return);
for (i = 0; i  length; i++) {
if (!(i % 8))
spu_write_wait();
+   local_irq_save(flags);
writel(what, toi + SPU_MEMORY_BASE);
+   local_irq_restore(flags);
toi++;
}
 }
@@ -118,6 +121,7 @@ static void spu_memset(u32 toi, u32 what, int length)
 /* spu_memload - write to SPU address space */
 static void spu_memload(u32 toi, void *from, int length)
 {
+   unsigned long flags;
u32 *froml = from;
u32 __iomem *to = (u32 __iomem *) (SPU_MEMORY_BASE + toi);
int i;
@@ -128,7 +132,9 @@ static void spu_memload(u32 toi, void *from, int length)
if (!(i % 8))
spu_write_wait();
val = *froml;
+   local_irq_save(flags);
writel(val, to);
+   local_irq_restore(flags);
froml++;
to++;
}
@@ -138,28 +144,36 @@ static void spu_memload(u32 toi, void *from, int length)
 static void spu_disable(void)
 {
int i;
+   unsigned long flags;
u32 regval;
spu_write_wait();
regval = readl(ARM_RESET_REGISTER);
regval |= 1;
spu_write_wait();
+   local_irq_save(flags);
writel(regval, ARM_RESET_REGISTER);
+   local_irq_restore(flags);
for (i = 0; i  64; i++) {
spu_write_wait();
regval = readl(SPU_REGISTER_BASE + (i * 0x80));
regval = (regval  ~0x4000) | 0x8000;
spu_write_wait();
+   local_irq_save(flags);
writel(regval, SPU_REGISTER_BASE + (i * 0x80));
+   local_irq_restore(flags);
}
 }
 
 /* spu_enable - set spu registers to enable sound output */
 static void spu_enable(void)
 {
+   unsigned long flags;
u32 regval = readl(ARM_RESET_REGISTER);
regval = ~1;
spu_write_wait();
+   local_irq_save(flags);
writel(regval, ARM_RESET_REGISTER);
+   local_irq_restore(flags);
 }
 
 /* 
@@ -168,25 +182,34 @@ static void spu_enable(void)
 */
 static void spu_reset(void)
 {
+   unsigned long flags;
spu_disable();
spu_memset(0, 0, 0x20 / 4);
/* Put ARM7 in endless loop */
+   local_irq_save(flags);
ctrl_outl(0xea02, SPU_MEMORY_BASE);
+   local_irq_restore(flags);
spu_enable();
 }
 
 /* aica_chn_start - write to spu to start playback */
 static void aica_chn_start(void)
 {
+   unsigned long flags;
spu_write_wait();
+   local_irq_save(flags);
writel(AICA_CMD_KICK | AICA_CMD_START, (u32 *) AICA_CONTROL_POINT);
+   local_irq_restore(flags);
 }
 
 /* aica_chn_halt - write to spu to halt playback */
 static void aica_chn_halt(void)
 {
+   unsigned long flags;
spu_write_wait();
+   local_irq_save(flags);
writel(AICA_CMD_KICK | AICA_CMD_STOP, (u32 *) AICA_CONTROL_POINT);
+   local_irq_restore(flags);
 }
 
 /* ALSA code below */
@@ -213,12 +236,13 @@ static int aica_dma_transfer(int channels, int 
buffer_size,
int q, err, period_offset;
struct snd_card_aica *dreamcastcard;
struct snd_pcm_runtime *runtime;
-   err = 0;
+   unsigned long flags;
dreamcastcard = substream-pcm-private_data;
period_offset = dreamcastcard-clicks;
period_offset %= (AICA_PERIOD_NUMBER / channels);
runtime = substream-runtime;

[ALSA] snd-bt87x: Make the load_all option work correctly

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8e84c6413a2bec1c3e67bb38d42422f9f3262c10
Commit: 8e84c6413a2bec1c3e67bb38d42422f9f3262c10
Parent: 44e0b6821d7eacb4f93d2c131d436f96e500aa08
Author: Trent Piepho [EMAIL PROTECTED]
AuthorDate: Thu Oct 18 10:48:43 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:34 2007 +0200

[ALSA] snd-bt87x: Make the load_all option work correctly

If the load_all option was turned on all cards would be treated as unknown,
even those which are in the database.  Of course, if the card is in the
database there is no reason to use the load_all option.  It's there to force
loading when the card isn't in the database.  But there are out of date 
wikis
that say to do this and some distros might turn this option on by default.
So, we keep the load_all option from turning known cards into unknown cards.

Signed-off-by: Trent Piepho [EMAIL PROTECTED]
Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/bt87x.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index f960b82..2dba752 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -848,7 +848,7 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev 
*pci)
int i;
const struct pci_device_id *supported;
 
-   supported = pci_match_device(driver, pci);
+   supported = pci_match_id(snd_bt87x_ids, pci);
if (supported  supported-driver_data  0)
return supported-driver_data;
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] hda-codec - Fix conflict of Master volume in STAC92xx codec

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9a2a763e08889318d7ace9f59d7963661a46d393
Commit: 9a2a763e08889318d7ace9f59d7963661a46d393
Parent: 8e84c6413a2bec1c3e67bb38d42422f9f3262c10
Author: Takashi Iwai [EMAIL PROTECTED]
AuthorDate: Thu Oct 18 17:33:27 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:34 2007 +0200

[ALSA] hda-codec - Fix conflict of Master volume in STAC92xx codec

The addition of volume knob as Master volume resulted in conflict with
the existing one by stac92xx_auto_create_hp_ctls().
This patch fixes the conflict, and still keeps the Master control for
codecs without volume knob as much as possible.

Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/hda/patch_sigmatel.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index bf95019..f9b2c43 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -111,6 +111,7 @@ struct sigmatel_spec {
unsigned int alt_switch: 1;
unsigned int hp_detect: 1;
unsigned int gpio_mute: 1;
+   unsigned int no_vol_knob :1;
 
unsigned int gpio_mask, gpio_data;
 
@@ -1930,7 +1931,8 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec 
*codec,
}
if (spec-multiout.hp_nid) {
const char *pfx;
-   if (old_num_dacs == spec-multiout.num_dacs)
+   if (old_num_dacs == spec-multiout.num_dacs 
+   spec-no_vol_knob)
pfx = Master;
else
pfx = Headphone;
@@ -2487,6 +2489,7 @@ static int patch_stac9200(struct hda_codec *codec)
codec-spec = spec;
spec-num_pins = ARRAY_SIZE(stac9200_pin_nids);
spec-pin_nids = stac9200_pin_nids;
+   spec-no_vol_knob = 1;
spec-board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
stac9200_models,
stac9200_cfg_tbl);
@@ -2541,6 +2544,7 @@ static int patch_stac925x(struct hda_codec *codec)
codec-spec = spec;
spec-num_pins = ARRAY_SIZE(stac925x_pin_nids);
spec-pin_nids = stac925x_pin_nids;
+   spec-no_vol_knob = 1;
spec-board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
stac925x_models,
stac925x_cfg_tbl);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] hda-codec - Fix Conexant 5045 volumes

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c8229c38c61b1acab1f3fc28275690da71907248
Commit: c8229c38c61b1acab1f3fc28275690da71907248
Parent: 9a2a763e08889318d7ace9f59d7963661a46d393
Author: Takashi Iwai [EMAIL PROTECTED]
AuthorDate: Fri Oct 19 08:06:21 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:34 2007 +0200

[ALSA] hda-codec - Fix Conexant 5045 volumes

Fixed the init verbs and added the missing volume controls so that
the driver works again with Conexant 5045 codec chip.

Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/hda/patch_conexant.c |   33 +++--
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 080e300..7df9058 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -554,10 +554,16 @@ static struct snd_kcontrol_new cxt5045_mixers[] = {
.get = conexant_mux_enum_get,
.put = conexant_mux_enum_put
},
-   HDA_CODEC_VOLUME(Int Mic Volume, 0x1a, 0x01, HDA_INPUT),
-   HDA_CODEC_MUTE(Int Mic Switch, 0x1a, 0x01, HDA_INPUT),
-   HDA_CODEC_VOLUME(Ext Mic Volume, 0x1a, 0x02, HDA_INPUT),
-   HDA_CODEC_MUTE(Ext Mic Switch, 0x1a, 0x02, HDA_INPUT),
+   HDA_CODEC_VOLUME(Int Mic Capture Volume, 0x1a, 0x01, HDA_INPUT),
+   HDA_CODEC_MUTE(Int Mic Capture Switch, 0x1a, 0x01, HDA_INPUT),
+   HDA_CODEC_VOLUME(Ext Mic Capture Volume, 0x1a, 0x02, HDA_INPUT),
+   HDA_CODEC_MUTE(Ext Mic Capture Switch, 0x1a, 0x02, HDA_INPUT),
+   HDA_CODEC_VOLUME(PCM Playback Volume, 0x17, 0x0, HDA_INPUT),
+   HDA_CODEC_MUTE(PCM Playback Switch, 0x17, 0x0, HDA_INPUT),
+   HDA_CODEC_VOLUME(Int Mic Playback Volume, 0x17, 0x1, HDA_INPUT),
+   HDA_CODEC_MUTE(Int Mic Playback Switch, 0x17, 0x1, HDA_INPUT),
+   HDA_CODEC_VOLUME(Ext Mic Playback Volume, 0x17, 0x2, HDA_INPUT),
+   HDA_CODEC_MUTE(Ext Mic Playback Switch, 0x17, 0x2, HDA_INPUT),
HDA_BIND_VOL(Master Playback Volume, cxt5045_hp_bind_master_vol),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -576,16 +582,15 @@ static struct hda_verb cxt5045_init_verbs[] = {
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_80 },
/* HP, Amp  */
-   {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
-   {0x17, AC_VERB_SET_CONNECT_SEL,0x01},
-   {0x17, AC_VERB_SET_AMP_GAIN_MUTE,
-AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x01},
-   {0x17, AC_VERB_SET_AMP_GAIN_MUTE,
-AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x02},
-   {0x17, AC_VERB_SET_AMP_GAIN_MUTE,
-AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x03},
-   {0x17, AC_VERB_SET_AMP_GAIN_MUTE,
-AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x04},
+   {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+   {0x10, AC_VERB_SET_CONNECT_SEL, 0x1},
+   {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+   {0x11, AC_VERB_SET_CONNECT_SEL, 0x1},
+   {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
+   {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
+   {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
+   {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
+   {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
/* Record selector: Int mic */
{0x1a, AC_VERB_SET_CONNECT_SEL,0x1},
{0x1a, AC_VERB_SET_AMP_GAIN_MUTE,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] hda-codec - Fix build without CONFIG_SND_HDA_GENERIC

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=35a1e0cce647737b88dac7ca526fc525d92b3fff
Commit: 35a1e0cce647737b88dac7ca526fc525d92b3fff
Parent: c8229c38c61b1acab1f3fc28275690da71907248
Author: Takashi Iwai [EMAIL PROTECTED]
AuthorDate: Fri Oct 19 08:13:40 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:04:35 2007 +0200

[ALSA] hda-codec - Fix build without CONFIG_SND_HDA_GENERIC

Fixed the build error from patch_sigmatel.c when built without
CONFIG_SND_HDA_GENERIC by defining a dummy function to return error.
Also, clean up hda_codec.c by removing unneeded ifdefs (the compiler
will optimize out).

Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/hda/hda_codec.c |9 ++---
 sound/pci/hda/hda_local.h |7 +++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 187533e..ad4cb38 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -626,24 +626,19 @@ int __devinit snd_hda_codec_new(struct hda_bus *bus, 
unsigned int codec_addr,
snd_hda_get_codec_name(codec, bus-card-mixername,
   sizeof(bus-card-mixername));
 
-#ifdef CONFIG_SND_HDA_GENERIC
if (is_generic_config(codec)) {
err = snd_hda_parse_generic_codec(codec);
goto patched;
}
-#endif
if (codec-preset  codec-preset-patch) {
err = codec-preset-patch(codec);
goto patched;
}
 
/* call the default parser */
-#ifdef CONFIG_SND_HDA_GENERIC
err = snd_hda_parse_generic_codec(codec);
-#else
-   printk(KERN_ERR hda-codec: No codec parser is available\n);
-   err = -ENODEV;
-#endif
+   if (err  0)
+   printk(KERN_ERR hda-codec: No codec parser is available\n);
 
  patched:
if (err  0) {
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index a79d0ed..a708eff 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -245,7 +245,14 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec 
*codec,
 /*
  * generic codec parser
  */
+#ifdef CONFIG_SND_HDA_GENERIC
 int snd_hda_parse_generic_codec(struct hda_codec *codec);
+#else
+static inline int snd_hda_parse_generic_codec(struct hda_codec *codec)
+{
+   return -ENODEV;
+}
+#endif
 
 /*
  * generic proc interface
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] usb-audio: Another USB mic quirk for Logitech Communicator webcam

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31127f2eb945f092010a457c65260b0e19471cc5
Commit: 31127f2eb945f092010a457c65260b0e19471cc5
Parent: 35a1e0cce647737b88dac7ca526fc525d92b3fff
Author: Dawid Wrobel [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:57:17 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:07:55 2007 +0200

[ALSA] usb-audio: Another USB mic quirk for Logitech Communicator webcam

The patch adds the USB microphone quirk for Logitech Communicator
(046d:08f5 Logitech, Inc.) webcam.

Signed-off-by: Dawid Wrobel [EMAIL PROTECTED]
Signed-off-by: Clemens Ladisch [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/usb/usbquirks.h |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h
index 743568f..59410f4 100644
--- a/sound/usb/usbquirks.h
+++ b/sound/usb/usbquirks.h
@@ -84,6 +84,15 @@
   USB_DEVICE_ID_MATCH_INT_CLASS |
   USB_DEVICE_ID_MATCH_INT_SUBCLASS,
.idVendor = 0x046d,
+   .idProduct = 0x08f5,
+   .bInterfaceClass = USB_CLASS_AUDIO,
+   .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
+},
+{
+   .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
+  USB_DEVICE_ID_MATCH_INT_CLASS |
+  USB_DEVICE_ID_MATCH_INT_SUBCLASS,
+   .idVendor = 0x046d,
.idProduct = 0x08f6,
.bInterfaceClass = USB_CLASS_AUDIO,
.bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] sound/core/control.c: hard-irq-safe - hard-irq-unsafe lock warning

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7507e8da2f21476007501f04d8bce2b7d0cb3971
Commit: 7507e8da2f21476007501f04d8bce2b7d0cb3971
Parent: 31127f2eb945f092010a457c65260b0e19471cc5
Author: Borislav Petkov [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 17:11:09 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:07:55 2007 +0200

[ALSA] sound/core/control.c: hard-irq-safe - hard-irq-unsafe lock warning

The lock grabbed in snd_ctl_empty_read_queue() is hardirq-unsafe but we hold
an hardirq-safe one already, so make the ctl-read_lock also hard-irq-safe.

Signed-off-by: Borislav Petkov [EMAIL PROTECTED]
Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/core/control.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/core/control.c b/sound/core/control.c
index 4c3aa8e..df0774c 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -93,15 +93,16 @@ static int snd_ctl_open(struct inode *inode, struct file 
*file)
 
 static void snd_ctl_empty_read_queue(struct snd_ctl_file * ctl)
 {
+   unsigned long flags;
struct snd_kctl_event *cread;

-   spin_lock(ctl-read_lock);
+   spin_lock_irqsave(ctl-read_lock, flags);
while (!list_empty(ctl-events)) {
cread = snd_kctl_event(ctl-events.next);
list_del(cread-list);
kfree(cread);
}
-   spin_unlock(ctl-read_lock);
+   spin_unlock_irqrestore(ctl-read_lock, flags);
 }
 
 static int snd_ctl_release(struct inode *inode, struct file *file)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[ALSA] hda-codec - Fix possible array overflow

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=41923e441305728ba3640e773e55d16e4769145c
Commit: 41923e441305728ba3640e773e55d16e4769145c
Parent: 7507e8da2f21476007501f04d8bce2b7d0cb3971
Author: Takashi Iwai [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 17:20:10 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:07:55 2007 +0200

[ALSA] hda-codec - Fix possible array overflow

dac_nids arrays in each codec support code may have up to 5 items
when assigned from the auto-configurator.  Some codec codes have
less numbers than the possible max.  This patch defines the constant
and fixes the array definitions.

Signed-off-by: Takashi Iwai [EMAIL PROTECTED]
Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 sound/pci/hda/hda_local.h  |   11 ++-
 sound/pci/hda/patch_analog.c   |2 +-
 sound/pci/hda/patch_cmedia.c   |3 +--
 sound/pci/hda/patch_conexant.c |2 +-
 sound/pci/hda/patch_realtek.c  |2 +-
 sound/pci/hda/patch_via.c  |2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index a708eff..20c5e62 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -310,16 +310,17 @@ enum {
 
 extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST];
 
+#define AUTO_CFG_MAX_OUTS  5
+
 struct auto_pin_cfg {
int line_outs;
-   hda_nid_t line_out_pins[5]; /* sorted in the order of
-* Front/Surr/CLFE/Side
-*/
+   /* sorted in the order of Front/Surr/CLFE/Side */
+   hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
int speaker_outs;
-   hda_nid_t speaker_pins[5];
+   hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
int hp_outs;
int line_out_type;  /* AUTO_PIN_XXX_OUT */
-   hda_nid_t hp_pins[5];
+   hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
hda_nid_t input_pins[AUTO_PIN_LAST];
hda_nid_t dig_out_pin;
hda_nid_t dig_in_pin;
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 9bf38f9..0ee8ae4 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -72,7 +72,7 @@ struct ad198x_spec {
unsigned int num_kctl_alloc, num_kctl_used;
struct snd_kcontrol_new *kctl_alloc;
struct hda_input_mux private_imux;
-   hda_nid_t private_dac_nids[4];
+   hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
 
unsigned int jack_present :1;
 
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 2468f31..6c54793 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -50,7 +50,7 @@ struct cmi_spec {
 
/* playback */
struct hda_multi_out multiout;
-   hda_nid_t dac_nids[4];  /* NID for each DAC */
+   hda_nid_t dac_nids[AUTO_CFG_MAX_OUTS];  /* NID for each DAC */
int num_dacs;
 
/* capture */
@@ -73,7 +73,6 @@ struct cmi_spec {
unsigned int pin_def_confs;
 
/* multichannel pins */
-   hda_nid_t multich_pin[4];   /* max 8-channel */
struct hda_verb multi_init[9];  /* 2 verbs for each pin + terminator */
 };
 
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 7df9058..6aa0739 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -85,7 +85,7 @@ struct conexant_spec {
unsigned int num_kctl_alloc, num_kctl_used;
struct snd_kcontrol_new *kctl_alloc;
struct hda_input_mux private_imux;
-   hda_nid_t private_dac_nids[4];
+   hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
 
 };
 
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 53b0428..d9f78c8 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -238,7 +238,7 @@ struct alc_spec {
unsigned int num_kctl_alloc, num_kctl_used;
struct snd_kcontrol_new *kctl_alloc;
struct hda_input_mux private_imux;
-   hda_nid_t private_dac_nids[5];
+   hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
 
/* hooks */
void (*init_hook)(struct hda_codec *codec);
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 33b5e1f..4cdf3e6 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -114,7 +114,7 @@ struct via_spec {
unsigned int num_kctl_alloc, num_kctl_used;
struct snd_kcontrol_new *kctl_alloc;
struct hda_input_mux private_imux;
-   hda_nid_t private_dac_nids[4];  
+   hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
struct hda_loopback_check loopback;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  

[ALSA] version 1.0.15

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9efbf95f6204da0112371f41e63c7330f94e1042
Commit: 9efbf95f6204da0112371f41e63c7330f94e1042
Parent: 41923e441305728ba3640e773e55d16e4769145c
Author: Jaroslav Kysela [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 08:09:20 2007 +0200
Committer:  Jaroslav Kysela [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:09:20 2007 +0200

[ALSA] version 1.0.15

Signed-off-by: Jaroslav Kysela [EMAIL PROTECTED]
---
 include/sound/version.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/sound/version.h b/include/sound/version.h
index 8d4a8dd..a2be8ad 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
 /* include/version.h.  Generated by alsa/ksync script.  */
 #define CONFIG_SND_VERSION 1.0.15
-#define CONFIG_SND_DATE  (Tue Oct 16 14:57:44 2007 UTC)
+#define CONFIG_SND_DATE  (Tue Oct 23 06:09:18 2007 UTC)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


arm: build fix

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9f2326be52f4fa83d20a75998cd3c87b300588c4
Commit: 9f2326be52f4fa83d20a75998cd3c87b300588c4
Parent: 0895e91d60ef9bdef426d1ce14bb94bd5875870d
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:11:41 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:11:41 2007 +0200

arm: build fix

arch/arm/common/dmabounce.c: In function 'dma_map_sg':
arch/arm/common/dmabounce.c:445: error: implicit declaration of function 
'sg_page'

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 arch/arm/common/dmabounce.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 9d371e4..52fc6a8 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -29,6 +29,7 @@
 #include linux/dma-mapping.h
 #include linux/dmapool.h
 #include linux/list.h
+#include linux/scatterlist.h
 
 #include asm/cacheflush.h
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


IB/ehca: Fix sg_page() fallout

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c8ac5a7309c5060e27caf69403072f54e008ee54
Commit: c8ac5a7309c5060e27caf69403072f54e008ee54
Parent: 9f2326be52f4fa83d20a75998cd3c87b300588c4
Author: Olof Johansson [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:12:52 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:12:52 2007 +0200

IB/ehca: Fix sg_page() fallout

More fallout from sg_page changes:

drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 
'ehca_set_pagebuf_user1':
drivers/infiniband/hw/ehca/ehca_mrmw.c:1779: error: 'struct scatterlist' 
has no member named 'page'
drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 
'ehca_check_kpages_per_ate':
drivers/infiniband/hw/ehca/ehca_mrmw.c:1835: error: 'struct scatterlist' 
has no member named 'page'
drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 
'ehca_set_pagebuf_user2':
drivers/infiniband/hw/ehca/ehca_mrmw.c:1870: error: 'struct scatterlist' 
has no member named 'page'

Signed-off-by: Olof Johansson [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c 
b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index da88738..ead7230 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -1776,7 +1776,7 @@ static int ehca_set_pagebuf_user1(struct ehca_mr_pginfo 
*pginfo,
list_for_each_entry_continue(
chunk, ((pginfo-u.usr.region-chunk_list)), list) {
for (i = pginfo-u.usr.next_nmap; i  chunk-nmap; ) {
-   pgaddr = page_to_pfn(chunk-page_list[i].page)
+   pgaddr = page_to_pfn(sg_page(chunk-page_list[i]))
 PAGE_SHIFT ;
*kpage = phys_to_abs(pgaddr +
 (pginfo-next_hwpage *
@@ -1832,7 +1832,7 @@ static int ehca_check_kpages_per_ate(struct scatterlist 
*page_list,
 {
int t;
for (t = start_idx; t = end_idx; t++) {
-   u64 pgaddr = page_to_pfn(page_list[t].page)  PAGE_SHIFT;
+   u64 pgaddr = page_to_pfn(sg_page(page_list[t]))  PAGE_SHIFT;
ehca_gen_dbg(chunk_page=%lx value=%016lx, pgaddr,
 *(u64 *)abs_to_virt(phys_to_abs(pgaddr)));
if (pgaddr - PAGE_SIZE != *prev_pgaddr) {
@@ -1867,7 +1867,7 @@ static int ehca_set_pagebuf_user2(struct ehca_mr_pginfo 
*pginfo,
chunk, ((pginfo-u.usr.region-chunk_list)), list) {
for (i = pginfo-u.usr.next_nmap; i  chunk-nmap; ) {
if (nr_kpages == kpages_per_hwpage) {
-   pgaddr = ( page_to_pfn(chunk-page_list[i].page)
+   pgaddr = ( 
page_to_pfn(sg_page(chunk-page_list[i]))
PAGE_SHIFT );
*kpage = phys_to_abs(pgaddr);
if ( !(*kpage) ) {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


powerpc: Fix fallout from sg_page() changes

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2
Commit: 5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2
Parent: c8ac5a7309c5060e27caf69403072f54e008ee54
Author: Olof Johansson [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:13:14 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:13:14 2007 +0200

powerpc: Fix fallout from sg_page() changes

Fix fallout from 18dabf473e15850c0dbc8ff13ac1e2806d542c15:

In file included from include/linux/dma-mapping.h:52,
 from drivers/base/dma-mapping.c:10:
include/asm/dma-mapping.h: In function 'dma_map_sg':
include/asm/dma-mapping.h:288: error: 'struct scatterlist' has no member 
named 'page'
include/asm/dma-mapping.h:288: error: 'struct scatterlist' has no member 
named 'page'
include/asm/dma-mapping.h:288: error: 'struct scatterlist' has no member 
named 'page'
include/asm/dma-mapping.h:289: error: 'struct scatterlist' has no member 
named 'page'
include/asm/dma-mapping.h:290: error: 'struct scatterlist' has no member 
named 'page'
include/asm/dma-mapping.h: In function 'dma_sync_sg_for_cpu':
include/asm/dma-mapping.h:331: error: 'struct scatterlist' has no member 
named 'page'

drivers/scsi/ps3rom.c: In function 'fetch_to_dev_buffer':
drivers/scsi/ps3rom.c:150: error: 'struct scatterlist' has no member named 
'page'

Signed-off-by: Olof Johansson [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 drivers/scsi/ps3rom.c |2 +-
 include/asm-powerpc/dma-mapping.h |   10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index 03f19b8..17b4a7c 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -147,7 +147,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void 
*buf)
 
req_len = fin = 0;
scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) {
-   kaddr = kmap_atomic(sg_page(sgpnt-page), KM_IRQ0);
+   kaddr = kmap_atomic(sg_page(sgpnt), KM_IRQ0);
len = sgpnt-length;
if ((req_len + len)  buflen) {
len = buflen - req_len;
diff --git a/include/asm-powerpc/dma-mapping.h 
b/include/asm-powerpc/dma-mapping.h
index 65be95d..ff52013 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -285,9 +285,9 @@ dma_map_sg(struct device *dev, struct scatterlist *sgl, int 
nents,
BUG_ON(direction == DMA_NONE);
 
for_each_sg(sgl, sg, nents, i) {
-   BUG_ON(!sg-page);
-   __dma_sync_page(sg-page, sg-offset, sg-length, direction);
-   sg-dma_address = page_to_bus(sg-page) + sg-offset;
+   BUG_ON(!sg_page(sg));
+   __dma_sync_page(sg_page(sg), sg-offset, sg-length, direction);
+   sg-dma_address = page_to_bus(sg_page(sg)) + sg-offset;
}
 
return nents;
@@ -328,7 +328,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev,
BUG_ON(direction == DMA_NONE);
 
for_each_sg(sgl, sg, nents, i)
-   __dma_sync_page(sg-page, sg-offset, sg-length, direction);
+   __dma_sync_page(sg_page(sg), sg-offset, sg-length, direction);
 }
 
 static inline void dma_sync_sg_for_device(struct device *dev,
@@ -341,7 +341,7 @@ static inline void dma_sync_sg_for_device(struct device 
*dev,
BUG_ON(direction == DMA_NONE);
 
for_each_sg(sgl, sg, nents, i)
-   __dma_sync_page(sg-page, sg-offset, sg-length, direction);
+   __dma_sync_page(sg_page(sg), sg-offset, sg-length, direction);
 }
 
 static inline int dma_mapping_error(dma_addr_t dma_addr)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


s390 zfcp: sg fixups

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=73fc4f0d2ce4a92c36b00649c58e0a068a6cdfa4
Commit: 73fc4f0d2ce4a92c36b00649c58e0a068a6cdfa4
Parent: 5edadbd0ae35d2daabaf6b44f2c58d67d4021ed2
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:17:53 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:17:53 2007 +0200

s390 zfcp: sg fixups

Based on initial patch from Heiko Carstens [EMAIL PROTECTED]

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 drivers/s390/scsi/zfcp_aux.c |1 +
 drivers/s390/scsi/zfcp_def.h |4 ++--
 drivers/s390/scsi/zfcp_erp.c |   10 ++
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 7507067..fd5d0c1 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -559,6 +559,7 @@ zfcp_sg_list_alloc(struct zfcp_sg_list *sg_list, size_t 
size)
retval = -ENOMEM;
goto out;
}
+   sg_init_table(sg_list-sg, sg_list-count);
 
for (i = 0, sg = sg_list-sg; i  sg_list-count; i++, sg++) {
sg-length = min(size, PAGE_SIZE);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 57cac70..326e7ee 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -63,7 +63,7 @@
 static inline void *
 zfcp_sg_to_address(struct scatterlist *list)
 {
-   return (void *) (page_address(list-page) + list-offset);
+   return sg_virt(list);
 }
 
 /**
@@ -74,7 +74,7 @@ zfcp_sg_to_address(struct scatterlist *list)
 static inline void
 zfcp_address_to_sg(void *address, struct scatterlist *list)
 {
-   list-page = virt_to_page(address);
+   sg_set_page(list, virt_to_page(address));
list-offset = ((unsigned long) address)  (PAGE_SIZE - 1);
 }
 
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index a6475a2..9438d0b 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -308,13 +308,15 @@ zfcp_erp_adisc(struct zfcp_port *port)
if (send_els == NULL)
goto nomem;
 
-   send_els-req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC);
+   send_els-req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
if (send_els-req == NULL)
goto nomem;
+   sg_init_table(send_els-req, 1);
 
-   send_els-resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC);
+   send_els-resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
if (send_els-resp == NULL)
goto nomem;
+   sg_init_table(send_els-resp, 1);
 
address = (void *) get_zeroed_page(GFP_ATOMIC);
if (address == NULL)
@@ -363,7 +365,7 @@ zfcp_erp_adisc(struct zfcp_port *port)
retval = -ENOMEM;
  freemem:
if (address != NULL)
-   __free_pages(send_els-req-page, 0);
+   __free_pages(sg_page(send_els-req), 0);
if (send_els != NULL) {
kfree(send_els-req);
kfree(send_els-resp);
@@ -437,7 +439,7 @@ zfcp_erp_adisc_handler(unsigned long data)
 
  out:
zfcp_port_put(port);
-   __free_pages(send_els-req-page, 0);
+   __free_pages(sg_page(send_els-req), 0);
kfree(send_els-req);
kfree(send_els-resp);
kfree(send_els);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BLOCK] Don't clear sg_dma_len/addr() in blk_rq_map_sg()

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ad0d4083e65d9f223275adbfb9a7927e2120dc6c
Commit: ad0d4083e65d9f223275adbfb9a7927e2120dc6c
Parent: 73fc4f0d2ce4a92c36b00649c58e0a068a6cdfa4
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:27:05 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:27:05 2007 +0200

[BLOCK] Don't clear sg_dma_len/addr() in blk_rq_map_sg()

It's not a proper lvalue on all archs.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 block/ll_rw_blk.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 61c2e39..fb8fb88 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1354,8 +1354,6 @@ new_segment:
else
sg = sg_next(sg);
 
-   sg_dma_len(sg) = 0;
-   sg_dma_address(sg) = 0;
sg_set_page(sg, bvec-bv_page);
sg-length = nbytes;
sg-offset = bvec-bv_offset;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BLOCK] blk_rq_map_sg: force clear termination bit

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7aeacf982203fb4dea2f3434eefdc268cfd5d6d9
Commit: 7aeacf982203fb4dea2f3434eefdc268cfd5d6d9
Parent: ad0d4083e65d9f223275adbfb9a7927e2120dc6c
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:49:25 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:49:25 2007 +0200

[BLOCK] blk_rq_map_sg: force clear termination bit

Since blk_rq_map_sg() sets the termination bit at the end of the sg
table, we could see it prematurely on the next mapping unless we
force drivers to do a full sg_init_table() prior to each mapping. So
force clear the termination bit to avoid having to put that clear in
the driver for every mapping.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 block/ll_rw_blk.c |   14 +-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index fb8fb88..de5ba47 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -1351,8 +1351,20 @@ int blk_rq_map_sg(struct request_queue *q, struct 
request *rq,
 new_segment:
if (!sg)
sg = sglist;
-   else
+   else {
+   /*
+* If the driver previously mapped a shorter
+* list, we could see a termination bit
+* prematurely unless it fully inits the sg
+* table on each mapping. We KNOW that there
+* must be more entries here or the driver
+* would be buggy, so force clear the
+* termination bit to avoid doing a full
+* sg_init_table() in drivers for each command.
+*/
+   sg-page_link = ~0x02;
sg = sg_next(sg);
+   }
 
sg_set_page(sg, bvec-bv_page);
sg-length = nbytes;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ide: build fix

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dc81785dd620c770cf929ff25bb4720e91c23f7a
Commit: dc81785dd620c770cf929ff25bb4720e91c23f7a
Parent: b3b724f48c0c0ade1d5120744cc5c9a3e5193d08
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:29:58 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:49:29 2007 +0200

ide: build fix

git-drivers/ide/ide-probe.c: In function 'hwif_init':
drivers/ide/ide-probe.c:1327: error: implicit declaration of function
'sg_init_table'

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 drivers/ide/ide-probe.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index ec55a17..6a6f2e0 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -47,6 +47,7 @@
 #include linux/spinlock.h
 #include linux/kmod.h
 #include linux/pci.h
+#include linux/scatterlist.h
 
 #include asm/byteorder.h
 #include asm/irq.h
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


parisc: fix sg_page() fallout

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b61e8f4844fd0767b656bd1f983933cc3d0102f3
Commit: b61e8f4844fd0767b656bd1f983933cc3d0102f3
Parent: dc81785dd620c770cf929ff25bb4720e91c23f7a
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 09:30:28 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:49:31 2007 +0200

parisc: fix sg_page() fallout

arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_map_sg':
arch/parisc/kernel/pci-dma.c:487: error: 'struct scatterlist' has no member 
named 'page'
arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_unmap_sg':
arch/parisc/kernel/pci-dma.c:508: error: 'struct scatterlist' has no member 
named 'page'
arch/parisc/kernel/pci-dma.c:508: error: 'struct scatterlist' has no member 
named 'page'
arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_sync_sg_for_cpu':
arch/parisc/kernel/pci-dma.c:535: error: 'struct scatterlist' has no member 
named 'page'
arch/parisc/kernel/pci-dma.c:535: error: 'struct scatterlist' has no member 
named 'page'
arch/parisc/kernel/pci-dma.c: In function 'pa11_dma_sync_sg_for_device':
arch/parisc/kernel/pci-dma.c:545: error: 'struct scatterlist' has no member 
named 'page'
arch/parisc/kernel/pci-dma.c:545: error: 'struct scatterlist' has no member 
named 'page'

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 arch/parisc/kernel/pci-dma.c |1 +
 drivers/parisc/ccio-dma.c|1 +
 drivers/parisc/sba_iommu.c   |1 +
 include/asm-parisc/scatterlist.h |2 +-
 4 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 41f8e32..9448d4e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -25,6 +25,7 @@
 #include linux/slab.h
 #include linux/string.h
 #include linux/types.h
+#include linux/scatterlist.h
 
 #include asm/cacheflush.h
 #include asm/dma.h/* for DMA_CHUNK_SIZE */
diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index b3c4dbf..7c60cbd 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -42,6 +42,7 @@
 #include linux/reboot.h
 #include linux/proc_fs.h
 #include linux/seq_file.h
+#include linux/scatterlist.h
 
 #include asm/byteorder.h
 #include asm/cache.h /* for L1_CACHE_BYTES */
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index e5c3239..e527a0e 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -28,6 +28,7 @@
 #include linux/mm.h
 #include linux/string.h
 #include linux/pci.h
+#include linux/scatterlist.h
 
 #include asm/byteorder.h
 #include asm/io.h
diff --git a/include/asm-parisc/scatterlist.h b/include/asm-parisc/scatterlist.h
index cd3cfdf..62269b3 100644
--- a/include/asm-parisc/scatterlist.h
+++ b/include/asm-parisc/scatterlist.h
@@ -18,7 +18,7 @@ struct scatterlist {
__u32  iova_length; /* bytes mapped */
 };
 
-#define sg_virt_addr(sg) ((unsigned long)(page_address(sg-page) + sg-offset))
+#define sg_virt_addr(sg) ((unsigned long)sg_virt(sg))
 #define sg_dma_address(sg) ((sg)-iova)
 #define sg_dma_len(sg) ((sg)-iova_length)
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


mips: sg_page() fallout

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4fcc47a053adc786cc1ab84f3b8909eeb5c37963
Commit: 4fcc47a053adc786cc1ab84f3b8909eeb5c37963
Parent: 944bda26fbfb3c30533b95ee4aaff72778008f78
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:32:34 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:32:34 2007 +0200

mips: sg_page() fallout

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 arch/mips/mm/dma-default.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index b0b034c..b1b4052 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -13,6 +13,7 @@
 #include linux/mm.h
 #include linux/module.h
 #include linux/string.h
+#include linux/scatterlist.h
 
 #include asm/cache.h
 #include asm/io.h
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


arm: sg fallout

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dee9ba828fb5e72bef17450168774fb360dce983
Commit: dee9ba828fb5e72bef17450168774fb360dce983
Parent: 4fcc47a053adc786cc1ab84f3b8909eeb5c37963
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:37:59 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:37:59 2007 +0200

arm: sg fallout

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 include/asm-arm/dma-mapping.h |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h
index 1eb8aac..e99406a 100644
--- a/include/asm-arm/dma-mapping.h
+++ b/include/asm-arm/dma-mapping.h
@@ -5,7 +5,7 @@
 
 #include linux/mm.h /* need struct page */
 
-#include asm/scatterlist.h
+#include linux/scatterlist.h
 
 /*
  * DMA-consistent mapping functions.  These allocate/free a region of
@@ -274,8 +274,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int 
nents,
for (i = 0; i  nents; i++, sg++) {
char *virt;
 
-   sg-dma_address = page_to_dma(dev, sg-page) + sg-offset;
-   virt = page_address(sg-page) + sg-offset;
+   sg-dma_address = page_to_dma(dev, sg_page(sg)) + sg-offset;
+   virt = sg_virt(sg);
 
if (!arch_is_coherent())
dma_cache_maint(virt, sg-length, dir);
@@ -371,7 +371,7 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist 
*sg, int nents,
int i;
 
for (i = 0; i  nents; i++, sg++) {
-   char *virt = page_address(sg-page) + sg-offset;
+   char *virt = sg_virt(sg);
if (!arch_is_coherent())
dma_cache_maint(virt, sg-length, dir);
}
@@ -384,7 +384,7 @@ dma_sync_sg_for_device(struct device *dev, struct 
scatterlist *sg, int nents,
int i;
 
for (i = 0; i  nents; i++, sg++) {
-   char *virt = page_address(sg-page) + sg-offset;
+   char *virt = sg_virt(sg);
if (!arch_is_coherent())
dma_cache_maint(virt, sg-length, dir);
}
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


blackfin: remove sg_address()

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=26da10784866974d3e87ba998c66458c305777ca
Commit: 26da10784866974d3e87ba998c66458c305777ca
Parent: dee9ba828fb5e72bef17450168774fb360dce983
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:42:44 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:42:44 2007 +0200

blackfin: remove sg_address()

I would have replaced it with sg_virt(), but it doesn't appear to be
used at all.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 include/asm-blackfin/scatterlist.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/asm-blackfin/scatterlist.h 
b/include/asm-blackfin/scatterlist.h
index 32128d5..04f4487 100644
--- a/include/asm-blackfin/scatterlist.h
+++ b/include/asm-blackfin/scatterlist.h
@@ -20,7 +20,6 @@ struct scatterlist {
  * returns, or alternatively stop on the first sg_dma_len(sg) which
  * is 0.
  */
-#define sg_address(sg) (page_address((sg)-page) + (sg)-offset)
 #define sg_dma_address(sg)  ((sg)-dma_address)
 #define sg_dma_len(sg)  ((sg)-length)
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


frv: update comment in scatterlist to reflect new setup

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d09d276ebf62afdaed5f7bab6e7e340ffbde4dd1
Commit: d09d276ebf62afdaed5f7bab6e7e340ffbde4dd1
Parent: 26da10784866974d3e87ba998c66458c305777ca
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:39:41 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:42:46 2007 +0200

frv: update comment in scatterlist to reflect new setup

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 include/asm-frv/scatterlist.h |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/asm-frv/scatterlist.h b/include/asm-frv/scatterlist.h
index f7da007..99ba76e 100644
--- a/include/asm-frv/scatterlist.h
+++ b/include/asm-frv/scatterlist.h
@@ -4,19 +4,19 @@
 #include asm/types.h
 
 /*
- * Drivers must set either -address or (preferred) -page and -offset
+ * Drivers must set either -address or (preferred) page and -offset
  * to indicate where data must be transferred to/from.
  *
- * Using -page is recommended since it handles highmem data as well as
+ * Using page is recommended since it handles highmem data as well as
  * low mem. -address is restricted to data which has a virtual mapping, and
- * it will go away in the future. Updating to -page can be automated very
+ * it will go away in the future. Updating to page can be automated very
  * easily -- something like
  *
  * sg-address = some_ptr;
  *
  * can be rewritten as
  *
- * sg-page = virt_to_page(some_ptr);
+ * sg_set_page(virt_to_page(some_ptr));
  * sg-offset = (unsigned long) some_ptr  ~PAGE_MASK;
  *
  * and that's it. There's no excuse for not highmem enabling YOUR driver. /jens
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


m68knommu: remove sg_address()

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=75d35c93cf8b938f28f06ceb8ffa2606d6e57d3b
Commit: 75d35c93cf8b938f28f06ceb8ffa2606d6e57d3b
Parent: d09d276ebf62afdaed5f7bab6e7e340ffbde4dd1
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:41:57 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:42:47 2007 +0200

m68knommu: remove sg_address()

I would have replaced it with sg_virt(), but it doesn't appear to be
used at all.

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 include/asm-m68knommu/scatterlist.h |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/include/asm-m68knommu/scatterlist.h 
b/include/asm-m68knommu/scatterlist.h
index 1094284..afc4788 100644
--- a/include/asm-m68knommu/scatterlist.h
+++ b/include/asm-m68knommu/scatterlist.h
@@ -14,7 +14,6 @@ struct scatterlist {
unsigned intlength;
 };
 
-#define sg_address(sg) (page_address((sg)-page) + (sg)-offset)
 #define sg_dma_address(sg)  ((sg)-dma_address)
 #define sg_dma_len(sg)  ((sg)-length)
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sh/sh64: fixup dma-mapping for new sg layout

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=71df50a4e4ca9934bbf520c87612d711278f38af
Commit: 71df50a4e4ca9934bbf520c87612d711278f38af
Parent: ebc3bbcfcf0a7fed2ac82f1a849a5f92cf4c217f
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:52:48 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:52:48 2007 +0200

sh/sh64: fixup dma-mapping for new sg layout

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 include/asm-sh/dma-mapping.h   |   12 +---
 include/asm-sh64/dma-mapping.h |   12 +---
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
index 84fefda..fcea067 100644
--- a/include/asm-sh/dma-mapping.h
+++ b/include/asm-sh/dma-mapping.h
@@ -2,7 +2,7 @@
 #define __ASM_SH_DMA_MAPPING_H
 
 #include linux/mm.h
-#include asm/scatterlist.h
+#include linux/scatterlist.h
 #include asm/cacheflush.h
 #include asm/io.h
 
@@ -85,10 +85,9 @@ static inline int dma_map_sg(struct device *dev, struct 
scatterlist *sg,
 
for (i = 0; i  nents; i++) {
 #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-   dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
-  sg[i].length, dir);
+   dma_cache_sync(dev, sg_virt(sg[i]), sg[i].length, dir);
 #endif
-   sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
+   sg[i].dma_address = sg_phys(sg[i]);
}
 
return nents;
@@ -138,10 +137,9 @@ static inline void dma_sync_sg(struct device *dev, struct 
scatterlist *sg,
 
for (i = 0; i  nelems; i++) {
 #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-   dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
-  sg[i].length, dir);
+   dma_cache_sync(dev, sg_virt(sg[i]), sg[i].length, dir);
 #endif
-   sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
+   sg[i].dma_address = sg_phys(sg[i]);
}
 }
 
diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h
index e661857..1438b76 100644
--- a/include/asm-sh64/dma-mapping.h
+++ b/include/asm-sh64/dma-mapping.h
@@ -2,7 +2,7 @@
 #define __ASM_SH_DMA_MAPPING_H
 
 #include linux/mm.h
-#include asm/scatterlist.h
+#include linux/scatterlist.h
 #include asm/io.h
 
 struct pci_dev;
@@ -71,10 +71,9 @@ static inline int dma_map_sg(struct device *dev, struct 
scatterlist *sg,
 
for (i = 0; i  nents; i++) {
 #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-   dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
-  sg[i].length, dir);
+   dma_cache_sync(dev, sg_virt(sg[i]), sg[i].length, dir);
 #endif
-   sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
+   sg[i].dma_address = sg_phys(sg[i]);
}
 
return nents;
@@ -124,10 +123,9 @@ static inline void dma_sync_sg(struct device *dev, struct 
scatterlist *sg,
 
for (i = 0; i  nelems; i++) {
 #if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
-   dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
-  sg[i].length, dir);
+   dma_cache_sync(dev, sg_virt(sg[i]), sg[i].length, dir);
 #endif
-   sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
+   sg[i].dma_address = sg_phys(sg[i]);
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


fvr32: fixup dma-mapping for new sg layout

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=83fcaf70403ce04c693b52e62c794834b9a86089
Commit: 83fcaf70403ce04c693b52e62c794834b9a86089
Parent: 71df50a4e4ca9934bbf520c87612d711278f38af
Author: Jens Axboe [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:54:14 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:54:14 2007 +0200

fvr32: fixup dma-mapping for new sg layout

Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 include/asm-avr32/dma-mapping.h |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/asm-avr32/dma-mapping.h b/include/asm-avr32/dma-mapping.h
index 81e3426..a713163 100644
--- a/include/asm-avr32/dma-mapping.h
+++ b/include/asm-avr32/dma-mapping.h
@@ -217,8 +217,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int 
nents,
for (i = 0; i  nents; i++) {
char *virt;
 
-   sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
-   virt = page_address(sg[i].page) + sg[i].offset;
+   sg[i].dma_address = page_to_bus(sg_page(sg[i])) + sg[i].offset;
+   virt = sg_virt(sg[i]);
dma_cache_sync(dev, virt, sg[i].length, direction);
}
 
@@ -327,8 +327,7 @@ dma_sync_sg_for_device(struct device *dev, struct 
scatterlist *sg,
int i;
 
for (i = 0; i  nents; i++) {
-   dma_cache_sync(dev, page_address(sg[i].page) + sg[i].offset,
-  sg[i].length, direction);
+   dma_cache_sync(dev, sg_virt(sg[i]), sg[i].length, direction);
}
 }
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


sparc64: zero out dma_length

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cb92ae81509eb5ddaea53884b60437502c837405
Commit: cb92ae81509eb5ddaea53884b60437502c837405
Parent: 83fcaf70403ce04c693b52e62c794834b9a86089
Author: FUJITA Tomonori [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 12:58:39 2007 +0200
Committer:  Jens Axboe [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:58:39 2007 +0200

sparc64: zero out dma_length

zero out dma_length in the entry immediately following the last mapped
entry for unmap_sg.

Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
Signed-off-by: Jens Axboe [EMAIL PROTECTED]
---
 arch/sparc64/kernel/iommu_common.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/sparc64/kernel/iommu_common.c 
b/arch/sparc64/kernel/iommu_common.c
index 78e8277..b70324e 100644
--- a/arch/sparc64/kernel/iommu_common.c
+++ b/arch/sparc64/kernel/iommu_common.c
@@ -233,6 +233,11 @@ unsigned long prepare_sg(struct scatterlist *sg, int nents)
dma_sg-dma_address = dent_addr;
dma_sg-dma_length = dent_len;
 
+   if (dma_sg != sg) {
+   dma_sg = next_sg(dma_sg);
+   dma_sg-dma_length = 0;
+   }
+
return ((unsigned long) dent_addr +
(unsigned long) dent_len +
(IO_PAGE_SIZE - 1UL))  IO_PAGE_SHIFT;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AVR32] Platform code for pata_at32

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=48021bd93ca339fcafe9b043d05f5d3a58be7c0a
Commit: 48021bd93ca339fcafe9b043d05f5d3a58be7c0a
Parent: 55b70a0300b873c0ec7ea6e33752af56f41250ce
Author: Kristoffer Nyborg Gregertsen [EMAIL PROTECTED]
AuthorDate: Thu Aug 16 13:45:00 2007 +0200
Committer:  Haavard Skinnemoen [EMAIL PROTECTED]
CommitDate: Tue Oct 23 11:19:05 2007 +0200

[AVR32] Platform code for pata_at32

This patch adds platform code for PATA devices on the AP7000.

[EMAIL PROTECTED]: board code left out for now since stk1000
doesn't support IDE out of the box]
Signed-off-by: Kristoffer Nyborg Gregertsen [EMAIL PROTECTED]
Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 arch/avr32/mach-at32ap/at32ap7000.c   |   65 +
 include/asm-avr32/arch-at32ap/board.h |7 
 2 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/arch/avr32/mach-at32ap/at32ap7000.c 
b/arch/avr32/mach-at32ap/at32ap7000.c
index f6d154c..30aedc9 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -1228,6 +1228,71 @@ out_free_pdev:
 }
 
 /* 
+ * IDE
+ *  */
+static struct ide_platform_data at32_ide0_data;
+static struct resource at32_ide0_resource[] = {
+   {
+   .start  = 0x0400,
+   .end= 0x07ff,
+   .flags  = IORESOURCE_MEM,
+   },
+   IRQ(~0UL), /* Magic IRQ will be overridden */
+};
+DEFINE_DEV_DATA(at32_ide, 0);
+
+struct platform_device *__init
+at32_add_device_ide(unsigned int id, unsigned int extint,
+   struct ide_platform_data *data)
+{
+   struct platform_device *pdev;
+   unsigned int extint_pin;
+
+   switch (extint) {
+   case 0:
+   extint_pin = GPIO_PIN_PB(25);
+   break;
+   case 1:
+   extint_pin = GPIO_PIN_PB(26);
+   break;
+   case 2:
+   extint_pin = GPIO_PIN_PB(27);
+   break;
+   case 3:
+   extint_pin = GPIO_PIN_PB(28);
+   break;
+   default:
+   return NULL;
+   }
+
+   switch (id) {
+   case 0:
+   pdev = at32_ide0_device;
+   select_peripheral(PE(19), PERIPH_A, 0); /* CFCE1  - CS0_N */
+   select_peripheral(PE(20), PERIPH_A, 0); /* CFCE2  - CS1_N */
+   select_peripheral(PE(21), PERIPH_A, 0); /* NCS4   - OE_N  */
+   select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW  - DIR   */
+   select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT  - IORDY */
+   set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
+   data-cs = 4;
+   break;
+   default:
+   return NULL;
+   }
+
+   at32_select_periph(extint_pin, GPIO_PERIPH_A, AT32_GPIOF_DEGLITCH);
+
+   pdev-resource[1].start = EIM_IRQ_BASE + extint;
+   pdev-resource[1].end = pdev-resource[1].start;
+
+   memcpy(pdev-dev.platform_data, data, sizeof(struct ide_platform_data));
+
+   platform_device_register(pdev);
+
+   return pdev;
+}
+
+/* 
  *  GCLK
  *  */
 static struct clk gclk0 = {
diff --git a/include/asm-avr32/arch-at32ap/board.h 
b/include/asm-avr32/arch-at32ap/board.h
index 7dbd603..c18160f 100644
--- a/include/asm-avr32/arch-at32ap/board.h
+++ b/include/asm-avr32/arch-at32ap/board.h
@@ -44,6 +44,13 @@ struct usba_platform_data {
 struct platform_device *
 at32_add_device_usba(unsigned int id, struct usba_platform_data *data);
 
+struct ide_platform_data {
+   u8  cs;
+};
+struct platform_device *
+at32_add_device_ide(unsigned int id, unsigned int extint,
+   struct ide_platform_data *data);
+
 /* depending on what's hooked up, not all SSC pins will be used */
 #defineATMEL_SSC_TK0x01
 #defineATMEL_SSC_TF0x02
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AVR32] Wire up AT73C213 sound driver on ATSTK1000 board

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1c2f173796e4d692b71d1305adb833a104713cd8
Commit: 1c2f173796e4d692b71d1305adb833a104713cd8
Parent: 48021bd93ca339fcafe9b043d05f5d3a58be7c0a
Author: Hans-Christian Egtvedt [EMAIL PROTECTED]
AuthorDate: Mon Jul 16 16:13:33 2007 +0200
Committer:  Haavard Skinnemoen [EMAIL PROTECTED]
CommitDate: Tue Oct 23 11:19:14 2007 +0200

[AVR32] Wire up AT73C213 sound driver on ATSTK1000 board

Signed-off-by: Hans-Christian Egtvedt [EMAIL PROTECTED]
Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 arch/avr32/boards/atstk1000/atstk1002.c |   58 +++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/arch/avr32/boards/atstk1000/atstk1002.c 
b/arch/avr32/boards/atstk1000/atstk1002.c
index 6b9e466..5be0d13 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -16,6 +16,7 @@
 #include linux/string.h
 #include linux/types.h
 #include linux/spi/spi.h
+#include linux/spi/at73c213.h
 
 #include video/atmel_lcdc.h
 
@@ -49,7 +50,26 @@ static struct eth_platform_data __initdata eth_data[2] = {
 };
 
 #ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+static struct at73c213_board_info at73c213_data = {
+   .ssc_id = 0,
+   .shortname  = AVR32 STK1000 external DAC,
+};
+#endif
+#endif
+
+#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
 static struct spi_board_info spi0_board_info[] __initdata = {
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+   {
+   /* AT73C213 */
+   .modalias   = at73c213,
+   .max_speed_hz   = 20,
+   .chip_select= 0,
+   .mode   = SPI_MODE_1,
+   .platform_data  = at73c213_data,
+   },
+#endif
{
/* QVGA display */
.modalias   = ltv350qv,
@@ -180,6 +200,38 @@ static void setup_j2_leds(void)
 }
 #endif
 
+#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+static void __init at73c213_set_clk(struct at73c213_board_info *info)
+{
+   struct clk *gclk;
+   struct clk *pll;
+
+   gclk = clk_get(NULL, gclk0);
+   if (IS_ERR(gclk))
+   goto err_gclk;
+   pll = clk_get(NULL, pll0);
+   if (IS_ERR(pll))
+   goto err_pll;
+
+   if (clk_set_parent(gclk, pll)) {
+   pr_debug(STK1000: failed to set pll0 as parent for DAC 
clock\n);
+   goto err_set_clk;
+   }
+
+   at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
+   info-dac_clk = gclk;
+
+err_set_clk:
+   clk_put(pll);
+err_pll:
+   clk_put(gclk);
+err_gclk:
+   return;
+}
+#endif
+#endif
+
 void __init setup_board(void)
 {
 #ifdef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
@@ -248,6 +300,12 @@ static int __init atstk1002_init(void)
 
setup_j2_leds();
 
+#ifndef CONFIG_BOARD_ATSTK1002_SW3_CUSTOM
+#ifndef CONFIG_BOARD_ATSTK1002_SW1_CUSTOM
+   at73c213_set_clk(at73c213_data);
+#endif
+#endif
+
return 0;
 }
 postcore_initcall(atstk1002_init);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AVR32] Fix a couple of sparse warnings

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=86298962c06c2584a8c4df5fb92a70179ca7e4f5
Commit: 86298962c06c2584a8c4df5fb92a70179ca7e4f5
Parent: 1c2f173796e4d692b71d1305adb833a104713cd8
Author: Haavard Skinnemoen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 15:51:04 2007 +0200
Committer:  Haavard Skinnemoen [EMAIL PROTECTED]
CommitDate: Tue Oct 23 11:19:24 2007 +0200

[AVR32] Fix a couple of sparse warnings

Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 arch/avr32/mach-at32ap/extint.c |2 +-
 arch/avr32/mach-at32ap/pm.h |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index 8acd010..f5bfd4c 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -142,7 +142,7 @@ static int eic_set_irq_type(unsigned int irq, unsigned int 
flow_type)
return ret;
 }
 
-struct irq_chip eic_chip = {
+static struct irq_chip eic_chip = {
.name   = eic,
.ack= eic_ack_irq,
.mask   = eic_mask_irq,
diff --git a/arch/avr32/mach-at32ap/pm.h b/arch/avr32/mach-at32ap/pm.h
index 47efd0d..694d521 100644
--- a/arch/avr32/mach-at32ap/pm.h
+++ b/arch/avr32/mach-at32ap/pm.h
@@ -113,8 +113,8 @@
 
 /* Register access macros */
 #define pm_readl(reg)  \
-   __raw_readl((void __iomem *)AT32_PM_BASE + PM_##reg)
+   __raw_readl((void __iomem __force *)AT32_PM_BASE + PM_##reg)
 #define pm_writel(reg,value)   \
-   __raw_writel((value), (void __iomem *)AT32_PM_BASE + PM_##reg)
+   __raw_writel((value), (void __iomem __force *)AT32_PM_BASE + PM_##reg)
 
 #endif /* __ARCH_AVR32_MACH_AT32AP_PM_H__ */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[AVR32] Implement more at32_add_device_foo() functions

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2042c1c4e7a5e3b69ff3c3c5db6bf6416abd8b24
Commit: 2042c1c4e7a5e3b69ff3c3c5db6bf6416abd8b24
Parent: 86298962c06c2584a8c4df5fb92a70179ca7e4f5
Author: Haavard Skinnemoen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 17:42:35 2007 +0200
Committer:  Haavard Skinnemoen [EMAIL PROTECTED]
CommitDate: Tue Oct 23 11:19:32 2007 +0200

[AVR32] Implement more at32_add_device_foo() functions

Implement functions for adding platform devices for TWI, MCI, AC97C
and ABDAC. They may need to be modified to cope with platform data,
etc. when the corresponding drivers are ready to be merged, but such
changes are much less likely to conflict than adding support for a
whole new type of device.

Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 arch/avr32/mach-at32ap/at32ap7000.c   |  208 +
 include/asm-avr32/arch-at32ap/board.h |5 +
 2 files changed, 213 insertions(+), 0 deletions(-)

diff --git a/arch/avr32/mach-at32ap/at32ap7000.c 
b/arch/avr32/mach-at32ap/at32ap7000.c
index 30aedc9..d152504 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -556,6 +556,17 @@ static struct clk pico_clk = {
.users  = 1,
 };
 
+static struct resource dmaca0_resource[] = {
+   {
+   .start  = 0xff20,
+   .end= 0xff20,
+   .flags  = IORESOURCE_MEM,
+   },
+   IRQ(2),
+};
+DEFINE_DEV(dmaca, 0);
+DEV_CLK(hclk, dmaca0, hsb, 10);
+
 /* 
  * HMATRIX
  *  */
@@ -655,6 +666,7 @@ void __init at32_add_system_devices(void)
platform_device_register(at32_eic0_device);
platform_device_register(smc0_device);
platform_device_register(pdc_device);
+   platform_device_register(dmaca0_device);
 
platform_device_register(at32_systc0_device);
 
@@ -960,6 +972,96 @@ at32_add_device_spi(unsigned int id, struct spi_board_info 
*b, unsigned int n)
 }
 
 /* 
+ *  TWI
+ *  */
+static struct resource atmel_twi0_resource[] __initdata = {
+   PBMEM(0xffe00800),
+   IRQ(5),
+};
+static struct clk atmel_twi0_pclk = {
+   .name   = twi_pclk,
+   .parent = pba_clk,
+   .mode   = pba_clk_mode,
+   .get_rate   = pba_clk_get_rate,
+   .index  = 2,
+};
+
+struct platform_device *__init at32_add_device_twi(unsigned int id)
+{
+   struct platform_device *pdev;
+
+   if (id != 0)
+   return NULL;
+
+   pdev = platform_device_alloc(atmel_twi, id);
+   if (!pdev)
+   return NULL;
+
+   if (platform_device_add_resources(pdev, atmel_twi0_resource,
+   ARRAY_SIZE(atmel_twi0_resource)))
+   goto err_add_resources;
+
+   select_peripheral(PA(6),  PERIPH_A, 0); /* SDA  */
+   select_peripheral(PA(7),  PERIPH_A, 0); /* SDL  */
+
+   atmel_twi0_pclk.dev = pdev-dev;
+
+   platform_device_add(pdev);
+   return pdev;
+
+err_add_resources:
+   platform_device_put(pdev);
+   return NULL;
+}
+
+/* 
+ * MMC
+ *  */
+static struct resource atmel_mci0_resource[] __initdata = {
+   PBMEM(0xfff02400),
+   IRQ(28),
+};
+static struct clk atmel_mci0_pclk = {
+   .name   = mci_clk,
+   .parent = pbb_clk,
+   .mode   = pbb_clk_mode,
+   .get_rate   = pbb_clk_get_rate,
+   .index  = 9,
+};
+
+struct platform_device *__init at32_add_device_mci(unsigned int id)
+{
+   struct platform_device *pdev;
+
+   if (id != 0)
+   return NULL;
+
+   pdev = platform_device_alloc(atmel_mci, id);
+   if (!pdev)
+   return NULL;
+
+   if (platform_device_add_resources(pdev, atmel_mci0_resource,
+   ARRAY_SIZE(atmel_mci0_resource)))
+   goto err_add_resources;
+
+   select_peripheral(PA(10), PERIPH_A, 0); /* CLK   */
+   select_peripheral(PA(11), PERIPH_A, 0); /* CMD   */
+   select_peripheral(PA(12), PERIPH_A, 0); /* DATA0 */
+   select_peripheral(PA(13), PERIPH_A, 0); /* DATA1 */
+   select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */
+   select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */
+
+   atmel_mci0_pclk.dev = pdev-dev;
+
+   platform_device_add(pdev);
+   return pdev;
+
+err_add_resources:
+   platform_device_put(pdev);
+   return NULL;
+}
+
+/* 
  *  LCDC
  * 

[AVR32] Implement at32_add_device_cf()

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eaf5f925a31973e2fdc50c785665b90ff444eceb
Commit: eaf5f925a31973e2fdc50c785665b90ff444eceb
Parent: 2042c1c4e7a5e3b69ff3c3c5db6bf6416abd8b24
Author: Haavard Skinnemoen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 18:32:14 2007 +0200
Committer:  Haavard Skinnemoen [EMAIL PROTECTED]
CommitDate: Tue Oct 23 11:20:05 2007 +0200

[AVR32] Implement at32_add_device_cf()

Implement at32_add_device_cf() which will add a platform_device for
the at32_cf driver (not merged yet). Separate out most of the
at32_add_device_ide() code and use it to implement
at32_add_device_cf() as well.

This changes the API in the following ways:
  * The board code must initialize data-cs to the chipselect ID to
use before calling any of these functions.
  * The board code must use GPIO_PIN_NONE to indicate unused CF pins.

Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 arch/avr32/mach-at32ap/at32ap7000.c   |  133 +
 include/asm-avr32/arch-at32ap/board.h |   11 +++
 2 files changed, 113 insertions(+), 31 deletions(-)

diff --git a/arch/avr32/mach-at32ap/at32ap7000.c 
b/arch/avr32/mach-at32ap/at32ap7000.c
index d152504..a9d9ec0 100644
--- a/arch/avr32/mach-at32ap/at32ap7000.c
+++ b/arch/avr32/mach-at32ap/at32ap7000.c
@@ -1330,10 +1330,9 @@ out_free_pdev:
 }
 
 /* 
- * IDE
+ * IDE / CompactFlash
  *  */
-static struct ide_platform_data at32_ide0_data;
-static struct resource at32_ide0_resource[] = {
+static struct resource at32_smc_cs4_resource[] __initdata = {
{
.start  = 0x0400,
.end= 0x07ff,
@@ -1341,45 +1340,63 @@ static struct resource at32_ide0_resource[] = {
},
IRQ(~0UL), /* Magic IRQ will be overridden */
 };
-DEFINE_DEV_DATA(at32_ide, 0);
+static struct resource at32_smc_cs5_resource[] __initdata = {
+   {
+   .start  = 0x2000,
+   .end= 0x23ff,
+   .flags  = IORESOURCE_MEM,
+   },
+   IRQ(~0UL), /* Magic IRQ will be overridden */
+};
 
-struct platform_device *__init
-at32_add_device_ide(unsigned int id, unsigned int extint,
-   struct ide_platform_data *data)
+static int __init at32_init_ide_or_cf(struct platform_device *pdev,
+   unsigned int cs, unsigned int extint)
 {
-   struct platform_device *pdev;
+   static unsigned int extint_pin_map[4] __initdata = {
+   GPIO_PIN_PB(25),
+   GPIO_PIN_PB(26),
+   GPIO_PIN_PB(27),
+   GPIO_PIN_PB(28),
+   };
+   static bool common_pins_initialized __initdata = false;
unsigned int extint_pin;
+   int ret;
 
-   switch (extint) {
-   case 0:
-   extint_pin = GPIO_PIN_PB(25);
-   break;
-   case 1:
-   extint_pin = GPIO_PIN_PB(26);
-   break;
-   case 2:
-   extint_pin = GPIO_PIN_PB(27);
+   if (extint = ARRAY_SIZE(extint_pin_map))
+   return -EINVAL;
+   extint_pin = extint_pin_map[extint];
+
+   switch (cs) {
+   case 4:
+   ret = platform_device_add_resources(pdev,
+   at32_smc_cs4_resource,
+   ARRAY_SIZE(at32_smc_cs4_resource));
+   if (ret)
+   return ret;
+
+   select_peripheral(PE(21), PERIPH_A, 0); /* NCS4   - OE_N  */
+   set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
break;
-   case 3:
-   extint_pin = GPIO_PIN_PB(28);
+   case 5:
+   ret = platform_device_add_resources(pdev,
+   at32_smc_cs5_resource,
+   ARRAY_SIZE(at32_smc_cs5_resource));
+   if (ret)
+   return ret;
+
+   select_peripheral(PE(22), PERIPH_A, 0); /* NCS5   - OE_N  */
+   set_ebi_sfr_bits(HMATRIX_BIT(CS5A));
break;
default:
-   return NULL;
+   return -EINVAL;
}
 
-   switch (id) {
-   case 0:
-   pdev = at32_ide0_device;
+   if (!common_pins_initialized) {
select_peripheral(PE(19), PERIPH_A, 0); /* CFCE1  - CS0_N */
select_peripheral(PE(20), PERIPH_A, 0); /* CFCE2  - CS1_N */
-   select_peripheral(PE(21), PERIPH_A, 0); /* NCS4   - OE_N  */
select_peripheral(PE(23), PERIPH_A, 0); /* CFRNW  - DIR   */
select_peripheral(PE(24), PERIPH_A, 0); /* NWAIT  - IORDY */
-   set_ebi_sfr_bits(HMATRIX_BIT(CS4A));
-   data-cs = 4;
-   break;
-   default:
-   return NULL;
+   

[AVR32] ARRAY_SIZE() cleanup

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2298a1dd819213802b8a7f955f9b382f5e92127a
Commit: 2298a1dd819213802b8a7f955f9b382f5e92127a
Parent: eaf5f925a31973e2fdc50c785665b90ff444eceb
Author: Alejandro Martinez Ruiz [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 21:18:24 2007 +0200
Committer:  Haavard Skinnemoen [EMAIL PROTECTED]
CommitDate: Tue Oct 23 11:20:26 2007 +0200

[AVR32] ARRAY_SIZE() cleanup

Signed-off-by: Alejandro Martinez Ruiz [EMAIL PROTECTED]
Signed-off-by: Haavard Skinnemoen [EMAIL PROTECTED]
---
 arch/avr32/mach-at32ap/time-tc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/avr32/mach-at32ap/time-tc.c b/arch/avr32/mach-at32ap/time-tc.c
index e3070bd..1026586 100644
--- a/arch/avr32/mach-at32ap/time-tc.c
+++ b/arch/avr32/mach-at32ap/time-tc.c
@@ -79,7 +79,7 @@ static int avr32_timer_calc_div_and_set_jiffies(struct clk 
*pclk)
 {
unsigned int cycles_max = (clocksource_avr32.mask + 1) / 2;
unsigned int divs[] = { 4, 8, 16, 32 };
-   int divs_size = sizeof(divs) / sizeof(*divs);
+   int divs_size = ARRAY_SIZE(divs);
int i = 0;
unsigned long count_hz;
unsigned long shift;
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[JFFS2] Tidy up fix for ACL/permissions problem.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cfc8dc6f6f69ede939e09c2af06a01adee577285
Commit: cfc8dc6f6f69ede939e09c2af06a01adee577285
Parent: e8b8c977734193adedf2b0f607d6252c78e86394
Author: KaiGai Kohei [EMAIL PROTECTED]
AuthorDate: Fri Sep 14 15:16:35 2007 +0900
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Sat Oct 20 14:10:54 2007 +0100

[JFFS2] Tidy up fix for ACL/permissions problem.

[In commit 9ed437c50d89eabae763dd422579f73fdebf288d we fixed a problem
with standard permissions on newly-created inodes, when POSIX ACLs are
enabled. This cleans it up...]

The attached patch separate jffs2_init_acl() into two parts.

The one is jffs2_init_acl_pre() called from jffs2_new_inode().
It compute ACL oriented inode-i_mode bits, and allocate in-memory ACL
objects associated with the new inode just before when inode meta
infomation is written to the medium.

The other is jffs2_init_acl_post() called from jffs2_symlink(),
jffs2_mkdir(), jffs2_mknod() and jffs2_do_create().
It actually writes in-memory ACL objects into the medium next to
the success of writing meta-information.

In the current implementation, we have to write a same inode meta
infomation twice when inode-i_mode is updated by the default ACL.
However, we can avoid the behavior by putting an updated i_mode
before it is written at first, as jffs2_init_acl_pre() doing.

Signed-off-by: KaiGai Kohei [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 fs/jffs2/acl.c  |  101 +--
 fs/jffs2/acl.h  |   12 ---
 fs/jffs2/dir.c  |   35 --
 fs/jffs2/fs.c   |   21 +++
 fs/jffs2/os-linux.h |4 +--
 fs/jffs2/write.c|8 
 6 files changed, 94 insertions(+), 87 deletions(-)

diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c
index 8ec9323..9728614 100644
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -228,11 +228,28 @@ struct posix_acl *jffs2_get_acl(struct inode *inode, int 
type)
return acl;
 }
 
+static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl 
*acl)
+{
+   char *value = NULL;
+   size_t size = 0;
+   int rc;
+
+   if (acl) {
+   value = jffs2_acl_to_medium(acl, size);
+   if (IS_ERR(value))
+   return PTR_ERR(value);
+   }
+   rc = do_jffs2_setxattr(inode, xprefix, , value, size, 0);
+   if (!value  rc == -ENODATA)
+   rc = 0;
+   kfree(value);
+
+   return rc;
+}
+
 static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 {
struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-   size_t size = 0;
-   char *value = NULL;
int rc, xprefix;
 
if (S_ISLNK(inode-i_mode))
@@ -267,17 +284,7 @@ static int jffs2_set_acl(struct inode *inode, int type, 
struct posix_acl *acl)
default:
return -EINVAL;
}
-   if (acl) {
-   value = jffs2_acl_to_medium(acl, size);
-   if (IS_ERR(value))
-   return PTR_ERR(value);
-   }
-
-   rc = do_jffs2_setxattr(inode, xprefix, , value, size, 0);
-   if (!value  rc == -ENODATA)
-   rc = 0;
-   if (value)
-   kfree(value);
+   rc = __jffs2_set_acl(inode, xprefix, acl);
if (!rc) {
switch(type) {
case ACL_TYPE_ACCESS:
@@ -312,37 +319,59 @@ int jffs2_permission(struct inode *inode, int mask, 
struct nameidata *nd)
return generic_permission(inode, mask, jffs2_check_acl);
 }
 
-int jffs2_init_acl(struct inode *inode, struct posix_acl *acl)
+int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
 {
struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
-   struct posix_acl *clone;
-   mode_t mode;
-   int rc = 0;
+   struct posix_acl *acl, *clone;
+   int rc;
 
-   f-i_acl_access = JFFS2_ACL_NOT_CACHED;
-   f-i_acl_default = JFFS2_ACL_NOT_CACHED;
+   f-i_acl_default = NULL;
+   f-i_acl_access = NULL;
+
+   if (S_ISLNK(*i_mode))
+   return 0;   /* Symlink always has no-ACL */
+
+   acl = jffs2_get_acl(dir_i, ACL_TYPE_DEFAULT);
+   if (IS_ERR(acl))
+   return PTR_ERR(acl);
+
+   if (!acl) {
+   *i_mode = ~current-fs-umask;
+   } else {
+   if (S_ISDIR(*i_mode))
+   jffs2_iset_acl(inode, f-i_acl_default, acl);
 
-   if (acl) {
-   if (S_ISDIR(inode-i_mode)) {
-   rc = jffs2_set_acl(inode, ACL_TYPE_DEFAULT, acl);
-   if (rc)
-   goto cleanup;
-   }
clone = posix_acl_clone(acl, GFP_KERNEL);
-   rc = -ENOMEM;
if (!clone)
-

[MTD] [OneNAND] onenand-sim: fix kernel-doc and typos

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19e75ea72b21136805218a2f55177e99100d62e5
Commit: 19e75ea72b21136805218a2f55177e99100d62e5
Parent: cfc8dc6f6f69ede939e09c2af06a01adee577285
Author: Randy Dunlap [EMAIL PROTECTED]
AuthorDate: Thu Oct 18 12:23:10 2007 -0700
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Sat Oct 20 14:11:44 2007 +0100

[MTD] [OneNAND] onenand-sim: fix kernel-doc and typos

Correct kernel-doc notation and descriptions.
Correct other typos.

Signed-off-by: Randy Dunlap [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 drivers/mtd/onenand/onenand_sim.c |   49 +++--
 1 files changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_sim.c 
b/drivers/mtd/onenand/onenand_sim.c
index 0d89ad5..d5b4888 100644
--- a/drivers/mtd/onenand/onenand_sim.c
+++ b/drivers/mtd/onenand/onenand_sim.c
@@ -88,11 +88,11 @@ do {
\
 
 /**
  * onenand_lock_handle - Handle Lock scheme
- * @param this OneNAND device structure
- * @param cmd  The command to be sent
+ * @this:  OneNAND device structure
+ * @cmd:   The command to be sent
  *
  * Send lock command to OneNAND device.
- * The lock scheme is depends on chip type.
+ * The lock scheme depends on chip type.
  */
 static void onenand_lock_handle(struct onenand_chip *this, int cmd)
 {
@@ -131,8 +131,8 @@ static void onenand_lock_handle(struct onenand_chip *this, 
int cmd)
 
 /**
  * onenand_bootram_handle - Handle BootRAM area
- * @param this OneNAND device structure
- * @param cmd  The command to be sent
+ * @this:  OneNAND device structure
+ * @cmd:   The command to be sent
  *
  * Emulate BootRAM area. It is possible to do basic operation using BootRAM.
  */
@@ -153,10 +153,10 @@ static void onenand_bootram_handle(struct onenand_chip 
*this, int cmd)
 
 /**
  * onenand_update_interrupt - Set interrupt register
- * @param this OneNAND device structure
- * @param cmd  The command to be sent
+ * @this: OneNAND device structure
+ * @cmd:  The command to be sent
  *
- * Update interrupt register. The status is depends on command.
+ * Update interrupt register. The status depends on command.
  */
 static void onenand_update_interrupt(struct onenand_chip *this, int cmd)
 {
@@ -189,11 +189,12 @@ static void onenand_update_interrupt(struct onenand_chip 
*this, int cmd)
 }
 
 /**
- * onenand_check_overwrite - Check over-write if happend
- * @param dest The destination pointer
- * @param src  The source pointer
- * @param countThe length to be check
- * @return 0 on same, otherwise 1
+ * onenand_check_overwrite - Check if over-write happened
+ * @dest:  The destination pointer
+ * @src:   The source pointer
+ * @count: The length to be check
+ *
+ * Returns:0 on same, otherwise 1
  *
  * Compare the source with destination
  */
@@ -213,10 +214,10 @@ static int onenand_check_overwrite(void *dest, void *src, 
size_t count)
 
 /**
  * onenand_data_handle - Handle OneNAND Core and DataRAM
- * @param this OneNAND device structure
- * @param cmd  The command to be sent
- * @param dataram  Which dataram used
- * @param offset   The offset to OneNAND Core
+ * @this:  OneNAND device structure
+ * @cmd:   The command to be sent
+ * @dataram:   Which dataram used
+ * @offset:The offset to OneNAND Core
  *
  * Copy data from OneNAND Core to DataRAM (read)
  * Copy data from DataRAM to OneNAND Core (write)
@@ -295,8 +296,8 @@ static void onenand_data_handle(struct onenand_chip *this, 
int cmd,
 
 /**
  * onenand_command_handle - Handle command
- * @param this OneNAND device structure
- * @param cmd  The command to be sent
+ * @this:  OneNAND device structure
+ * @cmd:   The command to be sent
  *
  * Emulate OneNAND command.
  */
@@ -350,8 +351,8 @@ static void onenand_command_handle(struct onenand_chip 
*this, int cmd)
 
 /**
  * onenand_writew - [OneNAND Interface] Emulate write operation
- * @param valuevalue to write
- * @param addr address to write
+ * @value: value to write
+ * @addr:  address to write
  *
  * Write OneNAND register with value
  */
@@ -373,7 +374,7 @@ static void onenand_writew(unsigned short value, void 
__iomem * addr)
 
 /**
  * flash_init - Initialize OneNAND simulator
- * @param flashOneNAND simulaotr data strucutres
+ * @flash: OneNAND simulator data strucutres
  *
  * Initialize OneNAND simulator.
  */
@@ -416,7 +417,7 @@ static int __init flash_init(struct onenand_flash *flash)
 
 /**
  * flash_exit - Clean up OneNAND 

[MTD] [NAND] add s3c2440-specific read_buf/write_buf

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b773bb2e702f6ac96223018d621ea9ed0d4f23ff
Commit: b773bb2e702f6ac96223018d621ea9ed0d4f23ff
Parent: 19e75ea72b21136805218a2f55177e99100d62e5
Author: Matt Reimer [EMAIL PROTECTED]
AuthorDate: Thu Oct 18 17:43:07 2007 -0700
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Sat Oct 20 14:54:26 2007 +0100

[MTD] [NAND] add s3c2440-specific read_buf/write_buf

Add read_buf/write_buf for s3c2440, which can read/write 32 bits at a
time rather than just 8. In my testing on an s3c2440a running at 400 MHz
with a 100 MHz HCLK, read performance improves by 36% (from 5.19 MB/s
to 7.07 MB/s).

Signed-off-by: Matt Reimer [EMAIL PROTECTED]
Acked-by: Ben Dooks [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 drivers/mtd/nand/s3c2410.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 21b921d..66f76e9 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -488,12 +488,24 @@ static void s3c2410_nand_read_buf(struct mtd_info *mtd, 
u_char *buf, int len)
readsb(this-IO_ADDR_R, buf, len);
 }
 
+static void s3c2440_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
+{
+   struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
+   readsl(info-regs + S3C2440_NFDATA, buf, len / 4);
+}
+
 static void s3c2410_nand_write_buf(struct mtd_info *mtd, const u_char *buf, 
int len)
 {
struct nand_chip *this = mtd-priv;
writesb(this-IO_ADDR_W, buf, len);
 }
 
+static void s3c2440_nand_write_buf(struct mtd_info *mtd, const u_char *buf, 
int len)
+{
+   struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
+   writesl(info-regs + S3C2440_NFDATA, buf, len / 4);
+}
+
 /* device management functions */
 
 static int s3c2410_nand_remove(struct platform_device *pdev)
@@ -604,6 +616,8 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info 
*info,
info-sel_bit   = S3C2440_NFCONT_nFCE;
chip-cmd_ctrl  = s3c2440_nand_hwcontrol;
chip-dev_ready = s3c2440_nand_devready;
+   chip-read_buf  = s3c2440_nand_read_buf;
+   chip-write_buf = s3c2440_nand_write_buf;
break;
 
case TYPE_S3C2412:
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RSLIB] BUG() when passing illegal parameters to decode_rs8() or decode_rs16()

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1dd7fdb163645f453f5ae55686511b6fcc2314cd
Commit: 1dd7fdb163645f453f5ae55686511b6fcc2314cd
Parent: c32b8dcc45c823cf30dcdf0fc37ee2f6b78f38cb
Author: Jörn Engel [EMAIL PROTECTED]
AuthorDate: Sat Oct 20 23:14:42 2007 +0200
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Sat Oct 20 22:29:09 2007 +0100

[RSLIB] BUG() when passing illegal parameters to decode_rs8() or 
decode_rs16()

Returning -ERANGE should never happen.

Signed-off-by: Jörn Engel [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 lib/reed_solomon/decode_rs.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c
index a58df56..65bc718 100644
--- a/lib/reed_solomon/decode_rs.c
+++ b/lib/reed_solomon/decode_rs.c
@@ -39,8 +39,7 @@
 
/* Check length parameter for validity */
pad = nn - nroots - len;
-   if (pad  0 || pad = nn)
-   return -ERANGE;
+   BUG_ON(pad  0 || pad = nn);
 
/* Does the caller provide the syndrome ? */
if (s != NULL)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[MTD] [NAND] Replace -1 with -EBADMSG in nand error correction code

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=eb684507159de2162cd6fc62f2b3a671afd5a61d
Commit: eb684507159de2162cd6fc62f2b3a671afd5a61d
Parent: 1dd7fdb163645f453f5ae55686511b6fcc2314cd
Author: Jörn Engel [EMAIL PROTECTED]
AuthorDate: Sat Oct 20 23:16:32 2007 +0200
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Sat Oct 20 22:30:54 2007 +0100

[MTD] [NAND] Replace -1 with -EBADMSG in nand error correction code

Magic numerical values are just bad style.  Particularly so when
undocumented.

Signed-off-by: Jörn Engel [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 drivers/mtd/nand/diskonchip.c   |4 ++--
 drivers/mtd/nand/nand_ecc.c |2 +-
 lib/reed_solomon/decode_rs.c|2 +-
 lib/reed_solomon/reed_solomon.c |2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index ab9f5c5..0e72153 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -220,7 +220,7 @@ static int doc_ecc_decode(struct rs_control *rs, uint8_t 
*data, uint8_t *ecc)
}
}
/* If the parity is wrong, no rescue possible */
-   return parity ? -1 : nerr;
+   return parity ? -EBADMSG : nerr;
 }
 
 static void DoC_Delay(struct doc_priv *doc, unsigned short cycles)
@@ -1034,7 +1034,7 @@ static int doc200x_correct_data(struct mtd_info *mtd, 
u_char *dat,
WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf);
else
WriteDOC(DOC_ECC_DIS, docptr, ECCConf);
-   if (no_ecc_failures  (ret == -1)) {
+   if (no_ecc_failures  (ret == -EBADMSG)) {
printk(KERN_ERR suppressing ECC failure\n);
ret = 0;
}
diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index fde593e..9003a13 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -189,7 +189,7 @@ int nand_correct_data(struct mtd_info *mtd, u_char *dat,
if(countbits(s0 | ((uint32_t)s1  8) | ((uint32_t)s2 16)) == 1)
return 1;
 
-   return -1;
+   return -EBADMSG;
 }
 EXPORT_SYMBOL(nand_correct_data);
 
diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c
index 65bc718..0ec3f25 100644
--- a/lib/reed_solomon/decode_rs.c
+++ b/lib/reed_solomon/decode_rs.c
@@ -202,7 +202,7 @@
 * deg(lambda) unequal to number of roots = uncorrectable
 * error detected
 */
-   count = -1;
+   count = -EBADMSG;
goto finish;
}
/*
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index 5b0d852..3ea2db9 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -320,6 +320,7 @@ EXPORT_SYMBOL_GPL(encode_rs8);
  *  The syndrome and parity uses a uint16_t data type to enable
  *  symbol size  8. The calling code must take care of decoding of the
  *  syndrome result and the received parity before calling this code.
+ *  Returns the number of corrected bits or -EBADMSG for uncorrectable errors.
  */
 int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
   uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
@@ -363,6 +364,7 @@ EXPORT_SYMBOL_GPL(encode_rs16);
  *  @corr: buffer to store correction bitmask on eras_pos
  *
  *  Each field in the data array contains up to symbol size bits of valid data.
+ *  Returns the number of corrected bits or -EBADMSG for uncorrectable errors.
  */
 int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len,
uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[MTD] [OneNAND] Fix wrong free the static address in onenand_sim

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c21f900cb8817009930e672d22a5b91e5b706351
Commit: c21f900cb8817009930e672d22a5b91e5b706351
Parent: eb684507159de2162cd6fc62f2b3a671afd5a61d
Author: Kyungmin Park [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:01:52 2007 +0900
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Mon Oct 22 09:57:28 2007 +0100

[MTD] [OneNAND] Fix wrong free the static address in onenand_sim

Reported-by: Randy Dunlap [EMAIL PROTECTED]
Signed-off-by: Kyungmin Park [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 drivers/mtd/onenand/onenand_sim.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_sim.c 
b/drivers/mtd/onenand/onenand_sim.c
index d5b4888..d64200b 100644
--- a/drivers/mtd/onenand/onenand_sim.c
+++ b/drivers/mtd/onenand/onenand_sim.c
@@ -425,7 +425,6 @@ static void flash_exit(struct onenand_flash *flash)
 {
vfree(ONENAND_CORE(flash));
kfree(flash-base);
-   kfree(flash);
 }
 
 static int __init onenand_sim_init(void)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[MTD] [NOR] Fix deadlock in Intel chip driver caused by get_chip recursion

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5a37cf19efcceae14c2078449e35b9f4eb3e63e4
Commit: 5a37cf19efcceae14c2078449e35b9f4eb3e63e4
Parent: 2a754b51aacb122cec25c849e3cf7f5503cc3ec6
Author: Alexey Korolev [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 17:55:20 2007 +0100
Committer:  David Woodhouse [EMAIL PROTECTED]
CommitDate: Tue Oct 23 12:07:52 2007 +0100

[MTD] [NOR] Fix deadlock in Intel chip driver caused by get_chip recursion

This patch solves kernel deadlock issue seen on JFFF2 simultaneous
operations. Detailed investigation of the issue showed that the kernel
deadlock is caused by tons of recursive get_chip calls.

Signed-off-by: Alexey Korolev [EMAIL PROTECTED]
Acked-by: Nicolas Pitre [EMAIL PROTECTED]
Signed-off-by: David Woodhouse [EMAIL PROTECTED]
---
 drivers/mtd/chips/cfi_cmdset_0001.c |  146 ++
 1 files changed, 77 insertions(+), 69 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c 
b/drivers/mtd/chips/cfi_cmdset_0001.c
index 3aa3dca..a9eb1c5 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -85,6 +85,7 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t 
from, size_t len,
 static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t 
from,
size_t len);
 
+static int chip_ready (struct map_info *map, struct flchip *chip, unsigned 
long adr, int mode);
 static int get_chip(struct map_info *map, struct flchip *chip, unsigned long 
adr, int mode);
 static void put_chip(struct map_info *map, struct flchip *chip, unsigned long 
adr);
 #include fwh_lock.h
@@ -641,73 +642,13 @@ static int cfi_intelext_partition_fixup(struct mtd_info 
*mtd,
 /*
  *  *** CHIP ACCESS FUNCTIONS ***
  */
-
-static int get_chip(struct map_info *map, struct flchip *chip, unsigned long 
adr, int mode)
+static int chip_ready (struct map_info *map, struct flchip *chip, unsigned 
long adr, int mode)
 {
DECLARE_WAITQUEUE(wait, current);
struct cfi_private *cfi = map-fldrv_priv;
map_word status, status_OK = CMD(0x80), status_PWS = CMD(0x01);
-   unsigned long timeo;
struct cfi_pri_intelext *cfip = cfi-cmdset_priv;
-
- resettime:
-   timeo = jiffies + HZ;
- retry:
-   if (chip-priv  (mode == FL_WRITING || mode == FL_ERASING || mode == 
FL_OTP_WRITE || mode == FL_SHUTDOWN)) {
-   /*
-* OK. We have possibility for contension on the write/erase
-* operations which are global to the real chip and not per
-* partition.  So let's fight it over in the partition which
-* currently has authority on the operation.
-*
-* The rules are as follows:
-*
-* - any write operation must own shared-writing.
-*
-* - any erase operation must own _both_ shared-writing and
-*   shared-erasing.
-*
-* - contension arbitration is handled in the owner's context.
-*
-* The 'shared' struct can be read and/or written only when
-* its lock is taken.
-*/
-   struct flchip_shared *shared = chip-priv;
-   struct flchip *contender;
-   spin_lock(shared-lock);
-   contender = shared-writing;
-   if (contender  contender != chip) {
-   /*
-* The engine to perform desired operation on this
-* partition is already in use by someone else.
-* Let's fight over it in the context of the chip
-* currently using it.  If it is possible to suspend,
-* that other partition will do just that, otherwise
-* it'll happily send us to sleep.  In any case, when
-* get_chip returns success we're clear to go ahead.
-*/
-   int ret = spin_trylock(contender-mutex);
-   spin_unlock(shared-lock);
-   if (!ret)
-   goto retry;
-   spin_unlock(chip-mutex);
-   ret = get_chip(map, contender, contender-start, mode);
-   spin_lock(chip-mutex);
-   if (ret) {
-   spin_unlock(contender-mutex);
-   return ret;
-   }
-   timeo = jiffies + HZ;
-   spin_lock(shared-lock);
-   spin_unlock(contender-mutex);
-   }
-
-   /* We now own it */
-   shared-writing = chip;
-   if (mode == FL_ERASING)
-   

[POWERPC] Add Vitaly Bordug as PPC8xx maintainer

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dba5baf32887f58414ed7183a95309686894eab2
Commit: dba5baf32887f58414ed7183a95309686894eab2
Parent: 0895e91d60ef9bdef426d1ce14bb94bd5875870d
Author: Marcelo Tosatti [EMAIL PROTECTED]
AuthorDate: Mon Sep 10 18:46:01 2007 -0400
Committer:  Paul Mackerras [EMAIL PROTECTED]
CommitDate: Tue Oct 23 14:14:38 2007 +1000

[POWERPC] Add Vitaly Bordug as PPC8xx maintainer

Vitaly has been doing most of the 8xx maintenance work.

Signed-off-by: Marcelo Tosatti [EMAIL PROTECTED]
Signed-off-by: Paul Mackerras [EMAIL PROTECTED]
---
 MAINTAINERS |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1fd6d02..40245af 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2338,6 +2338,8 @@ L:[EMAIL PROTECTED]
 S: Maintained
 
 LINUX FOR POWERPC EMBEDDED PPC8XX
+P: Vitaly Bordug
+M: [EMAIL PROTECTED]
 P: Marcelo Tosatti
 M: [EMAIL PROTECTED]
 W: http://www.penguinppc.org/
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[POWERPC] 4xx: Enable EMAC on the PPC 440GP Ebony board

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16fdad334c5ba055b8eb79a97da561fbdfacd15e
Commit: 16fdad334c5ba055b8eb79a97da561fbdfacd15e
Parent: 1d5499b5ac6515991a5149f934cb6f0ead653dbc
Author: Josh Boyer [EMAIL PROTECTED]
AuthorDate: Sat Oct 20 00:53:09 2007 +1000
Committer:  Josh Boyer [EMAIL PROTECTED]
CommitDate: Fri Oct 19 16:18:29 2007 -0500

[POWERPC] 4xx: Enable EMAC on the PPC 440GP Ebony board

Update the Ebony defconfig to enable the ibm_newemac driver.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]
---
 arch/powerpc/configs/ebony_defconfig |  115 -
 1 files changed, 70 insertions(+), 45 deletions(-)

diff --git a/arch/powerpc/configs/ebony_defconfig 
b/arch/powerpc/configs/ebony_defconfig
index 35a95dd..d3ef642 100644
--- a/arch/powerpc/configs/ebony_defconfig
+++ b/arch/powerpc/configs/ebony_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc4
-# Thu Aug 30 16:34:11 2007
+# Linux kernel version: 2.6.23
+# Thu Oct 18 08:01:57 2007
 #
 # CONFIG_PPC64 is not set
 
@@ -21,8 +21,13 @@ CONFIG_PHYS_64BIT=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
 CONFIG_PPC_MERGE=y
 CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_IRQ_PER_CPU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -66,6 +71,8 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
 CONFIG_BLK_DEV_INITRD=y
@@ -86,7 +93,6 @@ CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
@@ -130,7 +136,9 @@ CONFIG_DEFAULT_IOSCHED=anticipatory
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
+# CONFIG_BAMBOO is not set
 CONFIG_EBONY=y
+# CONFIG_SEQUOIA is not set
 CONFIG_440GP=y
 # CONFIG_MPIC is not set
 # CONFIG_MPIC_WEIRD is not set
@@ -149,6 +157,10 @@ CONFIG_440GP=y
 # Kernel options
 #
 # CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_100 is not set
 CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
@@ -170,6 +182,7 @@ CONFIG_FLATMEM_MANUAL=y
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
+# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_RESOURCES_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
@@ -194,10 +207,6 @@ CONFIG_PCI_SYSCALL=y
 CONFIG_ARCH_SUPPORTS_MSI=y
 # CONFIG_PCI_MSI is not set
 # CONFIG_PCI_DEBUG is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
 # CONFIG_PCCARD is not set
 # CONFIG_HOTPLUG_PCI is not set
 
@@ -212,7 +221,7 @@ CONFIG_ARCH_SUPPORTS_MSI=y
 CONFIG_HIGHMEM_START=0xfe00
 CONFIG_LOWMEM_SIZE=0x3000
 CONFIG_KERNEL_START=0xc000
-CONFIG_TASK_SIZE=0x8000
+CONFIG_TASK_SIZE=0xc000
 CONFIG_CONSISTENT_START=0xff10
 CONFIG_CONSISTENT_SIZE=0x0020
 CONFIG_BOOT_LOAD=0x0100
@@ -249,6 +258,7 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_XFRM_MODE_TRANSPORT is not set
 # CONFIG_INET_XFRM_MODE_TUNNEL is not set
 # CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
 CONFIG_INET_DIAG=y
 CONFIG_INET_TCP_DIAG=y
 # CONFIG_TCP_CONG_ADVANCED is not set
@@ -306,6 +316,7 @@ CONFIG_DEFAULT_TCP_CONG=cubic
 #
 # Generic Driver Options
 #
+CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=y
@@ -332,6 +343,7 @@ CONFIG_MTD_BLOCK=y
 # CONFIG_INFTL is not set
 # CONFIG_RFD_FTL is not set
 # CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
 
 #
 # RAM/ROM/Flash chip drivers
@@ -364,6 +376,7 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 # CONFIG_MTD_PHYSMAP is not set
 CONFIG_MTD_PHYSMAP_OF=y
+# CONFIG_MTD_INTEL_VR_NOR is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -423,10 +436,6 @@ CONFIG_MISC_DEVICES=y
 # CONFIG_SCSI_NETLINK is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
 # CONFIG_FUSION is not set
 
 #
@@ -443,12 +452,36 @@ CONFIG_NETDEVICES=y
 # CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_IP1000 is not set
 # CONFIG_ARCNET is not set
-# CONFIG_NET_ETHERNET is not set
+# CONFIG_PHYLIB is not set
+CONFIG_NET_ETHERNET=y
+# CONFIG_MII is not set
+# CONFIG_HAPPYMEAL is not set
+# CONFIG_SUNGEM is not set
+# CONFIG_CASSINI is not set
+# CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_NET_TULIP is not set
+# CONFIG_HP100 is not set
+CONFIG_IBM_NEW_EMAC=y
+CONFIG_IBM_NEW_EMAC_RXB=128

[POWERPC] 4xx: Fix timebase clock selection on Walnut

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=094624fa66758e9f87c29b23cf5bc67c10fd
Commit: 094624fa66758e9f87c29b23cf5bc67c10fd
Parent: 16fdad334c5ba055b8eb79a97da561fbdfacd15e
Author: Josh Boyer [EMAIL PROTECTED]
AuthorDate: Sat Oct 20 00:53:10 2007 +1000
Committer:  Josh Boyer [EMAIL PROTECTED]
CommitDate: Fri Oct 19 16:18:31 2007 -0500

[POWERPC] 4xx: Fix timebase clock selection on Walnut

The current bootwrapper fails to set the timebase clock to the CPU clock
which causes the time to increment incorrectly.  This fixes it by using the
correct #define for the CPC0_CR1 register.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]
---
 arch/powerpc/boot/treeboot-walnut.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/treeboot-walnut.c 
b/arch/powerpc/boot/treeboot-walnut.c
index 3adf2d0..6be76b7 100644
--- a/arch/powerpc/boot/treeboot-walnut.c
+++ b/arch/powerpc/boot/treeboot-walnut.c
@@ -57,8 +57,8 @@ void ibm405gp_fixup_clocks(unsigned int sysclk, unsigned int 
ser_clk)
}
 
/* setup the timebase clock to tick at the cpu frequency */
-   cpc0_cr1 = cpc0_cr1  ~ 0x0080;
-   mtdcr(DCRN_CPC0_CR1, cpc0_cr1);
+   cpc0_cr1 = cpc0_cr1  ~0x0080;
+   mtdcr(DCRN_405_CPC0_CR1, cpc0_cr1);
tb = cpu;
 
dt_fixup_cpu_clocks(cpu, tb, 0);
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[POWERPC] 4xx: Enable EMAC for PPC405 Walnut board

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b3af7a55da9925b73136d5358573e8962dfd35a0
Commit: b3af7a55da9925b73136d5358573e8962dfd35a0
Parent: 094624fa66758e9f87c29b23cf5bc67c10fd
Author: Josh Boyer [EMAIL PROTECTED]
AuthorDate: Sat Oct 20 00:53:11 2007 +1000
Committer:  Josh Boyer [EMAIL PROTECTED]
CommitDate: Fri Oct 19 16:18:33 2007 -0500

[POWERPC] 4xx: Enable EMAC for PPC405 Walnut board

This patch enables the ibm_newemac driver for the Walnut board.  It fixes 
the
device tree for the walnut board to order the MAL interrupts correctly and
adds the local-mac-address property to the EMAC node.  The bootwrapper is 
also
updated to extract the MAC address from the OpenBIOS offset where it is 
stored.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/walnut.dts  |   12 +++-
 arch/powerpc/boot/treeboot-walnut.c   |2 +
 arch/powerpc/configs/walnut_defconfig |   94 +++--
 arch/powerpc/platforms/40x/Kconfig|1 +
 4 files changed, 66 insertions(+), 43 deletions(-)

diff --git a/arch/powerpc/boot/dts/walnut.dts b/arch/powerpc/boot/dts/walnut.dts
index ec54f4e..fa681f5 100644
--- a/arch/powerpc/boot/dts/walnut.dts
+++ b/arch/powerpc/boot/dts/walnut.dts
@@ -64,10 +64,15 @@
MAL: mcmal {
compatible = ibm,mcmal-405gp, ibm,mcmal;
dcr-reg = 180 62;
-   num-tx-chans = 2;
+   num-tx-chans = 1;
num-rx-chans = 1;
interrupt-parent = UIC0;
-   interrupts = a 4 b 4 c 4 d 4 e 4;
+   interrupts = 
+   b 4 /* TXEOB */
+   c 4 /* RXEOB */
+   a 4 /* SERR */
+   d 4 /* TXDE */
+   e 4 /* RXDE */;
};
 
POB0: opb {
@@ -118,9 +123,10 @@
compatible = ibm,emac-405gp, ibm,emac;
interrupt-parent = UIC0;
interrupts = 9 4 f 4;
+   local-mac-address = []; /* Filled 
in by zImage */
reg = ef600800 70;
mal-device = MAL;
-   mal-tx-channel = 0 1;
+   mal-tx-channel = 0;
mal-rx-channel = 0;
cell-index = 0;
max-frame-size = 5dc;
diff --git a/arch/powerpc/boot/treeboot-walnut.c 
b/arch/powerpc/boot/treeboot-walnut.c
index 6be76b7..bb2c309 100644
--- a/arch/powerpc/boot/treeboot-walnut.c
+++ b/arch/powerpc/boot/treeboot-walnut.c
@@ -109,6 +109,7 @@ static void walnut_flashsel_fixup(void)
setprop(sram, reg, reg_sram, sizeof(reg_sram));
 }
 
+#define WALNUT_OPENBIOS_MAC_OFF 0xfe0b
 static void walnut_fixups(void)
 {
ibm4xx_fixup_memsize();
@@ -116,6 +117,7 @@ static void walnut_fixups(void)
ibm4xx_quiesce_eth((u32 *)0xef600800, NULL);
ibm4xx_fixup_ebc_ranges(/plb/ebc);
walnut_flashsel_fixup();
+   dt_fixup_mac_addresses((u8 *) WALNUT_OPENBIOS_MAC_OFF);
 }
 
 void platform_init(void)
diff --git a/arch/powerpc/configs/walnut_defconfig 
b/arch/powerpc/configs/walnut_defconfig
index 7724292..02896ec 100644
--- a/arch/powerpc/configs/walnut_defconfig
+++ b/arch/powerpc/configs/walnut_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc4
-# Wed Sep  5 12:06:37 2007
+# Linux kernel version: 2.6.23
+# Thu Oct 18 12:54:18 2007
 #
 # CONFIG_PPC64 is not set
 
@@ -18,8 +18,13 @@ CONFIG_4xx=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
 CONFIG_PPC_MERGE=y
 CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_IRQ_PER_CPU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -63,6 +68,8 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
 CONFIG_BLK_DEV_INITRD=y
@@ -83,7 +90,6 @@ CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
@@ -127,7 +133,9 @@ CONFIG_DEFAULT_IOSCHED=anticipatory
 # CONFIG_PPC_CELL is not set
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PQ2ADS is not set
+# CONFIG_KILAUEA is not set
 CONFIG_WALNUT=y
+# CONFIG_XILINX_VIRTEX_GENERIC_BOARD is not set
 CONFIG_405GP=y
 CONFIG_IBM405_ERR77=y
 CONFIG_IBM405_ERR51=y
@@ -148,6 +156,10 @@ CONFIG_IBM405_ERR51=y
 # Kernel 

[POWERPC] 4xx: Enable EMAC on Bamboo board

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=739253765ed55742431866b19330fa0e1012c417
Commit: 739253765ed55742431866b19330fa0e1012c417
Parent: b3af7a55da9925b73136d5358573e8962dfd35a0
Author: Josh Boyer [EMAIL PROTECTED]
AuthorDate: Sat Oct 20 00:53:12 2007 +1000
Committer:  Josh Boyer [EMAIL PROTECTED]
CommitDate: Fri Oct 19 16:18:35 2007 -0500

[POWERPC] 4xx: Enable EMAC on Bamboo board

Fix some device tree omissions that prevented the new EMAC driver from
setting up ethernet on the Bamboo board correctly and update the Bamboo
defconfig.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/bamboo.dts  |   10 ++-
 arch/powerpc/configs/bamboo_defconfig |  114 +++-
 arch/powerpc/platforms/44x/Kconfig|2 +-
 3 files changed, 76 insertions(+), 50 deletions(-)

diff --git a/arch/powerpc/boot/dts/bamboo.dts b/arch/powerpc/boot/dts/bamboo.dts
index a88ae3d..cb2fb50 100644
--- a/arch/powerpc/boot/dts/bamboo.dts
+++ b/arch/powerpc/boot/dts/bamboo.dts
@@ -98,11 +98,13 @@
interrupt-parent = MAL0;
interrupts = 0 1 2 3 4;
#interrupt-cells = 1;
+   #address-cells = 0;
+   #size-cells = 0;
interrupt-map = /*TXEOB*/ 0 UIC0 a 4
/*RXEOB*/ 1 UIC0 b 4
/*SERR*/  2 UIC1 0 4
/*TXDE*/  3 UIC1 1 4
-   /*RXDE*/  4 UIC1 3 4;
+   /*RXDE*/  4 UIC1 2 4;
};
 
POB0: opb {
@@ -196,6 +198,7 @@
};
 
EMAC0: [EMAIL PROTECTED] {
+   linux,network-index = 0;
device_type = network;
compatible = ibm,emac-440ep, 
ibm,emac-440gp, ibm,emac;
interrupt-parent = UIC1;
@@ -210,12 +213,13 @@
rx-fifo-size = 1000;
tx-fifo-size = 800;
phy-mode = rmii;
-   phy-map = 0001;
+   phy-map = ;
zmii-device = ZMII0;
zmii-channel = 0;
};
 
EMAC1: [EMAIL PROTECTED] {
+   linux,network-index = 1;
device_type = network;
compatible = ibm,emac-440ep, 
ibm,emac-440gp, ibm,emac;
interrupt-parent = UIC1;
@@ -230,7 +234,7 @@
rx-fifo-size = 1000;
tx-fifo-size = 800;
phy-mode = rmii;
-   phy-map = 0001;
+   phy-map = ;
zmii-device = ZMII0;
zmii-channel = 1;
};
diff --git a/arch/powerpc/configs/bamboo_defconfig 
b/arch/powerpc/configs/bamboo_defconfig
index d22fed6..844808e 100644
--- a/arch/powerpc/configs/bamboo_defconfig
+++ b/arch/powerpc/configs/bamboo_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.23-rc1
-# Fri Aug  3 10:46:53 2007
+# Linux kernel version: 2.6.23
+# Fri Oct 19 09:01:11 2007
 #
 # CONFIG_PPC64 is not set
 
@@ -22,8 +22,13 @@ CONFIG_PHYS_64BIT=y
 # CONFIG_PPC_MM_SLICES is not set
 CONFIG_NOT_COHERENT_CACHE=y
 CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
 CONFIG_PPC_MERGE=y
 CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_IRQ_PER_CPU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -67,6 +72,8 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
 CONFIG_BLK_DEV_INITRD=y
@@ -87,7 +94,6 @@ CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
 CONFIG_VM_EVENT_COUNTERS=y
@@ -133,6 +139,7 @@ CONFIG_DEFAULT_IOSCHED=anticipatory
 # CONFIG_PQ2ADS is not set
 CONFIG_BAMBOO=y
 # CONFIG_EBONY is not set
+# CONFIG_SEQUOIA is not set
 CONFIG_440EP=y
 CONFIG_IBM440EP_ERR42=y
 # CONFIG_MPIC is not set
@@ -146,11 +153,16 @@ CONFIG_IBM440EP_ERR42=y
 # CONFIG_GENERIC_IOMAP is not set
 # CONFIG_CPU_FREQ is not set
 # CONFIG_CPM2 is not set
+# CONFIG_FSL_ULI1575 is not set
 
 #
 # Kernel options
 #
 # CONFIG_HIGHMEM is not set
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# 

SELinux: always check SIGCHLD in selinux_task_wait

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8a53514043e380aa573baa805298a7727c993985
Commit: 8a53514043e380aa573baa805298a7727c993985
Parent: 55b70a0300b873c0ec7ea6e33752af56f41250ce
Author: Eric Paris [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 16:10:31 2007 -0400
Committer:  James Morris [EMAIL PROTECTED]
CommitDate: Tue Oct 23 08:47:48 2007 +1000

SELinux: always check SIGCHLD in selinux_task_wait

When checking if we can wait on a child we were looking at
p-exit_signal and trying to make the decision based on if the signal
would eventually be allowed.  One big flaw is that p-exit_signal is -1
for NPTL threads and so aignal_to_av was not actually checking SIGCHLD
which is what would have been sent.  Even is exit_signal was set to
something strange it wouldn't change the fact that the child was there
and needed to be waited on.  This patch just assumes wait is based on
SIGCHLD.  Specific permission checks are made when the child actually
attempts to send a signal.

This resolves the problem of things like using GDB on confined domains
such as in RH BZ 232371.  The confined domain did not have permission to
send a generic signal (exit_signal == -1) back to the unconfined GDB.
With this patch the GDB wait works and since the actual signal sent is
allowed everything functions as it should.

Signed-off-by: Eric Paris [EMAIL PROTECTED]
Signed-off-by: James Morris [EMAIL PROTECTED]
---
 security/selinux/hooks.c |6 +-
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 24e1b18..9f3124b 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2977,11 +2977,7 @@ static int selinux_task_prctl(int option,
 
 static int selinux_task_wait(struct task_struct *p)
 {
-   u32 perm;
-
-   perm = signal_to_av(p-exit_signal);
-
-   return task_has_perm(p, current, perm);
+   return task_has_perm(p, current, PROCESS__SIGCHLD);
 }
 
 static void selinux_task_reparent_to_init(struct task_struct *p)
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fix synchronize_irq races with IRQ handler

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a98ce5c6feead6bfedefabd46cb3d7f5be148d9a
Commit: a98ce5c6feead6bfedefabd46cb3d7f5be148d9a
Parent: 48d2268473a66fe3aa78fb13b09ee59d6ee95073
Author: Herbert Xu [EMAIL PROTECTED]
AuthorDate: Tue Oct 23 11:26:25 2007 +0800
Committer:  Linus Torvalds [EMAIL PROTECTED]
CommitDate: Tue Oct 23 09:01:31 2007 -0700

Fix synchronize_irq races with IRQ handler

As it is some callers of synchronize_irq rely on memory barriers
to provide synchronisation against the IRQ handlers.  For example,
the tg3 driver does

tp-irq_sync = 1;
smp_mb();
synchronize_irq();

and then in the IRQ handler:

if (!tp-irq_sync)
netif_rx_schedule(dev, tp-napi);

Unfortunately memory barriers only work well when they come in
pairs.  Because we don't actually have memory barriers on the
IRQ path, the memory barrier before the synchronize_irq() doesn't
actually protect us.

In particular, synchronize_irq() may return followed by the
result of netif_rx_schedule being made visible.

This patch (mostly written by Linus) fixes this by using spin
locks instead of memory barries on the synchronize_irq() path.

Signed-off-by: Herbert Xu [EMAIL PROTECTED]
Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
Signed-off-by: Linus Torvalds [EMAIL PROTECTED]
---
 kernel/irq/manage.c |   20 ++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 80eab7a..1f31422 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -29,12 +29,28 @@
 void synchronize_irq(unsigned int irq)
 {
struct irq_desc *desc = irq_desc + irq;
+   unsigned int status;
 
if (irq = NR_IRQS)
return;
 
-   while (desc-status  IRQ_INPROGRESS)
-   cpu_relax();
+   do {
+   unsigned long flags;
+
+   /*
+* Wait until we're out of the critical section.  This might
+* give the wrong answer due to the lack of memory barriers.
+*/
+   while (desc-status  IRQ_INPROGRESS)
+   cpu_relax();
+
+   /* Ok, that indicated we're done: double-check carefully. */
+   spin_lock_irqsave(desc-lock, flags);
+   status = desc-status;
+   spin_unlock_irqrestore(desc-lock, flags);
+
+   /* Oops, that failed? */
+   } while (status  IRQ_INPROGRESS);
 }
 EXPORT_SYMBOL(synchronize_irq);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Normalize config options for guest support

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d3d1c4bdf16bd154d9f27f34fca28edca90465eb
Commit: d3d1c4bdf16bd154d9f27f34fca28edca90465eb
Parent: 0895e91d60ef9bdef426d1ce14bb94bd5875870d
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:55:21 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:47 2007 +1000

Normalize config options for guest support

1) Group all the guest OS support options together, under a PARAVIRT_GUEST
   menu.
2) Make those options select CONFIG_PARAVIRT, as suggested by Andi.
3) Make kconfig help titles consistent.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Andi Kleen [EMAIL PROTECTED]
Cc: Zach Amsden [EMAIL PROTECTED]
Cc: Jeremy Fitzhardinge [EMAIL PROTECTED]
Cc: Chris Wright [EMAIL PROTECTED]
---
 arch/i386/Kconfig  |   38 --
 arch/x86/xen/Kconfig   |5 +++--
 drivers/lguest/Kconfig |3 +--
 3 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f6e44fc..3523e82 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -227,28 +227,46 @@ config SCHED_NO_NO_OMIT_FRAME_POINTER
  If in doubt, say Y.
 
 config PARAVIRT
-   bool Paravirtualization support (EXPERIMENTAL)
-   depends on EXPERIMENTAL
+   bool
depends on !(X86_VISWS || X86_VOYAGER)
help
- Paravirtualization is a way of running multiple instances of
- Linux on the same machine, under a hypervisor.  This option
- changes the kernel so it can modify itself when it is run
- under a hypervisor, improving performance significantly.
- However, when run without a hypervisor the kernel is
- theoretically slower.  If in doubt, say N.
+ This changes the kernel so it can modify itself when it is run
+ under a hypervisor, potentially improving performance significantly
+ over full virtualization.  However, when run without a hypervisor
+ the kernel is theoretically slower and slightly larger.
+
+menuconfig PARAVIRT_GUEST
+   bool Paravirtualized guest support
+   help
+ Say Y here to get to see options related to running Linux under
+ various hypervisors.  This option alone does not add any kernel code.
+
+ If you say N, all options in this submenu will be skipped and 
disabled.
+
+if PARAVIRT_GUEST
 
 source arch/x86/xen/Kconfig
 
 config VMI
-   bool VMI Paravirt-ops support
-   depends on PARAVIRT
+   bool VMI Guest support
+   select PARAVIRT
+   depends on !(X86_VISWS || X86_VOYAGER)
help
  VMI provides a paravirtualized interface to the VMware ESX server
  (it could be used by other hypervisors in theory too, but is not
  at the moment), by linking the kernel to a GPL-ed ROM module
  provided by the hypervisor.
 
+config LGUEST_GUEST
+   bool Lguest guest support
+   select PARAVIRT
+   depends on !X86_PAE
+   help
+ Lguest is a tiny in-kernel hypervisor.  Selecting this will
+ allow your kernel to boot under lguest.  This option will increase
+ your kernel size by about 6k.  If in doubt, say N.
+endif
+
 config ACPI_SRAT
bool
default y
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 9df99e1..fbfa55c 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -3,8 +3,9 @@
 #
 
 config XEN
-   bool Enable support for Xen hypervisor
-   depends on PARAVIRT  X86_CMPXCHG  X86_TSC  !NEED_MULTIPLE_NODES
+   bool Xen guest support
+   select PARAVIRT
+   depends on X86_CMPXCHG  X86_TSC  !NEED_MULTIPLE_NODES  
!(X86_VISWS || X86_VOYAGER)
help
  This is the Linux Xen port.  Enabling this will allow the
  kernel to boot in a paravirtualized environment under the
diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 41e2250..64e1bb3 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -1,7 +1,6 @@
 config LGUEST
tristate Linux hypervisor example code
-   depends on X86  PARAVIRT  EXPERIMENTAL  !X86_PAE  FUTEX
-   select LGUEST_GUEST
+   depends on X86  EXPERIMENTAL  !X86_PAE  FUTEX  !(X86_VISWS || 
X86_VOYAGER)
select HVC_DRIVER
---help---
  This is a very simple module which allows you to run
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Consolidate host virtualization support under Virtualization menu

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9525ca0286afd54a5cd69d9ded741b4df8d0c554
Commit: 9525ca0286afd54a5cd69d9ded741b4df8d0c554
Parent: d3d1c4bdf16bd154d9f27f34fca28edca90465eb
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:55:43 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:47 2007 +1000

Consolidate host virtualization support under Virtualization menu

Move lguest under the virtualization menu.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Avi Kivity [EMAIL PROTECTED]
---
 drivers/Kconfig |2 --
 drivers/kvm/Kconfig |4 
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 34f40ea..d945ffc 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -93,6 +93,4 @@ source drivers/auxdisplay/Kconfig
 source drivers/kvm/Kconfig
 
 source drivers/uio/Kconfig
-
-source drivers/lguest/Kconfig
 endmenu
diff --git a/drivers/kvm/Kconfig b/drivers/kvm/Kconfig
index 8749fa4..6569206 100644
--- a/drivers/kvm/Kconfig
+++ b/drivers/kvm/Kconfig
@@ -47,4 +47,8 @@ config KVM_AMD
  Provides support for KVM on AMD processors equipped with the AMD-V
  (SVM) extensions.
 
+# OK, it's a little counter-intuitive to do this, but it puts it neatly under
+# the virtualization menu.
+source drivers/lguest/Kconfig
+
 endif # VIRTUALIZATION
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Make asm-x86/bootparam.h includable from userspace.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ee8e7cfe9d330d6f1ce0b9b1620d6df5d9cf6b70
Commit: ee8e7cfe9d330d6f1ce0b9b1620d6df5d9cf6b70
Parent: 9525ca0286afd54a5cd69d9ded741b4df8d0c554
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:19 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:47 2007 +1000

Make asm-x86/bootparam.h includable from userspace.

To actually write a bootloader (or, say, the lguest launcher)
currently requires duplication of these structures.  Making them
includable from userspace is much nicer.

We merge the common userspace-required definitions of e820_32/64.h
into e820.h for export.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |2 +-
 include/asm-x86/Kbuild|3 +
 include/asm-x86/bootparam.h   |  108 
 include/asm-x86/e820.h|   28 
 include/asm-x86/e820_32.h |   21 --
 include/asm-x86/e820_64.h |   20 --
 include/asm-x86/ist.h |   12 ++--
 include/linux/Kbuild  |2 +
 include/linux/apm_bios.h  |   30 +-
 include/linux/edd.h   |  137 +
 include/linux/screen_info.h   |   81 ++---
 include/video/Kbuild  |1 +
 include/video/edid.h  |9 +--
 13 files changed, 229 insertions(+), 225 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 103e346..c7fc995 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -46,7 +46,7 @@ typedef uint32_t u32;
 typedef uint16_t u16;
 typedef uint8_t u8;
 #include ../../include/linux/lguest_launcher.h
-#include ../../include/asm-x86/e820_32.h
+#include ../../include/asm-x86/e820.h
 /*:*/
 
 #define PAGE_PRESENT 0x7   /* Present, RW, Execute */
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index 559830e..5e3539c 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -1,6 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
 header-y += boot.h
+header-y += bootparam.h
 header-y += debugreg.h
 header-y += ldt.h
 header-y += msr-index.h
@@ -14,8 +15,10 @@ unifdef-y += a.out_32.h
 unifdef-y += a.out_64.h
 unifdef-y += byteorder_32.h
 unifdef-y += byteorder_64.h
+unifdef-y += e820.h
 unifdef-y += elf_32.h
 unifdef-y += elf_64.h
+unifdef-y += ist.h
 unifdef-y += mce.h
 unifdef-y += msgbuf_32.h
 unifdef-y += msgbuf_64.h
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h
index dc031cf..19f3ddf 100644
--- a/include/asm-x86/bootparam.h
+++ b/include/asm-x86/bootparam.h
@@ -10,85 +10,85 @@
 #include video/edid.h
 
 struct setup_header {
-   u8  setup_sects;
-   u16 root_flags;
-   u32 syssize;
-   u16 ram_size;
+   __u8setup_sects;
+   __u16   root_flags;
+   __u32   syssize;
+   __u16   ram_size;
 #define RAMDISK_IMAGE_START_MASK   0x07FF
 #define RAMDISK_PROMPT_FLAG0x8000
 #define RAMDISK_LOAD_FLAG  0x4000
-   u16 vid_mode;
-   u16 root_dev;
-   u16 boot_flag;
-   u16 jump;
-   u32 header;
-   u16 version;
-   u32 realmode_swtch;
-   u16 start_sys;
-   u16 kernel_version;
-   u8  type_of_loader;
-   u8  loadflags;
+   __u16   vid_mode;
+   __u16   root_dev;
+   __u16   boot_flag;
+   __u16   jump;
+   __u32   header;
+   __u16   version;
+   __u32   realmode_swtch;
+   __u16   start_sys;
+   __u16   kernel_version;
+   __u8type_of_loader;
+   __u8loadflags;
 #define LOADED_HIGH(10)
 #define KEEP_SEGMENTS  (16)
 #define CAN_USE_HEAP   (17)
-   u16 setup_move_size;
-   u32 code32_start;
-   u32 ramdisk_image;
-   u32 ramdisk_size;
-   u32 bootsect_kludge;
-   u16 heap_end_ptr;
-   u16 _pad1;
-   u32 cmd_line_ptr;
-   u32 initrd_addr_max;
-   u32 kernel_alignment;
-   u8  relocatable_kernel;
-   u8  _pad2[3];
-   u32 cmdline_size;
-   u32 hardware_subarch;
-   u64 hardware_subarch_data;
+   __u16   setup_move_size;
+   __u32   code32_start;
+   __u32   ramdisk_image;
+   __u32   ramdisk_size;
+   __u32   bootsect_kludge;
+   __u16   heap_end_ptr;
+   __u16   _pad1;
+   __u32   cmd_line_ptr;
+   __u32   initrd_addr_max;
+   __u32   kernel_alignment;
+   __u8relocatable_kernel;
+   __u8_pad2[3];
+   __u32   cmdline_size;
+   __u32   hardware_subarch;
+   __u64   hardware_subarch_data;
 } __attribute__((packed));
 
 struct sys_desc_table {
-   u16 length;
-   u8  table[14];
+   __u16 length;
+   __u8  table[14];
 };
 
 struct efi_info {
-   u32 

Use copy_to_user() not put_user for struct timespec

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=891ff65ff50bb6affdaebb2cda3a4c58a6442b4d
Commit: 891ff65ff50bb6affdaebb2cda3a4c58a6442b4d
Parent: babed5c00225f109d6ebea368ad2deea2abcce32
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:22 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:48 2007 +1000

Use copy_to_user() not put_user for struct timespec

Use copy_to_user() when copying a struct timespec to the guest -
put_user() cannot handle two long's in one go on a 64bit arch.

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Jes Sorensen [EMAIL PROTECTED]
Cc: Al Viro [EMAIL PROTECTED]
---
 drivers/lguest/hypercalls.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index db6caac..5ecd60b 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -295,6 +295,6 @@ void write_timestamp(struct lguest *lg)
 {
struct timespec now;
ktime_get_real_ts(now);
-   if (put_user(now, lg-lguest_data-time))
+   if (copy_to_user(lg-lguest_data-time, now, sizeof(struct timespec)))
kill_guest(lg, Writing timestamp);
 }
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Lguest currently depends on 32-bit x86, not just x86.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=141341cdae5f1745e3903a6b9732672230b1dd64
Commit: 141341cdae5f1745e3903a6b9732672230b1dd64
Parent: 891ff65ff50bb6affdaebb2cda3a4c58a6442b4d
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:22 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:48 2007 +1000

Lguest currently depends on 32-bit x86, not just x86.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/lguest/Kconfig b/drivers/lguest/Kconfig
index 64e1bb3..3ec5cc8 100644
--- a/drivers/lguest/Kconfig
+++ b/drivers/lguest/Kconfig
@@ -1,6 +1,6 @@
 config LGUEST
tristate Linux hypervisor example code
-   depends on X86  EXPERIMENTAL  !X86_PAE  FUTEX  !(X86_VISWS || 
X86_VOYAGER)
+   depends on X86_32  EXPERIMENTAL  !X86_PAE  FUTEX  !(X86_VISWS 
|| X86_VOYAGER)
select HVC_DRIVER
---help---
  This is a very simple module which allows you to run
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


lguest.txt update

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9653c4aff94e43de5f4ef918d47e00018beb4105
Commit: 9653c4aff94e43de5f4ef918d47e00018beb4105
Parent: 141341cdae5f1745e3903a6b9732672230b1dd64
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:23 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:48 2007 +1000

lguest.txt update

o Describe the new split configurations
o Highlight code documentation in drivers/lguest/README
o Point out necessity of having a getty on /dev/hvc0
o Remove gratuitous m in example
o Don't discuss I/O model here, stick to user documentation.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.txt |   68 --
 1 files changed, 29 insertions(+), 39 deletions(-)

diff --git a/Documentation/lguest/lguest.txt b/Documentation/lguest/lguest.txt
index 821617b..b60f0ab 100644
--- a/Documentation/lguest/lguest.txt
+++ b/Documentation/lguest/lguest.txt
@@ -6,7 +6,7 @@ Lguest is designed to be a minimal hypervisor for the Linux 
kernel, for
 Linux developers and users to experiment with virtualization with the
 minimum of complexity.  Nonetheless, it should have sufficient
 features to make it useful for specific tasks, and, of course, you are
-encouraged to fork and enhance it.
+encouraged to fork and enhance it (see drivers/lguest/README).
 
 Features:
 
@@ -23,19 +23,30 @@ Developer features:
 
 Running Lguest:
 
-- Lguest runs the same kernel as guest and host.  You can configure
-  them differently, but usually it's easiest not to.
+- The easiest way to run lguest is to use same kernel as guest and host.
+  You can configure them differently, but usually it's easiest not to.
 
   You will need to configure your kernel with the following options:
 
-  CONFIG_HIGHMEM64G=n (High Memory Support 64GB)[1]
-  CONFIG_TUN=y/m (Universal TUN/TAP device driver support)
-  CONFIG_EXPERIMENTAL=y (Prompt for development and/or incomplete 
code/drivers)
-  CONFIG_PARAVIRT=y (Paravirtualization support (EXPERIMENTAL))
-  CONFIG_LGUEST=y/m (Linux hypervisor example code)
-
-  and I recommend:
-  CONFIG_HZ=100 (Timer frequency)[2]
+  General setup:
+ Prompt for development and/or incomplete code/drivers = Y
+(CONFIG_EXPERIMENTAL=y)
+
+  Processor type and features:
+ Paravirtualized guest support = Y
+Lguest guest support = Y
+ High Memory Support = off/4GB
+ Alignment value to which kernel should be aligned = 0x10
+(CONFIG_PARAVIRT=y, CONFIG_LGUEST_GUEST=y, CONFIG_HIGHMEM64G=n and
+ CONFIG_PHYSICAL_ALIGN=0x10)
+
+  Device Drivers:
+ Network device support
+Universal TUN/TAP device driver support = M/Y
+   (CONFIG_TUN=m)
+ Virtualization
+Linux hypervisor example code = M/Y
+   (CONFIG_LGUEST=m)
 
 - A tool called lguest is available in this directory: type make
   to build it.  If you didn't build your kernel in-tree, use make
@@ -51,14 +62,17 @@ Running Lguest:
  dd if=/dev/zero of=rootfile bs=1M count=2048
  qemu -cdrom image.iso -hda rootfile -net user -net nic -boot d
 
+  Make sure that you install a getty on /dev/hvc0 if you want to log in on the
+  console!
+
 - modprobe lg if you built it as a module.
 
 - Run an lguest as root:
 
-  Documentation/lguest/lguest 64m vmlinux --tunnet=192.168.19.1 
--block=rootfile root=/dev/lgba
+  Documentation/lguest/lguest 64 vmlinux --tunnet=192.168.19.1 
--block=rootfile root=/dev/lgba
 
Explanation:
-64m: the amount of memory to use.
+64: the amount of memory to use, in MB.
 
 vmlinux: the kernel image found in the top of your build directory.  You
can also use a standard bzImage.
@@ -99,31 +113,7 @@ Running Lguest:
   --sharenet=filename: any two guests using the same file are on
   the same network.  This file is created if it does not exist.
 
-Lguest I/O model:
-
-Lguest uses a simplified DMA model plus shared memory for I/O.  Guests
-can communicate with each other if they share underlying memory
-(usually by the lguest program mmaping the same file), but they can
-use any non-shared memory to communicate with the lguest process.
-
-Guests can register DMA buffers at any key (must be a valid physical
-address) using the LHCALL_BIND_DMA(key, dmabufs, num8|irq)
-hypercall.  dmabufs is the physical address of an array of num
-struct lguest_dma: each contains a used_len, and an array of
-physical addresses and lengths.  When a transfer occurs, the
-used_len field of one of the buffers which has used_len 0 will be
-set to the length transferred and the irq will fire.
+There is a helpful mailing list at http://ozlabs.org/mailman/listinfo/lguest
 
-Using an irq value of 0 unbinds the dma buffers.
-
-To send DMA, the LHCALL_SEND_DMA(key, dma_physaddr) hypercall is used,
-and the bytes used is written to the used_len 

Make lguest_launcher.h types userspace-friendly

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b45d8cb054d7677d75176ae22a584fd84e4650e9
Commit: b45d8cb054d7677d75176ae22a584fd84e4650e9
Parent: 9653c4aff94e43de5f4ef918d47e00018beb4105
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:24 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:49 2007 +1000

Make lguest_launcher.h types userspace-friendly

lguest_launcher.h uses u32 not __u32, which sets a bad example.  Fix 
that,
and include linux/types.h.

This means we need to use -I on the Launcher build line so types.h is found.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/Makefile   |2 +-
 Documentation/lguest/lguest.c   |4 ++--
 include/linux/lguest_launcher.h |   21 +++--
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile
index c0b7a45..526c15f 100644
--- a/Documentation/lguest/Makefile
+++ b/Documentation/lguest/Makefile
@@ -11,7 +11,7 @@ endif
 include $(KBUILD_OUTPUT)/.config
 LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x0800)
 
-CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds
+CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include 
-Wl,-T,lguest.lds
 LDLIBS:=-lz
 # Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and
 # not others (eg. FC7).
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 276f2f6..fa838e2 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -45,8 +45,8 @@ typedef unsigned long long u64;
 typedef uint32_t u32;
 typedef uint16_t u16;
 typedef uint8_t u8;
-#include ../../include/linux/lguest_launcher.h
-#include ../../include/asm-x86/e820.h
+#include linux/lguest_launcher.h
+#include asm-x86/e820.h
 /*:*/
 
 #define PAGE_PRESENT 0x7   /* Present, RW, Execute */
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index 6416705..736e19a 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -1,6 +1,7 @@
 #ifndef _ASM_LGUEST_USER
 #define _ASM_LGUEST_USER
 /* Everything the lguest userspace program needs to know. */
+#include linux/types.h
 /* They can register up to 32 arrays of lguest_dma. */
 #define LGUEST_MAX_DMA 32
 /* At most we can dma 16 lguest_dma in one op. */
@@ -37,9 +38,9 @@
 struct lguest_dma
 {
/* 0 if free to be used, filled by the Host. */
-   u32 used_len;
+   __u32 used_len;
+   __u16 len[LGUEST_MAX_DMA_SECTIONS];
unsigned long addr[LGUEST_MAX_DMA_SECTIONS];
-   u16 len[LGUEST_MAX_DMA_SECTIONS];
 };
 /*:*/
 
@@ -52,11 +53,11 @@ struct lguest_block_page
 {
/* 0 is a read, 1 is a write. */
int type;
-   u32 sector; /* Offset in device = sector * 512. */
-   u32 bytes;  /* Length expected to be read/written in bytes */
+   __u32 sector;   /* Offset in device = sector * 512. */
+   __u32 bytes;/* Length expected to be read/written in bytes */
/* 0 = pending, 1 = done, 2 = done, error */
int result;
-   u32 num_sectors; /* Disk length = num_sectors * 512 */
+   __u32 num_sectors; /* Disk length = num_sectors * 512 */
 };
 
 /*D:520 The network device is basically a memory page where all the Guests on
@@ -86,21 +87,21 @@ struct lguest_net
  */
 struct lguest_device_desc {
/* The device type: console, network, disk etc. */
-   u16 type;
+   __u16 type;
 #define LGUEST_DEVICE_T_CONSOLE1
 #define LGUEST_DEVICE_T_NET2
 #define LGUEST_DEVICE_T_BLOCK  3
 
/* The specific features of this device: these depends on device type
 * except for LGUEST_DEVICE_F_RANDOMNESS. */
-   u16 features;
+   __u16 features;
 #define LGUEST_NET_F_NOCSUM0x4000 /* Don't bother checksumming */
 #define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */
 
/* This is how the Guest reports status of the device: the Host can set
 * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only
 * ever manipulated by the Guest, and only ever set. */
-   u16 status;
+   __u16 status;
 /* 256 and above are device specific. */
 #define LGUEST_DEVICE_S_ACKNOWLEDGE1 /* We have seen device. */
 #define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */
@@ -111,8 +112,8 @@ struct lguest_device_desc {
 
/* Each device exists somewhere in Guest physical memory, over some
 * number of pages. */
-   u16 num_pages;
-   u32 pfn;
+   __u16 num_pages;
+   __u32 pfn;
 };
 /*:*/
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


lguest_devices belongs in lguest_bus.c: it's not i386-specific.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ebac52524df31e7c2fe13ca5bd3438907842f763
Commit: ebac52524df31e7c2fe13ca5bd3438907842f763
Parent: b45d8cb054d7677d75176ae22a584fd84e4650e9
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:24 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:49 2007 +1000

lguest_devices belongs in lguest_bus.c: it's not i386-specific.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/lguest.c |1 -
 drivers/lguest/lguest_bus.c |2 ++
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index 3ba337d..c9ca610 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -87,7 +87,6 @@ struct lguest_data lguest_data = {
.noirq_end = (u32)lguest_noirq_end,
.blocked_interrupts = { 1 }, /* Block timer interrupts */
 };
-struct lguest_device_desc *lguest_devices;
 static cycle_t clock_base;
 
 /*G:035 Notice the lazy_hcall() above, rather than hcall().  This is our first
diff --git a/drivers/lguest/lguest_bus.c b/drivers/lguest/lguest_bus.c
index 5732978..2e9a202 100644
--- a/drivers/lguest/lguest_bus.c
+++ b/drivers/lguest/lguest_bus.c
@@ -7,6 +7,8 @@
 #include asm/io.h
 #include asm/paravirt.h
 
+struct lguest_device_desc *lguest_devices;
+
 static ssize_t type_show(struct device *_dev,
  struct device_attribute *attr, char *buf)
 {
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Clocksource is continuous regardless of the state of the host's TSC.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=05aa026a62d0fe0b4664a01d1537984b12567e7c
Commit: 05aa026a62d0fe0b4664a01d1537984b12567e7c
Parent: ebac52524df31e7c2fe13ca5bd3438907842f763
Author: Tony Breeds [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:25 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:49 2007 +1000

Clocksource is continuous regardless of the state of the host's TSC.

Currently lguest will spend a lot of of time waking up the host, as it
cannot go tickless (if the [host] TSC has been marked unstable). On my
laptop I was getting ~40% of wakeups from lguest.

With this patch applied, my laptop is much happier!

Signed-off-by: Tony Breeds [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/lguest.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index c9ca610..8e9e485 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -679,6 +679,7 @@ static struct clocksource lguest_clock = {
.mask   = CLOCKSOURCE_MASK(64),
.mult   = 1  22,
.shift  = 22,
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 /* The scheduler clock is just our real clock, adjusted to start at zero */
@@ -760,11 +761,9 @@ static void lguest_time_init(void)
 * the TSC, otherwise it's a dumb nanosecond-resolution clock.  Either
 * way, the rating is initialized so high that it's always chosen
 * over any other clocksource. */
-   if (lguest_data.tsc_khz) {
+   if (lguest_data.tsc_khz)
lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz,
 lguest_clock.shift);
-   lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS;
-   }
clock_base = lguest_clock_read();
clocksource_register(lguest_clock);
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Move lguest hcalls to arch-specific header

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c37ae93d597fc63bae979db76b527dcc7740dc9d
Commit: c37ae93d597fc63bae979db76b527dcc7740dc9d
Parent: 05aa026a62d0fe0b4664a01d1537984b12567e7c
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 10:56:26 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:49 2007 +1000

Move lguest hcalls to arch-specific header

Move architecture specific portion of lg_hcall code to asm-i386/lg_hcall.h
and have it included from linux/lguest.h.

[Changed to asm-i386/lguest_hcall.h so documentation finds it -RR]

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Jes Sorensen [EMAIL PROTECTED]
---
 include/asm-x86/lguest_hcall.h |   67 ++
 include/linux/lguest.h |   69 ++-
 2 files changed, 71 insertions(+), 65 deletions(-)

diff --git a/include/asm-x86/lguest_hcall.h b/include/asm-x86/lguest_hcall.h
new file mode 100644
index 000..7859cfe
--- /dev/null
+++ b/include/asm-x86/lguest_hcall.h
@@ -0,0 +1,67 @@
+/* Architecture specific portion of the lguest hypercalls */
+#ifndef _X86_LGUEST_HCALL_H
+#define _X86_LGUEST_HCALL_H
+
+#define LHCALL_FLUSH_ASYNC 0
+#define LHCALL_LGUEST_INIT 1
+#define LHCALL_CRASH   2
+#define LHCALL_LOAD_GDT3
+#define LHCALL_NEW_PGTABLE 4
+#define LHCALL_FLUSH_TLB   5
+#define LHCALL_LOAD_IDT_ENTRY  6
+#define LHCALL_SET_STACK   7
+#define LHCALL_TS  8
+#define LHCALL_SET_CLOCKEVENT  9
+#define LHCALL_HALT10
+#define LHCALL_BIND_DMA12
+#define LHCALL_SEND_DMA13
+#define LHCALL_SET_PTE 14
+#define LHCALL_SET_PMD 15
+#define LHCALL_LOAD_TLS16
+
+/*G:031 First, how does our Guest contact the Host to ask for privileged
+ * operations?  There are two ways: the direct way is to make a hypercall,
+ * to make requests of the Host Itself.
+ *
+ * Our hypercall mechanism uses the highest unused trap code (traps 32 and
+ * above are used by real hardware interrupts).  Seventeen hypercalls are
+ * available: the hypercall number is put in the %eax register, and the
+ * arguments (when required) are placed in %edx, %ebx and %ecx.  If a return
+ * value makes sense, it's returned in %eax.
+ *
+ * Grossly invalid calls result in Sudden Death at the hands of the vengeful
+ * Host, rather than returning failure.  This reflects Winston Churchill's
+ * definition of a gentleman: someone who is only rude intentionally. */
+#define LGUEST_TRAP_ENTRY 0x1F
+
+static inline unsigned long
+hcall(unsigned long call,
+  unsigned long arg1, unsigned long arg2, unsigned long arg3)
+{
+   /* int is the Intel instruction to trigger a trap. */
+   asm volatile(int $ __stringify(LGUEST_TRAP_ENTRY)
+  /* The call is in %eax (aka a), and can be replaced */
+: =a(call)
+  /* The other arguments are in %eax, %edx, %ebx  %ecx */
+: a(call), d(arg1), b(arg2), c(arg3)
+  /* memory means this might write somewhere in memory.
+   * This isn't true for all calls, but it's safe to tell
+   * gcc that it might happen so it doesn't get clever. */
+: memory);
+   return call;
+}
+/*:*/
+
+void async_hcall(unsigned long call,
+unsigned long arg1, unsigned long arg2, unsigned long arg3);
+
+/* Can't use our min() macro here: needs to be a constant */
+#define LGUEST_IRQS (NR_IRQS  32 ? NR_IRQS: 32)
+
+#define LHCALL_RING_SIZE 64
+struct hcall_ring
+{
+   u32 eax, edx, ebx, ecx;
+};
+
+#endif /* _I386_LGUEST_HCALL_H */
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 157ad64..d4d94a1 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -1,76 +1,15 @@
 /* Things the lguest guest needs to know.  Note: like all lguest interfaces,
  * this is subject to wild and random change between versions. */
-#ifndef _ASM_LGUEST_H
-#define _ASM_LGUEST_H
+#ifndef _LINUX_LGUEST_H
+#define _LINUX_LGUEST_H
 
 #ifndef __ASSEMBLY__
 #include asm/irq.h
-
-#define LHCALL_FLUSH_ASYNC 0
-#define LHCALL_LGUEST_INIT 1
-#define LHCALL_CRASH   2
-#define LHCALL_LOAD_GDT3
-#define LHCALL_NEW_PGTABLE 4
-#define LHCALL_FLUSH_TLB   5
-#define LHCALL_LOAD_IDT_ENTRY  6
-#define LHCALL_SET_STACK   7
-#define LHCALL_TS  8
-#define LHCALL_SET_CLOCKEVENT  9
-#define LHCALL_HALT10
-#define LHCALL_BIND_DMA12
-#define LHCALL_SEND_DMA13
-#define LHCALL_SET_PTE 14
-#define LHCALL_SET_PMD 15
-#define LHCALL_LOAD_TLS16
+#include asm/lguest_hcall.h
 
 #define LG_CLOCK_MIN_DELTA 100UL
 #define 

Rename switcher.S to x86/switcher_32.S

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1f4e1de4f23e158abf976a76e1d0fce6e39b532a
Commit: 1f4e1de4f23e158abf976a76e1d0fce6e39b532a
Parent: 34b8867a034364ca33d0adb3a1c5b9982903c719
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:25 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:50 2007 +1000

Rename switcher.S to x86/switcher_32.S

lguest uses a switcher shim mapped high to bounce between host and
guest.  As lguest becomes less i386-centric, we separate this code
into a subdir.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/Makefile  |6 +-
 drivers/lguest/switcher.S|  350 --
 drivers/lguest/x86/switcher_32.S |  350 ++
 3 files changed, 354 insertions(+), 352 deletions(-)

diff --git a/drivers/lguest/Makefile b/drivers/lguest/Makefile
index 2db98c2..a4567c9 100644
--- a/drivers/lguest/Makefile
+++ b/drivers/lguest/Makefile
@@ -3,8 +3,10 @@ obj-$(CONFIG_LGUEST_GUEST) += lguest_bus.o
 
 # Host requires the other files, which can be a module.
 obj-$(CONFIG_LGUEST)   += lg.o
-lg-y := core.o hypercalls.o page_tables.o interrupts_and_traps.o \
-   segments.o io.o lguest_user.o switcher.o
+lg-y = core.o hypercalls.o page_tables.o interrupts_and_traps.o \
+   segments.o io.o lguest_user.o
+
+lg-$(CONFIG_X86_32) += x86/switcher_32.o
 
 Preparation Preparation!: PREFIX=P
 Guest: PREFIX=G
diff --git a/drivers/lguest/switcher.S b/drivers/lguest/switcher.S
deleted file mode 100644
index 7c9c230..000
--- a/drivers/lguest/switcher.S
+++ /dev/null
@@ -1,350 +0,0 @@
-/*P:900 This is the Switcher: code which sits at 0xFFC0 to do the low-level
- * Guest-Host switch.  It is as simple as it can be made, but it's naturally
- * very specific to x86.
- *
- * You have now completed Preparation.  If this has whet your appetite; if you
- * are feeling invigorated and refreshed then the next, more challenging stage
- * can be found in make Guest. :*/
-
-/*S:100
- * Welcome to the Switcher itself!
- *
- * This file contains the low-level code which changes the CPU to run the Guest
- * code, and returns to the Host when something happens.  Understand this, and
- * you understand the heart of our journey.
- *
- * Because this is in assembler rather than C, our tale switches from prose to
- * verse.  First I tried limericks:
- *
- * There once was an eax reg,
- * To which our pointer was fed,
- * It needed an add,
- * Which asm-offsets.h had
- * But this limerick is hurting my head.
- *
- * Next I tried haikus, but fitting the required reference to the seasons in
- * every stanza was quickly becoming tiresome:
- *
- * The %eax reg
- * Holds struct lguest_pages now:
- * Cherry blossoms fall.
- *
- * Then I started with Heroic Verse, but the rhyming requirement leeched away
- * the content density and led to some uniquely awful oblique rhymes:
- *
- * These constants are coming from struct offsets
- * For use within the asm switcher text.
- *
- * Finally, I settled for something between heroic hexameter, and normal prose
- * with inappropriate linebreaks.  Anyway, it aint no Shakespeare.
- */
-
-// Not all kernel headers work from assembler
-// But these ones are needed: the ENTRY() define
-// And constants extracted from struct offsets
-// To avoid magic numbers and breakage:
-// Should they change the compiler can't save us
-// Down here in the depths of assembler code.
-#include linux/linkage.h
-#include asm/asm-offsets.h
-#include asm/page.h
-#include lg.h
-
-// We mark the start of the code to copy
-// It's placed in .text tho it's never run here
-// You'll see the trick macro at the end
-// Which interleaves data and text to effect.
-.text
-ENTRY(start_switcher_text)
-
-// When we reach switch_to_guest we have just left
-// The safe and comforting shores of C code
-// %eax has the struct lguest_pages to use
-// Where we save state and still see it from the Guest
-// And %ebx holds the Guest shadow pagetable:
-// Once set we have truly left Host behind.
-ENTRY(switch_to_guest)
-   // We told gcc all its regs could fade,
-   // Clobbered by our journey into the Guest
-   // We could have saved them, if we tried
-   // But time is our master and cycles count.
-
-   // Segment registers must be saved for the Host
-   // We push them on the Host stack for later
-   pushl   %es
-   pushl   %ds
-   pushl   %gs
-   pushl   %fs
-   // But the compiler is fickle, and heeds
-   // No warning of %ebp clobbers
-   // When frame pointers are used.  That register
-   // Must be saved and restored or chaos strikes.
-   pushl   %ebp
-   // The Host's stack is done, now save it away
-   // In our struct lguest_pages at offset
-   // Distilled into asm-offsets.h
-   

Accept elf files that are valid but have sections that can not be mmap'ed for some reason.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6649bb7af6a819b675bfcf22ab704737e905645a
Commit: 6649bb7af6a819b675bfcf22ab704737e905645a
Parent: 1f4e1de4f23e158abf976a76e1d0fce6e39b532a
Author: Ronald G. Minnich [EMAIL PROTECTED]
AuthorDate: Tue Aug 28 14:35:59 2007 -0700
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:50 2007 +1000

Accept elf files that are valid but have sections that can not be mmap'ed 
for some reason.

Plan9 kernel binaries don't neatly align their ELF sections to our
page boundaries.

Signed-off-by: Ronald G. Minnich [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |   61 +---
 1 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index fa838e2..401d26b 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -15,6 +15,7 @@
 #include stdlib.h
 #include elf.h
 #include sys/mman.h
+#include sys/param.h
 #include sys/types.h
 #include sys/stat.h
 #include sys/wait.h
@@ -162,6 +163,30 @@ static unsigned long entry_point(void *start, void *end,
errx(1, Is this image a genuine lguest?);
 }
 
+/* This routine is used to load the kernel or initrd.  It tries mmap, but if
+ * that fails (Plan 9's kernel file isn't nicely aligned on page boundaries),
+ * it falls back to reading the memory in. */
+static void map_at(int fd, void *addr, unsigned long offset, unsigned long len)
+{
+   ssize_t r;
+
+   /* We map writable even though for some segments are marked read-only.
+* The kernel really wants to be writable: it patches its own
+* instructions.
+*
+* MAP_PRIVATE means that the page won't be copied until a write is
+* done to it.  This allows us to share untouched memory between
+* Guests. */
+   if (mmap(addr, len, PROT_READ|PROT_WRITE|PROT_EXEC,
+MAP_FIXED|MAP_PRIVATE, fd, offset) != MAP_FAILED)
+   return;
+
+   /* pread does a seek and a read in one shot: saves a few lines. */
+   r = pread(fd, addr, len, offset);
+   if (r != len)
+   err(1, Reading offset %lu len %lu gave %zi, offset, len, r);
+}
+
 /* This routine takes an open vmlinux image, which is in ELF, and maps it into
  * the Guest memory.  ELF = Embedded Linking Format, which is the format used
  * by all modern binaries on Linux including the kernel.
@@ -176,7 +201,6 @@ static unsigned long entry_point(void *start, void *end,
 static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr,
 unsigned long *page_offset)
 {
-   void *addr;
Elf32_Phdr phdr[ehdr-e_phnum];
unsigned int i;
unsigned long start = -1UL, end = 0;
@@ -227,23 +251,9 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr 
*ehdr,
if (phdr[i].p_paddr + phdr[i].p_filesz  end)
end = phdr[i].p_paddr + phdr[i].p_filesz;
 
-   /* We map this section of the file at its physical address.  We
-* map it read  write even if the header says this segment is
-* read-only.  The kernel really wants to be writable: it
-* patches its own instructions which would normally be
-* read-only.
-*
-* MAP_PRIVATE means that the page won't be copied until a
-* write is done to it.  This allows us to share much of the
-* kernel memory between Guests. */
-   addr = mmap((void *)phdr[i].p_paddr,
-   phdr[i].p_filesz,
-   PROT_READ|PROT_WRITE|PROT_EXEC,
-   MAP_FIXED|MAP_PRIVATE,
-   elf_fd, phdr[i].p_offset);
-   if (addr != (void *)phdr[i].p_paddr)
-   err(1, Mmaping vmlinux seg %i gave %p not %p,
-   i, addr, (void *)phdr[i].p_paddr);
+   /* We map this section of the file at its physical address. */
+   map_at(elf_fd, (void *)phdr[i].p_paddr,
+  phdr[i].p_offset, phdr[i].p_filesz);
}
 
return entry_point((void *)start, (void *)end, *page_offset);
@@ -402,27 +412,20 @@ static unsigned long load_initrd(const char *name, 
unsigned long mem)
int ifd;
struct stat st;
unsigned long len;
-   void *iaddr;
 
ifd = open_or_die(name, O_RDONLY);
/* fstat() is needed to get the file size. */
if (fstat(ifd, st)  0)
err(1, fstat() on initrd '%s', name);
 
-   /* The length needs to be rounded up to a page size: mmap needs the
-* address to be page aligned. */
+   /* We map the initrd at the top of memory, but mmap wants it to be
+* 

Introduce guest mem offset, static link example launcher

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3c6b5bfa3cf3b4057788e08482a468cc3bc00780
Commit: 3c6b5bfa3cf3b4057788e08482a468cc3bc00780
Parent: 6649bb7af6a819b675bfcf22ab704737e905645a
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:26 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:50 2007 +1000

Introduce guest mem offset, static link example launcher

In order to avoid problematic special linking of the Launcher, we give
the Host an offset: this means we can use any memory region in the
Launcher as Guest memory rather than insisting on mmap() at 0.

The result is quite pleasing: a number of casts are replaced with
simple additions.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/Makefile |   26 +-
 Documentation/lguest/lguest.c |  189 -
 drivers/lguest/core.c |   22 ++---
 drivers/lguest/hypercalls.c   |   15 ++--
 drivers/lguest/io.c   |   18 ++--
 drivers/lguest/lg.h   |3 +
 drivers/lguest/lguest_user.c  |   23 +++--
 drivers/lguest/page_tables.c  |7 +-
 8 files changed, 163 insertions(+), 140 deletions(-)

diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile
index 526c15f..bac037e 100644
--- a/Documentation/lguest/Makefile
+++ b/Documentation/lguest/Makefile
@@ -1,28 +1,8 @@
 # This creates the demonstration utility lguest which runs a Linux guest.
-
-# For those people that have a separate object dir, look there for .config
-KBUILD_OUTPUT := ../..
-ifdef O
-  ifeq ($(origin O), command line)
-KBUILD_OUTPUT := $(O)
-  endif
-endif
-# We rely on CONFIG_PAGE_OFFSET to know where to put lguest binary.
-include $(KBUILD_OUTPUT)/.config
-LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x0800)
-
-CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include 
-Wl,-T,lguest.lds
+CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include
 LDLIBS:=-lz
-# Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and
-# not others (eg. FC7).
-LDFLAGS+=-static
-all: lguest.lds lguest
 
-# The linker script on x86 is so complex the only way of creating one
-# which will link our binary in the right place is to mangle the
-# default one.
-lguest.lds:
-   $(LD) --verbose | awk '/^==/ { PRINT=1; next; } 
/SIZEOF_HEADERS/ { gsub(/0x[0-9A-F]*/, $(LGUEST_GUEST_TOP)) } { if (PRINT) 
print $$0; }'  $@
+all: lguest
 
 clean:
-   rm -f lguest.lds lguest
+   rm -f lguest
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 401d26b..140bd98 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -1,10 +1,7 @@
 /*P:100 This is the Launcher code, a simple program which lays out the
  * physical memory for the new Guest by mapping the kernel image and the
  * virtual devices, then reads repeatedly from /dev/lguest to run the Guest.
- *
- * The only trick: the Makefile links it at a high address so it will be clear
- * of the guest memory region.  It means that each Guest cannot have more than
- * about 2.5G of memory on a normally configured Host. :*/
+:*/
 #define _LARGEFILE64_SOURCE
 #define _GNU_SOURCE
 #include stdio.h
@@ -56,6 +53,8 @@ typedef uint8_t u8;
 #ifndef SIOCBRADDIF
 #define SIOCBRADDIF0x89a2  /* add interface to bridge  */
 #endif
+/* We can have up to 256 pages for devices. */
+#define DEVICE_PAGES 256
 
 /*L:120 verbose is both a global flag and a macro.  The C preprocessor allows
  * this, and although I wouldn't recommend it, it works quite nicely here. */
@@ -66,8 +65,10 @@ static bool verbose;
 
 /* The pipe to send commands to the waker process */
 static int waker_fd;
-/* The top of guest physical memory. */
-static u32 top;
+/* The pointer to the start of guest memory. */
+static void *guest_base;
+/* The maximum guest physical address allowed, and maximum possible. */
+static unsigned long guest_limit, guest_max;
 
 /* This is our list of devices. */
 struct device_list
@@ -111,6 +112,29 @@ struct device
void *priv;
 };
 
+/*L:100 The Launcher code itself takes us out into userspace, that scary place
+ * where pointers run wild and free!  Unfortunately, like most userspace
+ * programs, it's quite boring (which is why everyone likes to hack on the
+ * kernel!).  Perhaps if you make up an Lguest Drinking Game at this point, it
+ * will get you through this section.  Or, maybe not.
+ *
+ * The Launcher sets up a big chunk of memory to be the Guest's physical
+ * memory and stores it in guest_base.  In other words, Guest physical ==
+ * Launcher virtual with an offset.
+ *
+ * This can be tough to get your head around, but usually it just means that we
+ * use these trivial conversion functions when the Guest gives us it's
+ * physical addresses: */
+static void 

Remove fixed limit on number of guests, and lguests array.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=48245cc0708d49d1d0566b9fa617ad6c5f4c6934
Commit: 48245cc0708d49d1d0566b9fa617ad6c5f4c6934
Parent: 3c6b5bfa3cf3b4057788e08482a468cc3bc00780
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:27 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:51 2007 +1000

Remove fixed limit on number of guests, and lguests array.

Back when we had all the Guest state in the switcher, we had a fixed
array of them.  This is no longer necessary.

If we switch the network code to using random_ether_addr (46 bits is
enough to avoid clashes), we can get rid of the concept of guest id
altogether.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/core.c|   14 --
 drivers/lguest/hypercalls.c  |4 +---
 drivers/lguest/io.c  |   10 +-
 drivers/lguest/lg.h  |5 +
 drivers/lguest/lguest_user.c |   17 ++---
 drivers/net/lguest_net.c |7 +--
 include/linux/lguest.h   |2 --
 7 files changed, 14 insertions(+), 45 deletions(-)

diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index eb95860..ca581ef 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -47,10 +47,6 @@ static struct {
 DEFINE_MUTEX(lguest_lock);
 static DEFINE_PER_CPU(struct lguest *, last_guest);
 
-/* FIXME: Make dynamic. */
-#define MAX_LGUEST_GUESTS 16
-struct lguest lguests[MAX_LGUEST_GUESTS];
-
 /* Offset from where switcher.S was compiled to where we've copied it */
 static unsigned long switcher_offset(void)
 {
@@ -660,16 +656,6 @@ int run_guest(struct lguest *lg, unsigned long __user 
*user)
  * deliver_trap() and demand_page().  After all those, we'll be ready to
  * examine the Switcher, and our philosophical understanding of the Host/Guest
  * duality will be complete. :*/
-
-int find_free_guest(void)
-{
-   unsigned int i;
-   for (i = 0; i  MAX_LGUEST_GUESTS; i++)
-   if (!lguests[i].tsk)
-   return i;
-   return -1;
-}
-
 static void adjust_pge(void *on)
 {
if (on)
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 02e67b4..8bde209 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -225,9 +225,7 @@ static void initialize(struct lguest *lg)
/* We tell the Guest that it can't use the top 4MB of virtual
 * addresses used by the Switcher. */
|| put_user(4U*1024*1024, lg-lguest_data-reserve_mem)
-   || put_user(tsc_speed, lg-lguest_data-tsc_khz)
-   /* We also give the Guest a unique id, as used in lguest_net.c. */
-   || put_user(lg-guestid, lg-lguest_data-guestid))
+   || put_user(tsc_speed, lg-lguest_data-tsc_khz))
kill_guest(lg, bad guest page %p, lg-lguest_data);
 
/* We write the current time into the Guest's data page once now. */
diff --git a/drivers/lguest/io.c b/drivers/lguest/io.c
index 3a84533..0e842e9 100644
--- a/drivers/lguest/io.c
+++ b/drivers/lguest/io.c
@@ -212,7 +212,7 @@ int bind_dma(struct lguest *lg,
lg-dma[i].num_dmas = numdmas;
lg-dma[i].next_dma = 0;
lg-dma[i].key = key;
-   lg-dma[i].guestid = lg-guestid;
+   lg-dma[i].owner = lg;
lg-dma[i].interrupt = interrupt;
 
/* Now we add it to the hash table: the position
@@ -412,7 +412,7 @@ static int dma_transfer(struct lguest *srclg,
 
/* From the struct lguest_dma_info we found in the hash, grab the
 * Guest. */
-   dstlg = lguests[dst-guestid];
+   dstlg = dst-owner;
/* Read in the source struct lguest_dma handed to SEND_DMA. */
lgread(srclg, src_dma, udma, sizeof(src_dma));
 
@@ -506,8 +506,8 @@ again:
struct lguest_dma_info *i;
/* Look through the hash for other Guests. */
list_for_each_entry(i, dma_hash[hash(key)], list) {
-   /* Don't send to ourselves. */
-   if (i-guestid == lg-guestid)
+   /* Don't send to ourselves (would deadlock). */
+   if (i-owner-mm == lg-mm)
continue;
if (!key_eq(key, i-key))
continue;
@@ -594,7 +594,7 @@ unsigned long get_dma_buffer(struct lguest *lg,
 * send to its own Guest for the moment, so the entry must be for this
 * Guest) */
list_for_each_entry(i, dma_hash[hash(key)], list) {
-   if (key_eq(key, i-key)  i-guestid == lg-guestid) {
+   if (key_eq(key, i-key)  i-owner == lg) {
unsigned int j;
/* Look through the registered DMA array for an
   

Make shadow IDT a complete IDT with 256 entries.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=56adbe9ddc935600c64635d6a55c260a63c67e4a
Commit: 56adbe9ddc935600c64635d6a55c260a63c67e4a
Parent: 48245cc0708d49d1d0566b9fa617ad6c5f4c6934
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:28 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:51 2007 +1000

Make shadow IDT a complete IDT with 256 entries.

This simplifies the code a little, in preparation for allowing
alternate system call vectors in guests (Plan 9 uses 0x40).

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/interrupts_and_traps.c |   49 +
 drivers/lguest/lg.h   |3 +-
 2 files changed, 20 insertions(+), 32 deletions(-)

diff --git a/drivers/lguest/interrupts_and_traps.c 
b/drivers/lguest/interrupts_and_traps.c
index 3973123..0dfb090 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -218,10 +218,9 @@ int deliver_trap(struct lguest *lg, unsigned int num)
  * system calls down from 1750ns to 270ns.  Plus, if lguest didn't do it, all
  * the other hypervisors would tease it.
  *
- * This routine determines if a trap can be delivered directly. */
-static int direct_trap(const struct lguest *lg,
-  const struct desc_struct *trap,
-  unsigned int num)
+ * This routine indicates if a particular trap number could be delivered
+ * directly. */
+static int direct_trap(unsigned int num)
 {
/* Hardware interrupts don't go to the Guest at all (except system
 * call). */
@@ -232,14 +231,7 @@ static int direct_trap(const struct lguest *lg,
 * fault address), general protection faults (in/out emulation) and
 * device not available (TS handling), and of course, the hypercall
 * trap. */
-   if (num == 14 || num == 13 || num == 7 || num == LGUEST_TRAP_ENTRY)
-   return 0;
-
-   /* Only trap gates (type 15) can go direct to the Guest.  Interrupt
-* gates (type 14) disable interrupts as they are entered, which we
-* never let the Guest do.  Not present entries (type 0x0) also can't
-* go direct, of course 8) */
-   return idt_type(trap-a, trap-b) == 0xF;
+   return num != 14  num != 13  num != 7  num != LGUEST_TRAP_ENTRY;
 }
 /*:*/
 
@@ -348,15 +340,11 @@ void load_guest_idt_entry(struct lguest *lg, unsigned int 
num, u32 lo, u32 hi)
 * to copy this again. */
lg-changed |= CHANGED_IDT;
 
-   /* The IDT which we keep in struct lguest only contains 32 entries
-* for the traps and LGUEST_IRQS (32) entries for interrupts.  We
-* ignore attempts to set handlers for higher interrupt numbers, except
-* for the system call interrupt at 128: we have a special IDT entry
-* for that. */
-   if (num  ARRAY_SIZE(lg-idt))
+   /* Check that the Guest doesn't try to step outside the bounds. */
+   if (num = ARRAY_SIZE(lg-idt))
+   kill_guest(lg, Setting idt entry %u, num);
+   else
set_trap(lg, lg-idt[num], num, lo, hi);
-   else if (num == SYSCALL_VECTOR)
-   set_trap(lg, lg-syscall_idt, num, lo, hi);
 }
 
 /* The default entry for each interrupt points into the Switcher routines which
@@ -399,20 +387,21 @@ void copy_traps(const struct lguest *lg, struct 
desc_struct *idt,
 
/* We can simply copy the direct traps, otherwise we use the default
 * ones in the Switcher: they will return to the Host. */
-   for (i = 0; i  FIRST_EXTERNAL_VECTOR; i++) {
-   if (direct_trap(lg, lg-idt[i], i))
+   for (i = 0; i  ARRAY_SIZE(lg-idt); i++) {
+   /* If no Guest can ever override this trap, leave it alone. */
+   if (!direct_trap(i))
+   continue;
+
+   /* Only trap gates (type 15) can go direct to the Guest.
+* Interrupt gates (type 14) disable interrupts as they are
+* entered, which we never let the Guest do.  Not present
+* entries (type 0x0) also can't go direct, of course. */
+   if (idt_type(lg-idt[i].a, lg-idt[i].b) == 0xF)
idt[i] = lg-idt[i];
else
+   /* Reset it to the default. */
default_idt_entry(idt[i], i, def[i]);
}
-
-   /* Don't forget the system call trap!  The IDT entries for other
-* interupts never change, so no need to copy them. */
-   i = SYSCALL_VECTOR;
-   if (direct_trap(lg, lg-syscall_idt, i))
-   idt[i] = lg-syscall_idt;
-   else
-   default_idt_entry(idt[i], i, def[i]);
 }
 
 void guest_set_clockevent(struct lguest *lg, unsigned long delta)
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index c9d1dc2..c1ca127 100644
--- 

Move i386 part of core.c to x86/core.c.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=625efab1cd3d4da4634dfe26df6b4005385397e2
Commit: 625efab1cd3d4da4634dfe26df6b4005385397e2
Parent: 56adbe9ddc935600c64635d6a55c260a63c67e4a
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:28 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:51 2007 +1000

Move i386 part of core.c to x86/core.c.

Separate i386 architecture specific from core.c and move it to
x86/core.c and add x86/lguest.h header file to match.

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 arch/x86/lguest/boot.c|1 +
 drivers/lguest/Makefile   |2 +-
 drivers/lguest/core.c |  459 +--
 drivers/lguest/interrupts_and_traps.c |   18 +-
 drivers/lguest/lg.h   |   63 +
 drivers/lguest/segments.c |   26 +-
 drivers/lguest/x86/core.c |  476 +
 drivers/lguest/x86/switcher_32.S  |3 +-
 include/asm-x86/lguest.h  |   87 ++
 9 files changed, 613 insertions(+), 522 deletions(-)

diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 8e9e485..c7ebc13 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -65,6 +65,7 @@
 #include asm/e820.h
 #include asm/mce.h
 #include asm/io.h
+#include asm/i387.h
 
 /*G:010 Welcome to the Guest!
  *
diff --git a/drivers/lguest/Makefile b/drivers/lguest/Makefile
index a4567c9..d330f5b 100644
--- a/drivers/lguest/Makefile
+++ b/drivers/lguest/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_LGUEST)+= lg.o
 lg-y = core.o hypercalls.o page_tables.o interrupts_and_traps.o \
segments.o io.o lguest_user.o
 
-lg-$(CONFIG_X86_32) += x86/switcher_32.o
+lg-$(CONFIG_X86_32) += x86/switcher_32.o x86/core.o
 
 Preparation Preparation!: PREFIX=P
 Guest: PREFIX=G
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index ca581ef..06869a2 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -11,54 +11,20 @@
 #include linux/vmalloc.h
 #include linux/cpu.h
 #include linux/freezer.h
+#include linux/highmem.h
 #include asm/paravirt.h
-#include asm/desc.h
 #include asm/pgtable.h
 #include asm/uaccess.h
 #include asm/poll.h
-#include asm/highmem.h
 #include asm/asm-offsets.h
-#include asm/i387.h
 #include lg.h
 
-/* Found in switcher.S */
-extern char start_switcher_text[], end_switcher_text[], switch_to_guest[];
-extern unsigned long default_idt_entries[];
-
-/* Every guest maps the core switcher code. */
-#define SHARED_SWITCHER_PAGES \
-   DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE)
-/* Pages for switcher itself, then two pages per cpu */
-#define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * NR_CPUS)
-
-/* We map at -4M for ease of mapping into the guest (one PTE page). */
-#define SWITCHER_ADDR 0xFFC0
 
 static struct vm_struct *switcher_vma;
 static struct page **switcher_page;
 
-static int cpu_had_pge;
-static struct {
-   unsigned long offset;
-   unsigned short segment;
-} lguest_entry;
-
 /* This One Big lock protects all inter-guest data structures. */
 DEFINE_MUTEX(lguest_lock);
-static DEFINE_PER_CPU(struct lguest *, last_guest);
-
-/* Offset from where switcher.S was compiled to where we've copied it */
-static unsigned long switcher_offset(void)
-{
-   return SWITCHER_ADDR - (unsigned long)start_switcher_text;
-}
-
-/* This cpu's struct lguest_pages. */
-static struct lguest_pages *lguest_pages(unsigned int cpu)
-{
-   return (((struct lguest_pages *)
- (SWITCHER_ADDR + SHARED_SWITCHER_PAGES*PAGE_SIZE))[cpu]);
-}
 
 /*H:010 We need to set up the Switcher at a high virtual address.  Remember the
  * Switcher is a few hundred bytes of assembler code which actually changes the
@@ -69,9 +35,7 @@ static struct lguest_pages *lguest_pages(unsigned int cpu)
  * Host since it will be running as the switchover occurs.
  *
  * Trying to map memory at a particular address is an unusual thing to do, so
- * it's not a simple one-liner.  We also set up the per-cpu parts of the
- * Switcher here.
- */
+ * it's not a simple one-liner. */
 static __init int map_switcher(void)
 {
int i, err;
@@ -128,90 +92,11 @@ static __init int map_switcher(void)
goto free_vma;
}
 
-   /* Now the switcher is mapped at the right address, we can't fail!
-* Copy in the compiled-in Switcher code (from switcher.S). */
+   /* Now the Switcher is mapped at the right address, we can't fail!
+* Copy in the compiled-in Switcher code (from arch_switcher.S). */
memcpy(switcher_vma-addr, start_switcher_text,
   end_switcher_text - start_switcher_text);
 
-   /* Most of the switcher.S doesn't care that it's been moved; on Intel,
-* jumps are relative, and it doesn't 

Reorder guest saved regs to match hyperall order

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4614a3a3b638dfd7a67d0237944f6a76331af61d
Commit: 4614a3a3b638dfd7a67d0237944f6a76331af61d
Parent: 625efab1cd3d4da4634dfe26df6b4005385397e2
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:29 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:51 2007 +1000

Reorder guest saved regs to match hyperall order

Move eax next to ebx/ecx/edx in struct lguest_regs on i386, so they
will be located together and allow it to map directly to a struct
hcall_ring entry (which will be renamed struct hcall_args as in a
subsequent patch).

This is in preparation for making the code hcall code architecture
independent.

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/x86/switcher_32.S |4 ++--
 include/asm-x86/lguest.h |3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/lguest/x86/switcher_32.S b/drivers/lguest/x86/switcher_32.S
index e66cec5..1010b90 100644
--- a/drivers/lguest/x86/switcher_32.S
+++ b/drivers/lguest/x86/switcher_32.S
@@ -133,6 +133,7 @@ ENTRY(switch_to_guest)
// The Guest's register page has been mapped
// Writable onto our %esp (stack) --
// We can simply pop off all Guest regs.
+   popl%eax
popl%ebx
popl%ecx
popl%edx
@@ -140,7 +141,6 @@ ENTRY(switch_to_guest)
popl%edi
popl%ebp
popl%gs
-   popl%eax
popl%fs
popl%ds
popl%es
@@ -168,7 +168,6 @@ ENTRY(switch_to_guest)
pushl   %es;\
pushl   %ds;\
pushl   %fs;\
-   pushl   %eax;   \
pushl   %gs;\
pushl   %ebp;   \
pushl   %edi;   \
@@ -176,6 +175,7 @@ ENTRY(switch_to_guest)
pushl   %edx;   \
pushl   %ecx;   \
pushl   %ebx;   \
+   pushl   %eax;   \
/* Our stack and our code are using segments\
 * Set in the TSS and IDT   \
 * Yet if we were to touch data we'd use\
diff --git a/include/asm-x86/lguest.h b/include/asm-x86/lguest.h
index f10f1c6..ccd3384 100644
--- a/include/asm-x86/lguest.h
+++ b/include/asm-x86/lguest.h
@@ -26,10 +26,9 @@ extern unsigned long default_idt_entries[];
 struct lguest_regs
 {
/* Manually saved part. */
-   unsigned long ebx, ecx, edx;
+   unsigned long eax, ebx, ecx, edx;
unsigned long esi, edi, ebp;
unsigned long gs;
-   unsigned long eax;
unsigned long fs, ds, es;
unsigned long trapnum, errcode;
/* Trap pushed part */
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Introduce hcall pointer to indicate pending hypercall.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=cc6d4fbcef328acdc9fa7023e69f39f753f72fe1
Commit: cc6d4fbcef328acdc9fa7023e69f39f753f72fe1
Parent: 4614a3a3b638dfd7a67d0237944f6a76331af61d
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:30 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:52 2007 +1000

Introduce hcall pointer to indicate pending hypercall.

Currently we look at the trapnum to see if the Guest wants a
hypercall.  But once the hypercall is done we have to reset trapnum to
a bogus value, otherwise if we exit to userspace and return, we'd run
the same hypercall twice (that was a nasty bug to find!).

This has two main effects:

1) When Jes's patch changes the hypercall args to be a generic struct
   hcall_args we simply change the type of lg-hcall.  It's set by
   arch code, so if it has to copy args or something it can do so, and
   point hcall into lg-arch somewhere.

2) Async hypercalls only get run when an actual hypercall is pending.
   This simplfies the code a little and is a more logical semantic.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/core.c   |8 +++---
 drivers/lguest/hypercalls.c |   48 +-
 drivers/lguest/lg.h |3 ++
 drivers/lguest/x86/core.c   |   13 ++-
 4 files changed, 34 insertions(+), 38 deletions(-)

diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 06869a2..02556ba 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -198,10 +198,10 @@ int run_guest(struct lguest *lg, unsigned long __user 
*user)
 {
/* We stop running once the Guest is dead. */
while (!lg-dead) {
-   /* First we run any hypercalls the Guest wants done: either in
-* the hypercall ring in struct lguest_data, or directly by
-* using int 31 (LGUEST_TRAP_ENTRY). */
-   do_hypercalls(lg);
+   /* First we run any hypercalls the Guest wants done. */
+   if (lg-hcall)
+   do_hypercalls(lg);
+
/* It's possible the Guest did a SEND_DMA hypercall to the
 * Launcher, in which case we return from the read() now. */
if (lg-dma_is_pending) {
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 8bde209..0175a9f 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -241,19 +241,6 @@ static void initialize(struct lguest *lg)
  * is one other way we can do things for the Guest, as we see in
  * emulate_insn(). */
 
-/*H:110 Tricky point: we mark the hypercall as done once we've done it.
- * Normally we don't need to do this: the Guest will run again and update the
- * trap number before we come back around the run_guest() loop to
- * do_hypercalls().
- *
- * However, if we are signalled or the Guest sends DMA to the Launcher, that
- * loop will exit without running the Guest.  When it comes back it would try
- * to re-run the hypercall. */
-static void clear_hcall(struct lguest *lg)
-{
-   lg-regs-trapnum = 255;
-}
-
 /*H:100
  * Hypercalls
  *
@@ -262,16 +249,12 @@ static void clear_hcall(struct lguest *lg)
  */
 void do_hypercalls(struct lguest *lg)
 {
-   /* Not initialized yet? */
+   /* Not initialized yet?  This hypercall must do it. */
if (unlikely(!lg-lguest_data)) {
-   /* Did the Guest make a hypercall?  We might have come back for
-* some other reason (an interrupt, a different trap). */
-   if (lg-regs-trapnum == LGUEST_TRAP_ENTRY) {
-   /* Set up the struct lguest_data */
-   initialize(lg);
-   /* The hypercall is done. */
-   clear_hcall(lg);
-   }
+   /* Set up the struct lguest_data */
+   initialize(lg);
+   /* Hcall is done. */
+   lg-hcall = NULL;
return;
}
 
@@ -281,12 +264,21 @@ void do_hypercalls(struct lguest *lg)
do_async_hcalls(lg);
 
/* If we stopped reading the hypercall ring because the Guest did a
-* SEND_DMA to the Launcher, we want to return now.  Otherwise if the
-* Guest asked us to do a hypercall, we do it. */
-   if (!lg-dma_is_pending  lg-regs-trapnum == LGUEST_TRAP_ENTRY) {
-   do_hcall(lg, lg-regs);
-   /* The hypercall is done. */
-   clear_hcall(lg);
+* SEND_DMA to the Launcher, we want to return now.  Otherwise we do
+* the hypercall. */
+   if (!lg-dma_is_pending) {
+   do_hcall(lg, lg-hcall);
+   /* Tricky point: we reset the hcall pointer to mark the
+* hypercall as done.  We use the hcall pointer rather than
+  

Make hypercalls arch-independent.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b410e7b1499c49513cab18275db8a8ab549d9e09
Commit: b410e7b1499c49513cab18275db8a8ab549d9e09
Parent: cc6d4fbcef328acdc9fa7023e69f39f753f72fe1
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:31 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:52 2007 +1000

Make hypercalls arch-independent.

Clean up the hypercall code to make the code in hypercalls.c
architecture independent. First process the common hypercalls and
then call lguest_arch_do_hcall() if the call hasn't been handled.
Rename struct hcall_ring to hcall_args.

This patch requires the previous patch which reorganize the layout of
struct lguest_regs on i386 so they match the layout of struct
hcall_args.

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 arch/x86/lguest/boot.c |8 ++--
 drivers/lguest/hypercalls.c|  104 +++
 drivers/lguest/lg.h|4 +-
 drivers/lguest/x86/core.c  |   62 +++-
 include/asm-x86/lguest_hcall.h |8 ++-
 include/linux/lguest.h |2 +-
 6 files changed, 104 insertions(+), 84 deletions(-)

diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index c7ebc13..1040f9b 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -146,10 +146,10 @@ void async_hcall(unsigned long call,
/* Table full, so do normal hcall which will flush table. */
hcall(call, arg1, arg2, arg3);
} else {
-   lguest_data.hcalls[next_call].eax = call;
-   lguest_data.hcalls[next_call].edx = arg1;
-   lguest_data.hcalls[next_call].ebx = arg2;
-   lguest_data.hcalls[next_call].ecx = arg3;
+   lguest_data.hcalls[next_call].arg0 = call;
+   lguest_data.hcalls[next_call].arg1 = arg1;
+   lguest_data.hcalls[next_call].arg2 = arg2;
+   lguest_data.hcalls[next_call].arg3 = arg3;
/* Arguments must all be written before we mark it to go */
wmb();
lguest_data.hcall_status[next_call] = 0;
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 0175a9f..2859a76 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -25,17 +25,13 @@
 #include linux/mm.h
 #include asm/page.h
 #include asm/pgtable.h
-#include irq_vectors.h
 #include lg.h
 
-/*H:120 This is the core hypercall routine: where the Guest gets what it
- * wants.  Or gets killed.  Or, in the case of LHCALL_CRASH, both.
- *
- * Remember from the Guest: %eax == which call to make, and the arguments are
- * packed into %edx, %ebx and %ecx if needed. */
-static void do_hcall(struct lguest *lg, struct lguest_regs *regs)
+/*H:120 This is the core hypercall routine: where the Guest gets what it wants.
+ * Or gets killed.  Or, in the case of LHCALL_CRASH, both. */
+static void do_hcall(struct lguest *lg, struct hcall_args *args)
 {
-   switch (regs-eax) {
+   switch (args-arg0) {
case LHCALL_FLUSH_ASYNC:
/* This call does nothing, except by breaking out of the Guest
 * it makes us process all the asynchronous hypercalls. */
@@ -51,7 +47,7 @@ static void do_hcall(struct lguest *lg, struct lguest_regs 
*regs)
char msg[128];
/* If the lgread fails, it will call kill_guest() itself; the
 * kill_guest() with the message will be ignored. */
-   lgread(lg, msg, regs-edx, sizeof(msg));
+   lgread(lg, msg, args-arg1, sizeof(msg));
msg[sizeof(msg)-1] = '\0';
kill_guest(lg, CRASH: %s, msg);
break;
@@ -59,7 +55,7 @@ static void do_hcall(struct lguest *lg, struct lguest_regs 
*regs)
case LHCALL_FLUSH_TLB:
/* FLUSH_TLB comes in two flavors, depending on the
 * argument: */
-   if (regs-edx)
+   if (args-arg1)
guest_pagetable_clear_all(lg);
else
guest_pagetable_flush_user(lg);
@@ -71,55 +67,47 @@ static void do_hcall(struct lguest *lg, struct lguest_regs 
*regs)
 * it here.  This can legitimately fail, since we currently
 * place a limit on the number of DMA pools a Guest can have.
 * So we return true or false from this call. */
-   regs-eax = bind_dma(lg, regs-edx, regs-ebx,
-regs-ecx  8, regs-ecx  0xFF);
+   args-arg0 = bind_dma(lg, args-arg1, args-arg2,
+args-arg3  8, args-arg3  0xFF);
break;
 
/* All these calls simply pass the arguments through to the right
 * routines. 

Change example launcher to use unsigned long not u32

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=511801dc31c095b2bfe3bf5c6a370dbe9b042a70
Commit: 511801dc31c095b2bfe3bf5c6a370dbe9b042a70
Parent: b410e7b1499c49513cab18275db8a8ab549d9e09
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:31 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:52 2007 +1000

Change example launcher to use unsigned long not u32

Apply Clue 2x4 to lguest userland-kernel handling code and the
lguest launcher. Pointers are not to be passed in u32's!

Basic rule of thumb: Anything passing u32's back and forth should be
passing unsigned longs to be portable to 64 bit archs.

For those who forgotten already, I repeat: NO POINTERS IN u32!

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |   27 ++-
 drivers/lguest/lguest_user.c  |   31 ---
 2 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 140bd98..4950b03 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -473,9 +473,9 @@ static unsigned long setup_pagetables(unsigned long mem,
  unsigned long initrd_size,
  unsigned long page_offset)
 {
-   u32 *pgdir, *linear;
+   unsigned long *pgdir, *linear;
unsigned int mapped_pages, i, linear_pages;
-   unsigned int ptes_per_page = getpagesize()/sizeof(u32);
+   unsigned int ptes_per_page = getpagesize()/sizeof(void *);
 
/* Ideally we map all physical memory starting at page_offset.
 * However, if page_offset is 0xC000 we can only map 1G of physical
@@ -505,7 +505,7 @@ static unsigned long setup_pagetables(unsigned long mem,
 * continue from there. */
for (i = 0; i  mapped_pages; i += ptes_per_page) {
pgdir[(i + page_offset/getpagesize())/ptes_per_page]
-   = ((to_guest_phys(linear) + i*sizeof(u32))
+   = ((to_guest_phys(linear) + i*sizeof(void *))
   | PAGE_PRESENT);
}
 
@@ -537,12 +537,13 @@ static void concat(char *dst, char *args[])
  * the base of guest physical memory, the top physical page to allow, the
  * top level pagetable, the entry point and the page_offset constant for the
  * Guest. */
-static int tell_kernel(u32 pgdir, u32 start, u32 page_offset)
+static int tell_kernel(unsigned long pgdir, unsigned long start,
+  unsigned long page_offset)
 {
-   u32 args[] = { LHREQ_INITIALIZE,
-  (unsigned long)guest_base,
-  guest_limit / getpagesize(),
-  pgdir, start, page_offset };
+   unsigned long args[] = { LHREQ_INITIALIZE,
+(unsigned long)guest_base,
+guest_limit / getpagesize(),
+pgdir, start, page_offset };
int fd;
 
verbose(Guest: %p - %p (%#lx)\n,
@@ -586,7 +587,7 @@ static void wake_parent(int pipefd, int lguest_fd, struct 
device_list *devices)
 
for (;;) {
fd_set rfds = devices-infds;
-   u32 args[] = { LHREQ_BREAK, 1 };
+   unsigned long args[] = { LHREQ_BREAK, 1 };
 
/* Wait until input is ready from one of the devices. */
select(devices-max_infd+1, rfds, NULL, NULL, NULL);
@@ -684,7 +685,7 @@ static u32 *dma2iov(unsigned long dma, struct iovec iov[], 
unsigned *num)
 static u32 *get_dma_buffer(int fd, void *key,
   struct iovec iov[], unsigned int *num, u32 *irq)
 {
-   u32 buf[] = { LHREQ_GETDMA, to_guest_phys(key) };
+   unsigned long buf[] = { LHREQ_GETDMA, to_guest_phys(key) };
unsigned long udma;
u32 *res;
 
@@ -705,7 +706,7 @@ static u32 *get_dma_buffer(int fd, void *key,
 /* This is a convenient routine to send the Guest an interrupt. */
 static void trigger_irq(int fd, u32 irq)
 {
-   u32 buf[] = { LHREQ_IRQ, irq };
+   unsigned long buf[] = { LHREQ_IRQ, irq };
if (write(fd, buf, sizeof(buf)) != 0)
err(1, Triggering irq %i, irq);
 }
@@ -787,7 +788,7 @@ static bool handle_console_input(int fd, struct device *dev)
struct timeval now;
gettimeofday(now, NULL);
if (now.tv_sec = abort-start.tv_sec+1) {
-   u32 args[] = { LHREQ_BREAK, 0 };
+   unsigned long args[] = { LHREQ_BREAK, 0 };
/* Close the fd so Waker will know it has to
 * exit. */
close(waker_fd);
@@ -1365,7 +1366,7 @@ static 

Move register setup into i386_core.c

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d612cde060a005c1effb13d0f665448a04ce5f67
Commit: d612cde060a005c1effb13d0f665448a04ce5f67
Parent: 511801dc31c095b2bfe3bf5c6a370dbe9b042a70
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:32 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:52 2007 +1000

Move register setup into i386_core.c

Move setup_regs() to lguest_arch_setup_regs() in i386_core.c given
that this is very architecture specific.

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/lg.h  |1 +
 drivers/lguest/lguest_user.c |   37 +
 drivers/lguest/x86/core.c|   36 
 3 files changed, 38 insertions(+), 36 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index 00c869b..c2557cf 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -199,6 +199,7 @@ void lguest_arch_run_guest(struct lguest *lg);
 void lguest_arch_handle_trap(struct lguest *lg);
 int lguest_arch_init_hypercalls(struct lguest *lg);
 int lguest_arch_do_hcall(struct lguest *lg, struct hcall_args *args);
+void lguest_arch_setup_regs(struct lguest *lg, unsigned long start);
 
 /* arch/switcher.S: */
 extern char start_switcher_text[], end_switcher_text[], switch_to_guest[];
diff --git a/drivers/lguest/lguest_user.c b/drivers/lguest/lguest_user.c
index d4ac5f8..b184652 100644
--- a/drivers/lguest/lguest_user.c
+++ b/drivers/lguest/lguest_user.c
@@ -9,37 +9,6 @@
 #include linux/fs.h
 #include lg.h
 
-/*L:030 setup_regs() doesn't really belong in this file, but it gives us an
- * early glimpse deeper into the Host so it's worth having here.
- *
- * Most of the Guest's registers are left alone: we used get_zeroed_page() to
- * allocate the structure, so they will be 0. */
-static void setup_regs(struct lguest_regs *regs, unsigned long start)
-{
-   /* There are four segment registers which the Guest needs to boot:
-* The code segment register (cs) refers to the kernel code segment
-* __KERNEL_CS, and the data, extra and stack segment registers
-* refer to the kernel data segment __KERNEL_DS.
-*
-* The privilege level is packed into the lower bits.  The Guest runs
-* at privilege level 1 (GUEST_PL).*/
-   regs-ds = regs-es = regs-ss = __KERNEL_DS|GUEST_PL;
-   regs-cs = __KERNEL_CS|GUEST_PL;
-
-   /* The eflags register contains miscellaneous flags.  Bit 1 (0x002)
-* is supposed to always be 1.  Bit 9 (0x200) controls whether
-* interrupts are enabled.  We always leave interrupts enabled while
-* running the Guest. */
-   regs-eflags = 0x202;
-
-   /* The Extended Instruction Pointer register says where the Guest is
-* running. */
-   regs-eip = start;
-
-   /* %esi points to our boot information, at physical address 0, so don't
-* touch it. */
-}
-
 /*L:310 To send DMA into the Guest, the Launcher needs to be able to ask for a
  * DMA buffer.  This is done by writing LHREQ_GETDMA and the key to
  * /dev/lguest. */
@@ -214,11 +183,7 @@ static int initialize(struct file *file, const unsigned 
long __user *input)
 
/* Now we initialize the Guest's registers, handing it the start
 * address. */
-   setup_regs(lg-regs, args[3]);
-
-   /* There are a couple of GDT entries the Guest expects when first
-* booting. */
-   setup_guest_gdt(lg);
+   lguest_arch_setup_regs(lg, args[3]);
 
/* The timer for lguest's clock needs initialization. */
init_clockdev(lg);
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
index 2ef64a2..84c0908 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -535,3 +535,39 @@ int lguest_arch_init_hypercalls(struct lguest *lg)
 /* Now we've examined the hypercall code; our Guest can make requests.  There
  * is one other way we can do things for the Guest, as we see in
  * emulate_insn(). :*/
+
+/*L:030 lguest_arch_setup_regs()
+ *
+ * Most of the Guest's registers are left alone: we used get_zeroed_page() to
+ * allocate the structure, so they will be 0. */
+void lguest_arch_setup_regs(struct lguest *lg, unsigned long start)
+{
+   struct lguest_regs *regs = lg-regs;
+
+   /* There are four segment registers which the Guest needs to boot:
+* The code segment register (cs) refers to the kernel code segment
+* __KERNEL_CS, and the data, extra and stack segment registers
+* refer to the kernel data segment __KERNEL_DS.
+*
+* The privilege level is packed into the lower bits.  The Guest runs
+* at privilege level 1 (GUEST_PL).*/
+   regs-ds = regs-es = regs-ss = __KERNEL_DS|GUEST_PL;
+   regs-cs = __KERNEL_CS|GUEST_PL;
+
+   /* The eflags 

lguest.h declares a struct timespec, make it include linux/time.h

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=47aee45ae3c708ab678e09abfba0efaf6ca0e87a
Commit: 47aee45ae3c708ab678e09abfba0efaf6ca0e87a
Parent: d612cde060a005c1effb13d0f665448a04ce5f67
Author: Jes Sorensen [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:33 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:52 2007 +1000

lguest.h declares a struct timespec, make it include linux/time.h

Signed-off-by: Jes Sorensen [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 include/linux/lguest.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index ea335c8..9ddac2f 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -4,6 +4,7 @@
 #define _LINUX_LGUEST_H
 
 #ifndef __ASSEMBLY__
+#include linux/time.h
 #include asm/irq.h
 #include asm/lguest_hcall.h
 
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Pagetables to use normal kernel types

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=df29f43e650df29456804dabdb2611de914e7c0f
Commit: df29f43e650df29456804dabdb2611de914e7c0f
Parent: 47aee45ae3c708ab678e09abfba0efaf6ca0e87a
Author: Matias Zabaljauregui [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:33 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:53 2007 +1000

Pagetables to use normal kernel types

This is my first step in the migration of page_tables.c to the kernel
types and functions/macros (2.6.23-rc3).  Seems to be working OK.

Signed-off-by: Matias Zabaljauregui [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/hypercalls.c  |2 +-
 drivers/lguest/lg.h  |   45 ++
 drivers/lguest/page_tables.c |  192 +++--
 3 files changed, 98 insertions(+), 141 deletions(-)

diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 2859a76..02d0ae2 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -83,7 +83,7 @@ static void do_hcall(struct lguest *lg, struct hcall_args 
*args)
guest_set_stack(lg, args-arg1, args-arg2, args-arg3);
break;
case LHCALL_SET_PTE:
-   guest_set_pte(lg, args-arg1, args-arg2, mkgpte(args-arg3));
+   guest_set_pte(lg, args-arg1, args-arg2, __pte(args-arg3));
break;
case LHCALL_SET_PMD:
guest_set_pmd(lg, args-arg1, args-arg2);
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index c2557cf..dc15b88 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -28,45 +28,10 @@ struct lguest_dma_info
u8 interrupt;   /* 0 when not registered */
 };
 
-/*H:310 The page-table code owes a great debt of gratitude to Andi Kleen.  He
- * reviewed the original code which used u32 for all page table entries, and
- * insisted that it would be far clearer with explicit typing.  I thought it
- * was overkill, but he was right: it is much clearer than it was before.
- *
- * We have separate types for the Guest's ptes  pgds and the shadow ptes 
- * pgds.  There's already a Linux type for these (pte_t and pgd_t) but they
- * change depending on kernel config options (PAE). */
-
-/* Each entry is identical: lower 12 bits of flags and upper 20 bits for the
- * page frame number (0 == first physical page, etc).  They are different
- * types so the compiler will warn us if we mix them improperly. */
-typedef union {
-   struct { unsigned flags:12, pfn:20; };
-   struct { unsigned long val; } raw;
-} spgd_t;
-typedef union {
-   struct { unsigned flags:12, pfn:20; };
-   struct { unsigned long val; } raw;
-} spte_t;
-typedef union {
-   struct { unsigned flags:12, pfn:20; };
-   struct { unsigned long val; } raw;
-} gpgd_t;
-typedef union {
-   struct { unsigned flags:12, pfn:20; };
-   struct { unsigned long val; } raw;
-} gpte_t;
-
-/* We have two convenient macros to convert a raw value as handed to us by
- * the Guest into the correct Guest PGD or PTE type. */
-#define mkgpte(_val) ((gpte_t){.raw.val = _val})
-#define mkgpgd(_val) ((gpgd_t){.raw.val = _val})
-/*:*/
-
 struct pgdir
 {
unsigned long cr3;
-   spgd_t *pgdir;
+   pgd_t *pgdir;
 };
 
 /* We have two pages shared with guests, per cpu.  */
@@ -157,6 +122,12 @@ int lguest_address_ok(const struct lguest *lg,
  unsigned long addr, unsigned long len);
 int run_guest(struct lguest *lg, unsigned long __user *user);
 
+/* Helper macros to obtain the first 12 or the last 20 bits, this is only the
+ * first step in the migration to the kernel types.  pte_pfn is already defined
+ * in the kernel. */
+#define pgd_flags(x)   (pgd_val(x)  ~PAGE_MASK)
+#define pte_flags(x)   (pte_val(x)  ~PAGE_MASK)
+#define pgd_pfn(x) (pgd_val(x)  PAGE_SHIFT)
 
 /* interrupts_and_traps.c: */
 void maybe_do_interrupt(struct lguest *lg);
@@ -187,7 +158,7 @@ void guest_set_pmd(struct lguest *lg, unsigned long cr3, 
u32 i);
 void guest_pagetable_clear_all(struct lguest *lg);
 void guest_pagetable_flush_user(struct lguest *lg);
 void guest_set_pte(struct lguest *lg, unsigned long cr3,
-  unsigned long vaddr, gpte_t val);
+  unsigned long vaddr, pte_t val);
 void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages);
 int demand_page(struct lguest *info, unsigned long cr2, int errcode);
 void pin_page(struct lguest *lg, unsigned long vaddr);
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 9cd2fac..5c4c53f 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -44,44 +44,32 @@
  *  (vii) Setting up the page tables initially.
  :*/
 
-/* Pages a 4k long, and each page table entry is 4 bytes long, giving us 1024
- * (or 2^10) entries per page. */
-#define PTES_PER_PAGE_SHIFT 10

Rename cr3 to gpgdir to avoid x86-specific naming.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ee3db0f2b6053b65f3b70253f5f810d9a3d67b28
Commit: ee3db0f2b6053b65f3b70253f5f810d9a3d67b28
Parent: df29f43e650df29456804dabdb2611de914e7c0f
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:34 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:53 2007 +1000

Rename cr3 to gpgdir to avoid x86-specific naming.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/lg.h  |6 +++---
 drivers/lguest/page_tables.c |   18 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h
index dc15b88..f921684 100644
--- a/drivers/lguest/lg.h
+++ b/drivers/lguest/lg.h
@@ -30,7 +30,7 @@ struct lguest_dma_info
 
 struct pgdir
 {
-   unsigned long cr3;
+   unsigned long gpgdir;
pgd_t *pgdir;
 };
 
@@ -154,10 +154,10 @@ void copy_gdt_tls(const struct lguest *lg, struct 
desc_struct *gdt);
 int init_guest_pagetable(struct lguest *lg, unsigned long pgtable);
 void free_guest_pagetable(struct lguest *lg);
 void guest_new_pagetable(struct lguest *lg, unsigned long pgtable);
-void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 i);
+void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 i);
 void guest_pagetable_clear_all(struct lguest *lg);
 void guest_pagetable_flush_user(struct lguest *lg);
-void guest_set_pte(struct lguest *lg, unsigned long cr3,
+void guest_set_pte(struct lguest *lg, unsigned long gpgdir,
   unsigned long vaddr, pte_t val);
 void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages);
 int demand_page(struct lguest *info, unsigned long cr2, int errcode);
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
index 5c4c53f..bfe3650 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -96,7 +96,7 @@ static pte_t *spte_addr(struct lguest *lg, pgd_t spgd, 
unsigned long vaddr)
 static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr)
 {
unsigned int index = vaddr  (PGDIR_SHIFT);
-   return lg-pgdirs[lg-pgdidx].cr3 + index * sizeof(pgd_t);
+   return lg-pgdirs[lg-pgdidx].gpgdir + index * sizeof(pgd_t);
 }
 
 static unsigned long gpte_addr(struct lguest *lg,
@@ -365,7 +365,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned 
long pgtable)
 {
unsigned int i;
for (i = 0; i  ARRAY_SIZE(lg-pgdirs); i++)
-   if (lg-pgdirs[i].cr3 == pgtable)
+   if (lg-pgdirs[i].gpgdir == pgtable)
break;
return i;
 }
@@ -374,7 +374,7 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned 
long pgtable)
  * allocate a new one (and so the kernel parts are not there), we set
  * blank_pgdir. */
 static unsigned int new_pgdir(struct lguest *lg,
- unsigned long cr3,
+ unsigned long gpgdir,
  int *blank_pgdir)
 {
unsigned int next;
@@ -394,7 +394,7 @@ static unsigned int new_pgdir(struct lguest *lg,
*blank_pgdir = 1;
}
/* Record which Guest toplevel this shadows. */
-   lg-pgdirs[next].cr3 = cr3;
+   lg-pgdirs[next].gpgdir = gpgdir;
/* Release all the non-kernel mappings. */
flush_user_mappings(lg, next);
 
@@ -496,7 +496,7 @@ static void do_set_pte(struct lguest *lg, int idx,
  * The benefit is that when we have to track a new page table, we can copy keep
  * all the kernel mappings.  This speeds up context switch immensely. */
 void guest_set_pte(struct lguest *lg,
-  unsigned long cr3, unsigned long vaddr, pte_t gpte)
+  unsigned long gpgdir, unsigned long vaddr, pte_t gpte)
 {
/* Kernel mappings must be changed on all top levels.  Slow, but
 * doesn't happen often. */
@@ -507,7 +507,7 @@ void guest_set_pte(struct lguest *lg,
do_set_pte(lg, i, vaddr, gpte);
} else {
/* Is this page table one we have a shadow for? */
-   int pgdir = find_pgdir(lg, cr3);
+   int pgdir = find_pgdir(lg, gpgdir);
if (pgdir != ARRAY_SIZE(lg-pgdirs))
/* If so, do the update. */
do_set_pte(lg, pgdir, vaddr, gpte);
@@ -528,7 +528,7 @@ void guest_set_pte(struct lguest *lg,
  *
  * So with that in mind here's our code to to update a (top-level) PGD entry:
  */
-void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx)
+void guest_set_pmd(struct lguest *lg, unsigned long gpgdir, u32 idx)
 {
int pgdir;
 
@@ -538,7 +538,7 @@ void guest_set_pmd(struct lguest *lg, unsigned long cr3, 
u32 idx)
return;
 
/* If they're talking about a page table we have a shadow for... */
-   pgdir = find_pgdir(lg, cr3);
+ 

Allow guest to specify syscall vector to use.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c18acd73ffc209def08003a1927473096f66c5ad
Commit: c18acd73ffc209def08003a1927473096f66c5ad
Parent: ee3db0f2b6053b65f3b70253f5f810d9a3d67b28
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:35 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:53 2007 +1000

Allow guest to specify syscall vector to use.

(Based on Ron Minnich's LGUEST_PLAN9_SYSCALL patch).

This patch allows Guests to specify what system call vector they want,
and we try to reserve it.  We only allow one non-Linux system call
vector, to try to avoid DoS on the Host.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 arch/x86/lguest/boot.c|1 +
 drivers/lguest/core.c |   30 +---
 drivers/lguest/interrupts_and_traps.c |   49 -
 drivers/lguest/lg.h   |3 ++
 drivers/lguest/x86/core.c |4 +++
 include/linux/lguest.h|3 ++
 6 files changed, 79 insertions(+), 11 deletions(-)

diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 1040f9b..3a06b51 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -87,6 +87,7 @@ struct lguest_data lguest_data = {
.noirq_start = (u32)lguest_noirq_start,
.noirq_end = (u32)lguest_noirq_end,
.blocked_interrupts = { 1 }, /* Block timer interrupts */
+   .syscall_vec = SYSCALL_VECTOR,
 };
 static cycle_t clock_base;
 
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 02556ba..41b26e5 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -281,37 +281,47 @@ static int __init init(void)
/* First we put the Switcher up in very high virtual memory. */
err = map_switcher();
if (err)
-   return err;
+   goto out;
 
/* Now we set up the pagetable implementation for the Guests. */
err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES);
-   if (err) {
-   unmap_switcher();
-   return err;
-   }
+   if (err)
+   goto unmap;
 
/* The I/O subsystem needs some things initialized. */
lguest_io_init();
 
+   /* We might need to reserve an interrupt vector. */
+   err = init_interrupts();
+   if (err)
+   goto free_pgtables;
+
/* /dev/lguest needs to be registered. */
err = lguest_device_init();
-   if (err) {
-   free_pagetables();
-   unmap_switcher();
-   return err;
-   }
+   if (err)
+   goto free_interrupts;
 
/* Finally we do some architecture-specific setup. */
lguest_arch_host_init();
 
/* All good! */
return 0;
+
+free_interrupts:
+   free_interrupts();
+free_pgtables:
+   free_pagetables();
+unmap:
+   unmap_switcher();
+out:
+   return err;
 }
 
 /* Cleaning up is just the same code, backwards.  With a little French. */
 static void __exit fini(void)
 {
lguest_device_remove();
+   free_interrupts();
free_pagetables();
unmap_switcher();
 
diff --git a/drivers/lguest/interrupts_and_traps.c 
b/drivers/lguest/interrupts_and_traps.c
index fdefc0a..a57d757 100644
--- a/drivers/lguest/interrupts_and_traps.c
+++ b/drivers/lguest/interrupts_and_traps.c
@@ -12,8 +12,14 @@
  * them first, so we also have a way of reflecting them into the Guest as if
  * they had been delivered to it directly. :*/
 #include linux/uaccess.h
+#include linux/interrupt.h
+#include linux/module.h
 #include lg.h
 
+/* Allow Guests to use a non-128 (ie. non-Linux) syscall trap. */
+static unsigned int syscall_vector = SYSCALL_VECTOR;
+module_param(syscall_vector, uint, 0444);
+
 /* The address of the interrupt handler is split into two bits: */
 static unsigned long idt_address(u32 lo, u32 hi)
 {
@@ -183,6 +189,47 @@ void maybe_do_interrupt(struct lguest *lg)
 * timer interrupt. */
write_timestamp(lg);
 }
+/*:*/
+
+/* Linux uses trap 128 for system calls.  Plan9 uses 64, and Ron Minnich sent
+ * me a patch, so we support that too.  It'd be a big step for lguest if half
+ * the Plan 9 user base were to start using it.
+ *
+ * Actually now I think of it, it's possible that Ron *is* half the Plan 9
+ * userbase.  Oh well. */
+static bool could_be_syscall(unsigned int num)
+{
+   /* Normal Linux SYSCALL_VECTOR or reserved vector? */
+   return num == SYSCALL_VECTOR || num == syscall_vector;
+}
+
+/* The syscall vector it wants must be unused by Host. */
+bool check_syscall_vector(struct lguest *lg)
+{
+   u32 vector;
+
+   if (get_user(vector, lg-lguest_data-syscall_vec))
+   return false;
+
+   return could_be_syscall(vector);
+}
+
+int init_interrupts(void)
+{
+   /* If they want some strange system 

Boot with virtual == physical to get closer to native Linux.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=47436aa4ad054c1c7c8231618e86ebd9305308dc
Commit: 47436aa4ad054c1c7c8231618e86ebd9305308dc
Parent: c18acd73ffc209def08003a1927473096f66c5ad
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:36 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:54 2007 +1000

Boot with virtual == physical to get closer to native Linux.

1) This allows us to get alot closer to booting bzImages.

2) It means we don't have to know page_offset.

3) The Guest needs to modify the boot pagetables to create the
   PAGE_OFFSET mapping before jumping to C code.

4) guest_pa() walks the page tables rather than using page_offset.

5) We don't use page_offset to figure out whether to emulate: it was
   always kinda quesationable, and won't work for instructions done
   before remapping (bzImage unpacking in particular).

6) We still want the kernel address for tlb flushing: have the initial
   hypercall give us that, too.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |  134 -
 arch/x86/kernel/asm-offsets_32.c  |1 +
 arch/x86/lguest/boot.c|7 +-
 arch/x86/lguest/i386_head.S   |   41 +-
 drivers/lguest/hypercalls.c   |8 +-
 drivers/lguest/interrupts_and_traps.c |   13 ++-
 drivers/lguest/lg.h   |8 +-
 drivers/lguest/lguest_user.c  |   11 +--
 drivers/lguest/page_tables.c  |   47 ++--
 drivers/lguest/x86/core.c |7 +-
 include/asm-x86/lguest_hcall.h|7 +-
 include/linux/lguest.h|5 +-
 12 files changed, 141 insertions(+), 148 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 4950b03..32c2eaf 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -178,19 +178,16 @@ static void *get_pages(unsigned int num)
 /* To find out where to start we look for the magic Guest string, which marks
  * the code we see in lguest_asm.S.  This is a hack which we are currently
  * plotting to replace with the normal Linux entry point. */
-static unsigned long entry_point(const void *start, const void *end,
-unsigned long page_offset)
+static unsigned long entry_point(const void *start, const void *end)
 {
const void *p;
 
-   /* The scan gives us the physical starting address.  We want the
-* virtual address in this case, and fortunately, we already figured
-* out the physical-virtual difference and passed it here in
-* page_offset. */
+   /* The scan gives us the physical starting address.  We boot with
+* pagetables set up with virtual and physical the same, so that's
+* OK. */
for (p = start; p  end; p++)
if (memcmp(p, GenuineLguest, strlen(GenuineLguest)) == 0)
-   return to_guest_phys(p + strlen(GenuineLguest))
-   + page_offset;
+   return to_guest_phys(p + strlen(GenuineLguest));
 
errx(1, Is this image a genuine lguest?);
 }
@@ -224,14 +221,11 @@ static void map_at(int fd, void *addr, unsigned long 
offset, unsigned long len)
  * by all modern binaries on Linux including the kernel.
  *
  * The ELF headers give *two* addresses: a physical address, and a virtual
- * address.  The Guest kernel expects to be placed in memory at the physical
- * address, and the page tables set up so it will correspond to that virtual
- * address.  We return the difference between the virtual and physical
- * addresses in the page_offset pointer.
+ * address.  We use the physical address; the Guest will map itself to the
+ * virtual address.
  *
  * We return the starting address. */
-static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr,
-unsigned long *page_offset)
+static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr)
 {
void *start = (void *)-1, *end = NULL;
Elf32_Phdr phdr[ehdr-e_phnum];
@@ -255,9 +249,6 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr 
*ehdr,
if (read(elf_fd, phdr, sizeof(phdr)) != sizeof(phdr))
err(1, Reading program headers);
 
-   /* We don't know page_offset yet. */
-   *page_offset = 0;
-
/* Try all the headers: there are usually only three.  A read-only one,
 * a read-write one, and a note section which isn't loadable. */
for (i = 0; i  ehdr-e_phnum; i++) {
@@ -268,14 +259,6 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr 
*ehdr,
verbose(Section %i: size %i addr %p\n,
i, phdr[i].p_memsz, (void *)phdr[i].p_paddr);
 
-   /* We expect a simple linear 

Virtio interface

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ec3d41c4db4c21164332826ea8d812f94f2f6886
Commit: ec3d41c4db4c21164332826ea8d812f94f2f6886
Parent: 47436aa4ad054c1c7c8231618e86ebd9305308dc
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:36 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:54 2007 +1000

Virtio interface

This attempts to implement a virtual I/O layer which should allow
common drivers to be efficiently used across most virtual I/O
mechanisms.  It will no-doubt need further enhancement.

The virtio drivers add buffers to virtio queues; as the buffers are consumed
the driver interrupt callbacks are invoked.

There is also a generic implementation of config space which drivers can 
query
to get setup information from the host.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Dor Laor [EMAIL PROTECTED]
Cc: Arnd Bergmann [EMAIL PROTECTED]
---
 drivers/Kconfig |2 +
 drivers/Makefile|1 +
 drivers/virtio/Kconfig  |3 +
 drivers/virtio/Makefile |1 +
 drivers/virtio/config.c |   13 +++
 drivers/virtio/virtio.c |  171 +++
 include/linux/Kbuild|1 +
 include/linux/mod_devicetable.h |6 ++
 include/linux/virtio.h  |  110 +
 include/linux/virtio_config.h   |  111 +
 10 files changed, 419 insertions(+), 0 deletions(-)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index d945ffc..f4076d9 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -93,4 +93,6 @@ source drivers/auxdisplay/Kconfig
 source drivers/kvm/Kconfig
 
 source drivers/uio/Kconfig
+
+source drivers/virtio/Kconfig
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index cfe38ff..560496b 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -91,3 +91,4 @@ obj-$(CONFIG_HID) += hid/
 obj-$(CONFIG_PPC_PS3)  += ps3/
 obj-$(CONFIG_OF)   += of/
 obj-$(CONFIG_SSB)  += ssb/
+obj-$(CONFIG_VIRTIO)   += virtio/
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
new file mode 100644
index 000..bce84b5
--- /dev/null
+++ b/drivers/virtio/Kconfig
@@ -0,0 +1,3 @@
+# Virtio always gets selected by whoever wants it.
+config VIRTIO
+   bool
diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile
new file mode 100644
index 000..af0d57d
--- /dev/null
+++ b/drivers/virtio/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_VIRTIO) += virtio.o
diff --git a/drivers/virtio/config.c b/drivers/virtio/config.c
new file mode 100644
index 000..983d482
--- /dev/null
+++ b/drivers/virtio/config.c
@@ -0,0 +1,13 @@
+/* Configuration space parsing helpers for virtio.
+ *
+ * The configuration is [type][len][... len bytes ...] fields.
+ *
+ * Copyright 2007 Rusty Russell, IBM Corporation.
+ * GPL v2 or later.
+ */
+#include linux/err.h
+#include linux/virtio.h
+#include linux/virtio_config.h
+#include linux/bug.h
+#include asm/system.h
+
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
new file mode 100644
index 000..f640e0b
--- /dev/null
+++ b/drivers/virtio/virtio.c
@@ -0,0 +1,171 @@
+#include linux/virtio.h
+#include linux/spinlock.h
+#include linux/virtio_config.h
+
+static ssize_t device_show(struct device *_d,
+  struct device_attribute *attr, char *buf)
+{
+   struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
+   return sprintf(buf, %hu, dev-id.device);
+}
+static ssize_t vendor_show(struct device *_d,
+  struct device_attribute *attr, char *buf)
+{
+   struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
+   return sprintf(buf, %hu, dev-id.vendor);
+}
+static ssize_t status_show(struct device *_d,
+  struct device_attribute *attr, char *buf)
+{
+   struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
+   return sprintf(buf, 0x%08x, dev-config-get_status(dev));
+}
+static struct device_attribute virtio_dev_attrs[] = {
+   __ATTR_RO(device),
+   __ATTR_RO(vendor),
+   __ATTR_RO(status),
+   __ATTR_NULL
+};
+
+static inline int virtio_id_match(const struct virtio_device *dev,
+ const struct virtio_device_id *id)
+{
+   if (id-device != dev-id.device)
+   return 0;
+
+   return id-vendor == VIRTIO_DEV_ANY_ID || id-vendor != dev-id.vendor;
+}
+
+/* This looks through all the IDs a driver claims to support.  If any of them
+ * match, we return 1 and the kernel will call virtio_dev_probe(). */
+static int virtio_dev_match(struct device *_dv, struct device_driver *_dr)
+{
+   unsigned int i;
+   struct virtio_device *dev = container_of(_dv,struct virtio_device,dev);
+   const struct 

Net driver using virtio

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=296f96fcfc160e29c01819c0c7b20c2dc8320edd
Commit: 296f96fcfc160e29c01819c0c7b20c2dc8320edd
Parent: ec3d41c4db4c21164332826ea8d812f94f2f6886
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:37 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:54 2007 +1000

Net driver using virtio

The network driver uses two virtqueues: one for input packets and one
for output packets.  This has nice locking properties (ie. we don't do
any for recv vs send).

TODO:
1) Big packets.
2) Multi-client devices (maybe separate driver?).
3) Resolve freeing of old xmit skbs (Christian Borntraeger)

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Christian Borntraeger [EMAIL PROTECTED]
Cc: Herbert Xu [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
---
 drivers/net/Kconfig|6 +
 drivers/net/Makefile   |1 +
 drivers/net/virtio_net.c   |  435 
 include/linux/Kbuild   |1 +
 include/linux/virtio_net.h |   36 
 5 files changed, 479 insertions(+), 0 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index ce34b53..2538816 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -3100,4 +3100,10 @@ config NETPOLL_TRAP
 config NET_POLL_CONTROLLER
def_bool NETPOLL
 
+config VIRTIO_NET
+   tristate Virtio network driver (EXPERIMENTAL)
+   depends on EXPERIMENTAL  VIRTIO
+   ---help---
+ This is the virtual network driver for lguest.  Say Y or M.
+
 endif # NETDEVICES
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 22f78cb..6745feb 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -243,3 +243,4 @@ obj-$(CONFIG_FS_ENET) += fs_enet/
 
 obj-$(CONFIG_NETXEN_NIC) += netxen/
 obj-$(CONFIG_NIU) += niu.o
+obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
new file mode 100644
index 000..e396c9d
--- /dev/null
+++ b/drivers/net/virtio_net.c
@@ -0,0 +1,435 @@
+/* A simple network driver using virtio.
+ *
+ * Copyright 2007 Rusty Russell [EMAIL PROTECTED] IBM Corporation
+ *
+ * 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+//#define DEBUG
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/module.h
+#include linux/virtio.h
+#include linux/virtio_net.h
+#include linux/scatterlist.h
+
+/* FIXME: MTU in config. */
+#define MAX_PACKET_LEN (ETH_HLEN+ETH_DATA_LEN)
+
+struct virtnet_info
+{
+   struct virtio_device *vdev;
+   struct virtqueue *rvq, *svq;
+   struct net_device *dev;
+   struct napi_struct napi;
+
+   /* Number of input buffers, and max we've ever had. */
+   unsigned int num, max;
+
+   /* Receive  send queues. */
+   struct sk_buff_head recv;
+   struct sk_buff_head send;
+};
+
+static inline struct virtio_net_hdr *skb_vnet_hdr(struct sk_buff *skb)
+{
+   return (struct virtio_net_hdr *)skb-cb;
+}
+
+static inline void vnet_hdr_to_sg(struct scatterlist *sg, struct sk_buff *skb)
+{
+   sg_init_one(sg, skb_vnet_hdr(skb), sizeof(struct virtio_net_hdr));
+}
+
+static bool skb_xmit_done(struct virtqueue *rvq)
+{
+   struct virtnet_info *vi = rvq-vdev-priv;
+
+   /* In case we were waiting for output buffers. */
+   netif_wake_queue(vi-dev);
+   return true;
+}
+
+static void receive_skb(struct net_device *dev, struct sk_buff *skb,
+   unsigned len)
+{
+   struct virtio_net_hdr *hdr = skb_vnet_hdr(skb);
+
+   if (unlikely(len  sizeof(struct virtio_net_hdr) + ETH_HLEN)) {
+   pr_debug(%s: short packet %i\n, dev-name, len);
+   dev-stats.rx_length_errors++;
+   goto drop;
+   }
+   len -= sizeof(struct virtio_net_hdr);
+   BUG_ON(len  MAX_PACKET_LEN);
+
+   skb_trim(skb, len);
+   skb-protocol = eth_type_trans(skb, dev);
+   pr_debug(Receiving skb proto 0x%04x len %i type %i\n,
+ntohs(skb-protocol), skb-len, skb-pkt_type);
+   dev-stats.rx_bytes += skb-len;
+   dev-stats.rx_packets++;
+
+   if (hdr-flags  VIRTIO_NET_HDR_F_NEEDS_CSUM) {
+   

Block driver using virtio.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e467cde238184d1b0923db2cd61ae1c5a6dc15aa
Commit: e467cde238184d1b0923db2cd61ae1c5a6dc15aa
Parent: 296f96fcfc160e29c01819c0c7b20c2dc8320edd
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:03:38 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:54 2007 +1000

Block driver using virtio.

The block driver uses scatter-gather lists with sg[0] being the
request information (struct virtio_blk_outhdr) with the type, sector
and inbuf id.  The next N sg entries are the bio itself, then the last
sg is the status byte.  Whether the N entries are in or out depends on
whether it's a read or a write.

We accept the normal (SCSI) ioctls: they get handed through to the other
side which can then handle it or reply that it's unsupported.  It's
not clear that this actually works in general, since I don't know
if blk_pc_request() requests have an accurate rq_data_dir().

Although we try to reply -ENOTTY on unsupported commands, ioctl(fd,
CDROMEJECT) returns success to userspace.  This needs a separate
patch.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Cc: Jens Axboe [EMAIL PROTECTED]
---
 drivers/block/Kconfig  |6 +
 drivers/block/Makefile |1 +
 drivers/block/virtio_blk.c |  308 
 include/linux/Kbuild   |1 +
 include/linux/virtio_blk.h |   51 
 5 files changed, 367 insertions(+), 0 deletions(-)

diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
index ce4b1e4..4d0119e 100644
--- a/drivers/block/Kconfig
+++ b/drivers/block/Kconfig
@@ -425,4 +425,10 @@ config XEN_BLKDEV_FRONTEND
  block device driver.  It communicates with a back-end driver
  in another domain which drives the actual block device.
 
+config VIRTIO_BLK
+   tristate Virtio block driver (EXPERIMENTAL)
+   depends on EXPERIMENTAL  VIRTIO
+   ---help---
+ This is the virtual block driver for lguest.  Say Y or M.
+
 endif # BLK_DEV
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index 014e721..d199eba 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_SUNVDC)  += sunvdc.o
 obj-$(CONFIG_BLK_DEV_UMEM) += umem.o
 obj-$(CONFIG_BLK_DEV_NBD)  += nbd.o
 obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryptoloop.o
+obj-$(CONFIG_VIRTIO_BLK)   += virtio_blk.o
 
 obj-$(CONFIG_VIODASD)  += viodasd.o
 obj-$(CONFIG_BLK_DEV_SX8)  += sx8.o
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
new file mode 100644
index 000..a901eee
--- /dev/null
+++ b/drivers/block/virtio_blk.c
@@ -0,0 +1,308 @@
+//#define DEBUG
+#include linux/spinlock.h
+#include linux/blkdev.h
+#include linux/hdreg.h
+#include linux/virtio.h
+#include linux/virtio_blk.h
+#include linux/virtio_blk.h
+
+static unsigned char virtblk_index = 'a';
+struct virtio_blk
+{
+   spinlock_t lock;
+
+   struct virtio_device *vdev;
+   struct virtqueue *vq;
+
+   /* The disk structure for the kernel. */
+   struct gendisk *disk;
+
+   /* Request tracking. */
+   struct list_head reqs;
+
+   mempool_t *pool;
+
+   /* Scatterlist: can be too big for stack. */
+   struct scatterlist sg[3+MAX_PHYS_SEGMENTS];
+};
+
+struct virtblk_req
+{
+   struct list_head list;
+   struct request *req;
+   struct virtio_blk_outhdr out_hdr;
+   struct virtio_blk_inhdr in_hdr;
+};
+
+static bool blk_done(struct virtqueue *vq)
+{
+   struct virtio_blk *vblk = vq-vdev-priv;
+   struct virtblk_req *vbr;
+   unsigned int len;
+   unsigned long flags;
+
+   spin_lock_irqsave(vblk-lock, flags);
+   while ((vbr = vblk-vq-vq_ops-get_buf(vblk-vq, len)) != NULL) {
+   int uptodate;
+   switch (vbr-in_hdr.status) {
+   case VIRTIO_BLK_S_OK:
+   uptodate = 1;
+   break;
+   case VIRTIO_BLK_S_UNSUPP:
+   uptodate = -ENOTTY;
+   break;
+   default:
+   uptodate = 0;
+   break;
+   }
+
+   end_dequeued_request(vbr-req, uptodate);
+   list_del(vbr-list);
+   mempool_free(vbr, vblk-pool);
+   }
+   /* In case queue is stopped waiting for more buffers. */
+   blk_start_queue(vblk-disk-queue);
+   spin_unlock_irqrestore(vblk-lock, flags);
+   return true;
+}
+
+static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
+  struct request *req)
+{
+   unsigned long num, out, in;
+   struct virtblk_req *vbr;
+
+   vbr = mempool_alloc(vblk-pool, GFP_ATOMIC);
+   if (!vbr)
+   /* When another request finishes we'll try again. */
+   return 

Remove old lguest I/O infrrasructure.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=15045275c32bf6d15d32c2eca8157be9c0ba6e45
Commit: 15045275c32bf6d15d32c2eca8157be9c0ba6e45
Parent: 0ca49ca946409f87a8cd0b14d5acb6dea58de6f3
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:24:10 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:55 2007 +1000

Remove old lguest I/O infrrasructure.

This patch gets rid of the old lguest host I/O infrastructure and
replaces it with a single hypercall LHCALL_NOTIFY which takes an
address.

The main change is the removal of io.c: that mainly did inter-guest
I/O, which virtio doesn't yet support.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/lguest/Makefile |2 +-
 drivers/lguest/core.c   |   12 +-
 drivers/lguest/hypercalls.c |   26 +--
 drivers/lguest/io.c |  628 ---
 drivers/lguest/lg.h |   27 +--
 drivers/lguest/lguest_user.c|   39 +---
 include/asm-x86/lguest_hcall.h  |3 +-
 include/linux/lguest_launcher.h |   36 +---
 8 files changed, 21 insertions(+), 752 deletions(-)

diff --git a/drivers/lguest/Makefile b/drivers/lguest/Makefile
index 8c28236..a63f75d 100644
--- a/drivers/lguest/Makefile
+++ b/drivers/lguest/Makefile
@@ -1,7 +1,7 @@
 # Host requires the other files, which can be a module.
 obj-$(CONFIG_LGUEST)   += lg.o
 lg-y = core.o hypercalls.o page_tables.o interrupts_and_traps.o \
-   segments.o io.o lguest_user.o
+   segments.o lguest_user.o
 
 lg-$(CONFIG_X86_32) += x86/switcher_32.o x86/core.o
 
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 41b26e5..3aec29e 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -202,13 +202,12 @@ int run_guest(struct lguest *lg, unsigned long __user 
*user)
if (lg-hcall)
do_hypercalls(lg);
 
-   /* It's possible the Guest did a SEND_DMA hypercall to the
+   /* It's possible the Guest did a NOTIFY hypercall to the
 * Launcher, in which case we return from the read() now. */
-   if (lg-dma_is_pending) {
-   if (put_user(lg-pending_dma, user) ||
-   put_user(lg-pending_key, user+1))
+   if (lg-pending_notify) {
+   if (put_user(lg-pending_notify, user))
return -EFAULT;
-   return sizeof(unsigned long)*2;
+   return sizeof(lg-pending_notify);
}
 
/* Check for signals */
@@ -288,9 +287,6 @@ static int __init init(void)
if (err)
goto unmap;
 
-   /* The I/O subsystem needs some things initialized. */
-   lguest_io_init();
-
/* We might need to reserve an interrupt vector. */
err = init_interrupts();
if (err)
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 13b5f2f..3a53788 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -60,22 +60,9 @@ static void do_hcall(struct lguest *lg, struct hcall_args 
*args)
else
guest_pagetable_flush_user(lg);
break;
-   case LHCALL_BIND_DMA:
-   /* BIND_DMA really wants four arguments, but it's the only call
-* which does.  So the Guest packs the number of buffers and
-* the interrupt number into the final argument, and we decode
-* it here.  This can legitimately fail, since we currently
-* place a limit on the number of DMA pools a Guest can have.
-* So we return true or false from this call. */
-   args-arg0 = bind_dma(lg, args-arg1, args-arg2,
-args-arg3  8, args-arg3  0xFF);
-   break;
 
/* All these calls simply pass the arguments through to the right
 * routines. */
-   case LHCALL_SEND_DMA:
-   send_dma(lg, args-arg1, args-arg2);
-   break;
case LHCALL_NEW_PGTABLE:
guest_new_pagetable(lg, args-arg1);
break;
@@ -99,6 +86,9 @@ static void do_hcall(struct lguest *lg, struct hcall_args 
*args)
/* Similarly, this sets the halted flag for run_guest(). */
lg-halted = 1;
break;
+   case LHCALL_NOTIFY:
+   lg-pending_notify = args-arg1;
+   break;
default:
if (lguest_arch_do_hcall(lg, args))
kill_guest(lg, Bad hypercall %li\n, args-arg0);
@@ -156,9 +146,9 @@ static void do_async_hcalls(struct lguest *lg)
break;
}
 
-   /* Stop doing hypercalls if we've just done a DMA to the
-* Launcher: it needs to 

Lguest support for Virtio

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=19f1537b7b8a9a82665db3ad8210a9d954d13acd
Commit: 19f1537b7b8a9a82665db3ad8210a9d954d13acd
Parent: 15045275c32bf6d15d32c2eca8157be9c0ba6e45
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:24:21 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:56 2007 +1000

Lguest support for Virtio

This makes lguest able to use the virtio devices.

We change the device descriptor page from a simple array to a variable
length type, config_len, status, config data... format, and
implement virtio_config_ops to read from that config data.

We use the virtio ring implementation for an efficient Guest - Host
virtqueue mechanism, and the new LHCALL_NOTIFY hypercall to kick the
host when it changes.

We also use LHCALL_NOTIFY on kernel addresses for very very early
console output.  We could have another hypercall, but this hack works
quite well.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 arch/x86/lguest/Kconfig |5 +
 arch/x86/lguest/boot.c  |   21 +++
 drivers/lguest/Makefile |3 +
 drivers/lguest/lguest_device.c  |  373 +++
 include/linux/lguest_launcher.h |   47 ++---
 5 files changed, 421 insertions(+), 28 deletions(-)

diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index 44dccfd..c4dffbe 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -2,8 +2,13 @@ config LGUEST_GUEST
bool Lguest guest support
select PARAVIRT
depends on !X86_PAE
+   select VIRTIO
select VIRTIO_RING
+   select VIRTIO_CONSOLE
help
  Lguest is a tiny in-kernel hypervisor.  Selecting this will
  allow your kernel to boot under lguest.  This option will increase
  your kernel size by about 6k.  If in doubt, say N.
+
+ If you say Y here, make sure you say Y (or M) to the virtio block
+ and net drivers which lguest needs.
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 959aeeb..495e46a 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -55,6 +55,7 @@
 #include linux/clockchips.h
 #include linux/lguest.h
 #include linux/lguest_launcher.h
+#include linux/virtio_console.h
 #include asm/paravirt.h
 #include asm/param.h
 #include asm/page.h
@@ -849,6 +850,23 @@ static __init char *lguest_memory_setup(void)
return LGUEST;
 }
 
+/* Before virtqueues are set up, we use LHCALL_NOTIFY on normal memory to
+ * produce console output. */
+static __init int early_put_chars(u32 vtermno, const char *buf, int count)
+{
+   char scratch[17];
+   unsigned int len = count;
+
+   if (len  sizeof(scratch) - 1)
+   len = sizeof(scratch) - 1;
+   scratch[len] = '\0';
+   memcpy(scratch, buf, len);
+   hcall(LHCALL_NOTIFY, __pa(scratch), 0, 0);
+
+   /* This routine returns the number of bytes actually written. */
+   return len;
+}
+
 /*G:050
  * Patching (Powerfully Placating Performance Pedants)
  *
@@ -1048,6 +1066,9 @@ __init void lguest_init(void *boot)
 * adapted for lguest's use. */
add_preferred_console(hvc, 0, NULL);
 
+   /* Register our very early console. */
+   virtio_cons_early_init(early_put_chars);
+
/* Last of all, we set the power management poweroff hook to point to
 * the Guest routine to power off. */
pm_power_off = lguest_power_off;
diff --git a/drivers/lguest/Makefile b/drivers/lguest/Makefile
index a63f75d..5e8272d 100644
--- a/drivers/lguest/Makefile
+++ b/drivers/lguest/Makefile
@@ -1,3 +1,6 @@
+# Guest requires the device configuration and probing code.
+obj-$(CONFIG_LGUEST_GUEST) += lguest_device.o
+
 # Host requires the other files, which can be a module.
 obj-$(CONFIG_LGUEST)   += lg.o
 lg-y = core.o hypercalls.o page_tables.o interrupts_and_traps.o \
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
new file mode 100644
index 000..71c6483
--- /dev/null
+++ b/drivers/lguest/lguest_device.c
@@ -0,0 +1,373 @@
+/*P:050 Lguest guests use a very simple method to describe devices.  It's a
+ * series of device descriptors contained just above the top of normal
+ * memory.
+ *
+ * We use the standard virtio device infrastructure, which provides us with a
+ * console, a network and a block driver.  Each one expects some configuration
+ * information and a virtqueue mechanism to send and receive data. :*/
+#include linux/init.h
+#include linux/bootmem.h
+#include linux/lguest_launcher.h
+#include linux/virtio.h
+#include linux/virtio_config.h
+#include linux/interrupt.h
+#include linux/virtio_ring.h
+#include linux/err.h
+#include asm/io.h
+#include asm/paravirt.h
+#include asm/lguest_hcall.h
+
+/* The pointer to our (page) of device descriptions. */
+static void *lguest_devices;
+

Update example launcher for virtio

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=17cbca2ba3de990258943d9e5a1788430ca3ad0d
Commit: 17cbca2ba3de990258943d9e5a1788430ca3ad0d
Parent: 19f1537b7b8a9a82665db3ad8210a9d954d13acd
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:24:22 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:56 2007 +1000

Update example launcher for virtio

Implements virtio-based console, network and block servers.  The block
server uses a thread so it's async, which is an improvement over the
old synchronous implementation (but a little more complex).

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c | 1143 -
 1 files changed, 681 insertions(+), 462 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 32c2eaf..7418f85 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -32,7 +32,9 @@
 #include termios.h
 #include getopt.h
 #include zlib.h
-/*L:110 We can ignore the 28 include files we need for this program, but I do
+#include assert.h
+#include sched.h
+/*L:110 We can ignore the 30 include files we need for this program, but I do
  * want to draw attention to the use of kernel-style types.
  *
  * As Linus said, C is a Spartan language, and so should your naming be.  I
@@ -44,6 +46,12 @@ typedef uint32_t u32;
 typedef uint16_t u16;
 typedef uint8_t u8;
 #include linux/lguest_launcher.h
+#include linux/pci_ids.h
+#include linux/virtio_config.h
+#include linux/virtio_net.h
+#include linux/virtio_blk.h
+#include linux/virtio_console.h
+#include linux/virtio_ring.h
 #include asm-x86/e820.h
 /*:*/
 
@@ -55,6 +63,8 @@ typedef uint8_t u8;
 #endif
 /* We can have up to 256 pages for devices. */
 #define DEVICE_PAGES 256
+/* This fits nicely in a single 4096-byte page. */
+#define VIRTQUEUE_NUM 127
 
 /*L:120 verbose is both a global flag and a macro.  The C preprocessor allows
  * this, and although I wouldn't recommend it, it works quite nicely here. */
@@ -78,8 +88,17 @@ struct device_list
fd_set infds;
int max_infd;
 
+   /* Counter to assign interrupt numbers. */
+   unsigned int next_irq;
+
+   /* Counter to print out convenient device numbers. */
+   unsigned int device_num;
+
/* The descriptor page for the devices. */
-   struct lguest_device_desc *descs;
+   u8 *descpage;
+
+   /* The tail of the last descriptor. */
+   unsigned int desc_used;
 
/* A single linked list of devices. */
struct device *dev;
@@ -87,31 +106,88 @@ struct device_list
struct device **lastdev;
 };
 
+/* The list of Guest devices, based on command line arguments. */
+static struct device_list devices;
+
 /* The device structure describes a single device. */
 struct device
 {
/* The linked-list pointer. */
struct device *next;
-   /* The descriptor for this device, as mapped into the Guest. */
+
+   /* The this device's descriptor, as mapped into the Guest. */
struct lguest_device_desc *desc;
-   /* The memory page(s) of this device, if any.  Also mapped in Guest. */
-   void *mem;
+
+   /* The name of this device, for --verbose. */
+   const char *name;
 
/* If handle_input is set, it wants to be called when this file
 * descriptor is ready. */
int fd;
bool (*handle_input)(int fd, struct device *me);
 
-   /* If handle_output is set, it wants to be called when the Guest sends
-* DMA to this key. */
-   unsigned long watch_key;
-   u32 (*handle_output)(int fd, const struct iovec *iov,
-unsigned int num, struct device *me);
+   /* Any queues attached to this device */
+   struct virtqueue *vq;
 
/* Device-specific data. */
void *priv;
 };
 
+/* The virtqueue structure describes a queue attached to a device. */
+struct virtqueue
+{
+   struct virtqueue *next;
+
+   /* Which device owns me. */
+   struct device *dev;
+
+   /* The configuration for this queue. */
+   struct lguest_vqconfig config;
+
+   /* The actual ring of buffers. */
+   struct vring vring;
+
+   /* Last available index we saw. */
+   u16 last_avail_idx;
+
+   /* The routine to call when the Guest pings us. */
+   void (*handle_output)(int fd, struct virtqueue *me);
+};
+
+/* Since guest is UP and we don't run at the same time, we don't need barriers.
+ * But I include them in the code in case others copy it. */
+#define wmb()
+
+/* Convert an iovec element to the given type.
+ *
+ * This is a fairly ugly trick: we need to know the size of the type and
+ * alignment requirement to check the pointer is kosher.  It's also nice to
+ * have the name of the type in case we report failure.
+ *
+ * Typing those three things all the time is 

Example launcher handle guests not being ready for input

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=56ae43dfe233323683248a5c553bad7160db2fa5
Commit: 56ae43dfe233323683248a5c553bad7160db2fa5
Parent: 17cbca2ba3de990258943d9e5a1788430ca3ad0d
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:24:23 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:56 2007 +1000

Example launcher handle guests not being ready for input

We currently discard console and network input when the guest has no
input buffers.  This patch changes that, so that we simply stop
listening to that fd until the guest refills its input buffers.

This is particularly important because hvc_console without interrupts
does backoff polling and so often lose characters if we discard.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |  107 ++---
 1 files changed, 57 insertions(+), 50 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 7418f85..cbf4bec 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -598,15 +598,17 @@ static void wake_parent(int pipefd, int lguest_fd)
select(devices.max_infd+1, rfds, NULL, NULL, NULL);
/* Is it a message from the Launcher? */
if (FD_ISSET(pipefd, rfds)) {
-   int ignorefd;
+   int fd;
/* If read() returns 0, it means the Launcher has
 * exited.  We silently follow. */
-   if (read(pipefd, ignorefd, sizeof(ignorefd)) == 0)
+   if (read(pipefd, fd, sizeof(fd)) == 0)
exit(0);
-   /* Otherwise it's telling us there's a problem with one
-* of the devices, and we should ignore that file
-* descriptor from now on. */
-   FD_CLR(ignorefd, devices.infds);
+   /* Otherwise it's telling us to change what file
+* descriptors we're to listen to. */
+   if (fd = 0)
+   FD_SET(fd, devices.infds);
+   else
+   FD_CLR(-fd - 1, devices.infds);
} else /* Send LHREQ_BREAK command. */
write(lguest_fd, args, sizeof(args));
}
@@ -658,18 +660,6 @@ static void *_check_pointer(unsigned long addr, unsigned 
int size,
 /* A macro which transparently hands the line number to the real function. */
 #define check_pointer(addr,size) _check_pointer(addr, size, __LINE__)
 
-/* This simply sets up an iovec array where we can put data to be discarded.
- * This happens when the Guest doesn't want or can't handle the input: we have
- * to get rid of it somewhere, and if we bury it in the ceiling space it will
- * start to smell after a week. */
-static void discard_iovec(struct iovec *iov, unsigned int *num)
-{
-   static char discard_buf[1024];
-   *num = 1;
-   iov-iov_base = discard_buf;
-   iov-iov_len = sizeof(discard_buf);
-}
-
 /* This function returns the next descriptor in the chain, or vq-vring.num. */
 static unsigned next_desc(struct virtqueue *vq, unsigned int i)
 {
@@ -812,12 +802,13 @@ static bool handle_console_input(int fd, struct device 
*dev)
 
/* First we need a console buffer from the Guests's input virtqueue. */
head = get_vq_desc(dev-vq, iov, out_num, in_num);
-   if (head == dev-vq-vring.num) {
-   /* If they're not ready for input, we warn and set up to
-* discard. */
-   warnx(console: no dma buffer!);
-   discard_iovec(iov, in_num);
-   } else if (out_num)
+
+   /* If they're not ready for input, stop listening to this file
+* descriptor.  We'll start again once they add an input buffer. */
+   if (head == dev-vq-vring.num)
+   return false;
+
+   if (out_num)
errx(1, Output buffers in console in queue?);
 
/* This is why we convert to iovecs: the readv() call uses them, and so
@@ -827,15 +818,16 @@ static bool handle_console_input(int fd, struct device 
*dev)
/* This implies that the console is closed, is /dev/null, or
 * something went terribly wrong. */
warnx(Failed to get console input, ignoring console.);
-   /* Put the input terminal back and return failure (meaning,
-* don't call us again). */
+   /* Put the input terminal back. */
restore_term();
+   /* Remove callback from input vq, so it doesn't restart us. */
+   dev-vq-handle_output = NULL;
+   /* Stop listening to this fd: don't call us again. */
return 

generalize lgread_u32/lgwrite_u32.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d37f94a28170ca656438758fca577acb49a7932
Commit: 2d37f94a28170ca656438758fca577acb49a7932
Parent: 56ae43dfe233323683248a5c553bad7160db2fa5
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:24:24 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:56 2007 +1000

generalize lgread_u32/lgwrite_u32.

Jes complains that page table code still uses lgread_u32 even though
it now uses general kernel pte types.  The best thing to do is to
generalize lgread_u32 and lgwrite_u32.

This means we lose the efficiency of getuser().  We could potentially
regain it if we used __copy_from_user instead of copy_from_user, but
I'm not certain that our range check is equivalent to access_ok() on
all platforms.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
Acked-by: Jes Sorensen [EMAIL PROTECTED]
---
 drivers/lguest/core.c |   39 ++--
 drivers/lguest/hypercalls.c   |2 +-
 drivers/lguest/interrupts_and_traps.c |2 +-
 drivers/lguest/lg.h   |   23 ---
 drivers/lguest/page_tables.c  |   10 
 drivers/lguest/segments.c |4 +-
 drivers/lguest/x86/core.c |4 +-
 7 files changed, 38 insertions(+), 46 deletions(-)

diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
index 3aec29e..35d19ae 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -145,33 +145,10 @@ int lguest_address_ok(const struct lguest *lg,
return (addr+len) / PAGE_SIZE  lg-pfn_limit  (addr+len = addr);
 }
 
-/* This is a convenient routine to get a 32-bit value from the Guest (a very
- * common operation).  Here we can see how useful the kill_lguest() routine we
- * met in the Launcher can be: we return a random value (0) instead of needing
- * to return an error. */
-u32 lgread_u32(struct lguest *lg, unsigned long addr)
-{
-   u32 val = 0;
-
-   /* Don't let them access lguest binary. */
-   if (!lguest_address_ok(lg, addr, sizeof(val))
-   || get_user(val, (u32 *)(lg-mem_base + addr)) != 0)
-   kill_guest(lg, bad read address %#lx: pfn_limit=%u 
membase=%p, addr, lg-pfn_limit, lg-mem_base);
-   return val;
-}
-
-/* Same thing for writing a value. */
-void lgwrite_u32(struct lguest *lg, unsigned long addr, u32 val)
-{
-   if (!lguest_address_ok(lg, addr, sizeof(val))
-   || put_user(val, (u32 *)(lg-mem_base + addr)) != 0)
-   kill_guest(lg, bad write address %#lx, addr);
-}
-
-/* This routine is more generic, and copies a range of Guest bytes into a
- * buffer.  If the copy_from_user() fails, we fill the buffer with zeroes, so
- * the caller doesn't end up using uninitialized kernel memory. */
-void lgread(struct lguest *lg, void *b, unsigned long addr, unsigned bytes)
+/* This routine copies memory from the Guest.  Here we can see how useful the
+ * kill_lguest() routine we met in the Launcher can be: we return a random
+ * value (all zeroes) instead of needing to return an error. */
+void __lgread(struct lguest *lg, void *b, unsigned long addr, unsigned bytes)
 {
if (!lguest_address_ok(lg, addr, bytes)
|| copy_from_user(b, lg-mem_base + addr, bytes) != 0) {
@@ -181,15 +158,15 @@ void lgread(struct lguest *lg, void *b, unsigned long 
addr, unsigned bytes)
}
 }
 
-/* Similarly, our generic routine to copy into a range of Guest bytes. */
-void lgwrite(struct lguest *lg, unsigned long addr, const void *b,
-unsigned bytes)
+/* This is the write (copy into guest) version. */
+void __lgwrite(struct lguest *lg, unsigned long addr, const void *b,
+  unsigned bytes)
 {
if (!lguest_address_ok(lg, addr, bytes)
|| copy_to_user(lg-mem_base + addr, b, bytes) != 0)
kill_guest(lg, bad write address %#lx len %u, addr, bytes);
 }
-/* (end of memory access helper routines) :*/
+/*:*/
 
 /*H:030 Let's jump straight to the the main loop which runs the Guest.
  * Remember, this is called by the Launcher reading /dev/lguest, and we keep
diff --git a/drivers/lguest/hypercalls.c b/drivers/lguest/hypercalls.c
index 3a53788..9d5184c 100644
--- a/drivers/lguest/hypercalls.c
+++ b/drivers/lguest/hypercalls.c
@@ -47,7 +47,7 @@ static void do_hcall(struct lguest *lg, struct hcall_args 
*args)
char msg[128];
/* If the lgread fails, it will call kill_guest() itself; the
 * kill_guest() with the message will be ignored. */
-   lgread(lg, msg, args-arg1, sizeof(msg));
+   __lgread(lg, msg, args-arg1, sizeof(msg));
msg[sizeof(msg)-1] = '\0';
kill_guest(lg, CRASH: %s, msg);
break;
diff --git a/drivers/lguest/interrupts_and_traps.c 
b/drivers/lguest/interrupts_and_traps.c
index 

Update lguest documentation to reflect the new virtual block device name.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1f5a29022ac66bc90cbe2a2162f56e9cd7b393ef
Commit: 1f5a29022ac66bc90cbe2a2162f56e9cd7b393ef
Parent: 2d37f94a28170ca656438758fca577acb49a7932
Author: Chris Malley [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:27:54 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:57 2007 +1000

Update lguest documentation to reflect the new virtual block device name.

Signed-off-by: Chris Malley [EMAIL PROTECTED]
Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.txt |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/lguest/lguest.txt b/Documentation/lguest/lguest.txt
index b60f0ab..7885ab2 100644
--- a/Documentation/lguest/lguest.txt
+++ b/Documentation/lguest/lguest.txt
@@ -69,7 +69,7 @@ Running Lguest:
 
 - Run an lguest as root:
 
-  Documentation/lguest/lguest 64 vmlinux --tunnet=192.168.19.1 
--block=rootfile root=/dev/lgba
+  Documentation/lguest/lguest 64 vmlinux --tunnet=192.168.19.1 
--block=rootfile root=/dev/vda
 
Explanation:
 64: the amount of memory to use, in MB.
@@ -80,10 +80,10 @@ Running Lguest:
 --tunnet=192.168.19.1: configures a tap device for networking with this
IP address.
 
---block=rootfile: a file or block device which becomes /dev/lgba
+--block=rootfile: a file or block device which becomes /dev/vda
inside the guest.
 
-root=/dev/lgba: this (and anything else on the command line) are
+root=/dev/vda: this (and anything else on the command line) are
kernel boot parameters.
 
 - Configuring networking.  I usually have the host masquerade, using
-
To unsubscribe from this list: send the line unsubscribe git-commits-head in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Revert lguest magic and use hook in head.S

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=814a0e5cdfbd384f4bf7a8443f9c3b885f413d58
Commit: 814a0e5cdfbd384f4bf7a8443f9c3b885f413d58
Parent: 1f5a29022ac66bc90cbe2a2162f56e9cd7b393ef
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:29:44 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:57 2007 +1000

Revert lguest magic and use hook in head.S

Version 2.07 of the boot protocol uses 0x23C for the hardware_subarch
field, that for lguest is 1.  This allows us to use the standard
boot entry point rather than the GenuineLguest string hack.

The standard entry point also clears the BSS and copies the boot parameters
and commandline for us, saving more code.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |   42 
 arch/x86/lguest/boot.c|   17 +---
 arch/x86/lguest/i386_head.S   |   17 +++
 3 files changed, 18 insertions(+), 58 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index cbf4bec..004c5c6 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -251,23 +251,6 @@ static void *get_pages(unsigned int num)
return addr;
 }
 
-/* To find out where to start we look for the magic Guest string, which marks
- * the code we see in lguest_asm.S.  This is a hack which we are currently
- * plotting to replace with the normal Linux entry point. */
-static unsigned long entry_point(const void *start, const void *end)
-{
-   const void *p;
-
-   /* The scan gives us the physical starting address.  We boot with
-* pagetables set up with virtual and physical the same, so that's
-* OK. */
-   for (p = start; p  end; p++)
-   if (memcmp(p, GenuineLguest, strlen(GenuineLguest)) == 0)
-   return to_guest_phys(p + strlen(GenuineLguest));
-
-   errx(1, Is this image a genuine lguest?);
-}
-
 /* This routine is used to load the kernel or initrd.  It tries mmap, but if
  * that fails (Plan 9's kernel file isn't nicely aligned on page boundaries),
  * it falls back to reading the memory in. */
@@ -303,7 +286,6 @@ static void map_at(int fd, void *addr, unsigned long 
offset, unsigned long len)
  * We return the starting address. */
 static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr)
 {
-   void *start = (void *)-1, *end = NULL;
Elf32_Phdr phdr[ehdr-e_phnum];
unsigned int i;
 
@@ -335,19 +317,13 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr 
*ehdr)
verbose(Section %i: size %i addr %p\n,
i, phdr[i].p_memsz, (void *)phdr[i].p_paddr);
 
-   /* We track the first and last address we mapped, so we can
-* tell entry_point() where to scan. */
-   if (from_guest_phys(phdr[i].p_paddr)  start)
-   start = from_guest_phys(phdr[i].p_paddr);
-   if (from_guest_phys(phdr[i].p_paddr) + phdr[i].p_filesz  end)
-   end=from_guest_phys(phdr[i].p_paddr)+phdr[i].p_filesz;
-
/* We map this section of the file at its physical address. */
map_at(elf_fd, from_guest_phys(phdr[i].p_paddr),
   phdr[i].p_offset, phdr[i].p_filesz);
}
 
-   return entry_point(start, end);
+   /* The entry point is given in the ELF header. */
+   return ehdr-e_entry;
 }
 
 /*L:160 Unfortunately the entire ELF image isn't compressed: the segments
@@ -374,7 +350,8 @@ static unsigned long unpack_bzimage(int fd)
 
verbose(Unpacked size %i addr %p\n, len, img);
 
-   return entry_point(img, img + len);
+   /* The entry point for a bzImage is always the first byte */
+   return (unsigned long)img;
 }
 
 /*L:150 A bzImage, unlike an ELF file, is not meant to be loaded.  You're
@@ -1684,8 +1661,15 @@ int main(int argc, char *argv[])
*(u32 *)(boot + 0x228) = 4096;
concat(boot + 4096, argv+optind+2);
 
-   /* The guest type value of 1 tells the Guest it's under lguest. */
-   *(int *)(boot + 0x23c) = 1;
+   /* Boot protocol version: 2.07 supports the fields for lguest. */
+   *(u16 *)(boot + 0x206) = 0x207;
+
+   /* The hardware_subarch value of 1 tells the Guest it's an lguest. */
+   *(u32 *)(boot + 0x23c) = 1;
+
+   /* Set bit 6 of the loadflags (aka. KEEP_SEGMENTS) so the entry path
+* does not try to reload segment registers. */
+   *(u8 *)(boot + 0x211) |= (1  6);
 
/* We tell the kernel to initialize the Guest: this returns the open
 * /dev/lguest file descriptor. */
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 495e46a..d2235db 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -928,18 +928,8 @@ static unsigned 

Loading bzImage directly.

2007-10-23 Thread Linux Kernel Mailing List
Gitweb: 
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=5bbf89fc260830f3f58b331d946a16b39ad1ca2d
Commit: 5bbf89fc260830f3f58b331d946a16b39ad1ca2d
Parent: 814a0e5cdfbd384f4bf7a8443f9c3b885f413d58
Author: Rusty Russell [EMAIL PROTECTED]
AuthorDate: Mon Oct 22 11:29:56 2007 +1000
Committer:  Rusty Russell [EMAIL PROTECTED]
CommitDate: Tue Oct 23 15:49:57 2007 +1000

Loading bzImage directly.

Now arch/i386/boot/compressed/head.S understands the hardware_platform 
field,
we can directly execute bzImages.  No more horrific unpacking code.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 Documentation/lguest/lguest.c |   93 +
 1 files changed, 29 insertions(+), 64 deletions(-)

diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 004c5c6..3949620 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -326,74 +326,39 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr 
*ehdr)
return ehdr-e_entry;
 }
 
-/*L:160 Unfortunately the entire ELF image isn't compressed: the segments
- * which need loading are extracted and compressed raw.  This denies us the
- * information we need to make a fully-general loader. */
-static unsigned long unpack_bzimage(int fd)
-{
-   gzFile f;
-   int ret, len = 0;
-   /* A bzImage always gets loaded at physical address 1M.  This is
-* actually configurable as CONFIG_PHYSICAL_START, but as the comment
-* there says, Don't change this unless you know what you are doing.
-* Indeed. */
-   void *img = from_guest_phys(0x10);
-
-   /* gzdopen takes our file descriptor (carefully placed at the start of
-* the GZIP header we found) and returns a gzFile. */
-   f = gzdopen(fd, rb);
-   /* We read it into memory in 64k chunks until we hit the end. */
-   while ((ret = gzread(f, img + len, 65536))  0)
-   len += ret;
-   if (ret  0)
-   err(1, reading image from bzImage);
-
-   verbose(Unpacked size %i addr %p\n, len, img);
-
-   /* The entry point for a bzImage is always the first byte */
-   return (unsigned long)img;
-}
-
 /*L:150 A bzImage, unlike an ELF file, is not meant to be loaded.  You're
- * supposed to jump into it and it will unpack itself.  We can't do that
- * because the Guest can't run the unpacking code, and adding features to
- * lguest kills puppies, so we don't want to.
+ * supposed to jump into it and it will unpack itself.  We used to have to
+ * perform some hairy magic because the unpacking code scared me.
  *
- * The bzImage is formed by putting the decompressing code in front of the
- * compressed kernel code.  So we can simple scan through it looking for the
- * first gzip header, and start decompressing from there. */
+ * Fortunately, Jeremy Fitzhardinge convinced me it wasn't that hard and wrote
+ * a small patch to jump over the tricky bits in the Guest, so now we just read
+ * the funky header so we know where in the file to load, and away we go! */
 static unsigned long load_bzimage(int fd)
 {
-   unsigned char c;
-   int state = 0;
-
-   /* GZIP header is 0x1F 0x8B method flags... compressed-by. */
-   while (read(fd, c, 1) == 1) {
-   switch (state) {
-   case 0:
-   if (c == 0x1F)
-   state++;
-   break;
-   case 1:
-   if (c == 0x8B)
-   state++;
-   else
-   state = 0;
-   break;
-   case 2 ... 8:
-   state++;
-   break;
-   case 9:
-   /* Seek back to the start of the gzip header. */
-   lseek(fd, -10, SEEK_CUR);
-   /* One final check: compressed under UNIX. */
-   if (c != 0x03)
-   state = -1;
-   else
-   return unpack_bzimage(fd);
-   }
-   }
-   errx(1, Could not find kernel in bzImage);
+   u8 hdr[1024];
+   int r;
+   /* Modern bzImages get loaded at 1M. */
+   void *p = from_guest_phys(0x10);
+
+   /* Go back to the start of the file and read the header.  It should be
+* a Linux boot header (see Documentation/i386/boot.txt) */
+   lseek(fd, 0, SEEK_SET);
+   read(fd, hdr, sizeof(hdr));
+
+   /* At offset 0x202, we expect the magic HdrS */
+   if (memcmp(hdr + 0x202, HdrS, 4) != 0)
+   errx(1, This doesn't look like a bzImage to me);
+
+   /* The byte at 0x1F1 tells us how many extra sectors of
+* header: skip over them all. */
+   lseek(fd, (unsigned long)(hdr[0x1F1]+1) * 512, SEEK_SET);
+
+   /* Now read 

  1   2   3   >