diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-01-02 04:46:01 -0500 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2014-04-22 07:24:47 -0400 |
commit | 3263bd163720807e68045370b70aaf38acde1598 (patch) | |
tree | 146e43d74c5f1811a730afc2ba0453a9fed8a711 /arch/s390/kvm/gaccess.h | |
parent | 645c5bc1d5b1253bf3df849edc339ec09b43371a (diff) |
KVM: s390: remove old guest access functions
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/gaccess.h')
-rw-r--r-- | arch/s390/kvm/gaccess.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h index f46e764c5b43..ed4749ecef8b 100644 --- a/arch/s390/kvm/gaccess.h +++ b/arch/s390/kvm/gaccess.h | |||
@@ -56,87 +56,6 @@ static inline unsigned long kvm_s390_logical_to_effective(struct kvm_vcpu *vcpu, | |||
56 | return ga & ((1UL << 24) - 1); | 56 | return ga & ((1UL << 24) - 1); |
57 | } | 57 | } |
58 | 58 | ||
59 | static inline void __user *__gptr_to_uptr(struct kvm_vcpu *vcpu, | ||
60 | void __user *gptr, | ||
61 | int prefixing) | ||
62 | { | ||
63 | unsigned long gaddr = (unsigned long) gptr; | ||
64 | unsigned long uaddr; | ||
65 | |||
66 | if (prefixing) | ||
67 | gaddr = kvm_s390_real_to_abs(vcpu, gaddr); | ||
68 | uaddr = gmap_fault(gaddr, vcpu->arch.gmap); | ||
69 | if (IS_ERR_VALUE(uaddr)) | ||
70 | uaddr = -EFAULT; | ||
71 | return (void __user *)uaddr; | ||
72 | } | ||
73 | |||
74 | #define get_guest(vcpu, x, gptr) \ | ||
75 | ({ \ | ||
76 | __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\ | ||
77 | int __mask = sizeof(__typeof__(*(gptr))) - 1; \ | ||
78 | int __ret; \ | ||
79 | \ | ||
80 | if (IS_ERR((void __force *)__uptr)) { \ | ||
81 | __ret = PTR_ERR((void __force *)__uptr); \ | ||
82 | } else { \ | ||
83 | BUG_ON((unsigned long)__uptr & __mask); \ | ||
84 | __ret = get_user(x, __uptr); \ | ||
85 | } \ | ||
86 | __ret; \ | ||
87 | }) | ||
88 | |||
89 | #define put_guest(vcpu, x, gptr) \ | ||
90 | ({ \ | ||
91 | __typeof__(gptr) __uptr = __gptr_to_uptr(vcpu, gptr, 1);\ | ||
92 | int __mask = sizeof(__typeof__(*(gptr))) - 1; \ | ||
93 | int __ret; \ | ||
94 | \ | ||
95 | if (IS_ERR((void __force *)__uptr)) { \ | ||
96 | __ret = PTR_ERR((void __force *)__uptr); \ | ||
97 | } else { \ | ||
98 | BUG_ON((unsigned long)__uptr & __mask); \ | ||
99 | __ret = put_user(x, __uptr); \ | ||
100 | } \ | ||
101 | __ret; \ | ||
102 | }) | ||
103 | |||
104 | static inline int __copy_guest(struct kvm_vcpu *vcpu, unsigned long to, | ||
105 | unsigned long from, unsigned long len, | ||
106 | int to_guest, int prefixing) | ||
107 | { | ||
108 | unsigned long _len, rc; | ||
109 | void __user *uptr; | ||
110 | |||
111 | while (len) { | ||
112 | uptr = to_guest ? (void __user *)to : (void __user *)from; | ||
113 | uptr = __gptr_to_uptr(vcpu, uptr, prefixing); | ||
114 | if (IS_ERR((void __force *)uptr)) | ||
115 | return -EFAULT; | ||
116 | _len = PAGE_SIZE - ((unsigned long)uptr & (PAGE_SIZE - 1)); | ||
117 | _len = min(_len, len); | ||
118 | if (to_guest) | ||
119 | rc = copy_to_user((void __user *) uptr, (void *)from, _len); | ||
120 | else | ||
121 | rc = copy_from_user((void *)to, (void __user *)uptr, _len); | ||
122 | if (rc) | ||
123 | return -EFAULT; | ||
124 | len -= _len; | ||
125 | from += _len; | ||
126 | to += _len; | ||
127 | } | ||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | #define copy_to_guest(vcpu, to, from, size) \ | ||
132 | __copy_guest(vcpu, to, (unsigned long)from, size, 1, 1) | ||
133 | #define copy_from_guest(vcpu, to, from, size) \ | ||
134 | __copy_guest(vcpu, (unsigned long)to, from, size, 0, 1) | ||
135 | #define copy_to_guest_absolute(vcpu, to, from, size) \ | ||
136 | __copy_guest(vcpu, to, (unsigned long)from, size, 1, 0) | ||
137 | #define copy_from_guest_absolute(vcpu, to, from, size) \ | ||
138 | __copy_guest(vcpu, (unsigned long)to, from, size, 0, 0) | ||
139 | |||
140 | /* | 59 | /* |
141 | * put_guest_lc, read_guest_lc and write_guest_lc are guest access functions | 60 | * put_guest_lc, read_guest_lc and write_guest_lc are guest access functions |
142 | * which shall only be used to access the lowcore of a vcpu. | 61 | * which shall only be used to access the lowcore of a vcpu. |