Skip to content

Commit cca00eb

Browse files
frankjaaborntraeger
authored andcommitted
KVM: s390: Cleanup initial cpu reset
The code seems to be quite old and uses lots of unneeded spaces for alignment, which doesn't really help with readability. Let's: * Get rid of the extra spaces * Remove the ULs as they are not needed on 0s * Define constants for the CR 0 and 14 initial values * Use the sizeof of the gcr array to memset it to 0 Signed-off-by: Janosch Frank <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 5568089 commit cca00eb

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ struct mcck_volatile_info {
122122
__u32 reserved;
123123
};
124124

125+
#define CR0_INITIAL_MASK (CR0_UNUSED_56 | CR0_INTERRUPT_KEY_SUBMASK | \
126+
CR0_MEASUREMENT_ALERT_SUBMASK)
127+
#define CR14_INITIAL_MASK (CR14_UNUSED_32 | CR14_UNUSED_33 | \
128+
CR14_EXTERNAL_DAMAGE_SUBMASK)
129+
125130
#define CPUSTAT_STOPPED 0x80000000
126131
#define CPUSTAT_WAIT 0x10000000
127132
#define CPUSTAT_ECALL_PEND 0x08000000

arch/s390/kvm/kvm-s390.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,19 +2847,15 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
28472847
static void kvm_s390_vcpu_initial_reset(struct kvm_vcpu *vcpu)
28482848
{
28492849
/* this equals initial cpu reset in pop, but we don't switch to ESA */
2850-
vcpu->arch.sie_block->gpsw.mask = 0UL;
2851-
vcpu->arch.sie_block->gpsw.addr = 0UL;
2850+
vcpu->arch.sie_block->gpsw.mask = 0;
2851+
vcpu->arch.sie_block->gpsw.addr = 0;
28522852
kvm_s390_set_prefix(vcpu, 0);
28532853
kvm_s390_set_cpu_timer(vcpu, 0);
2854-
vcpu->arch.sie_block->ckc = 0UL;
2855-
vcpu->arch.sie_block->todpr = 0;
2856-
memset(vcpu->arch.sie_block->gcr, 0, 16 * sizeof(__u64));
2857-
vcpu->arch.sie_block->gcr[0] = CR0_UNUSED_56 |
2858-
CR0_INTERRUPT_KEY_SUBMASK |
2859-
CR0_MEASUREMENT_ALERT_SUBMASK;
2860-
vcpu->arch.sie_block->gcr[14] = CR14_UNUSED_32 |
2861-
CR14_UNUSED_33 |
2862-
CR14_EXTERNAL_DAMAGE_SUBMASK;
2854+
vcpu->arch.sie_block->ckc = 0;
2855+
vcpu->arch.sie_block->todpr = 0;
2856+
memset(vcpu->arch.sie_block->gcr, 0, sizeof(vcpu->arch.sie_block->gcr));
2857+
vcpu->arch.sie_block->gcr[0] = CR0_INITIAL_MASK;
2858+
vcpu->arch.sie_block->gcr[14] = CR14_INITIAL_MASK;
28632859
vcpu->run->s.regs.fpc = 0;
28642860
vcpu->arch.sie_block->gbea = 1;
28652861
vcpu->arch.sie_block->pp = 0;

0 commit comments

Comments
 (0)