Drivers: hv: vmbus: Add SNP support for VMbus channel initiate message
authorTianyu Lan <Tianyu.Lan@microsoft.com>
Mon, 25 Oct 2021 12:21:13 +0000 (08:21 -0400)
committerWei Liu <wei.liu@kernel.org>
Thu, 28 Oct 2021 11:22:55 +0000 (11:22 +0000)
commitf2f136c05fb6093818a3b3fefcba46231ac66a62
tree5d47436e59457ce37f13037cb9bcaac637331f45
parent20c89a559e00dfe352b73e867211a669113ae881
Drivers: hv: vmbus: Add SNP support for VMbus channel initiate message

The monitor pages in the CHANNELMSG_INITIATE_CONTACT msg are shared
with host in Isolation VM and so it's necessary to use hvcall to set
them visible to host. In Isolation VM with AMD SEV SNP, the access
address should be in the extra space which is above shared gpa
boundary. So remap these pages into the extra address(pa +
shared_gpa_boundary).

Introduce monitor_pages_original[] in the struct vmbus_connection
to store monitor page virtual address returned by hv_alloc_hyperv_
zeroed_page() and free monitor page via monitor_pages_original in
the vmbus_disconnect(). The monitor_pages[] is to used to access
monitor page and it is initialized to be equal with monitor_pages_
original. The monitor_pages[] will be overridden in the isolation VM
with va of extra address. Introduce monitor_pages_pa[] to store
monitor pages' physical address and use it to populate pa in the
initiate msg.

Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Link: https://lore.kernel.org/r/20211025122116.264793-9-ltykernel@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/connection.c
drivers/hv/hyperv_vmbus.h