mirror of
https://github.com/torvalds/linux
synced 2024-09-16 00:58:07 +00:00
s390/mm: move translation-exception identification structure to fault.h
Move translation-exception identification structure to new fault.h header file, change it to a union, and change existing kvm code accordingly. The new union will be used by subsequent patches. Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
parent
4416d2ed81
commit
44ae766353
28
arch/s390/include/asm/fault.h
Normal file
28
arch/s390/include/asm/fault.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright IBM Corp. 1999, 2023
|
||||
*/
|
||||
#ifndef _ASM_S390_FAULT_H
|
||||
#define _ASM_S390_FAULT_H
|
||||
|
||||
union teid {
|
||||
unsigned long val;
|
||||
struct {
|
||||
unsigned long addr : 52; /* Translation-exception Address */
|
||||
unsigned long fsi : 2; /* Access Exception Fetch/Store Indication */
|
||||
unsigned long : 2;
|
||||
unsigned long b56 : 1;
|
||||
unsigned long : 3;
|
||||
unsigned long b60 : 1;
|
||||
unsigned long b61 : 1;
|
||||
unsigned long as : 2; /* ASCE Identifier */
|
||||
};
|
||||
};
|
||||
|
||||
enum {
|
||||
TEID_FSI_UNKNOWN = 0, /* Unknown whether fetch or store */
|
||||
TEID_FSI_STORE = 1, /* Exception was due to store operation */
|
||||
TEID_FSI_FETCH = 2 /* Exception was due to fetch operation */
|
||||
};
|
||||
|
||||
#endif /* _ASM_S390_FAULT_H */
|
|
@ -11,7 +11,7 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/pgtable.h>
|
||||
#include <linux/bitfield.h>
|
||||
|
||||
#include <asm/fault.h>
|
||||
#include <asm/gmap.h>
|
||||
#include "kvm-s390.h"
|
||||
#include "gaccess.h"
|
||||
|
@ -466,23 +466,6 @@ static int ar_translation(struct kvm_vcpu *vcpu, union asce *asce, u8 ar,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct trans_exc_code_bits {
|
||||
unsigned long addr : 52; /* Translation-exception Address */
|
||||
unsigned long fsi : 2; /* Access Exception Fetch/Store Indication */
|
||||
unsigned long : 2;
|
||||
unsigned long b56 : 1;
|
||||
unsigned long : 3;
|
||||
unsigned long b60 : 1;
|
||||
unsigned long b61 : 1;
|
||||
unsigned long as : 2; /* ASCE Identifier */
|
||||
};
|
||||
|
||||
enum {
|
||||
FSI_UNKNOWN = 0, /* Unknown whether fetch or store */
|
||||
FSI_STORE = 1, /* Exception was due to store operation */
|
||||
FSI_FETCH = 2 /* Exception was due to fetch operation */
|
||||
};
|
||||
|
||||
enum prot_type {
|
||||
PROT_TYPE_LA = 0,
|
||||
PROT_TYPE_KEYC = 1,
|
||||
|
@ -497,11 +480,11 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
|
|||
enum gacc_mode mode, enum prot_type prot, bool terminate)
|
||||
{
|
||||
struct kvm_s390_pgm_info *pgm = &vcpu->arch.pgm;
|
||||
struct trans_exc_code_bits *tec;
|
||||
union teid *teid;
|
||||
|
||||
memset(pgm, 0, sizeof(*pgm));
|
||||
pgm->code = code;
|
||||
tec = (struct trans_exc_code_bits *)&pgm->trans_exc_code;
|
||||
teid = (union teid *)&pgm->trans_exc_code;
|
||||
|
||||
switch (code) {
|
||||
case PGM_PROTECTION:
|
||||
|
@ -511,25 +494,25 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
|
|||
WARN_ON_ONCE(1);
|
||||
break;
|
||||
case PROT_TYPE_IEP:
|
||||
tec->b61 = 1;
|
||||
teid->b61 = 1;
|
||||
fallthrough;
|
||||
case PROT_TYPE_LA:
|
||||
tec->b56 = 1;
|
||||
teid->b56 = 1;
|
||||
break;
|
||||
case PROT_TYPE_KEYC:
|
||||
tec->b60 = 1;
|
||||
teid->b60 = 1;
|
||||
break;
|
||||
case PROT_TYPE_ALC:
|
||||
tec->b60 = 1;
|
||||
teid->b60 = 1;
|
||||
fallthrough;
|
||||
case PROT_TYPE_DAT:
|
||||
tec->b61 = 1;
|
||||
teid->b61 = 1;
|
||||
break;
|
||||
}
|
||||
if (terminate) {
|
||||
tec->b56 = 0;
|
||||
tec->b60 = 0;
|
||||
tec->b61 = 0;
|
||||
teid->b56 = 0;
|
||||
teid->b60 = 0;
|
||||
teid->b61 = 0;
|
||||
}
|
||||
fallthrough;
|
||||
case PGM_ASCE_TYPE:
|
||||
|
@ -543,9 +526,9 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
|
|||
* exc_access_id has to be set to 0 for some instructions. Both
|
||||
* cases have to be handled by the caller.
|
||||
*/
|
||||
tec->addr = gva >> PAGE_SHIFT;
|
||||
tec->fsi = mode == GACC_STORE ? FSI_STORE : FSI_FETCH;
|
||||
tec->as = psw_bits(vcpu->arch.sie_block->gpsw).as;
|
||||
teid->addr = gva >> PAGE_SHIFT;
|
||||
teid->fsi = mode == GACC_STORE ? TEID_FSI_STORE : TEID_FSI_FETCH;
|
||||
teid->as = psw_bits(vcpu->arch.sie_block->gpsw).as;
|
||||
fallthrough;
|
||||
case PGM_ALEN_TRANSLATION:
|
||||
case PGM_ALE_SEQUENCE:
|
||||
|
|
Loading…
Reference in a new issue