Skip to contentSkip to conversation

drivers: platform: goldfish_sync: add a driver

PATCH New [email protected] 2 participants 2 messages Jan 5, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: platform: goldfish_sync: add a driver

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.

---
 drivers/platform/goldfish/Kconfig           |   7 +
 drivers/platform/goldfish/Makefile          |   1 +
 drivers/platform/goldfish/goldfish_sync.c   | 833 ++++++++++++++++++++
 include/uapi/linux/goldfish/goldfish_sync.h |  28 +
 4 files changed, 869 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 479031aa4f88..fbc0c53e8f35 100644
@@ -16,4 +16,11 @@ config GOLDFISH_PIPE
 	  This is a virtual device to drive the QEMU pipe interface used by
 	  the Goldfish Android Virtual Device.
 
+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 e0c202df9674..78c8736ba55d 100644
@@ -2,3 +2,4 @@
 # Makefile for Goldfish platform specific drivers
 #
 obj-$(CONFIG_GOLDFISH_PIPE)	+= goldfish_pipe.o
+obj-$(CONFIG_GOLDFISH_SYNC)	+= goldfish_sync.o
drivers/platform/goldfish/goldfish_sync.c new file +833 -0

833 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
#1 lore raw
Thank you for the patch! Yet something to improve:

Hi Roman,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.20 next-20190103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/rkir-google-com/drivers-platform-goldfish_sync-add-a-driver/20190105-123342
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm

All errors (new ones prefixed by >>):

>> drivers/platform/goldfish/goldfish_sync.c:807:34: error: array type has incomplete element type 'struct of_device_id'
    static const struct of_device_id goldfish_sync_of_match[] = {
                                     ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/platform/goldfish/goldfish_sync.c:808:4: error: field name not in record or union initializer
     { .compatible = "google,goldfish-sync", },
       ^
   drivers/platform/goldfish/goldfish_sync.c:808:4: note: (near initialization for 'goldfish_sync_of_match')
>> drivers/platform/goldfish/goldfish_sync.c:813:36: error: array type has incomplete element type 'struct acpi_device_id'
    static const struct acpi_device_id goldfish_sync_acpi_match[] = {
                                       ^~~~~~~~~~~~~~~~~~~~~~~~

vim +807 drivers/platform/goldfish/goldfish_sync.c

806

 > 807	static const struct of_device_id goldfish_sync_of_match[] = {
 > 808		{ .compatible = "google,goldfish-sync", },
   809		{},
   810	};
   811	MODULE_DEVICE_TABLE(of, goldfish_sync_of_match);
   812	
 > 813	static const struct acpi_device_id goldfish_sync_acpi_match[] = {

814 { "GFSH0006", 0 },
815 { },
816 };
817 MODULE_DEVICE_TABLE(acpi, goldfish_sync_acpi_match);
818

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation