Skip to contentSkip to conversation

drivers: platform: goldfish: fix the checkpatch complain in Kconfig

PATCH Superseded [email protected] 2 participants 6 messages Jan 7, 2019 – Jan 9, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 drivers: platform: goldfish: fix the checkpatch complain in Kconfig

From: Roman Kiryanov <[email protected]>

prefer 'help' over '---help---' for new help texts

---
Changes in v2:
- New change, a minor cleanup.

 drivers/platform/goldfish/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/goldfish/Kconfig +2 -2
index 479031aa4f88..74fdfa68d1f2 100644
@@ -2,7 +2,7 @@ menuconfig GOLDFISH
 	bool "Platform support for Goldfish virtual devices"
 	depends on X86_32 || X86_64 || ARM || ARM64 || MIPS
 	depends on HAS_IOMEM
-	---help---
+	help
 	  Say Y here to get to see options for the Goldfish virtual platform.
 	  This option alone does not add any kernel code.
 
@@ -12,7 +12,7 @@ if GOLDFISH
 
 config GOLDFISH_PIPE
 	tristate "Goldfish virtual device for QEMU pipes"
-	---help---
+	help
 	  This is a virtual device to drive the QEMU pipe interface used by
 	  the Goldfish Android Virtual Device.
 
Signature · 1 line
2.20.1.97.g81188d93c3-goog
#1 lore raw

PATCH v2 2/3 drivers: platform: goldfish: goldfish_address_space: add a driver

From: Roman Kiryanov <[email protected]>

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.

---
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
drivers/platform/goldfish/Kconfig +9 -0
index 74fdfa68d1f2..60ecec4a3c59 100644
@@ -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.
+
 endif # GOLDFISH
drivers/platform/goldfish/Makefile +1 -0
index e0c202df9674..034abe0727b8 100644
@@ -2,3 +2,4 @@
 # Makefile for Goldfish platform specific drivers
 #
 obj-$(CONFIG_GOLDFISH_PIPE)	+= goldfish_pipe.o
+obj-$(CONFIG_GOLDFISH_ADDRESS_SPACE) += goldfish_address_space.o
drivers/platform/goldfish/goldfish_address_space.c new file +666 -0

666 lines not on this page · raw message

include/uapi/linux/goldfish/goldfish_address_space.h new file +27 -0
new file mode 100644
index 000000000000..b1d11f95a4e1
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef UAPI_GOLDFISH_ADDRESS_SPACE_H
+#define UAPI_GOLDFISH_ADDRESS_SPACE_H
+
+#include <linux/types.h>
+
+#define GOLDFISH_ADDRESS_SPACE_DEVICE_NAME	"goldfish_address_space"
+
+struct goldfish_address_space_allocate_block {
+	__u64 size;
+	__u64 offset;
+	__u64 phys_addr;
+};
+
+#define GOLDFISH_ADDRESS_SPACE_IOCTL_MAGIC	'G'
+
+#define GOLDFISH_ADDRESS_SPACE_IOCTL_OP(OP, T)	\
+	_IOWR(GOLDFISH_ADDRESS_SPACE_IOCTL_MAGIC, OP, T)
+
+#define GOLDFISH_ADDRESS_SPACE_IOCTL_ALLOCATE_BLOCK \
+	GOLDFISH_ADDRESS_SPACE_IOCTL_OP(10, \
+		struct goldfish_address_space_allocate_block)
+
+#define GOLDFISH_ADDRESS_SPACE_IOCTL_DEALLOCATE_BLOCK \
+	GOLDFISH_ADDRESS_SPACE_IOCTL_OP(11, __u64)
+
+#endif /* UAPI_GOLDFISH_ADDRESS_SPACE_H */
Signature · 1 line
2.20.1.97.g81188d93c3-goog
#2 lore raw

PATCH v2 3/3 drivers: platform: goldfish: goldfish_sync: add a driver

In reply to [email protected]

From: Roman Kiryanov <[email protected]>

The Goldfish sync driver is designed to provide a interface between the underlying host's sync device and the kernel's fence sync framework.

---
Changes in v2:
- Added a missing include (mod_devicetable.h).
- Put in one batch with goldfish_address_space.c to avoid merge comflicts.

 drivers/platform/goldfish/Kconfig           |   7 +
 drivers/platform/goldfish/Makefile          |   1 +
 drivers/platform/goldfish/goldfish_sync.c   | 834 ++++++++++++++++++++
 include/uapi/linux/goldfish/goldfish_sync.h |  28 +
 4 files changed, 870 insertions(+)
 create mode 100644 drivers/platform/goldfish/goldfish_sync.c
 create mode 100644 include/uapi/linux/goldfish/goldfish_sync.h
