aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/kvm_host.h4
-rw-r--r--arch/s390/kvm/diag.c2
-rw-r--r--arch/s390/kvm/gaccess.h8
-rw-r--r--arch/s390/kvm/kvm-s390.c10
-rw-r--r--arch/s390/kvm/kvm-s390.h8
-rw-r--r--arch/s390/kvm/priv.c3
6 files changed, 22 insertions, 13 deletions
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index dc182a5b02b7..a27f5007062a 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -82,7 +82,9 @@ struct sca_block {
82 82
83struct kvm_s390_sie_block { 83struct kvm_s390_sie_block {
84 atomic_t cpuflags; /* 0x0000 */ 84 atomic_t cpuflags; /* 0x0000 */
85 __u32 prefix; /* 0x0004 */ 85 __u32 : 1; /* 0x0004 */
86 __u32 prefix : 18;
87 __u32 : 13;
86 __u8 reserved08[4]; /* 0x0008 */ 88 __u8 reserved08[4]; /* 0x0008 */
87#define PROG_IN_SIE (1<<0) 89#define PROG_IN_SIE (1<<0)
88 __u32 prog0c; /* 0x000c */ 90 __u32 prog0c; /* 0x000c */
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 004d385d9519..0161675878a2 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -23,7 +23,7 @@
23static int diag_release_pages(struct kvm_vcpu *vcpu) 23static int diag_release_pages(struct kvm_vcpu *vcpu)
24{ 24{
25 unsigned long start, end; 25 unsigned long start, end;
26 unsigned long prefix = vcpu->arch.sie_block->prefix; 26 unsigned long prefix = kvm_s390_get_prefix(vcpu);
27 27
28 start = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4]; 28 start = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
29 end = vcpu->run->s.regs.gprs[vcpu->arch.sie_block->ipa & 0xf] + 4096; 29 end = vcpu->run->s.regs.gprs[vcpu->arch.sie_block->ipa & 0xf] + 4096;
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index 68db43e4254f..a07ee08ac478 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -30,7 +30,7 @@
30static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu, 30static inline unsigned long kvm_s390_real_to_abs(struct kvm_vcpu *vcpu,
31 unsigned long gra) 31 unsigned long gra)
32{ 32{
33 unsigned long prefix = vcpu->arch.sie_block->prefix; 33 unsigned long prefix = kvm_s390_get_prefix(vcpu);
34 34
35 if (gra < 2 * PAGE_SIZE) 35 if (gra < 2 * PAGE_SIZE)
36 gra += prefix; 36 gra += prefix;
@@ -99,7 +99,7 @@ static inline unsigned long kvm_s390_logical_to_effective(struct kvm_vcpu *vcpu,
99 unsigned long __gpa; \ 99 unsigned long __gpa; \
100 \ 100 \
101 __gpa = (unsigned long)(gra); \ 101 __gpa = (unsigned long)(gra); \
102 __gpa += __vcpu->arch.sie_block->prefix; \ 102 __gpa += kvm_s390_get_prefix(__vcpu); \
103 kvm_write_guest(__vcpu->kvm, __gpa, &__x, sizeof(__x)); \ 103 kvm_write_guest(__vcpu->kvm, __gpa, &__x, sizeof(__x)); \
104}) 104})
105 105
@@ -124,7 +124,7 @@ static inline __must_check
124int write_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data, 124int write_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data,
125 unsigned long len) 125 unsigned long len)
126{ 126{
127 unsigned long gpa = gra + vcpu->arch.sie_block->prefix; 127 unsigned long gpa = gra + kvm_s390_get_prefix(vcpu);
128 128
129 return kvm_write_guest(vcpu->kvm, gpa, data, len); 129 return kvm_write_guest(vcpu->kvm, gpa, data, len);
130} 130}
@@ -150,7 +150,7 @@ static inline __must_check
150int read_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data, 150int read_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data,
151 unsigned long len) 151 unsigned long len)
152{ 152{
153 unsigned long gpa = gra + vcpu->arch.sie_block->prefix; 153 unsigned long gpa = gra + kvm_s390_get_prefix(vcpu);
154 154
155 return kvm_read_guest(vcpu->kvm, gpa, data, len); 155 return kvm_read_guest(vcpu->kvm, gpa, data, len);
156} 156}
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 2c243124a4e2..e519860c6031 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -753,7 +753,7 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long address)
753 753
754 kvm_for_each_vcpu(i, vcpu, kvm) { 754 kvm_for_each_vcpu(i, vcpu, kvm) {
755 /* match against both prefix pages */ 755 /* match against both prefix pages */
756 if (vcpu->arch.sie_block->prefix == (address & ~0x1000UL)) { 756 if (kvm_s390_get_prefix(vcpu) == (address & ~0x1000UL)) {
757 VCPU_EVENT(vcpu, 2, "gmap notifier for %lx", address); 757 VCPU_EVENT(vcpu, 2, "gmap notifier for %lx", address);
758 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu); 758 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
759 exit_sie_sync(vcpu); 759 exit_sie_sync(vcpu);
@@ -1017,7 +1017,7 @@ retry:
1017 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) { 1017 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) {
1018 int rc; 1018 int rc;
1019 rc = gmap_ipte_notify(vcpu->arch.gmap, 1019 rc = gmap_ipte_notify(vcpu->arch.gmap,
1020 vcpu->arch.sie_block->prefix, 1020 kvm_s390_get_prefix(vcpu),
1021 PAGE_SIZE * 2); 1021 PAGE_SIZE * 2);
1022 if (rc) 1022 if (rc)
1023 return rc; 1023 return rc;
@@ -1338,7 +1338,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1338 1338
1339 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask; 1339 kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
1340 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr; 1340 kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
1341 kvm_run->s.regs.prefix = vcpu->arch.sie_block->prefix; 1341 kvm_run->s.regs.prefix = kvm_s390_get_prefix(vcpu);
1342 memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128); 1342 memcpy(&kvm_run->s.regs.crs, &vcpu->arch.sie_block->gcr, 128);
1343 1343
1344 if (vcpu->sigset_active) 1344 if (vcpu->sigset_active)
@@ -1357,6 +1357,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
1357int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long gpa) 1357int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long gpa)
1358{ 1358{
1359 unsigned char archmode = 1; 1359 unsigned char archmode = 1;
1360 unsigned int px;
1360 u64 clkcomp; 1361 u64 clkcomp;
1361 int rc; 1362 int rc;
1362 1363
@@ -1375,8 +1376,9 @@ int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long gpa)
1375 vcpu->run->s.regs.gprs, 128); 1376 vcpu->run->s.regs.gprs, 128);
1376 rc |= write_guest_abs(vcpu, gpa + offsetof(struct save_area, psw), 1377 rc |= write_guest_abs(vcpu, gpa + offsetof(struct save_area, psw),
1377 &vcpu->arch.sie_block->gpsw, 16); 1378 &vcpu->arch.sie_block->gpsw, 16);
1379 px = kvm_s390_get_prefix(vcpu);
1378 rc |= write_guest_abs(vcpu, gpa + offsetof(struct save_area, pref_reg), 1380 rc |= write_guest_abs(vcpu, gpa + offsetof(struct save_area, pref_reg),
1379 &vcpu->arch.sie_block->prefix, 4); 1381 &px, 4);
1380 rc |= write_guest_abs(vcpu, 1382 rc |= write_guest_abs(vcpu,
1381 gpa + offsetof(struct save_area, fp_ctrl_reg), 1383 gpa + offsetof(struct save_area, fp_ctrl_reg),
1382 &vcpu->arch.guest_fpregs.fpc, 4); 1384 &vcpu->arch.guest_fpregs.fpc, 4);
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 87edfc919db9..a8655ed31616 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -61,9 +61,15 @@ static inline int kvm_is_ucontrol(struct kvm *kvm)
61#endif 61#endif
62} 62}
63 63
64#define GUEST_PREFIX_SHIFT 13
65static inline u32 kvm_s390_get_prefix(struct kvm_vcpu *vcpu)
66{
67 return vcpu->arch.sie_block->prefix << GUEST_PREFIX_SHIFT;
68}
69
64static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix) 70static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix)
65{ 71{
66 vcpu->arch.sie_block->prefix = prefix & 0x7fffe000u; 72 vcpu->arch.sie_block->prefix = prefix >> GUEST_PREFIX_SHIFT;
67 vcpu->arch.sie_block->ihcpu = 0xffff; 73 vcpu->arch.sie_block->ihcpu = 0xffff;
68 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu); 74 kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu);
69} 75}
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index d99f5f0305a0..6296159ac883 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -119,8 +119,7 @@ static int handle_store_prefix(struct kvm_vcpu *vcpu)
119 if (operand2 & 3) 119 if (operand2 & 3)
120 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION); 120 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
121 121
122 address = vcpu->arch.sie_block->prefix; 122 address = kvm_s390_get_prefix(vcpu);
123 address = address & 0x7fffe000u;
124 123
125 /* get the value */ 124 /* get the value */
126 rc = write_guest(vcpu, operand2, &address, sizeof(address)); 125 rc = write_guest(vcpu, operand2, &address, sizeof(address));