Skip to contentSkip to conversation

s390/kvm/vsie: Use virt_to_phys for crypto control block

PATCH In review Nina Schoetterl-Glausch 3 participants 4 messages Apr 29, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/kvm/vsie: Use virt_to_phys for crypto control block

The address of the crypto control block in the (shadow) SIE block is absolute/physical.
Convert from virtual to physical when shadowing the guest's control block during VSIE.

---
 arch/s390/kvm/vsie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index b2c9f010f0fe..24defeada00c 100644
@@ -361,7 +361,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	case -EACCES:
 		return set_validity_icpt(scb_s, 0x003CU);
 	}
-	scb_s->crycbd = ((__u32)(__u64) &vsie_page->crycb) | CRYCB_FORMAT2;
+	scb_s->crycbd = (u32)virt_to_phys(&vsie_page->crycb) | CRYCB_FORMAT2;
 	return 0;
 }
 

base-commit: b947cc5bf6d793101135265352e205aeb30b54f0

Signature · 1 line
2.40.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nina Schoetterl-Glausch

The address of the crypto control block in the (shadow) SIE block is absolute/physical.
Convert from virtual to physical when shadowing the guest's control block during VSIE.

---
 arch/s390/kvm/vsie.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Please apply and push to devel, preferably using the following commands:

# b390 shazam -t <message-id>
# git push <repository> devel
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Nina Schoetterl-Glausch

Am 29.04.24 um 19:15 schrieb Nina Schoetterl-Glausch:

Quoted 6 lines

The address of the crypto control block in the (shadow) SIE block is absolute/physical.
Convert from virtual to physical when shadowing the guest's control block during VSIE.

vsie_page was created with page_to_virt to this make sense to translated back here.

I guess this should go via the s390 with the other virt/phys changes.

Quoted 16 lines
---
  arch/s390/kvm/vsie.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kvm/vsie.c +1 -1
index b2c9f010f0fe..24defeada00c 100644
@@ -361,7 +361,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
  	case -EACCES:
  		return set_validity_icpt(scb_s, 0x003CU);
  	}
-	scb_s->crycbd = ((__u32)(__u64) &vsie_page->crycb) | CRYCB_FORMAT2;
+	scb_s->crycbd = (u32)virt_to_phys(&vsie_page->crycb) | CRYCB_FORMAT2;
  	return 0;
  }
#3 lore raw
Quoted 1 line · Christian Borntraeger

I guess this should go via the s390 with the other virt/phys changes.

Yes, I will pick it.

Thanks!