Skip to contentSkip to conversation

staging: Android: Add 'vsoc' driver for cuttlefish.

PATCH New Alistair Strachan 1 participant 1 message Apr 13, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: Android: Add 'vsoc' driver for cuttlefish.

From: Greg Hartman <[email protected]>

The cuttlefish system is a virtual SoC architecture based on QEMU. It uses the QEMU ivshmem feature to share memory regions between guest and host with a custom protocol.

Cc Greg Kroah-Hartman <[email protected]>
Cc Arve Hjønnevåg <[email protected]>
Cc Todd Kjos <[email protected]>
Cc Martijn Coenen <[email protected]>
Cc Dan Carpenter <[email protected]>
[astrachan: rebased against 4.16, added TODO, fixed checkpatch issues]

---
v2: addressed issues with class_create() failure handling and redundant
null pointer checks noticed by Dan Carpenter

 drivers/staging/android/Kconfig         |    9 +
 drivers/staging/android/Makefile        |    1 +
 drivers/staging/android/TODO            |   10 +
 drivers/staging/android/uapi/vsoc_shm.h |  303 ++++++
 drivers/staging/android/vsoc.c          | 1169 +++++++++++++++++++++++
 5 files changed, 1492 insertions(+)
 create mode 100644 drivers/staging/android/uapi/vsoc_shm.h
 create mode 100644 drivers/staging/android/vsoc.c
drivers/staging/android/Kconfig +9 -0
index 71a50b99caff..29d891355f7a 100644
@@ -14,6 +14,15 @@ config ASHMEM
 	  It is, in theory, a good memory allocator for low-memory devices,
 	  because it can discard shared memory units when under memory pressure.
 
+config ANDROID_VSOC
+	tristate "Android Virtual SoC support"
+	default n
+	depends on PCI_MSI
+	---help---
+	  This option adds support for the Virtual SoC driver needed to boot
+	  a 'cuttlefish' Android image inside QEmu. The driver interacts with
+	  a QEmu ivshmem device. If built as a module, it will be called vsoc.
+
 source "drivers/staging/android/ion/Kconfig"
 
 endif # if ANDROID
drivers/staging/android/Makefile +1 -0
index 7cf1564a49a5..90e6154f11a4 100644
@@ -3,3 +3,4 @@ ccflags-y += -I$(src)			# needed for trace events
 obj-y					+= ion/
 
 obj-$(CONFIG_ASHMEM)			+= ashmem.o
+obj-$(CONFIG_ANDROID_VSOC)		+= vsoc.o
drivers/staging/android/TODO +10 -0
index 687e0eac85bf..6aab759efa48 100644
@@ -11,5 +11,15 @@ ion/
  - Split /dev/ion up into multiple nodes (e.g. /dev/ion/heap0)
  - Better test framework (integration with VGEM was suggested)
 
+vsoc.c, uapi/vsoc_shm.h
+ - The current driver uses the same wait queue for all of the futexes in a
+   region. This will cause false wakeups in regions with a large number of
+   waiting threads. We should eventually use multiple queues and select the
+   queue based on the region.
+ - Add debugfs support for examining the permissions of regions.
+ - Use ioremap_wc instead of ioremap_nocache.
+ - Remove VSOC_WAIT_FOR_INCOMING_INTERRUPT ioctl. This functionality has been
+   superseded by the futex and is there for legacy reasons.
+
 Please send patches to Greg Kroah-Hartman <[email protected]> and Cc:
 Arve Hjønnevåg <[email protected]> and Riley Andrews <[email protected]>
drivers/staging/android/uapi/vsoc_shm.h new file +303 -0

303 lines not on this page · raw message

drivers/staging/android/vsoc.c new file +1169 -0

1,169 lines not on this page · raw message

Signature · 1 line
2.17.0.484.g0c8726318c-goog