drivers/platform/goldfish/Kconfig +7 -0
index 60ecec4a3c59..841250235430 100644
@@ -25,4 +25,11 @@ config GOLDFISH_ADDRESS_SPACE
 	  populate them later in the host. This allows sharing host's memory
 	  with the guest.
 
+config GOLDFISH_SYNC
+	tristate "Goldfish AVD Sync Driver"
+	depends on SW_SYNC
+	depends on SYNC_FILE
+	help
+	  Emulated sync fences for the Goldfish Android Virtual Device.
+
 endif # GOLDFISH
drivers/platform/goldfish/Makefile +1 -0
index 034abe0727b8..bdff4d6a0ad9 100644
@@ -3,3 +3,4 @@
 #
 obj-$(CONFIG_GOLDFISH_PIPE)	+= goldfish_pipe.o
 obj-$(CONFIG_GOLDFISH_ADDRESS_SPACE) += goldfish_address_space.o
+obj-$(CONFIG_GOLDFISH_SYNC)	+= goldfish_sync.o
drivers/platform/goldfish/goldfish_sync.c new file +834 -0

834 lines not on this page · raw message

include/uapi/linux/goldfish/goldfish_sync.h new file +28 -0
new file mode 100644
index 000000000000..01d762f77308
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef UAPI_GOLDFISH_SYNC_H
+#define UAPI_GOLDFISH_SYNC_H
+
+#include <linux/types.h>
+
+#define GOLDFISH_SYNC_DEVICE_NAME "goldfish_sync"
+
+struct goldfish_sync_ioctl_info {
+	__u64 host_glsync_handle_in;
+	__u64 host_syncthread_handle_in;
+	__s32 fence_fd_out;
+};
+
+/* There is an ioctl associated with goldfish sync driver.
+ * Make it conflict with ioctls that are not likely to be used
+ * in the emulator.
+ *
+ * '@'	00-0F	linux/radeonfb.h		conflict!
+ * '@'	00-0F	drivers/video/aty/aty128fb.c	conflict!
+ */
+#define GOLDFISH_SYNC_IOC_MAGIC	'@'
+
+#define GOLDFISH_SYNC_IOC_QUEUE_WORK	\
+	_IOWR(GOLDFISH_SYNC_IOC_MAGIC, 0, struct goldfish_sync_ioctl_info)
+
+#endif /* UAPI_GOLDFISH_SYNC_H */
Signature · 1 line
2.20.1.97.g81188d93c3-goog
#3 lore raw

Re: [PATCH v2 3/3] drivers: platform: goldfish: goldfish_sync: add a driver

Quoted 11 lines · On Mon, Jan 07, 2019 at 10:50:39AM -0800, [email protected] wrote:

From: Roman Kiryanov <[email protected]>

The Goldfish sync driver is designed to provide a interface between the underlying host's sync device and the kernel's fence sync framework.

---
Changes in v2:
- Added a missing include (mod_devicetable.h).
- Put in one batch with goldfish_address_space.c to avoid merge comflicts.

You have a number of WARN_ON() calls in here that are not needed, please remove.

Also, why is this driver needed at all? Why can't you use the "normal" drm sync api interface? Why write a custom ioctl driver just for this one kernel interface?

thanks,

greg k-h

#4 lore raw

Re: [PATCH v2 3/3] drivers: platform: goldfish: goldfish_sync: add a driver

Quoted 2 lines

You have a number of WARN_ON() calls in here that are not needed, please remove.

Thank you for noticing, I will remove them.

Quoted 3 lines

Also, why is this driver needed at all? Why can't you use the "normal" drm sync api interface? Why write a custom ioctl driver just for this one kernel interface?

This driver allows us to talk to host's sync api.

#5 lore raw

Re: [PATCH v2 3/3] drivers: platform: goldfish: goldfish_sync: add a driver

Quoted 5 lines · Roman Kiryanov
Quoted 3 lines

Also, why is this driver needed at all? Why can't you use the "normal" drm sync api interface? Why write a custom ioctl driver just for this one kernel interface?

This driver allows us to talk to host's sync api.

That describes what your code does, yes, but you did not answer my question at all. Why do you need this? What are you trying to do? And why is this so different from any other drm driver?

thanks,

greg k-h