Skip to content

Commit 723ac2d

Browse files
Claudio ImbrendaVasily Gorbik
authored andcommitted
s390/entry: Pass the asce as parameter to sie64a()
Pass the guest ASCE explicitly as parameter, instead of having sie64a() take it from lowcore. This removes hidden state from lowcore, and makes things look cleaner. Signed-off-by: Claudio Imbrenda <[email protected]> Reviewed-by: Nico Boehr <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent b7a5e5d commit 723ac2d

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,11 +1029,12 @@ void kvm_arch_crypto_clear_masks(struct kvm *kvm);
10291029
void kvm_arch_crypto_set_masks(struct kvm *kvm, unsigned long *apm,
10301030
unsigned long *aqm, unsigned long *adm);
10311031

1032-
int __sie64a(phys_addr_t sie_block_phys, struct kvm_s390_sie_block *sie_block, u64 *rsa);
1032+
int __sie64a(phys_addr_t sie_block_phys, struct kvm_s390_sie_block *sie_block, u64 *rsa,
1033+
unsigned long gasce);
10331034

1034-
static inline int sie64a(struct kvm_s390_sie_block *sie_block, u64 *rsa)
1035+
static inline int sie64a(struct kvm_s390_sie_block *sie_block, u64 *rsa, unsigned long gasce)
10351036
{
1036-
return __sie64a(virt_to_phys(sie_block), sie_block, rsa);
1037+
return __sie64a(virt_to_phys(sie_block), sie_block, rsa, gasce);
10371038
}
10381039

10391040
extern char sie_exit;

arch/s390/include/asm/stacktrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ struct stack_frame {
6565
unsigned long sie_reason;
6666
unsigned long sie_flags;
6767
unsigned long sie_control_block_phys;
68+
unsigned long sie_guest_asce;
6869
};
6970
};
7071
unsigned long gprs[10];

arch/s390/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ int main(void)
6363
OFFSET(__SF_SIE_REASON, stack_frame, sie_reason);
6464
OFFSET(__SF_SIE_FLAGS, stack_frame, sie_flags);
6565
OFFSET(__SF_SIE_CONTROL_PHYS, stack_frame, sie_control_block_phys);
66+
OFFSET(__SF_SIE_GUEST_ASCE, stack_frame, sie_guest_asce);
6667
DEFINE(STACK_FRAME_OVERHEAD, sizeof(struct stack_frame));
6768
BLANK();
6869
OFFSET(__SFUSER_BACKCHAIN, stack_frame_user, back_chain);

arch/s390/kernel/entry.S

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,22 +179,20 @@ SYM_FUNC_END(__switch_to_asm)
179179
* %r2 pointer to sie control block phys
180180
* %r3 pointer to sie control block virt
181181
* %r4 guest register save area
182+
* %r5 guest asce
182183
*/
183184
SYM_FUNC_START(__sie64a)
184185
stmg %r6,%r14,__SF_GPRS(%r15) # save kernel registers
185186
lg %r12,__LC_CURRENT
186187
stg %r2,__SF_SIE_CONTROL_PHYS(%r15) # save sie block physical..
187188
stg %r3,__SF_SIE_CONTROL(%r15) # ...and virtual addresses
188189
stg %r4,__SF_SIE_SAVEAREA(%r15) # save guest register save area
190+
stg %r5,__SF_SIE_GUEST_ASCE(%r15) # save guest asce
189191
xc __SF_SIE_REASON(8,%r15),__SF_SIE_REASON(%r15) # reason code = 0
190192
mvc __SF_SIE_FLAGS(8,%r15),__TI_flags(%r12) # copy thread flags
191193
lmg %r0,%r13,0(%r4) # load guest gprs 0-13
192-
lg %r14,__LC_GMAP # get gmap pointer
193-
ltgr %r14,%r14
194-
jz .Lsie_gmap
195194
oi __LC_CPU_FLAGS+7,_CIF_SIE
196-
lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce
197-
.Lsie_gmap:
195+
lctlg %c1,%c1,__SF_SIE_GUEST_ASCE(%r15) # load primary asce
198196
lg %r14,__SF_SIE_CONTROL(%r15) # get control block pointer
199197
oi __SIE_PROG0C+3(%r14),1 # we are going into SIE now
200198
tm __SIE_PROG20+3(%r14),3 # last exit...

arch/s390/kvm/kvm-s390.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4829,7 +4829,8 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
48294829
sizeof(sie_page->pv_grregs));
48304830
}
48314831
exit_reason = sie64a(vcpu->arch.sie_block,
4832-
vcpu->run->s.regs.gprs);
4832+
vcpu->run->s.regs.gprs,
4833+
gmap_get_enabled()->asce);
48334834
if (kvm_s390_pv_cpu_is_protected(vcpu)) {
48344835
memcpy(vcpu->run->s.regs.gprs,
48354836
sie_page->pv_grregs,

arch/s390/kvm/vsie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ static int do_vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
11501150
vcpu->arch.sie_block->prog0c |= PROG_IN_SIE;
11511151
barrier();
11521152
if (!kvm_s390_vcpu_sie_inhibited(vcpu))
1153-
rc = sie64a(scb_s, vcpu->run->s.regs.gprs);
1153+
rc = sie64a(scb_s, vcpu->run->s.regs.gprs, gmap_get_enabled()->asce);
11541154
barrier();
11551155
vcpu->arch.sie_block->prog0c &= ~PROG_IN_SIE;
11561156

0 commit comments

Comments
 (0)