From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, ajackson@redhat.com,
airlied@redhat.com, benh@kernel.crashing.org
Subject: [patch 5/5] spufs use the new vm_ops->access
Date: Thu, 15 May 2008 13:54:02 -0400 [thread overview]
Message-ID: <20080515175431.237110763@redhat.com> (raw)
In-Reply-To: 20080515175357.636334082@redhat.com
[-- Attachment #1: 05-spufs-use-vm_ops-access.patch --]
[-- Type: text/plain, Size: 1684 bytes --]
spufs: use new vm_ops->access to allow local state access from gdb
This uses the new vm_ops->access to allow gdb to access the SPU
local store. We currently prevent access to problem state registers,
this can be done later if really needed but it's safer not to.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Rik van Riel <riel@redhat.com>
---
Index: ptrace-2.6.26-rc2-mm1/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- ptrace-2.6.26-rc2-mm1.orig/arch/powerpc/platforms/cell/spufs/file.c 2008-05-15 13:35:39.000000000 -0400
+++ ptrace-2.6.26-rc2-mm1/arch/powerpc/platforms/cell/spufs/file.c 2008-05-15 13:42:26.000000000 -0400
@@ -287,9 +287,32 @@ spufs_mem_mmap_fault(struct vm_area_stru
return VM_FAULT_NOPAGE;
}
+static int spufs_mem_mmep_access(struct vm_area_struct *vma,
+ unsigned long address,
+ void *buf, int len, int write)
+{
+ struct spu_context *ctx = vma->vm_file->private_data;
+ unsigned long offset = address - vma->vm_start;
+ char *local_store;
+
+ if (write && !(vma->vm_flags & VM_WRITE))
+ return -EACCES;
+ if (spu_acquire(ctx))
+ return -EINTR;
+ if ((offset + len) > vma->vm_end)
+ len = vma->vm_end - offset;
+ local_store = ctx->ops->get_ls(ctx);
+ if (write)
+ memcpy_toio(local_store + offset, buf, len);
+ else
+ memcpy_fromio(buf, local_store + offset, len);
+ spu_release(ctx);
+ return len;
+}
static struct vm_operations_struct spufs_mem_mmap_vmops = {
.fault = spufs_mem_mmap_fault,
+ .access = spufs_mem_mmep_access,
};
static int spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
--
All Rights Reversed
next prev parent reply other threads:[~2008-05-15 17:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 17:53 [patch 0/5] access_process_vm device memory access Rik van Riel
2008-05-15 17:53 ` [patch 1/5] access_process_vm device memory infrastructure Rik van Riel
2008-05-16 8:20 ` Peter Zijlstra
2008-05-16 20:27 ` [PATCH 6/5] Add documentation for the vm_ops->access function Rik van Riel
2008-05-15 17:53 ` [patch 2/5] use generic_access_phys for /dev/mem mappings Rik van Riel
2008-05-15 17:54 ` [patch 3/5] use generic_access_phys for pci mmap on x86 Rik van Riel
2008-05-15 17:54 ` [patch 4/5] powerpc ioremap_prot Rik van Riel
2008-05-15 17:54 ` Rik van Riel [this message]
2008-05-23 5:58 ` [patch 0/5] access_process_vm device memory access Andrew Morton
2008-05-23 6:01 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080515175431.237110763@redhat.com \
--to=riel@redhat.com \
--cc=airlied@redhat.com \
--cc=ajackson@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox