]> err.no Git - linux-2.6/log
linux-2.6
17 years agoMerge git://git.infradead.org/mtd-2.6
Linus Torvalds [Sat, 13 Oct 2007 17:12:15 +0000 (10:12 -0700)]
Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6: (91 commits)
  [MTD] [NAND] Blackfin on-chip NAND Flash Controller driver
  [MTD] [NOR] fix ctrl-alt-del can't reboot for intel flash bug
  [MTD] [NAND] Fix compiler warning in Alauda driver
  [JFFS2] Remove stray debugging printk
  [JFFS2] Handle dirents on the flash with embedded zero bytes in names.
  [JFFS2] Check for creation of dirents with embedded zero bytes in name.
  [JFFS2] Don't count all 'very dirty' blocks except in debug mode
  [JFFS2] Check whether garbage-collection actually obsoleted its victim.
  [JFFS2] Relax threshold for triggering GC due to dirty blocks.
  [MTD] [OneNAND] Fix typo related with recent commit
  [JFFS2] Trigger garbage collection when very_dirty_list size becomes excessive
  [MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.
  [MTD] [NAND] Resume method for CAFÉ NAND controller
  [MTD] [NAND] Fix PCI ident table for CAFÉ NAND controller.
  [MTD] [NAND] s3c2410: fix arch moves
  [MTD] [OneNAND] fix numerous races
  [MTD] map driver for NOR flash on the Intel Vermilion Range chipset
  [JFFS2] Fix unpoint length
  [MTD] fix CFI point method for discontiguous maps
  [MTD] MAPS: Merge Lubbock and Mainstone drivers into common PXA2xx driver
  ...

17 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm
Linus Torvalds [Sat, 13 Oct 2007 17:02:11 +0000 (10:02 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm: (106 commits)
  KVM: Replace enum by #define
  KVM: Skip pio instruction when it is emulated, not executed
  KVM: x86 emulator: popf
  KVM: x86 emulator: fix src, dst value initialization
  KVM: x86 emulator: jmp abs
  KVM: x86 emulator: lea
  KVM: X86 emulator: jump conditional short
  KVM: x86 emulator: imlpement jump conditional relative
  KVM: x86 emulator: sort opcodes into ascending order
  KVM: Improve emulation failure reporting
  KVM: x86 emulator: pushf
  KVM: x86 emulator: call near
  KVM: x86 emulator: push imm8
  KVM: VMX: Fix exit qualification width on i386
  KVM: Move main vcpu loop into subarch independent code
  KVM: VMX: Move vm entry failure handling to the exit handler
  KVM: MMU: Don't do GFP_NOWAIT allocations
  KVM: Rename kvm_arch_ops to kvm_x86_ops
  KVM: Simplify memory allocation
  KVM: Hoist SVM's get_cs_db_l_bits into core code.
  ...

17 years agoDelete filenames in comments.
Dave Jones [Sat, 13 Oct 2007 01:10:53 +0000 (21:10 -0400)]
Delete filenames in comments.

Since the x86 merge, lots of files that referenced their own filenames
are no longer correct.  Rather than keep them up to date, just delete
them, as they add no real value.

Additionally:
- fix up comment formatting in scx200_32.c
- Remove a credit from myself in setup_64.c from a time when we had no SCM
- remove longwinded history from tsc_32.c which can be figured out from
  git.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agofix sparc32 breakage (result of vmlinux.lds.S bug)
Al Viro [Sat, 13 Oct 2007 07:40:24 +0000 (08:40 +0100)]
fix sparc32 breakage (result of vmlinux.lds.S bug)

In commit 4665079cbb2a3e17de82f2ab2940b9f97f37d65e ("[NETNS]: Move some
code into __init section when CONFIG_NET_NS=n") we got a new section -
.exit.text.refok (more of 'let's tell modpost that some bogus calls are
not bogus', a-la text.init.refok).

Unfortunately, the commit in question forgot to add it to TEXT_TEXT,
with rather amusing results.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agofallout from DECLARE_MAC_BUF patches
Al Viro [Sat, 13 Oct 2007 07:30:26 +0000 (08:30 +0100)]
fallout from DECLARE_MAC_BUF patches

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agov4l: copy_to_user() is not a good method name
Al Viro [Sat, 13 Oct 2007 07:25:24 +0000 (08:25 +0100)]
v4l: copy_to_user() is not a good method name

Breaks on any target that has copy_to_user() defined as a non-trivial
macro.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agominimal build fixes for uml (fallout from x86 merge)
Al Viro [Sat, 13 Oct 2007 07:16:04 +0000 (08:16 +0100)]
minimal build fixes for uml (fallout from x86 merge)

 a) include/asm-um/arch can't just point to include/asm-$(SUBARCH) now
 b) arch/{i386,x86_64}/crypto are merged now
 c) subarch-obj needed changes
 d) cpufeature_64.h should pull "cpufeature_32.h", not <asm/cpufeature_32.h>
    since it can be included from asm-um/cpufeature.h
 e) in case of uml-i386 we need CONFIG_X86_32 for make and gcc, but not
    for Kconfig
 f) sysctl.c shouldn't do vdso_enabled for uml-i386 (actually, that one
    should be registered from corresponding arch/*/kernel/*, with ifdef
    going away; that's a separate patch, though).

With that and with Stephen's patch ("[PATCH net-2.6] uml: hard_header fix")
we have uml allmodconfig building both on i386 and amd64.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agonet core: fix kernel-doc for new function parameters
Randy Dunlap [Sat, 13 Oct 2007 04:17:49 +0000 (21:17 -0700)]
net core: fix kernel-doc for new function parameters

Fix networking code kernel-doc for newly added parameters.

Warning(linux-2.6.23-git2//net/core/sock.c:879): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:570): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:594): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:617): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:641): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:667): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:722): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:959): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:1195): No description found for parameter 'dev'
Warning(linux-2.6.23-git2//net/core/dev.c:2105): No description found for parameter 'n'
Warning(linux-2.6.23-git2//net/core/dev.c:3272): No description found for parameter 'net'
Warning(linux-2.6.23-git2//net/core/dev.c:3445): No description found for parameter 'net'
Warning(linux-2.6.23-git2//include/linux/netdevice.h:1301): No description found for parameter 'cpu'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodocbook/mcabook: fixup x86 path/file names
Randy Dunlap [Sat, 13 Oct 2007 04:17:35 +0000 (21:17 -0700)]
docbook/mcabook: fixup x86 path/file names

Fix docbook templates for new x86 path/filenames:
docproc: linux-2.6.23-git2/include/asm-i386/mca_dma.h: No such file or directory

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodocbook/kernel-api: fixup x86 path/file names
Randy Dunlap [Sat, 13 Oct 2007 04:17:23 +0000 (21:17 -0700)]
docbook/kernel-api: fixup x86 path/file names

Fix docbook templates for new x86 path/filenames.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodocbook/kernel-hacking: fixup x86 path/file names
Randy Dunlap [Sat, 13 Oct 2007 04:17:12 +0000 (21:17 -0700)]
docbook/kernel-hacking: fixup x86 path/file names

Fix docbook templates for modified x86 path/filenames.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodocbook/deviceiobook: fixup x86 path/file names
Randy Dunlap [Sat, 13 Oct 2007 04:17:00 +0000 (21:17 -0700)]
docbook/deviceiobook: fixup x86 path/file names

Fix docbook templates for new x86 path/filenames:

docproc: linux-2.6.23-git2/include/asm-i386/io.h: No such file or directory

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh64-2.6
Linus Torvalds [Sat, 13 Oct 2007 16:50:26 +0000 (09:50 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh64-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh64-2.6:
  sh64: mach-cayman: Build fixes.
  sh64: Symbol export fixups.
  sh64: linker script tidying and alignment fixups.
  sh64: Set KBUILD_IMAGE to make the rpm target happy.
  sh64: Kill off obsolete linux/blk.h reference.
  sh64: cleanup struct irqaction initializers.
  sh64: Kill off dead gdb stub symbol.
  sh64: alphanumeric display only on Cayman.
  sh64: Add defconfigs for mach-sim and mach-harp.
  sh64: update cayman defconfig.
  sh64: Tidy up Kconfig dependencies.
  sh64: Move consistent DMA routines to arch/sh64/mm/.
  sh64: Some symbol exports and build fixes.
  sh64: mach-sim: Build fixes.
  sh64: mach-harp: Build fixes.
  sh64: Kill off duplicate frame pointer option.
  sh64: Kill off dead ROM-RAM and generic boards.
  sh64: Tidy up includes for Cayman board.
  sh64: Move *_p() I/O routine variants to io.h.

17 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
Linus Torvalds [Sat, 13 Oct 2007 16:49:04 +0000 (09:49 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (124 commits)
  sh: allow building for both r2d boards in same binary.
  sh: fix r2d board detection
  sh: Discard .exit.text/.exit.data at runtime.
  sh: Fix up some section alignments in linker script.
  sh: Fix SH-4 DMAC CHCR masking.
  sh: Rip out left-over nommu cond syscall cruft.
  sh: Make kgdb i-cache flushing less inept.
  sh: kgdb section mismatches and tidying.
  sh: cleanup struct irqaction initializers.
  sh: early_printk tidying.
  video: pvr2fb: Add TV (RGB) support to Dreamcast PVR driver.
  sh: Conditionalize gUSA support.
  sh: Follow gUSA preempt changes in __switch_to().
  sh: Tidy up gUSA preempt handling.
  sh: __copy_user() optimizations for small copies.
  sh: clkfwk: Support multi-level clock propagation.
  sh: Fix URAM start address on SH7785.
  sh: Use boot_cpu_data for CPU probe.
  sh: Support extended mode TLB on SH-X3.
  sh: Bump MAX_ACTIVE_REGIONS for SH7785.
  ...

17 years agossb bus needs <linux/io.h>
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:31 +0000 (14:31 +0200)]
ssb bus needs <linux/io.h>

ssb bus needs <linux/io.h>

  linux/drivers/ssb/main.c: In function 'ssb_ssb_read16':
  linux/drivers/ssb/main.c:518: error: implicit declaration of function 'readw'
  linux/drivers/ssb/main.c: In function 'ssb_ssb_read32':
  linux/drivers/ssb/main.c:526: error: implicit declaration of function 'readl'
  linux/drivers/ssb/main.c: In function 'ssb_ssb_write16':
  linux/drivers/ssb/main.c:534: error: implicit declaration of function 'writew'
  linux/drivers/ssb/main.c: In function 'ssb_ssb_write32':
  linux/drivers/ssb/main.c:542: error: implicit declaration of function 'writel'

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agob43 wireless needs <linux/io.h>
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:30 +0000 (14:31 +0200)]
b43 wireless needs <linux/io.h>

b43 wireless needs <linux/io.h>

  linux/drivers/net/wireless/b43/pio.h: In function 'b43_pio_write':
  linux/drivers/net/wireless/b43/pio.h:89: error: implicit declaration of function 'mmiowb'

  linux/drivers/net/wireless/b43/phy.c: In function 'b43_phy_write':
  linux/drivers/net/wireless/b43/phy.c:301: error: implicit declaration of function 'mmiowb'

  linuxdrivers/net/wireless/b43/sysfs.c: In function 'b43_attr_interfmode_store':
  linuxdrivers/net/wireless/b43/sysfs.c:147: error: implicit declaration of function 'mmiowb'

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agom68k: fix net drivers after recent get_stats updates
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:29 +0000 (14:31 +0200)]
m68k: fix net drivers after recent get_stats updates

m68k: fix net drivers after recent get_stats updates

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agodm: emc_endio returns void
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:28 +0000 (14:31 +0200)]
dm: emc_endio returns void

emc_endio returns void:
  linux/drivers/md/dm-emc.c: In function 'emc_endio':
  linux/drivers/md/dm-emc.c:58: warning: 'return' with a value, in function returning void

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agom68k: Export cachectl.h
Matthew Wilcox [Sat, 13 Oct 2007 12:31:27 +0000 (14:31 +0200)]
m68k: Export cachectl.h

libffi in GCC 4.2 needs cachectl.h to do its cache flushing.  But we
don't currently export it.  I believe this patch should do the trick.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agom68k: ignore restart_syscall
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:26 +0000 (14:31 +0200)]
m68k: ignore restart_syscall

m68k: ignore restart_syscall, which is not needed on m68k.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agom68k: Atari keyboard ACIA driver cleanup
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:25 +0000 (14:31 +0200)]
m68k: Atari keyboard ACIA driver cleanup

m68k: Atari keyboard ACIA driver cleanup:
  - removed dead key autorepeat code
  - removed hardcoded initial keymap

Signed-off-by: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agom68k: Atari input drivers cleanup
Geert Uytterhoeven [Sat, 13 Oct 2007 12:31:24 +0000 (14:31 +0200)]
m68k: Atari input drivers cleanup

m68k: Atari input drivers cleanup:
  - memleak on failed init/register of input devices fixed
  - correct keycodes table (Atari keycodes are almost, but not entirely, equal
    to Linux keycodes).

Signed-off-by: Michael Schmitz <schmitz@biophys.uni-duesseldorf.de>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
David Woodhouse [Sat, 13 Oct 2007 13:58:23 +0000 (14:58 +0100)]
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6

17 years agoMerge Linux 2.6.23
David Woodhouse [Sat, 13 Oct 2007 13:43:54 +0000 (14:43 +0100)]
Merge Linux 2.6.23

17 years ago[MTD] [NAND] Blackfin on-chip NAND Flash Controller driver
Bryan Wu [Tue, 2 Oct 2007 20:56:05 +0000 (13:56 -0700)]
[MTD] [NAND] Blackfin on-chip NAND Flash Controller driver

This is the driver for latest Blackfin on-chip nand flash controller

 - use nand_chip and mtd_info common nand driver interface
 - provide both PIO and dma operation
 - compiled with ezkit bf548 configuration
 - use hardware 1-bit ECC
 - tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs

ChangeLog from try#1
 - use hweight32() instead of count_bits()
 - replace bf54x with bf5xx and BF54X with BF5XX
 - compare against plat->page_size in 2 cases when enable hardware ECC

ChangeLog from try#2
 - passed nand_test suites
 - use cpu_relax() instead of busy wait loop
 - some coding style issue pointed out by Andrew

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[MTD] [NOR] fix ctrl-alt-del can't reboot for intel flash bug
Kevin Hao [Tue, 2 Oct 2007 20:56:04 +0000 (13:56 -0700)]
[MTD] [NOR] fix ctrl-alt-del can't reboot for intel flash bug

When we press ctrl-alt-del,kernel_restart_prepare will invoke
cfi_intelext_reboot which will set flash to read array mode, but later
when device_shutdown is invoked which may put current work queue to
sleep and other process may be scheduled to running and programming
flash in not FL_READY mode again. So we can't boot up if this flash is
used for bootloader.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[MTD] [NAND] Fix compiler warning in Alauda driver
akpm@linux-foundation.org [Thu, 11 Oct 2007 07:02:06 +0000 (00:02 -0700)]
[MTD] [NAND] Fix compiler warning in Alauda driver

drivers/mtd/nand/alauda.c: In function 'alauda_bounce_read':
drivers/mtd/nand/alauda.c:412: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[JFFS2] Remove stray debugging printk
David Woodhouse [Sat, 13 Oct 2007 13:29:39 +0000 (14:29 +0100)]
[JFFS2] Remove stray debugging printk

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[JFFS2] Handle dirents on the flash with embedded zero bytes in names.
David Woodhouse [Sat, 13 Oct 2007 10:35:58 +0000 (11:35 +0100)]
[JFFS2] Handle dirents on the flash with embedded zero bytes in names.

In three places: summary scan, normal scan, REF_PRISTINE GC.

Just truncate at the NUL, since that was the correct thing to do in the
only case where this (inexplicable) breakage has been seen.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[JFFS2] Check for creation of dirents with embedded zero bytes in name.
David Woodhouse [Sat, 13 Oct 2007 10:33:50 +0000 (11:33 +0100)]
[JFFS2] Check for creation of dirents with embedded zero bytes in name.

I have no idea how this happened, but OLPC trac #4184 suggests that it
did. Catch it early.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[JFFS2] Don't count all 'very dirty' blocks except in debug mode
David Woodhouse [Sat, 13 Oct 2007 10:32:16 +0000 (11:32 +0100)]
[JFFS2] Don't count all 'very dirty' blocks except in debug mode

... where we'll actually print the count in a debug message.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[JFFS2] Check whether garbage-collection actually obsoleted its victim.
David Woodhouse [Sat, 13 Oct 2007 10:31:23 +0000 (11:31 +0100)]
[JFFS2] Check whether garbage-collection actually obsoleted its victim.

In OLPC trac #4184 we found a case where a corrupted node didn't
actually get obsoleted when we tried to garbage-collect it. So we wrote
out many million copies of it, in repeated attempts to obsolete it,
until the flash became full. Don't Do That.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[JFFS2] Relax threshold for triggering GC due to dirty blocks.
David Woodhouse [Sat, 13 Oct 2007 10:29:07 +0000 (11:29 +0100)]
[JFFS2] Relax threshold for triggering GC due to dirty blocks.

Instead of matching resv_blocks_gcmerge, which is only about 3, instead
match resv_blocks_gctrigger, which includes a proportion of the total
device size.

These ought to become tunable from userspace, at some point.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years ago[MTD] [OneNAND] Fix typo related with recent commit
Kyungmin Park [Wed, 10 Oct 2007 04:48:14 +0000 (13:48 +0900)]
[MTD] [OneNAND] Fix typo related with recent commit

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
17 years agoKVM: Replace enum by #define
Avi Kivity [Wed, 10 Oct 2007 12:03:16 +0000 (14:03 +0200)]
KVM: Replace enum by #define

Easier for existence test (#ifdef) in userspace.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Skip pio instruction when it is emulated, not executed
Avi Kivity [Sat, 15 Sep 2007 14:34:36 +0000 (17:34 +0300)]
KVM: Skip pio instruction when it is emulated, not executed

If we defer updating rip until pio instructions are executed, we have a
problem with reset:  a pio reset updates rip, and when the instruction
completes we skip the emulated instruction, pointing rip somewhere completely
unrelated.

Fix by updating rip when we see decode the instruction, not after emulation.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: popf
Nitin A Kamble [Sat, 15 Sep 2007 07:45:05 +0000 (10:45 +0300)]
KVM: x86 emulator: popf

Implement emulation of instruction:
    popf
    opcode:  0x9d

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: fix src, dst value initialization
Nitin A Kamble [Sat, 15 Sep 2007 07:43:33 +0000 (10:43 +0300)]
KVM: x86 emulator: fix src, dst value initialization

Some operand fetches are less than the machine word size and can result in
stale bits if used together with operands of different sizes.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: jmp abs
Nitin A Kamble [Sat, 15 Sep 2007 07:41:26 +0000 (10:41 +0300)]
KVM: x86 emulator: jmp abs

Implement emulation of instruction:
    jump absolute r/m
    opcode: 0xff /4

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: lea
Nitin A Kamble [Sat, 15 Sep 2007 07:35:36 +0000 (10:35 +0300)]
KVM: x86 emulator: lea

Implement emulation of instruction
    lea r16/r32, m
    opcode:  0x8d:

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: X86 emulator: jump conditional short
Nitin A Kamble [Sat, 15 Sep 2007 07:25:41 +0000 (10:25 +0300)]
KVM: X86 emulator: jump conditional short

Implement emulation of more jump conditional instructions
    jcc shortrel
    opcodes: 0x70 - 0x7f

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: imlpement jump conditional relative
Nitin A Kamble [Sat, 15 Sep 2007 07:23:07 +0000 (10:23 +0300)]
KVM: x86 emulator: imlpement jump conditional relative

Implement emulation of instruction:
    jump conditional rel
    opcodes: 0x0f 0x80 - 0x0f 0x8f

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: sort opcodes into ascending order
Nitin A Kamble [Sat, 15 Sep 2007 07:13:07 +0000 (10:13 +0300)]
KVM: x86 emulator: sort opcodes into ascending order

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Improve emulation failure reporting
Avi Kivity [Wed, 12 Sep 2007 10:21:09 +0000 (13:21 +0300)]
KVM: Improve emulation failure reporting

Report failed opcodes from all locations.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: pushf
Nitin A Kamble [Wed, 29 Aug 2007 01:22:47 +0000 (18:22 -0700)]
KVM: x86 emulator: pushf

Implement emulation of instruction
pushf
opcode: 0x9c

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: call near
Nitin A Kamble [Wed, 29 Aug 2007 01:08:37 +0000 (18:08 -0700)]
KVM: x86 emulator: call near

Implement emulation of instruction
opcode: 0xe8
call (near)

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: push imm8
Nitin A Kamble [Wed, 29 Aug 2007 00:58:52 +0000 (17:58 -0700)]
KVM: x86 emulator: push imm8

Implement the instruction

     push imm8
     opcode: 0x6a

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Fix exit qualification width on i386
He, Qing [Wed, 12 Sep 2007 06:18:28 +0000 (14:18 +0800)]
KVM: VMX: Fix exit qualification width on i386

According to Intel Software Developer's Manual, Vol. 3B, Appendix H.4.2,
exit qualification should be of natural width. However, current code
uses u64 as the data type for this register, which occasionally
introduces invalid value to VMExit handling logics. This patch fixes
this bug.

I have tested Windows and Linux guest on i386 host, and they can boot
successfully with this patch.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Move main vcpu loop into subarch independent code
Avi Kivity [Mon, 10 Sep 2007 15:10:54 +0000 (18:10 +0300)]
KVM: Move main vcpu loop into subarch independent code

This simplifies adding new code as well as reducing overall code size.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Move vm entry failure handling to the exit handler
Avi Kivity [Mon, 10 Sep 2007 14:27:03 +0000 (17:27 +0300)]
KVM: VMX: Move vm entry failure handling to the exit handler

This will help moving the main loop to subarch independent code.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: MMU: Don't do GFP_NOWAIT allocations
Avi Kivity [Mon, 10 Sep 2007 08:28:17 +0000 (11:28 +0300)]
KVM: MMU: Don't do GFP_NOWAIT allocations

Before preempt notifiers, kvm needed to allocate memory with GFP_NOWAIT so
as not to have to enable preemption and take a heavyweight exit.  On oom, we'd
fall back to a GFP_KERNEL allocation.

With preemption notifiers, we can do a GFP_KERNEL allocation, and perform
the heavyweight exit only if the kernel decides to put us to sleep.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Rename kvm_arch_ops to kvm_x86_ops
Christian Ehrhardt [Sun, 9 Sep 2007 12:41:59 +0000 (15:41 +0300)]
KVM: Rename kvm_arch_ops to kvm_x86_ops

This patch just renames the current (misnamed) _arch namings to _x86 to
ensure better readability when a real arch layer takes place.

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Simplify memory allocation
Laurent Vivier [Thu, 30 Aug 2007 12:56:21 +0000 (14:56 +0200)]
KVM: Simplify memory allocation

The mutex->splinlock convertion alllows us to make some code simplifications.
As we can keep the lock longer, we don't have to release it and then
have to check if the environment has not been modified before re-taking it. We
can remove kvm->busy and kvm->memory_config_version.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Hoist SVM's get_cs_db_l_bits into core code.
Rusty Russell [Wed, 5 Sep 2007 15:21:32 +0000 (01:21 +1000)]
KVM: Hoist SVM's get_cs_db_l_bits into core code.

SVM gets the DB and L bits for the cs by decoding the segment.  This
is in fact the completely generic code, so hoist it for kvm-lite to use.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Keep control regs in sync
Rusty Russell [Wed, 5 Sep 2007 15:20:38 +0000 (01:20 +1000)]
KVM: Keep control regs in sync

We don't update the vcpu control registers in various places.  We
should do so.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Clean up unloved invlpg emulation
Rusty Russell [Sun, 9 Sep 2007 11:12:54 +0000 (14:12 +0300)]
KVM: Clean up unloved invlpg emulation

invlpg shouldn't fetch the "src" address, since it may not be valid,
however SVM's "solution" which neuters emulation of all group 7
instruction is horrible and breaks kvm-lite.  The simplest fix is to
put a special check in for invlpg.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Remove the unused invlpg member of struct kvm_arch_ops.
Rusty Russell [Sun, 9 Sep 2007 11:10:57 +0000 (14:10 +0300)]
KVM: Remove the unused invlpg member of struct kvm_arch_ops.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Set the ET flag in CR0 after initializing FX
Amit Shah [Sat, 25 Aug 2007 08:35:52 +0000 (11:35 +0300)]
KVM: Set the ET flag in CR0 after initializing FX

This was missed when moving stuff around in fbc4f2e

Fixes Solaris guests and bug #1773613

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: enable in-kernel APIC INIT/SIPI handling
He, Qing [Mon, 3 Sep 2007 14:07:41 +0000 (17:07 +0300)]
KVM: enable in-kernel APIC INIT/SIPI handling

This patch enables INIT/SIPI handling using in-kernel APIC by
introducing a ->mp_state field to emulate the SMP state transition.

[avi: remove smp_processor_id() warning]

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Xin Li <xin.b.li@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: round robin for APIC lowest priority delivery mode
He, Qing [Mon, 3 Sep 2007 14:01:36 +0000 (17:01 +0300)]
KVM: round robin for APIC lowest priority delivery mode

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: deliver PIC interrupt only to vcpu0
Qing He [Mon, 17 Sep 2007 06:47:13 +0000 (14:47 +0800)]
KVM: deliver PIC interrupt only to vcpu0

This patch changes the PIC interrupts delivery. Now it is only delivered
to vcpu0 when either condition is met (on vcpu0):
  1. local APIC is hardware disabled
  2. LVT0 is unmasked and configured to delivery mode ExtInt

It fixes the 2x faster wall clock on x86_64 and SMP i386 Linux guests

Signed-off-by: Eddie (Yaozu) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: disable tpr/cr8 sync when in-kernel APIC is used
He, Qing [Thu, 30 Aug 2007 09:04:26 +0000 (17:04 +0800)]
KVM: disable tpr/cr8 sync when in-kernel APIC is used

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Migrate lapic hrtimer when vcpu moves to another cpu
Eddie Dong [Mon, 3 Sep 2007 13:15:12 +0000 (16:15 +0300)]
KVM: Migrate lapic hrtimer when vcpu moves to another cpu

This reduces overhead by accessing cachelines from the wrong node, as well
as simplifying locking.

[Qing: fix for inactive or expired one-shot timer]

Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Keep track of missed timer irq injections
Eddie Dong [Mon, 3 Sep 2007 13:56:58 +0000 (16:56 +0300)]
KVM: Keep track of missed timer irq injections

APIC timer IRQ is set every time when a certain period
expires at host time, but the guest may be descheduled
at that time and thus the irq be overwritten by later fire.
This patch keep track of firing irq numbers and decrease
only when the IRQ is injected to guest or buffered in
APIC.

Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Use shadow TPR/cr8 for 64-bits guests
Yang, Sheng [Wed, 12 Sep 2007 10:03:11 +0000 (18:03 +0800)]
KVM: VMX: Use shadow TPR/cr8 for 64-bits guests

This patch enables TPR shadow of VMX on CR8 access. 64bit Windows using
CR8 access TPR frequently. The TPR shadow can improve the performance of
access TPR by not causing vmexit.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: pending irq save/restore
Eddie Dong [Mon, 6 Aug 2007 13:29:07 +0000 (16:29 +0300)]
KVM: pending irq save/restore

Add in kernel irqchip save/restore support for pending vectors.

[avi: fix compile warning on i386]
[avi: remove printk]

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: in-kernel LAPIC save and restore support
Eddie Dong [Thu, 6 Sep 2007 09:22:56 +0000 (12:22 +0300)]
KVM: in-kernel LAPIC save and restore support

This patch adds a new vcpu-based IOCTL to save and restore the local
apic registers for a single vcpu. The kernel only copies the apic page as
a whole, extraction of registers is left to userspace side. On restore, the
APIC timer is restarted from the initial count, this introduces a little
delay, but works fine.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: in-kernel IOAPIC save and restore support
He, Qing [Sun, 5 Aug 2007 07:49:16 +0000 (10:49 +0300)]
KVM: in-kernel IOAPIC save and restore support

This patch adds support for in-kernel ioapic save and restore (to
and from userspace). It uses the same get/set_irqchip ioctl as
in-kernel PIC.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Bypass irq_pending get/set when using in kernel irqchip
He, Qing [Thu, 2 Aug 2007 11:03:07 +0000 (14:03 +0300)]
KVM: Bypass irq_pending get/set when using in kernel irqchip

vcpu->irq_pending is saved in get/set_sreg IOCTL, but when in-kernel
local APIC is used, doing this may occasionally overwrite vcpu->apic to
an invalid value, as in the vm restore path.

Signed-off-by: Qing He <qing.he@intel.com>
17 years agoKVM: Add get/set irqchip ioctls for in-kernel PIC live migration support
He, Qing [Thu, 26 Jul 2007 08:05:18 +0000 (11:05 +0300)]
KVM: Add get/set irqchip ioctls for in-kernel PIC live migration support

This patch adds two new ioctls to dump and write kernel irqchips for
save/restore and live migration. PIC s/r and l/m is implemented in this
patch.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Protect in-kernel pio using kvm->lock
Eddie Dong [Sun, 22 Jul 2007 07:36:31 +0000 (10:36 +0300)]
KVM: Protect in-kernel pio using kvm->lock

pio operation and IRQ_LINE kvm_vm_ioctl is not kvm->lock
protected.  Add lock to same with IOAPIC MMIO operations.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Emulate hlt in the kernel
Eddie Dong [Wed, 18 Jul 2007 09:15:21 +0000 (12:15 +0300)]
KVM: Emulate hlt in the kernel

By sleeping in the kernel when hlt is executed, we simplify the in-kernel
guest interrupt path considerably.

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: In-kernel I/O APIC model
Eddie Dong [Wed, 18 Jul 2007 09:03:39 +0000 (12:03 +0300)]
KVM: In-kernel I/O APIC model

This allows in-kernel host-side device drivers to raise guest interrupts
without going to userspace.

[avi: fix level-triggered interrupt redelivery on eoi]
[avi: add missing #include]
[avi: avoid redelivery of edge-triggered interrupt]
[avi: implement polarity]
[avi: don't deliver edge-triggered interrupts when unmasking]
[avi: fix host oops on invalid guest access]

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Emulate local APIC in kernel
Eddie Dong [Wed, 12 Sep 2007 07:58:04 +0000 (10:58 +0300)]
KVM: Emulate local APIC in kernel

Because lightweight exits (exits which don't involve userspace) are many
times faster than heavyweight exits, it makes sense to emulate high usage
devices in the kernel.  The local APIC is one such device, especially for
Windows and for SMP, so we add an APIC model to kvm.

It also allows in-kernel host-side drivers to inject interrupts without
going through userspace.

[compile fix on i386 from Jindrich Makovicka]

Signed-off-by: Yaozu (Eddie) Dong <Eddie.Dong@intel.com>
Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Define and use cr8 access functions
Eddie Dong [Wed, 18 Jul 2007 08:34:57 +0000 (11:34 +0300)]
KVM: Define and use cr8 access functions

This patch is to wrap APIC base register and CR8 operation which can
provide a unique API for user level irqchip and kernel irqchip.
This is a preparation of merging lapic/ioapic patch.

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Add support for in-kernel PIC emulation
Eddie Dong [Fri, 6 Jul 2007 09:20:49 +0000 (12:20 +0300)]
KVM: Add support for in-kernel PIC emulation

Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Split segments reload in vmx_load_host_state()
Laurent Vivier [Thu, 23 Aug 2007 14:33:11 +0000 (16:33 +0200)]
KVM: VMX: Split segments reload in vmx_load_host_state()

vmx_load_host_state() bundles fs, gs, ldt, and tss reloading into
one in the hope that it is infrequent. With smp guests, fs reloading is
frequent due to fs being used by threads.

Unbundle the reloads so reduce expensive gs reloads.

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: X86 emulator: fix 'push reg' writeback
Avi Kivity [Wed, 22 Aug 2007 15:09:29 +0000 (18:09 +0300)]
KVM: X86 emulator: fix 'push reg' writeback

Pointed out by Rusty Russell.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Support more memory slots
Izik Eidus [Mon, 20 Aug 2007 15:11:00 +0000 (18:11 +0300)]
KVM: Support more memory slots

Needed for mapping memory at 4GB.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: allow rmode_tss_base() to work with >2G of guest memory
Izik Eidus [Sun, 19 Aug 2007 19:24:58 +0000 (22:24 +0300)]
KVM: VMX: allow rmode_tss_base() to work with >2G of guest memory

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: implement 'push reg' (opcodes 0x50-0x57)
Nitin A Kamble [Sun, 19 Aug 2007 08:07:06 +0000 (11:07 +0300)]
KVM: x86 emulator: implement 'push reg' (opcodes 0x50-0x57)

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: Implement 'jmp rel short' instruction (opcode 0xeb)
Nitin A Kamble [Sun, 19 Aug 2007 08:03:13 +0000 (11:03 +0300)]
KVM: x86 emulator: Implement 'jmp rel short' instruction (opcode 0xeb)

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: implement 'jmp rel' instruction (opcode 0xe9)
Nitin A Kamble [Sun, 19 Aug 2007 08:00:36 +0000 (11:00 +0300)]
KVM: x86 emulator: implement 'jmp rel' instruction (opcode 0xe9)

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: x86 emulator: implement 'and $imm, %{al|ax|eax}'
Nitin A Kamble [Fri, 17 Aug 2007 12:17:41 +0000 (15:17 +0300)]
KVM: x86 emulator: implement 'and $imm, %{al|ax|eax}'

Implement emulation of instruction
    and al imm8 (opcode 0x24)
    and ax/eax imm16/imm32 (opcode 0x25)

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Communicate cr8 changes to userspace
Yang, Sheng [Thu, 16 Aug 2007 10:01:00 +0000 (13:01 +0300)]
KVM: Communicate cr8 changes to userspace

This allows running 64-bit Windows.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Close minor race in signal handling
Avi Kivity [Wed, 15 Aug 2007 12:23:34 +0000 (15:23 +0300)]
KVM: Close minor race in signal handling

We need to check for signals inside the critical section, otherwise a
signal can be sent which we will not notice.  Also move the check
before entry, so that if the signal happens before the first entry,
we exit immediately instead of waiting for something to happen to the
guest.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Clean up kvm_setup_pio()
Laurent Vivier [Sun, 5 Aug 2007 07:43:32 +0000 (10:43 +0300)]
KVM: Clean up kvm_setup_pio()

Split kvm_setup_pio() into two functions, one to setup in/out pio
(kvm_emulate_pio()) and one to setup ins/outs pio (kvm_emulate_pio_string()).

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Cleanup string I/O instruction emulation
Laurent Vivier [Sun, 5 Aug 2007 07:36:40 +0000 (10:36 +0300)]
KVM: Cleanup string I/O instruction emulation

Both vmx and svm decode the I/O instructions, and both botch the job,
requiring the instruction prefixes to be fetched in order to completely
decode the instruction.

So, if we see a string I/O instruction, use the x86 emulator to decode it,
as it already has all the prefix decoding machinery.

This patch defines ins/outs opcodes in x86_emulate.c and calls
emulate_instruction() from io_interception() (svm.c) and from handle_io()
(vmx.c).  It removes all vmx/svm prefix instruction decoders
(get_addr_size(), io_get_override(), io_address(), get_io_count())

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Remove useless assignment
Laurent Vivier [Wed, 1 Aug 2007 18:51:09 +0000 (21:51 +0300)]
KVM: Remove useless assignment

Line 1809 of kvm_main.c is useless, value is overwritten in line 1815:

1809         now = min(count, PAGE_SIZE / size);
1810
1811         if (!down)
1812                 in_page = PAGE_SIZE - offset_in_page(address);
1813         else
1814                 in_page = offset_in_page(address) + size;
1815         now = min(count, (unsigned long)in_page / size);
1816         if (!now) {

Signed-off-by: Laurent Vivier <Laurent.Vivier@bull.net>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Remove a duplicated ia32e mode vm entry control
Li, Xin B [Wed, 1 Aug 2007 18:49:10 +0000 (21:49 +0300)]
KVM: VMX: Remove a duplicated ia32e mode vm entry control

Remove a duplicated ia32e mode VM Entry control definition and use the
proper one.

Signed-off-by: Xin Li <xin.b.li@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Use kmem_cache_free for kmem_cache_zalloc'ed objects
Rusty Russell [Wed, 1 Aug 2007 04:46:11 +0000 (14:46 +1000)]
KVM: Use kmem_cache_free for kmem_cache_zalloc'ed objects

We use kfree in svm.c and vmx.c, and this works, but it could break at
any time.  kfree() is supposed to match up with kmalloc().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Add and use pr_unimpl for standard formatting of unimplemented features
Rusty Russell [Wed, 1 Aug 2007 00:48:02 +0000 (10:48 +1000)]
KVM: Add and use pr_unimpl for standard formatting of unimplemented features

All guest-invokable printks should be ratelimited to prevent malicious
guests from flooding logs.  This is a start.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Remove unneeded kvm_dev_open and kvm_dev_release functions.
Rusty Russell [Wed, 1 Aug 2007 00:17:06 +0000 (10:17 +1000)]
KVM: Remove unneeded kvm_dev_open and kvm_dev_release functions.

Devices don't need open or release functions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Remove stat_set from debugfs
Rusty Russell [Wed, 1 Aug 2007 00:12:22 +0000 (10:12 +1000)]
KVM: Remove stat_set from debugfs

We shouldn't define stat_set on the debug attributes, since that will
cause silent failure on writing: without a set argument, userspace
will get -EACCESS.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Fix defined but not used warning in drivers/kvm/vmx.c
Gabriel C [Wed, 1 Aug 2007 14:23:10 +0000 (16:23 +0200)]
KVM: Fix defined but not used warning in drivers/kvm/vmx.c

move_msr_up() is used only on X86_64 and generates a warning on !X86_64

Signed-off-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Remove redundant alloc_vmcs_cpu declaration
Rusty Russell [Tue, 31 Jul 2007 10:46:12 +0000 (20:46 +1000)]
KVM: Remove redundant alloc_vmcs_cpu declaration

alloc_vmcs_cpu is already declared (static) above, no need to
redeclare.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: SVM: Make set_msr_interception more reliable
Rusty Russell [Tue, 31 Jul 2007 10:42:42 +0000 (20:42 +1000)]
KVM: SVM: Make set_msr_interception more reliable

set_msr_interception() is used by svm to set up which MSRs should be
intercepted.  It can only fail if someone has changed the code to try
to intercept an MSR without updating the array of ranges.

The return value is ignored anyway: it should just BUG() if it doesn't
work.  (A build-time failure would be better, but that's tricky).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Cleanup mark_page_dirty
Rusty Russell [Tue, 31 Jul 2007 10:41:14 +0000 (20:41 +1000)]
KVM: Cleanup mark_page_dirty

For some reason, mark_page_dirty open-codes __gfn_to_memslot().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Don't assign vcpu->cr3 if it's invalid: check first, set last
Rusty Russell [Tue, 31 Jul 2007 10:45:03 +0000 (20:45 +1000)]
KVM: Don't assign vcpu->cr3 if it's invalid: check first, set last

sSigned-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Add cpu consistency check
Yang, Sheng [Tue, 31 Jul 2007 11:23:01 +0000 (14:23 +0300)]
KVM: VMX: Add cpu consistency check

All the physical CPUs on the board should support the same VMX feature
set.  Add check_processor_compatibility to kvm_arch_ops for the consistency
check.

Signed-off-by: Sheng Yang <sheng.yang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>