Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55531b74 authored by Janosch Frank's avatar Janosch Frank Committed by Christian Borntraeger
Browse files

KVM: s390: Add storage key facility interpretation control



Up to now we always expected to have the storage key facility
available for our (non-VSIE) KVM guests. For huge page support, we
need to be able to disable it, so let's introduce that now.

We add the use_skf variable to manage KVM storage key facility
usage. Also we rename use_skey in the mm context struct to uses_skeys
to make it more clear that it is an indication that the vm actively
uses storage keys.

Signed-off-by: default avatarJanosch Frank <frankja@linux.vnet.ibm.com>
Reviewed-by: default avatarFarhan Ali <alifm@linux.vnet.ibm.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 75bc37fe
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -812,6 +812,7 @@ struct kvm_arch{
	int use_irqchip;
	int use_cmma;
	int use_pfmfi;
	int use_skf;
	int user_cpu_state_ctrl;
	int user_sigp;
	int user_stsi;
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ typedef struct {
	/* The mmu context uses extended page tables. */
	unsigned int has_pgste:1;
	/* The mmu context uses storage keys. */
	unsigned int use_skey:1;
	unsigned int uses_skeys:1;
	/* The mmu context uses CMM. */
	unsigned int uses_cmm:1;
} mm_context_t;
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ static inline int init_new_context(struct task_struct *tsk,
		test_thread_flag(TIF_PGSTE) ||
		(current->mm && current->mm->context.alloc_pgste);
	mm->context.has_pgste = 0;
	mm->context.use_skey = 0;
	mm->context.uses_skeys = 0;
	mm->context.uses_cmm = 0;
#endif
	switch (mm->context.asce_limit) {
+2 −2
Original line number Diff line number Diff line
@@ -507,10 +507,10 @@ static inline int mm_alloc_pgste(struct mm_struct *mm)
 * faults should no longer be backed by zero pages
 */
#define mm_forbids_zeropage mm_has_pgste
static inline int mm_use_skey(struct mm_struct *mm)
static inline int mm_uses_skeys(struct mm_struct *mm)
{
#ifdef CONFIG_PGSTE
	if (mm->context.use_skey)
	if (mm->context.uses_skeys)
		return 1;
#endif
	return 0;
+2 −1
Original line number Diff line number Diff line
@@ -1493,7 +1493,7 @@ static long kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args)
		return -EINVAL;

	/* Is this guest using storage keys? */
	if (!mm_use_skey(current->mm))
	if (!mm_uses_skeys(current->mm))
		return KVM_S390_GET_SKEYS_NONE;

	/* Enforce sane limit on memory allocation */
@@ -2066,6 +2066,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
	kvm->arch.css_support = 0;
	kvm->arch.use_irqchip = 0;
	kvm->arch.use_pfmfi = sclp.has_pfmfi;
	kvm->arch.use_skf = sclp.has_skey;
	kvm->arch.epoch = 0;

	spin_lock_init(&kvm->arch.start_stop_lock);
Loading