aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-06-14 20:42:33 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-06-14 20:42:33 +0000
commitf88360279f91387dc61725226ad38c3c95d3790a (patch)
tree66d21f3483914eb7e674c45f3497ab8912094ac0 /target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch
parenta6d8f8be9e06c5ffb03f815c8c76ba743c64aa3d (diff)
downloadupstream-f88360279f91387dc61725226ad38c3c95d3790a.tar.gz
upstream-f88360279f91387dc61725226ad38c3c95d3790a.tar.bz2
upstream-f88360279f91387dc61725226ad38c3c95d3790a.zip
add the 'goldfish' target, useful for experimenting with virtual phone hardware (includes the emulator)
SVN-Revision: 16459
Diffstat (limited to 'target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch')
-rw-r--r--target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch b/target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch
new file mode 100644
index 0000000000..44554a6176
--- /dev/null
+++ b/target/linux/goldfish/patches-2.6.30/0133--ARM-goldfish-qemutrace-Add-mmap-support.patch
@@ -0,0 +1,84 @@
+From 2309613958ee518f94f1a7ba900e08e604e06048 Mon Sep 17 00:00:00 2001
+From: Jack Veenstra <veenstra@android.com>
+Date: Fri, 1 May 2009 18:50:10 -0700
+Subject: [PATCH 133/134] [ARM] goldfish: qemutrace: Add mmap support.
+
+This makes a page of data available for writing from user-space to allow
+the Dalvik interpreter to send method trace information to the emulator.
+
+Signed-off-by: Jack Veenstra <veenstra@android.com>
+---
+ drivers/misc/qemutrace/qemu_trace.c | 35 ++++++++++++++++++++++++++++++++++-
+ 1 files changed, 34 insertions(+), 1 deletions(-)
+
+--- a/drivers/misc/qemutrace/qemu_trace.c
++++ b/drivers/misc/qemutrace/qemu_trace.c
+@@ -53,6 +53,7 @@
+
+ static unsigned char __iomem *qt_base;
+ static int init_called;
++static uint32_t qemu_trace_paddr;
+
+ /* PIDs that start before our device registered */
+ #define MAX_INIT_PIDS 2048
+@@ -330,8 +331,30 @@ static void qemu_trace_dump_init_threads
+ }
+ }
+
++static int qemu_trace_mmap_fop(struct file *file, struct vm_area_struct *vma)
++{
++ int ret = io_remap_pfn_range(vma, vma->vm_start,
++ (qemu_trace_paddr >> PAGE_SHIFT) + 1,
++ PAGE_SIZE, vma->vm_page_prot);
++ if (ret < 0)
++ return ret;
++ return 0;
++}
++
++static const struct file_operations qemu_trace_fops = {
++ .owner = THIS_MODULE,
++ .mmap = qemu_trace_mmap_fop,
++};
++
++static struct miscdevice qemu_trace_device = {
++ .minor = MISC_DYNAMIC_MINOR,
++ .name = "qemu_trace",
++ .fops = &qemu_trace_fops,
++};
++
+ static int qemu_trace_probe(struct platform_device *pdev)
+ {
++ int err;
+ struct resource *r;
+
+ /* not thread safe, but this should not happen */
+@@ -340,18 +363,28 @@ static int qemu_trace_probe(struct platf
+ return -ENODEV;
+ }
+ r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+- if (r == NULL)
++ if (r == NULL || r->end - r->start < 2 * PAGE_SIZE - 1)
+ return -EINVAL;
++ qemu_trace_paddr = r->start;
+ qt_base = ioremap(r->start, PAGE_SIZE);
+ printk(KERN_INFO "QEMU TRACE Device: The mapped IO base is %p\n", qt_base);
+
+ qemu_trace_dump_init_threads();
++ err = misc_register(&qemu_trace_device);
++ if (err)
++ goto err_misc_register;
+
+ return 0;
++
++err_misc_register:
++ iounmap(qt_base);
++ qt_base = NULL;
++ return err;
+ }
+
+ static int qemu_trace_remove(struct platform_device *pdev)
+ {
++ misc_deregister(&qemu_trace_device);
+ iounmap(qt_base);
+ qt_base = NULL;
+ return 0;