goldfish: enable 64 bit goldfish PIPE device
Enable the 64 bit PIPE device emulation in the goldfish platform.
Change-Id: I0d6fdbcb43310a7736eae58d67a29b4821934243
Signed-off-by: Jun Tian <jun.j.tian@intel.com>
diff --git a/docs/ANDROID-QEMU-PIPE.TXT b/docs/ANDROID-QEMU-PIPE.TXT
index e0d295c..5e9ae76 100644
--- a/docs/ANDROID-QEMU-PIPE.TXT
+++ b/docs/ANDROID-QEMU-PIPE.TXT
@@ -71,13 +71,37 @@
to the device. Variable names beginning with REG_ correspond to 32-bit I/O
registers:
+ 0/ Channel and address values:
+
+ Each communication channel is identified by a unique non-zero value
+ which is either 32-bit or 64-bit, depending on the guest CPU
+ architecture.
+
+ The channel value sent from the kernel to the emulator with:
+
+ void write_channel(channel) {
+ #if 64BIT_GUEST_CPU
+ REG_CHANNEL_HIGH = (channel >> 32);
+ #endif
+ REG_CHANNEL = (channel & 0xffffffffU);
+ }
+
+ Similarly, when passing a kernel address to the emulator:
+
+ void write_address(buffer_address) {
+ #if 64BIT_GUEST_CPU
+ REG_ADDRESS_HIGH = (buffer_address >> 32);
+ #endif
+ REG_ADDRESS = (buffer_address & 0xffffffffU);
+ }
+
1/ Creating a new channel:
Used by the driver to indicate that the guest just opened /dev/qemu_pipe
- that will be identified by a 32-bit value named '<channel>' here:
+ that will be identified by a named '<channel>':
- REG_CHANNEL = <channel>
- REG_CMD = CMD_OPEN
+ write_channel(<channel>)
+ REG_CMD = CMD_OPEN
IMPORTANT: <channel> should never be 0
@@ -86,8 +110,8 @@
Used by the driver to indicate that the guest called 'close' on the
channel file descriptor.
- REG_CHANNEL = <channel>
- REG_CMD = CMD_CLOSE
+ write_channel(<channel>)
+ REG_CMD = CMD_CLOSE
3/ Writing data to the channel:
@@ -95,8 +119,8 @@
channel's file descriptor. This command is used to send a single
memory buffer:
- REG_CHANNEL = <channel>
- REG_ADDRESS = <buffer-address>
+ write_channel(<channel>)
+ write_address(<buffer-address>)
REG_SIZE = <buffer-size>
REG_CMD = CMD_WRITE_BUFFER
@@ -127,8 +151,8 @@
Corresponds to when the guest does a read() or readv() on the
channel's file descriptor.
- REG_CHANNEL = <channel>
- REG_ADDRESS = <buffer-address>
+ write_channel(<channel>)
+ write_address(<buffer-address>)
REG_SIZE = <buffer-size>
REG_CMD = CMD_READ_BUFFER
@@ -145,7 +169,7 @@
Before this, the driver will do:
- REG_CHANNEL = <channel>
+ write_channel(<channel>)
REG_CMD = CMD_WAKE_ON_WRITE
To indicate to the virtual device that it is waiting and should be woken
@@ -156,7 +180,7 @@
This is the same than CMD_WAKE_ON_WRITE, but for readability instead.
- REG_CHANNEL = <channel>
+ write_channel(<channel>)
REG_CMD = CMD_WAKE_ON_READ
7/ Polling for write-able/read-able state:
@@ -164,7 +188,7 @@
The following command is used by the driver to implement the select(),
poll() and epoll() system calls where a pipe channel is involved.
- REG_CHANNEL = <channel>
+ write_channel(<channel>)
REG_CMD = CMD_POLL
mask = REG_STATUS
@@ -211,7 +235,9 @@
This uses the following structure known to both the virtual device and
the kernel, defined in $QEMU/hw/android/goldfish/pipe.h:
- struct access_params{
+ For 32-bit guest CPUs:
+
+ struct access_params {
uint32_t channel;
uint32_t size;
uint32_t address;
@@ -221,6 +247,18 @@
uint32_t flags;
};
+ And the 64-bit variant:
+
+ struct access_params_64 {
+ uint64_t channel;
+ uint32_t size;
+ uint64_t address;
+ uint32_t cmd;
+ uint32_t result;
+ /* reserved for future extension */
+ uint32_t flags;
+ };
+
This is simply a way to pack several parameters into a single structure.
Preliminary, e.g. at boot time, the kernel will allocate one such structure
and pass its physical address with: