aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-18 19:05:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-18 19:05:28 -0500
commit66dcff86ba40eebb5133cccf450878f2bba102ef (patch)
treee7eb49ad9316989a529b00303d2dd2cffa61a7f5 /arch/s390/mm
parent91ed9e8a32d9a76adc59c83f8b40024076cf8a02 (diff)
parent2c4aa55a6af070262cca425745e8e54310e96b8d (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM update from Paolo Bonzini: "3.19 changes for KVM: - spring cleaning: removed support for IA64, and for hardware- assisted virtualization on the PPC970 - ARM, PPC, s390 all had only small fixes For x86: - small performance improvements (though only on weird guests) - usual round of hardware-compliancy fixes from Nadav - APICv fixes - XSAVES support for hosts and guests. XSAVES hosts were broken because the (non-KVM) XSAVES patches inadvertently changed the KVM userspace ABI whenever XSAVES was enabled; hence, this part is going to stable. Guest support is just a matter of exposing the feature and CPUID leaves support" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (179 commits) KVM: move APIC types to arch/x86/ KVM: PPC: Book3S: Enable in-kernel XICS emulation by default KVM: PPC: Book3S HV: Improve H_CONFER implementation KVM: PPC: Book3S HV: Fix endianness of instruction obtained from HEIR register KVM: PPC: Book3S HV: Remove code for PPC970 processors KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions KVM: PPC: Book3S HV: Simplify locking around stolen time calculations arch: powerpc: kvm: book3s_paired_singles.c: Remove unused function arch: powerpc: kvm: book3s_pr.c: Remove unused function arch: powerpc: kvm: book3s.c: Remove some unused functions arch: powerpc: kvm: book3s_32_mmu.c: Remove unused function KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked KVM: PPC: Book3S HV: ptes are big endian KVM: PPC: Book3S HV: Fix inaccuracies in ICP emulation for H_IPI KVM: PPC: Book3S HV: Fix KSM memory corruption KVM: PPC: Book3S HV: Fix an issue where guest is paused on receiving HMI KVM: PPC: Book3S HV: Fix computation of tlbie operand KVM: PPC: Book3S HV: Add missing HPTE unlock KVM: PPC: BookE: Improve irq inject tracepoint arm/arm64: KVM: Require in-kernel vgic for the arch timers ...
Diffstat (limited to 'arch/s390/mm')
-rw-r--r--arch/s390/mm/pgtable.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 71c7eff2c89f..be99357d238c 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -844,7 +844,7 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
844 844
845 down_read(&mm->mmap_sem); 845 down_read(&mm->mmap_sem);
846retry: 846retry:
847 ptep = get_locked_pte(current->mm, addr, &ptl); 847 ptep = get_locked_pte(mm, addr, &ptl);
848 if (unlikely(!ptep)) { 848 if (unlikely(!ptep)) {
849 up_read(&mm->mmap_sem); 849 up_read(&mm->mmap_sem);
850 return -EFAULT; 850 return -EFAULT;
@@ -888,6 +888,45 @@ retry:
888} 888}
889EXPORT_SYMBOL(set_guest_storage_key); 889EXPORT_SYMBOL(set_guest_storage_key);
890 890
891unsigned long get_guest_storage_key(struct mm_struct *mm, unsigned long addr)
892{
893 spinlock_t *ptl;
894 pgste_t pgste;
895 pte_t *ptep;
896 uint64_t physaddr;
897 unsigned long key = 0;
898
899 down_read(&mm->mmap_sem);
900 ptep = get_locked_pte(mm, addr, &ptl);
901 if (unlikely(!ptep)) {
902 up_read(&mm->mmap_sem);
903 return -EFAULT;
904 }
905 pgste = pgste_get_lock(ptep);
906
907 if (pte_val(*ptep) & _PAGE_INVALID) {
908 key |= (pgste_val(pgste) & PGSTE_ACC_BITS) >> 56;
909 key |= (pgste_val(pgste) & PGSTE_FP_BIT) >> 56;
910 key |= (pgste_val(pgste) & PGSTE_GR_BIT) >> 48;
911 key |= (pgste_val(pgste) & PGSTE_GC_BIT) >> 48;
912 } else {
913 physaddr = pte_val(*ptep) & PAGE_MASK;
914 key = page_get_storage_key(physaddr);
915
916 /* Reflect guest's logical view, not physical */
917 if (pgste_val(pgste) & PGSTE_GR_BIT)
918 key |= _PAGE_REFERENCED;
919 if (pgste_val(pgste) & PGSTE_GC_BIT)
920 key |= _PAGE_CHANGED;
921 }
922
923 pgste_set_unlock(ptep, pgste);
924 pte_unmap_unlock(ptep, ptl);
925 up_read(&mm->mmap_sem);
926 return key;
927}
928EXPORT_SYMBOL(get_guest_storage_key);
929
891#else /* CONFIG_PGSTE */ 930#else /* CONFIG_PGSTE */
892 931
893static inline int page_table_with_pgste(struct page *page) 932static inline int page_table_with_pgste(struct page *page)