Skip to content

Drivers: hv: decrypt netvsc buffers on contiguous direct-map addresses

Kameron Carr linux-hyperv lkml netdev 4 versions – Applied

Status from this message: Applied. Thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 1 replyApplied
  2. v33 patches 3 repliesSuperseded
  3. v22 patches 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC2 patches9 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted()drivers/hv/channel.c include/linux/hyperv.h+32 -30 replies
2/3Drivers: hv: vmbus: Add vmbus_alloc_buffer()/vmbus_free_buffer() for CoCo VMsdrivers/hv/channel.c include/linux/hyperv.h+162 -00 replies
3/3hv_netvsc: Allocate send/receive buffers using vmbus_alloc_buffer()drivers/net/hyperv/hyperv_net.h drivers/net/hyperv/netvsc.c drivers/net/hyperv/netvsc_drv.c+83 -340 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchMichael Kelley
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] Drivers: hv: decrypt netvsc buffers on contiguous direct-map addresses

Arm CCA Realms implement set_memory_decrypted() only for addresses in the kernel linear map; vmalloc()/vmap() addresses are rejected. netvsc allocates its large send and receive buffers with vzalloc() and passes those addresses to vmbus_establish_gpadl(), which calls set_memory_decrypted(), causing GPADL establishment to fail in a Realm.

This series allocates shared buffers as a list of chunks, each physically contiguous, decrypts each chunk through its direct-map address, and combines them into a virtually contiguous mapping with vmap(). Private buffers continue to use vzalloc().

Changes since v1 [1]:
Patch 1:
- Add HV_GPADL_BUFFER_DECRYPTED to enum hv_gpadl_type to indicate a buffer that has already been decrypted.
Patch 2:
- Rename netvsc_{alloc,free}_buf_pages() -> vmbus_{alloc,free}_buffer() and move them to channel.c.
- Remove struct netvsc_buf_chunk and replace with page folio in compound pages.
- vmbus_alloc_buffer():
- use vzalloc() for non-host-visible buffers and remove the encryption decision out of netvsc.
- min_t() -> min().
- zero the memory after allocation.
- specify @size "will be rounded up to PAGE_SIZE" in the docstring.

Changes since v2 [2]:
Patch 2:
- Split patch into two patches, separating new helper functions in VMBus from the netvsc driver changes.
- Change nr_pages, remaining, and page_idx to unsigned long to avoid casting.
- Move order initialization to the top of vmbus_alloc_buffer(), removing one min() call.
- Change order to a signed int to avoid needing min_t().
- Restructure loop in vmbus_alloc_buffer() to avoid nested loops and simplify logic.
- Small comment changes.

Changes since v3 [3]:
- Subject line changes (no code changes)

[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
[3]: https://lore.kernel.org/all/[email protected]/

Kameron Carr (3):
Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted()
Drivers: hv: vmbus: Add vmbus_alloc_buffer()/vmbus_free_buffer() for
CoCo VMs
hv_netvsc: Allocate send/receive buffers using vmbus_alloc_buffer()

 drivers/hv/channel.c            | 182 +++++++++++++++++++++++++++++++-
 drivers/net/hyperv/hyperv_net.h |   8 +-
 drivers/net/hyperv/netvsc.c     | 103 ++++++++++++------
 drivers/net/hyperv/netvsc_drv.c |   6 ++
 include/linux/hyperv.h          |  15 ++-
 5 files changed, 277 insertions(+), 37 deletions(-)

base-commit: a4ffc59238be84dd1c26bf1c001543e832674fc6

Signature · 1 line
2.45.4