]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'kvm-ppc/kvm-ppc-next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Sep 2012 04:00:04 +0000 (14:00 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Sep 2012 04:00:04 +0000 (14:00 +1000)
Conflicts:
arch/powerpc/include/asm/kvm_ppc.h
arch/powerpc/kvm/e500_tlb.c
include/linux/kvm.h

1  2 
Documentation/virtual/kvm/api.txt
include/linux/kvm.h
include/linux/kvm_host.h

index b91bfd43f0071c5ed448f489696465a434a8db89,2c32651a74f187c0d98d080066ae623a730582fb..eb076cd17c0d94c98f4a4dec012ec794712725c1
@@@ -857,8 -857,7 +857,8 @@@ struct kvm_userspace_memory_region 
  };
  
  /* for kvm_memory_region::flags */
 -#define KVM_MEM_LOG_DIRTY_PAGES  1UL
 +#define KVM_MEM_LOG_DIRTY_PAGES       (1UL << 0)
 +#define KVM_MEM_READONLY      (1UL << 1)
  
  This ioctl allows the user to create or modify a guest physical memory
  slot.  When changing an existing slot, it may be moved in the guest
@@@ -874,12 -873,9 +874,12 @@@ It is recommended that the lower 21 bit
  be identical.  This allows large pages in the guest to be backed by large
  pages in the host.
  
 -The flags field supports just one flag, KVM_MEM_LOG_DIRTY_PAGES, which
 +The flags field supports two flag, KVM_MEM_LOG_DIRTY_PAGES, which
  instructs kvm to keep track of writes to memory within the slot.  See
 -the KVM_GET_DIRTY_LOG ioctl.
 +the KVM_GET_DIRTY_LOG ioctl. Another flag is KVM_MEM_READONLY when the
 +KVM_CAP_READONLY_MEM capability, it indicates the guest memory is read-only,
 +that means, guest is only allowed to read it. Writes will be posted to
 +userspace as KVM_EXIT_MMIO exits.
  
  When the KVM_CAP_SYNC_MMU capability, changes in the backing of the memory
  region are automatically reflected into the guest.  For example, an mmap()
@@@ -1194,12 -1190,15 +1194,15 @@@ struct kvm_ppc_pvinfo 
  This ioctl fetches PV specific information that need to be passed to the guest
  using the device tree or other means from vm context.
  
- For now the only implemented piece of information distributed here is an array
- of 4 instructions that make up a hypercall.
+ The hcall array defines 4 instructions that make up a hypercall.
  
  If any additional field gets added to this structure later on, a bit for that
  additional piece of information will be set in the flags bitmap.
  
+ The flags bitmap is defined as:
+    /* the host supports the ePAPR idle hcall
+    #define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
  
  4.48 KVM_ASSIGN_PCI_DEVICE
  
@@@ -1731,7 -1730,12 +1734,12 @@@ registers, find a list below
    Arch  |       Register        | Width (bits)
          |                       |
    PPC   | KVM_REG_PPC_HIOR      | 64
+   PPC   | KVM_REG_PPC_IAC1      | 64
+   PPC   | KVM_REG_PPC_IAC2      | 64
+   PPC   | KVM_REG_PPC_IAC3      | 64
+   PPC   | KVM_REG_PPC_IAC4      | 64
+   PPC   | KVM_REG_PPC_DAC1      | 64
+   PPC   | KVM_REG_PPC_DAC2      | 64
  
  4.69 KVM_GET_ONE_REG
  
@@@ -1747,7 -1751,7 +1755,7 @@@ kvm_one_reg struct passed in. On succes
  at the memory location pointed to by "addr".
  
  The list of registers accessible using this interface is identical to the
- list in 4.64.
+ list in 4.68.
  
  
  4.70 KVM_KVMCLOCK_CTRL
diff --combined include/linux/kvm.h
index d808694673f9fd65fe11923f341ed3d83daf58f7,f4f5be8dd58e1f6f9fc524ed64c2e757f5ea3598..41a9fd5c61d8a0f116967aa76e4d9ff4165d1785
@@@ -101,13 -101,9 +101,13 @@@ struct kvm_userspace_memory_region 
        __u64 userspace_addr; /* start of the userspace allocated memory */
  };
  
 -/* for kvm_memory_region::flags */
 -#define KVM_MEM_LOG_DIRTY_PAGES  1UL
 -#define KVM_MEMSLOT_INVALID      (1UL << 1)
 +/*
 + * The bit 0 ~ bit 15 of kvm_memory_region::flags are visible for userspace,
 + * other bits are reserved for kvm internal use which are defined in
 + * include/linux/kvm_host.h.
 + */
 +#define KVM_MEM_LOG_DIRTY_PAGES       (1UL << 0)
 +#define KVM_MEM_READONLY      (1UL << 1)
  
  /* for KVM_IRQ_LINE */
  struct kvm_irq_level {
@@@ -167,6 -163,7 +167,7 @@@ struct kvm_pit_config 
  #define KVM_EXIT_OSI              18
  #define KVM_EXIT_PAPR_HCALL     19
  #define KVM_EXIT_S390_UCONTROL          20
+ #define KVM_EXIT_WATCHDOG         21
  
  /* For KVM_EXIT_INTERNAL_ERROR */
  #define KVM_INTERNAL_ERROR_EMULATION 1
@@@ -477,6 -474,8 +478,8 @@@ struct kvm_ppc_smmu_info 
        struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
  };
  
