Re: [PATCH] KVM: s390: vsie: fix crycb virtual vs physical usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05.09.22 10:41, Pierre Morel wrote:
Prepare VSIE for architectural changes where lowmem kernel real and
kernel virtual address are different.

Bear with me, it used to be

	crycb = (struct kvm_s390_crypto_cb *) (unsigned long)crycb_o;
	apcb_o = (unsigned long) &crycb->apcb0;

and now it's

	apcb_o = crycb_o + offsetof(struct kvm_s390_crypto_cb, apcb0);


So the real issue seems to be

	crycb = (struct kvm_s390_crypto_cb *) (unsigned long)crycb_o;

because crycb_o actually is a guest address and not a host address.


But now I'm confused, because I would have thought that the result produced by both code would be identical (I completely agree that the new variant is better).

How does this interact with "lowmem kernel real and kernel virtual address are different." -- I would have thought that &crycb->apcb0 doesn't actually access any memory and only performs arithmetical operations?


When we get the original crycb from the guest crycb we can use the
phys_to_virt transformation, which will use the host transformations,
but we must use an offset to calculate the guest real address apcb
and give it to read_guest_real().

Can you elaborate where phys_to_virt() comes into play?

If this is an actual fix (as indicated in the patch subject), should this carry a

	Fixes: 56019f9aca22 ("KVM: s390: vsie: Allow CRYCB FORMAT-2")

--
Thanks,

David / dhildenb




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux