input: Add support for Qualcomm PMIC8XXX power key
[pandora-kernel.git] / include / linux / kvm_host.h
index 7ca831e..31ebb59 100644 (file)
 
 #include <asm/kvm_host.h>
 
+#ifndef KVM_MMIO_SIZE
+#define KVM_MMIO_SIZE 8
+#endif
+
 /*
  * vcpu->requests bit members
  */
@@ -132,7 +136,8 @@ struct kvm_vcpu {
        int mmio_read_completed;
        int mmio_is_write;
        int mmio_size;
-       unsigned char mmio_data[8];
+       int mmio_index;
+       unsigned char mmio_data[KVM_MMIO_SIZE];
        gpa_t mmio_phys_addr;
 #endif
 
@@ -291,9 +296,10 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
 }
 
 #define kvm_for_each_vcpu(idx, vcpup, kvm) \
-       for (idx = 0, vcpup = kvm_get_vcpu(kvm, idx); \
-            idx < atomic_read(&kvm->online_vcpus) && vcpup; \
-            vcpup = kvm_get_vcpu(kvm, ++idx))
+       for (idx = 0; \
+            idx < atomic_read(&kvm->online_vcpus) && \
+            (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \
+            idx++)
 
 int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
 void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
@@ -511,6 +517,7 @@ struct kvm_assigned_dev_kernel {
        struct kvm *kvm;
        spinlock_t intx_lock;
        char irq_name[32];
+       struct pci_saved_state *pci_saved_state;
 };
 
 struct kvm_irq_mask_notifier {
@@ -585,8 +592,17 @@ static inline int kvm_deassign_device(struct kvm *kvm,
 
 static inline void kvm_guest_enter(void)
 {
+       BUG_ON(preemptible());
        account_system_vtime(current);
        current->flags |= PF_VCPU;
+       /* KVM does not hold any references to rcu protected data when it
+        * switches CPU into a guest mode. In fact switching to a guest mode
+        * is very similar to exiting to userspase from rcu point of view. In
+        * addition CPU may stay in a guest mode for quite a long time (up to
+        * one time slice). Lets treat guest mode as quiescent state, just like
+        * we do with user-mode execution.
+        */
+       rcu_virt_note_context_switch(smp_processor_id());
 }
 
 static inline void kvm_guest_exit(void)