Re: [PATCH v3 4/9] xen/grant-table: Allow allocating buffers suitable for DMA

From: Oleksandr Andrushchenko
Date: Wed Jun 13 2018 - 03:08:10 EST


On 06/13/2018 04:12 AM, Boris Ostrovsky wrote:


On 06/12/2018 09:41 AM, Oleksandr Andrushchenko wrote:
From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

Extend grant table module API to allow allocating buffers that can
be used for DMA operations and mapping foreign grant references
on top of those.
The resulting buffer is similar to the one allocated by the balloon
driver in terms that proper memory reservation is made
({increase|decrease}_reservation and VA mappings updated if needed).
This is useful for sharing foreign buffers with HW drivers which
cannot work with scattered buffers provided by the balloon driver,
but require DMAable memory instead.

Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

with a small nit below


---
 drivers/xen/Kconfig | 13 ++++++
 drivers/xen/grant-table.c | 97 +++++++++++++++++++++++++++++++++++++++
 include/xen/grant_table.h | 18 ++++++++
 3 files changed, 128 insertions(+)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index e5d0c28372ea..39536ddfbce4 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -161,6 +161,19 @@ config XEN_GRANT_DEV_ALLOC
ÂÂÂÂÂÂÂ to other domains. This can be used to implement frontend drivers
ÂÂÂÂÂÂÂ or as part of an inter-domain shared memory channel.
 +config XEN_GRANT_DMA_ALLOC
+ÂÂÂ bool "Allow allocating DMA capable buffers with grant reference module"
+ÂÂÂ depends on XEN && HAS_DMA
+ÂÂÂ help
+ÂÂÂÂÂ Extends grant table module API to allow allocating DMA capable
+ÂÂÂÂÂ buffers and mapping foreign grant references on top of it.
+ÂÂÂÂÂ The resulting buffer is similar to one allocated by the balloon
+ÂÂÂÂÂ driver in terms that proper memory reservation is made
+ÂÂÂÂÂ ({increase|decrease}_reservation and VA mappings updated if needed).

I think you should drop the word "terms" and say "is made *by*" and "VA mappings *are* updated"

And similar change in the commit message.

Will, change, thank you
-boris