Re: [PATCH v3 2/3] drivers: platform: goldfish: goldfish_address_space: add a driver

From: Greg KH
Date: Tue Jan 22 2019 - 06:07:18 EST


On Tue, Jan 08, 2019 at 06:11:11PM -0800, rkir@xxxxxxxxxx wrote:
> From: Roman Kiryanov <rkir@xxxxxxxxxx>
>
> A driver for the Goldfish Android emulator that occupies
> address space to use it with the memory sharing device
> on the QEMU side. The memory sharding device allocates
> subranges and populate them with actual RAM.
> This allows sharing host's memory with the guest.
>
> Signed-off-by: Roman Kiryanov <rkir@xxxxxxxxxx>
> ---
> Changes in v3:
> - No changes.
>
> Changes in v2:
> - Removed WARN_ON.
> - Moved to drivers/platform/goldfish (from drivers/misc).
>
> drivers/platform/goldfish/Kconfig | 9 +
> drivers/platform/goldfish/Makefile | 1 +
> .../goldfish/goldfish_address_space.c | 666 ++++++++++++++++++
> .../linux/goldfish/goldfish_address_space.h | 27 +
> 4 files changed, 703 insertions(+)
> create mode 100644 drivers/platform/goldfish/goldfish_address_space.c
> create mode 100644 include/uapi/linux/goldfish/goldfish_address_space.h
>
> diff --git a/drivers/platform/goldfish/Kconfig b/drivers/platform/goldfish/Kconfig
> index 74fdfa68d1f2..60ecec4a3c59 100644
> --- a/drivers/platform/goldfish/Kconfig
> +++ b/drivers/platform/goldfish/Kconfig
> @@ -16,4 +16,13 @@ config GOLDFISH_PIPE
> This is a virtual device to drive the QEMU pipe interface used by
> the Goldfish Android Virtual Device.
>
> +config GOLDFISH_ADDRESS_SPACE
> + tristate "A Goldfish driver that talks to the memory sharing device in QEMU"
> + depends on PCI
> + depends on GOLDFISH
> + help
> + A Goldfish driver that allocates address space ranges in the guest to
> + populate them later in the host. This allows sharing host's memory
> + with the guest.

How does QEMU do this today? There isn't a virtio or some other virtual
memory device that allows memory regions to be shared? I can't believe
that there isn't one yet. If not, then this should be some kind of
"generic" QEMU memory device, not a "goldfish" specific one, right?

Please work with the QEMU developers on this, I need their ack before I
can take something like this.

thanks,

greg k-h