From patchwork Sat Jun 12 12:17:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "K.de Jong" X-Patchwork-Id: 105733 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5CCHjaa021825 for ; Sat, 12 Jun 2010 12:17:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753283Ab0FLMRb (ORCPT ); Sat, 12 Jun 2010 08:17:31 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:35434 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753025Ab0FLMRa (ORCPT ); Sat, 12 Jun 2010 08:17:30 -0400 Received: by bwz7 with SMTP id 7so956170bwz.19 for ; Sat, 12 Jun 2010 05:17:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=URYT3snyaJLzqUzG3ZL/jb68eL9wtyEtpowemXZJWys=; b=FUBXqAvxGPs59O8vxZDV+NCzKteexkQjYReYxnmWX9wTI+LnDSUP2vDnlNHTsSGAO7 Z+AgibFa+DYlFj/SmSjhEPBEBzV90db8IKEq5PIaoGTOWLjQrw97hSfExhPmgvyd1X4i jDoE1/dIXoQorQWC3XlW4kUes2tUq/bx3tWLM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=Fy1e0kfgjEcBcPArpnMMaUbklAKolVIETs/0vf2f682QkLbRrXa932895gG+vvc+5s twI3saCugKRJdNky2vDm0YelRgIuBM1fEnLfp1XDrPJ+IqCh/LB+jUU/RuOO9IlSQa7q nlmfuPQeImK9n8bVTEqkrs30q0CdLGjCyJMc4= MIME-Version: 1.0 Received: by 10.204.81.166 with SMTP id x38mr2267081bkk.88.1276345048688; Sat, 12 Jun 2010 05:17:28 -0700 (PDT) Received: by 10.204.123.200 with HTTP; Sat, 12 Jun 2010 05:17:28 -0700 (PDT) Date: Sat, 12 Jun 2010 14:17:28 +0200 X-Google-Sender-Auth: 4mZrjrxC466eZRzJD0mP01Zt9Pw Message-ID: Subject: [PATCH] These are my first patches to the kernel From: "K.de Jong" To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 12 Jun 2010 12:17:45 +0000 (UTC) diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index 4d10b1e..81b0e36 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c @@ -19,8 +19,8 @@ #include #include "irq.h" -static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head, - int assigned_dev_id) +static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev( + struct list_head *head, int assigned_dev_id) { struct list_head *ptr; struct kvm_assigned_dev_kernel *match; @@ -791,7 +791,7 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, goto out_free_irq_routing; r = kvm_set_irq_routing(kvm, entries, routing.nr, routing.flags); - out_free_irq_routing: +out_free_irq_routing: vfree(entries); break; } diff --git a/virt/kvm/coalesced_mmio.h b/virt/kvm/coalesced_mmio.h index 8a5959e..d45c5bc 100644 --- a/virt/kvm/coalesced_mmio.h +++ b/virt/kvm/coalesced_mmio.h @@ -25,9 +25,9 @@ struct kvm_coalesced_mmio_dev { int kvm_coalesced_mmio_init(struct kvm *kvm); void kvm_coalesced_mmio_free(struct kvm *kvm); int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm, - struct kvm_coalesced_mmio_zone *zone); + struct kvm_coalesced_mmio_zone *zone); int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm, - struct kvm_coalesced_mmio_zone *zone); + struct kvm_coalesced_mmio_zone *zone); #else diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index 3500dee..80f00fd 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -44,22 +44,21 @@ #include "irq.h" #if 0 -#define ioapic_debug(fmt,arg...) printk(KERN_WARNING fmt,##arg) +#define ioapic_debug(fmt, arg...) printk(KERN_WARNING fmt, ##arg) #else #define ioapic_debug(fmt, arg...) #endif static int ioapic_deliver(struct kvm_ioapic *vioapic, int irq); static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic, - unsigned long addr, - unsigned long length) + unsigned long addr, unsigned long length) { unsigned long result = 0; switch (ioapic->ioregsel) { case IOAPIC_REG_VERSION: result = ((((IOAPIC_NUM_PINS - 1) & 0xff) << 16) - | (IOAPIC_VERSION_ID & 0xff)); + | (IOAPIC_VERSION_ID & 0xff)); break; case IOAPIC_REG_APIC_ID: @@ -110,7 +109,7 @@ static void update_handled_vectors(struct kvm_ioapic *ioapic) for (i = 0; i < IOAPIC_NUM_PINS; ++i) __set_bit(ioapic->redirtbl[i].fields.vector, handled_vectors); memcpy(ioapic->handled_vectors, handled_vectors, - sizeof(handled_vectors)); + sizeof(handled_vectors)); smp_wmb(); } @@ -221,7 +220,7 @@ int kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level) } static void __kvm_ioapic_update_eoi(struct kvm_ioapic *ioapic, int vector, - int trigger_mode) + int trigger_mode) { int i; @@ -277,7 +276,7 @@ static inline int ioapic_in_range(struct kvm_ioapic *ioapic, gpa_t addr) } static int ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len, - void *val) + void *val) { struct kvm_ioapic *ioapic = to_ioapic(this); u32 result; @@ -320,7 +319,7 @@ static int ioapic_mmio_read(struct kvm_io_device *this, gpa_t addr, int len, } static int ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, - const void *val) + const void *val) { struct kvm_ioapic *ioapic = to_ioapic(this); u32 data; @@ -328,7 +327,7 @@ static int ioapic_mmio_write(struct kvm_io_device *this, gpa_t addr, int len, return -EOPNOTSUPP; ioapic_debug("ioapic_mmio_write addr=%p len=%d val=%p\n", - (void*)addr, len, val); + (void *)addr, len, val); ASSERT(!(addr & 0xf)); /* check alignment */ if (len == 4 || len == 8) diff --git a/virt/kvm/ioapic.h b/virt/kvm/ioapic.h index 0b190c3..9036de4 100644 --- a/virt/kvm/ioapic.h +++ b/virt/kvm/ioapic.h @@ -50,13 +50,13 @@ struct kvm_ioapic { }; #ifdef DEBUG -#define ASSERT(x) \ -do { \ - if (!(x)) { \ - printk(KERN_EMERG "assertion failed %s: %d: %s\n", \ - __FILE__, __LINE__, #x); \ - BUG(); \ - } \ +#define ASSERT(x)\ +do {\ + if (!(x)) {\ + printk(KERN_EMERG "assertion failed %s: %d: %s\n",\ + __FILE__, __LINE__, #x);\ + BUG();\ + } } while (0) #else #define ASSERT(x) do { } while (0) diff --git a/virt/kvm/iodev.h b/virt/kvm/iodev.h index 12fd3ca..92f436b 100644 --- a/virt/kvm/iodev.h +++ b/virt/kvm/iodev.h @@ -17,7 +17,7 @@ #define __KVM_IODEV_H__ #include -#include +#include struct kvm_io_device; diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c index a0e8880..3a5075d 100644 --- a/virt/kvm/irq_comm.c +++ b/virt/kvm/irq_comm.c @@ -163,7 +163,7 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level) irq_set[i++] = *e; rcu_read_unlock(); - while(i--) { + while (i--) { int r; r = irq_set[i].set(&irq_set[i], kvm, irq_source_id, level); if (r < 0) @@ -426,7 +426,7 @@ out: { .gsi = irq, .type = KVM_IRQ_ROUTING_IRQCHIP, \ .u.irqchip.irqchip = SELECT_PIC(irq), .u.irqchip.pin = (irq) % 8 } # define ROUTING_ENTRY2(irq) \ - IOAPIC_ROUTING_ENTRY(irq), PIC_ROUTING_ENTRY(irq) + { IOAPIC_ROUTING_ENTRY(irq), PIC_ROUTING_ENTRY(irq) } #else # define ROUTING_ENTRY2(irq) \ IOAPIC_ROUTING_ENTRY(irq) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f032806..7945231 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -48,8 +48,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -64,7 +64,7 @@ MODULE_LICENSE("GPL"); /* * Ordering of locks: * - * kvm->lock --> kvm->slots_lock --> kvm->irq_lock + * kvm->lock --> kvm->slots_lock --> kvm->irq_lock */ DEFINE_SPINLOCK(kvm_lock); @@ -625,7 +625,8 @@ int __kvm_set_memory_region(struct kvm *kvm, KVM_PAGES_PER_HPAGE(level); lpages -= base_gfn / KVM_PAGES_PER_HPAGE(level); - new.lpage_info[i] = vmalloc(lpages * sizeof(*new.lpage_info[i])); + new.lpage_info[i] = vmalloc(lpages * + sizeof(*new.lpage_info[i])); if (!new.lpage_info[i]) goto out_free; @@ -686,8 +687,8 @@ skip_lpage: * memslot will be created. * * validation of sp->gfn happens in: - * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) - * - kvm_is_visible_gfn (mmu_check_roots) + * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) + * - kvm_is_visible_gfn (mmu_check_roots) */ kvm_arch_flush_shadow(kvm); kfree(old_memslots); @@ -759,9 +760,7 @@ int kvm_set_memory_region(struct kvm *kvm, EXPORT_SYMBOL_GPL(kvm_set_memory_region); int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, - struct - kvm_userspace_memory_region *mem, - int user_alloc) + struct kvm_userspace_memory_region *mem, int user_alloc) { if (mem->slot >= KVM_MEMORY_SLOTS) return -EINVAL; @@ -769,7 +768,7 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, } int kvm_get_dirty_log(struct kvm *kvm, - struct kvm_dirty_log *log, int *is_dirty) + struct kvm_dirty_log *log, int *is_dirty) { struct kvm_memory_slot *memslot; int r, i; @@ -998,7 +997,6 @@ struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) get_page(bad_page); return bad_page; } - EXPORT_SYMBOL_GPL(gfn_to_page); void kvm_release_page_clean(struct page *page) @@ -1171,7 +1169,7 @@ int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len) int offset = offset_in_page(gpa); int ret; - while ((seg = next_segment(len, offset)) != 0) { + while ((seg = next_segment(len, offset)) != 0) { ret = kvm_clear_guest_page(kvm, gfn, offset, seg); if (ret < 0)