+ #define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
  #define KVMIO 0xAE
  
  /* machine type bits, to be used as argument to KVM_CREATE_VM */
  #define KVM_CAP_PPC_GET_SMMU_INFO 78
  #define KVM_CAP_S390_COW 79
  #define KVM_CAP_PPC_ALLOC_HTAB 80
 -#define KVM_CAP_PPC_BOOKE_WATCHDOG 81
 +#ifdef __KVM_HAVE_READONLY_MEM
 +#define KVM_CAP_READONLY_MEM 81
 +#endif
++#define KVM_CAP_PPC_BOOKE_WATCHDOG 82
  
  #ifdef KVM_CAP_IRQ_ROUTING
  
diff --combined include/linux/kvm_host.h
index 9c0b3c3ae0a5bda874b006154d19f1e74a6bec74,7c0bbd110f963a30a3daa93e0b31c5f1781ea832..00a0a98863602ed3f8faa02ce145ec64ce2cfc35
  #define KVM_MMIO_SIZE 8
  #endif
  
 +/*
 + * The bit 16 ~ bit 31 of kvm_memory_region::flags are internally used
 + * in kvm, other bits are visible for userspace which are defined in
 + * include/linux/kvm_h.
 + */
 +#define KVM_MEMSLOT_INVALID   (1UL << 16)
 +
  /*
   * If we support unaligned MMIO, at most one fragment will be split into two:
   */
@@@ -65,7 -58,6 +65,7 @@@
  #define KVM_PFN_ERR_FAULT     (KVM_PFN_ERR_MASK)
  #define KVM_PFN_ERR_HWPOISON  (KVM_PFN_ERR_MASK + 1)
  #define KVM_PFN_ERR_BAD               (KVM_PFN_ERR_MASK + 2)
 +#define KVM_PFN_ERR_RO_FAULT  (KVM_PFN_ERR_MASK + 3)
  
  static inline bool is_error_pfn(pfn_t pfn)
  {
@@@ -82,14 -74,6 +82,14 @@@ static inline bool is_invalid_pfn(pfn_
        return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
  }
  
 +#define KVM_HVA_ERR_BAD               (PAGE_OFFSET)
 +#define KVM_HVA_ERR_RO_BAD    (PAGE_OFFSET + PAGE_SIZE)
 +
 +static inline bool kvm_is_error_hva(unsigned long addr)
 +{
 +      return addr >= PAGE_OFFSET;
 +}
 +
  #define KVM_ERR_PTR_BAD_PAGE  (ERR_PTR(-ENOENT))
  
  static inline bool is_error_page(struct page *page)
  #define KVM_REQ_IMMEDIATE_EXIT    15
  #define KVM_REQ_PMU               16
  #define KVM_REQ_PMI               17
+ #define KVM_REQ_WATCHDOG          18
  
  #define KVM_USERSPACE_IRQ_SOURCE_ID   0
  
@@@ -438,6 -423,7 +439,6 @@@ id_to_memslot(struct kvm_memslots *slot
        return slot;
  }
  
 -int kvm_is_error_hva(unsigned long addr);
  int kvm_set_memory_region(struct kvm *kvm,
                          struct kvm_userspace_memory_region *mem,
                          int user_alloc);
@@@ -465,12 -451,12 +466,12 @@@ int gfn_to_page_many_atomic(struct kvm 
  
  struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
  unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
 +unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
  void kvm_release_page_clean(struct page *page);
  void kvm_release_page_dirty(struct page *page);
  void kvm_set_page_dirty(struct page *page);
  void kvm_set_page_accessed(struct page *page);
  
 -pfn_t hva_to_pfn_atomic(unsigned long addr);
  pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn);
  pfn_t gfn_to_pfn_async(struct kvm *kvm, gfn_t gfn, bool *async,
                       bool write_fault, bool *writable);
@@@ -478,8 -464,6 +479,8 @@@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_
  pfn_t gfn_to_pfn_prot(struct kvm *kvm, gfn_t gfn, bool write_fault,
                      bool *writable);
  pfn_t gfn_to_pfn_memslot(struct kvm_memory_slot *slot, gfn_t gfn);
 +pfn_t gfn_to_pfn_memslot_atomic(struct kvm_memory_slot *slot, gfn_t gfn);
 +
  void kvm_release_pfn_dirty(pfn_t pfn);
  void kvm_release_pfn_clean(pfn_t pfn);
  void kvm_set_pfn_dirty(pfn_t pfn);
@@@ -773,12 -757,6 +774,12 @@@ __gfn_to_memslot(struct kvm_memslots *s
        return search_memslots(slots, gfn);
  }
  
 +static inline unsigned long
 +__gfn_to_hva_memslot(struct kvm_memory_slot *slot, gfn_t gfn)
 +{
 +      return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
 +}
 +
  static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
  {
        return gfn_to_memslot(kvm, gfn)->id;
@@@ -799,6 -777,12 +800,6 @@@ hva_to_gfn_memslot(unsigned long hva, s
        return slot->base_gfn + gfn_offset;
  }
  
 -static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot,
 -                                             gfn_t gfn)
 -{
 -      return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
 -}
 -
  static inline gpa_t gfn_to_gpa(gfn_t gfn)
  {
        return (gpa_t)gfn << PAGE_SHIFT;