Drivers: hv: vmbus: Introduce types of GPADL
authorBoqun Feng <boqun.feng@gmail.com>
Wed, 16 Sep 2020 03:48:09 +0000 (11:48 +0800)
committerWei Liu <wei.liu@kernel.org>
Mon, 28 Sep 2020 08:55:12 +0000 (08:55 +0000)
commitc1135c7fd0e95740cd4619ce389f43ffce043140
tree6c14e6855fd6c55230a4c28dece071d4f69f519e
parentedd9bbc1d934c21c537444203d50a502ad3d945f
Drivers: hv: vmbus: Introduce types of GPADL

This patch introduces two types of GPADL: HV_GPADL_{BUFFER, RING}. The
types of GPADL are purely the concept in the guest, IOW the hypervisor
treat them as the same.

The reason of introducing the types for GPADL is to support guests whose
page size is not 4k (the page size of Hyper-V hypervisor). In these
guests, both the headers and the data parts of the ringbuffers need to
be aligned to the PAGE_SIZE, because 1) some of the ringbuffers will be
mapped into userspace and 2) we use "double mapping" mechanism to
support fast wrap-around, and "double mapping" relies on ringbuffers
being page-aligned. However, the Hyper-V hypervisor only uses 4k
(HV_HYP_PAGE_SIZE) headers. Our solution to this is that we always make
the headers of ringbuffers take one guest page and when GPADL is
established between the guest and hypervisor, the only first 4k of
header is used. To handle this special case, we need the types of GPADL
to differ different guest memory usage for GPADL.

Type enum is introduced along with several general interfaces to
describe the differences between normal buffer GPADL and ringbuffer
GPADL.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Link: https://lore.kernel.org/r/20200916034817.30282-4-boqun.feng@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/channel.c
include/linux/hyperv.h