Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282305 > unrolled thread

[PATCH v3 1/8] goldfish: refactor goldfish platform configs

Started byJin Qian <jinqian@android.com>
First post2015-12-02 20:40 +0100
Last post2015-12-02 20:50 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 1/8] goldfish: refactor goldfish platform configs Jin Qian <jinqian@android.com> - 2015-12-02 20:40 +0100
    [PATCH v3 4/8] platform: goldfish: pipe: add devicetree bindings Jin Qian <jinqian@android.com> - 2015-12-02 20:40 +0100
      Re: [PATCH v3 4/8] platform: goldfish: pipe: add devicetree bindings Rob Herring <robh@kernel.org> - 2015-12-04 16:00 +0100
    [PATCH v3 2/8] android_pipe: don't be clever with #define offsets Jin Qian <jinqian@android.com> - 2015-12-02 20:50 +0100
      Re: [PATCH v3 2/8] android_pipe: don't be clever with #define  offsets Joe Perches <joe@perches.com> - 2015-12-02 21:20 +0100
    [PATCH v3 8/8] goldfish: Enable ACPI-based enumeration for android pipe Jin Qian <jinqian@android.com> - 2015-12-02 20:50 +0100

#1282305 — [PATCH v3 1/8] goldfish: refactor goldfish platform configs

FromJin Qian <jinqian@android.com>
Date2015-12-02 20:40 +0100
Subject[PATCH v3 1/8] goldfish: refactor goldfish platform configs
Message-ID<qBlpT-35b-9@gated-at.bofh.it>
From: Greg Hackmann <ghackmann@google.com>

On new virtual devices, the goldfish virtual bus can be replaced with
autoprobing infrastructure like Device Tree.  Refactor the goldfish
kernel configs to better accommodate this.

Move the goldfish platform into a menuconfig in the style of the chrome
platform, and separate the goldfish bus into its own config option.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
---
 drivers/platform/Kconfig           |  3 +--
 drivers/platform/goldfish/Kconfig  | 18 ++++++++++++++++++
 drivers/platform/goldfish/Makefile |  2 +-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig
index 0adccbf..c11db8b 100644
--- a/drivers/platform/Kconfig
+++ b/drivers/platform/Kconfig
@@ -4,8 +4,7 @@ endif
 if MIPS
 source "drivers/platform/mips/Kconfig"
 endif
-if GOLDFISH
+
 source "drivers/platform/goldfish/Kconfig"
-endif
 
 source "drivers/platform/chrome/Kconfig"
diff --git a/drivers/platform/goldfish/Kconfig b/drivers/platform/goldfish/Kconfig
index 635ef25..1ae3690 100644
--- a/drivers/platform/goldfish/Kconfig
+++ b/drivers/platform/goldfish/Kconfig
@@ -1,5 +1,23 @@
+menuconfig GOLDFISH
+	bool "Platform support for Goldfish virtual devices"
+	depends on X86_32 || X86_64 || ARM || ARM64
+	---help---
+	  Say Y here to get to see options for the Goldfish virtual platform.
+	  This option alone does not add any kernel code.
+
+	  Unless you are building for the Android Goldfish emulator say N here.
+
+if GOLDFISH
+
+config GOLDFISH_BUS
+	tristate "Goldfish platform bus"
+	---help---
+	  This is a virtual bus to host Goldfish Android Virtual Devices.
+
 config GOLDFISH_PIPE
 	tristate "Goldfish virtual device for QEMU pipes"
 	---help---
 	  This is a virtual device to drive the QEMU pipe interface used by
 	  the Goldfish Android Virtual Device.
+
+endif # GOLDFISH
diff --git a/drivers/platform/goldfish/Makefile b/drivers/platform/goldfish/Makefile
index a002239..d348712 100644
--- a/drivers/platform/goldfish/Makefile
+++ b/drivers/platform/goldfish/Makefile
@@ -1,5 +1,5 @@
 #
 # Makefile for Goldfish platform specific drivers
 #
-obj-$(CONFIG_GOLDFISH)	+=	pdev_bus.o
+obj-$(CONFIG_GOLDFISH_BUS)	+= pdev_bus.o
 obj-$(CONFIG_GOLDFISH_PIPE)	+= goldfish_pipe.o
-- 
2.6.0.rc2.230.g3dd15c0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1282306 — [PATCH v3 4/8] platform: goldfish: pipe: add devicetree bindings

FromJin Qian <jinqian@android.com>
Date2015-12-02 20:40 +0100
Subject[PATCH v3 4/8] platform: goldfish: pipe: add devicetree bindings
Message-ID<qBlpU-35b-35@gated-at.bofh.it>
In reply to#1282305
From: Greg Hackmann <ghackmann@google.com>

