diff options
| author | Kameron Carr <kameroncarr@linux.microsoft.com> | 2026-08-11 09:04:47 -0700 |
|---|---|---|
| committer | Wei Liu <wei.liu@kernel.org> | 2026-08-24 00:33:25 +0000 |
| commit | f85e1cc5ecbbbb18ac68639f667c9de49b3ca986 (patch) | |
| tree | 2e819e9a58f6c08ab8d6c4a419c0189d55eea792 /include | |
| parent | 73fe42af955a24b6cc792b9a4867e809196f05ed (diff) | |
| download | linux-f85e1cc5ecbbbb18ac68639f667c9de49b3ca986.tar.gz linux-f85e1cc5ecbbbb18ac68639f667c9de49b3ca986.zip | |
hv_netvsc: Allocate send/receive buffers using vmbus_alloc_buffer()
On CoCo VMs without confidential VMBus, the netvsc send and receive buffers
must be made host-visible by decrypting them. These buffers are vmalloc'ed,
but set_memory_decrypted()/encrypted() do not work on vmalloc'ed memory.
This use case is (so far) unique to netvsc, so solve it locally rather than
changing the set_memory() or allocation APIs.
Use vmbus_alloc_buffer() to allocate the send and receive buffers, which
will make them host-visible. Store the list of memory chunks in the
netvsc_device struct so they can be individually freed later. Use
vmbus_establish_gpadl_caller_decrypted() so there is no attempt to decrypt
the virtual address.
Appropriately free the buffers with vmbus_free_buffer(). Because vunmap()
and set_memory_encrypted() must run in process context, replace the
rcu_head/call_rcu() pair used to defer free_netvsc_device() with
rcu_work/queue_rcu_work(). This also fixes a small race condition where the
buffers may be accessed while being re-encrypted by moving the
re-encryption after the RCU grace period.
Signed-off-by: Kameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions
