KVM: s390: vsie: Create constant SCB_ALIGNMENT_SHIFT

Create a simple constant for the SCB alignment shift.

Signed-off-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
This commit is contained in:
Christoph Schlameuss 2026-08-07 11:57:47 +02:00 committed by Christian Borntraeger
parent 6a3fe9ecc2
commit 3105276cef
2 changed files with 7 additions and 4 deletions

View File

@ -9,6 +9,8 @@
#define KVM_S390_BSCA_CPU_SLOTS 64
#define KVM_S390_ESCA_CPU_SLOTS 248
#define SCB_ALIGNMENT_SHIFT 9
#define SIGP_CTRL_C 0x80
#define SIGP_CTRL_SCN_MASK 0x3f

View File

@ -1485,7 +1485,7 @@ static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr)
int nr_vcpus;
rcu_read_lock();
vsie_page = radix_tree_lookup(&kvm->arch.vsie.addr_to_page, addr >> 9);
vsie_page = radix_tree_lookup(&kvm->arch.vsie.addr_to_page, addr >> SCB_ALIGNMENT_SHIFT);
rcu_read_unlock();
if (vsie_page) {
if (try_get_vsie_page(vsie_page)) {
@ -1526,13 +1526,14 @@ static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr)
}
if (vsie_page->scb_gpa != ULONG_MAX)
radix_tree_delete(&kvm->arch.vsie.addr_to_page,
vsie_page->scb_gpa >> 9);
vsie_page->scb_gpa >> SCB_ALIGNMENT_SHIFT);
}
/* Mark it as invalid until it resides in the tree. */
vsie_page->scb_gpa = ULONG_MAX;
/* Double use of the same address or allocation failure. */
if (radix_tree_insert(&kvm->arch.vsie.addr_to_page, addr >> 9, vsie_page)) {
if (radix_tree_insert(&kvm->arch.vsie.addr_to_page, addr >> SCB_ALIGNMENT_SHIFT,
vsie_page)) {
put_vsie_page(vsie_page);
mutex_unlock(&kvm->arch.vsie.mutex);
return NULL;
@ -1630,7 +1631,7 @@ void kvm_s390_vsie_destroy(struct kvm *kvm)
/* free the radix tree entry */
if (vsie_page->scb_gpa != ULONG_MAX)
radix_tree_delete(&kvm->arch.vsie.addr_to_page,
vsie_page->scb_gpa >> 9);
vsie_page->scb_gpa >> SCB_ALIGNMENT_SHIFT);
free_page((unsigned long)vsie_page);
}
kvm->arch.vsie.page_count = 0;