Add bindings so we don't need to rely on goldfish virtual bus for
probing any more, which means we don't need ARM and MIPS goldfish
board code for instantiating the bus.

In the long term we would like to move towards replacing the Android
pipe with virtio-vsock that is currently under development.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
---
 Documentation/devicetree/bindings/goldfish/pipe.txt | 17 +++++++++++++++++
 drivers/platform/goldfish/goldfish_pipe.c           | 10 +++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/goldfish/pipe.txt

diff --git a/Documentation/devicetree/bindings/goldfish/pipe.txt b/Documentation/devicetree/bindings/goldfish/pipe.txt
new file mode 100644
index 0000000..e417a31
--- /dev/null
+++ b/Documentation/devicetree/bindings/goldfish/pipe.txt
@@ -0,0 +1,17 @@
+Android Goldfish QEMU Pipe
+
+Andorid pipe virtual device generated by android emulator.
+
+Required properties:
+
+- compatible : should contain "google,android-pipe" to match emulator
+- reg        : <registers mapping>
+- interrupts : <interrupt mapping>
+
+Example:
+
+	android_pipe@a010000 {
+		compatible = "google,android-pipe";
+		reg = <ff018000 0x2000>;
+		interrupts = <0x12>;
+	};
diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index 20a9337..0b187ff 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -624,11 +624,19 @@ static int goldfish_pipe_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id goldfish_pipe_of_match[] = {
+	{ .compatible = "google,android-pipe", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, goldfish_pipe_of_match);
+
 static struct platform_driver goldfish_pipe = {
 	.probe = goldfish_pipe_probe,
 	.remove = goldfish_pipe_remove,
 	.driver = {
-		.name = "goldfish_pipe"
+		.name = "goldfish_pipe",
+		.owner = THIS_MODULE,
+		.of_match_table = goldfish_pipe_of_match,
 	}
 };
 
-- 
2.6.0.rc2.230.g3dd15c0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1283886 — Re: [PATCH v3 4/8] platform: goldfish: pipe: add devicetree bindings

FromRob Herring <robh@kernel.org>
Date2015-12-04 16:00 +0100
SubjectRe: [PATCH v3 4/8] platform: goldfish: pipe: add devicetree bindings
Message-ID<qC002-43h-13@gated-at.bofh.it>
In reply to#1282306
On Wed, Dec 02, 2015 at 11:35:59AM -0800, Jin Qian wrote:
> From: Greg Hackmann <ghackmann@google.com>
> 
> Add bindings so we don't need to rely on goldfish virtual bus for
> probing any more, which means we don't need ARM and MIPS goldfish
> board code for instantiating the bus.
> 
> In the long term we would like to move towards replacing the Android
> pipe with virtio-vsock that is currently under development.
> 
> Signed-off-by: Greg Hackmann <ghackmann@google.com>
> Signed-off-by: Jin Qian <jinqian@android.com>

Acked-by: Rob Herring <robh@kernel.org>

> ---
>  Documentation/devicetree/bindings/goldfish/pipe.txt | 17 +++++++++++++++++
>  drivers/platform/goldfish/goldfish_pipe.c           | 10 +++++++++-
>  2 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/goldfish/pipe.txt
> 
> diff --git a/Documentation/devicetree/bindings/goldfish/pipe.txt b/Documentation/devicetree/bindings/goldfish/pipe.txt
> new file mode 100644
> index 0000000..e417a31
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/goldfish/pipe.txt
> @@ -0,0 +1,17 @@
> +Android Goldfish QEMU Pipe
> +
> +Andorid pipe virtual device generated by android emulator.
> +
> +Required properties:
> +
> +- compatible : should contain "google,android-pipe" to match emulator
> +- reg        : <registers mapping>
> +- interrupts : <interrupt mapping>
> +
> +Example:
> +
> +	android_pipe@a010000 {
> +		compatible = "google,android-pipe";
> +		reg = <ff018000 0x2000>;
> +		interrupts = <0x12>;
> +	};
> diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
> index 20a9337..0b187ff 100644
> --- a/drivers/platform/goldfish/goldfish_pipe.c
> +++ b/drivers/platform/goldfish/goldfish_pipe.c
> @@ -624,11 +624,19 @@ static int goldfish_pipe_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct of_device_id goldfish_pipe_of_match[] = {
> +	{ .compatible = "google,android-pipe", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, goldfish_pipe_of_match);
> +
>  static struct platform_driver goldfish_pipe = {
>  	.probe = goldfish_pipe_probe,
>  	.remove = goldfish_pipe_remove,
>  	.driver = {
> -		.name = "goldfish_pipe"
> +		.name = "goldfish_pipe",
> +		.owner = THIS_MODULE,
> +		.of_match_table = goldfish_pipe_of_match,
>  	}
>  };
>  
> -- 
> 2.6.0.rc2.230.g3dd15c0
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282309 — [PATCH v3 2/8] android_pipe: don't be clever with #define offsets

FromJin Qian <jinqian@android.com>
Date2015-12-02 20:50 +0100
Subject[PATCH v3 2/8] android_pipe: don't be clever with #define offsets
Message-ID<qBlzA-38R-5@gated-at.bofh.it>
In reply to#1282305
From: Alex Bennée <alex.bennee@linaro.org>

You just make it harder to figure out when commands are being used.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Jin Qian <jinqian@android.com>
---
 drivers/platform/goldfish/goldfish_pipe.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index e7a29e2..0fb3a34 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -90,12 +90,6 @@
 #define CMD_WRITE_BUFFER	4  /* send a user buffer to the emulator */
 #define CMD_WAKE_ON_WRITE	5  /* tell the emulator to wake us when writing
 				     is possible */
-
-/* The following commands are related to read operations, they must be
- * listed in the same order than the corresponding write ones, since we
- * will use (CMD_READ_BUFFER - CMD_WRITE_BUFFER) as a special offset
- * in goldfish_pipe_read_write() below.
- */
 #define CMD_READ_BUFFER        6  /* receive a user buffer from the emulator */
 #define CMD_WAKE_ON_READ       7  /* tell the emulator to wake us when reading
 				   * is possible */
@@ -272,8 +266,6 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
 	unsigned long irq_flags;
 	struct goldfish_pipe *pipe = filp->private_data;
 	struct goldfish_pipe_dev *dev = pipe->dev;
-	const int cmd_offset = is_write ? 0
-					: (CMD_READ_BUFFER - CMD_WRITE_BUFFER);
 	unsigned long address, address_end;
 	int ret = 0;
 
@@ -325,7 +317,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
 
 		/* Now, try to transfer the bytes in the current page */
 		spin_lock_irqsave(&dev->lock, irq_flags);
-		if (access_with_param(dev, CMD_WRITE_BUFFER + cmd_offset,
+		if (access_with_param(dev,
+				is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER,
 				address, avail, pipe, &status)) {
 			gf_write_ptr(pipe, dev->base + PIPE_REG_CHANNEL,
 				     dev->base + PIPE_REG_CHANNEL_HIGH);
@@ -333,7 +326,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
 			gf_write_ptr((void *)address,
 				     dev->base + PIPE_REG_ADDRESS,
 				     dev->base + PIPE_REG_ADDRESS_HIGH);
-			writel(CMD_WRITE_BUFFER + cmd_offset,
+			writel(is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER,
 					dev->base + PIPE_REG_COMMAND);
 			status = readl(dev->base + PIPE_REG_STATUS);
 		}
@@ -370,7 +363,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
 		set_bit(wakeBit, &pipe->flags);
 
 		/* Tell the emulator we're going to wait for a wake event */
-		goldfish_cmd(pipe, CMD_WAKE_ON_WRITE + cmd_offset);
+		goldfish_cmd(pipe,
+			is_write ? CMD_WAKE_ON_WRITE : CMD_WAKE_ON_READ);
 
 		/* Unlock the pipe, then wait for the wake signal */
 		mutex_unlock(&pipe->lock);
-- 
2.6.0.rc2.230.g3dd15c0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282339 — Re: [PATCH v3 2/8] android_pipe: don't be clever with #define offsets

FromJoe Perches <joe@perches.com>
Date2015-12-02 21:20 +0100
SubjectRe: [PATCH v3 2/8] android_pipe: don't be clever with #define offsets
Message-ID<qBm2C-3zv-11@gated-at.bofh.it>
In reply to#1282309
On Wed, 2015-12-02 at 11:35 -0800, Jin Qian wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
> 
> You just make it harder to figure out when commands are being used.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Signed-off-by: Jin Qian <jinqian@android.com>
> ---
>  drivers/platform/goldfish/goldfish_pipe.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
> index e7a29e2..0fb3a34 100644
> --- a/drivers/platform/goldfish/goldfish_pipe.c
> +++ b/drivers/platform/goldfish/goldfish_pipe.c
> @@ -90,12 +90,6 @@
>  #define CMD_WRITE_BUFFER	4  /* send a user buffer to the emulator */
>  #define CMD_WAKE_ON_WRITE	5  /* tell the emulator to wake us when writing
>  				     is possible */
> -
> -/* The following commands are related to read operations, they must be
> - * listed in the same order than the corresponding write ones, since we
> - * will use (CMD_READ_BUFFER - CMD_WRITE_BUFFER) as a special offset
> - * in goldfish_pipe_read_write() below.
> - */
>  #define CMD_READ_BUFFER        6  /* receive a user buffer from the emulator */
>  #define CMD_WAKE_ON_READ       7  /* tell the emulator to wake us when reading
>  				   * is possible */
> @@ -272,8 +266,6 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
>  	unsigned long irq_flags;
>  	struct goldfish_pipe *pipe = filp->private_data;
>  	struct goldfish_pipe_dev *dev = pipe->dev;
> -	const int cmd_offset = is_write ? 0
> -					: (CMD_READ_BUFFER - CMD_WRITE_BUFFER);

This one could be
	int cmd_type = is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER;
@@ -325,7 +317,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
>  
>  		/* Now, try to transfer the bytes in the current page */
>  		spin_lock_irqsave(&dev->lock, irq_flags);
> -		if (access_with_param(dev, CMD_WRITE_BUFFER + cmd_offset,
> +		if (access_with_param(dev,
> +				is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER,
>  				address, avail, pipe, &status)) {
>  			gf_write_ptr(pipe, dev->base + PIPE_REG_CHANNEL,
>  				     dev->base + PIPE_REG_CHANNEL_HIGH);
> @@ -333,7 +326,7 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
>  			gf_write_ptr((void *)address,
>  				     dev->base + PIPE_REG_ADDRESS,
>  				     dev->base + PIPE_REG_ADDRESS_HIGH);
> -			writel(CMD_WRITE_BUFFER + cmd_offset,
> +			writel(is_write ? CMD_WRITE_BUFFER : CMD_READ_BUFFER,
>  					dev->base + PIPE_REG_COMMAND);
>  			status = readl(dev->base + PIPE_REG_STATUS);
>  		}

and the loop could use cmd_type instead of the ?:

> @@ -370,7 +363,8 @@ static ssize_t goldfish_pipe_read_write(struct file *filp, char __user *buffer,
>  		set_bit(wakeBit, &pipe->flags);
>  
>  		/* Tell the emulator we're going to wait for a wake event */
> -		goldfish_cmd(pipe, CMD_WAKE_ON_WRITE + cmd_offset);
> +		goldfish_cmd(pipe,
> +			is_write ? CMD_WAKE_ON_WRITE : CMD_WAKE_ON_READ);
>  
>  		/* Unlock the pipe, then wait for the wake signal */
>  		mutex_unlock(&pipe->lock);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282311 — [PATCH v3 8/8] goldfish: Enable ACPI-based enumeration for android pipe

FromJin Qian <jinqian@android.com>
Date2015-12-02 20:50 +0100
Subject[PATCH v3 8/8] goldfish: Enable ACPI-based enumeration for android pipe
Message-ID<qBlzA-38R-25@gated-at.bofh.it>
In reply to#1282305
From: Jason Hu <jia-cheng.hu@intel.com>

Add ACPI binding to the android pipe driver

Signed-off-by: Jason Hu <jia-cheng.hu@intel.com>
Signed-off-by: Jin Qian <jinqian@android.com>
---
 drivers/platform/goldfish/goldfish_pipe.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index c214434..e3fab9a 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -59,6 +59,7 @@
 #include <linux/io.h>
 #include <linux/goldfish.h>
 #include <linux/mm.h>
+#include <linux/acpi.h>
 
 /*
  * IMPORTANT: The following constants must match the ones used and defined
@@ -650,6 +651,12 @@ static int goldfish_pipe_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct acpi_device_id goldfish_pipe_acpi_match[] = {
+	{ "GFSH0003", 0 },
+	{ },
+};
+MODULE_DEVICE_TABLE(acpi, goldfish_pipe_acpi_match);
+
 static const struct of_device_id goldfish_pipe_of_match[] = {
 	{ .compatible = "google,android-pipe", },
 	{},
@@ -663,6 +670,7 @@ static struct platform_driver goldfish_pipe = {
 		.name = "goldfish_pipe",
 		.owner = THIS_MODULE,
 		.of_match_table = goldfish_pipe_of_match,
+		.acpi_match_table = ACPI_PTR(goldfish_pipe_acpi_match),
 	}
 };
 
-- 
2.6.0.rc2.230.g3dd15c0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web