mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] metag: misc improvements
@ 2013-03-27 14:35 James Hogan
  2013-03-27 14:35 ` [PATCH 1/3] metag: ptrace: Implement NT_METAG_TLS James Hogan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 14:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan

A few more misc arch/metag/ improvements for v3.10.

James Hogan (2):
  metag: export _metag_da_present and cpu_2_hwthread_id
  metag: add exported <asm/ech.h> for extended context handling

Paul Clothier (1):
  metag: ptrace: Implement NT_METAG_TLS

 arch/metag/include/uapi/asm/Kbuild |  1 +
 arch/metag/include/uapi/asm/ech.h  | 15 +++++++++++++++
 arch/metag/kernel/da.c             |  2 ++
 arch/metag/kernel/ptrace.c         | 34 ++++++++++++++++++++++++++++++++++
 arch/metag/kernel/setup.c          |  1 +
 include/uapi/linux/elf.h           |  1 +
 6 files changed, 54 insertions(+)
 create mode 100644 arch/metag/include/uapi/asm/ech.h

-- 
1.8.1.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] metag: ptrace: Implement NT_METAG_TLS
  2013-03-27 14:35 [PATCH 0/3] metag: misc improvements James Hogan
@ 2013-03-27 14:35 ` James Hogan
  2013-03-27 14:35 ` [PATCH 2/3] metag: export _metag_da_present and cpu_2_hwthread_id James Hogan
  2013-03-27 14:35 ` [PATCH 3/3] metag: add exported <asm/ech.h> for extended context handling James Hogan
  2 siblings, 0 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 14:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan, Paul Clothier

From: Paul Clothier <Paul.Clothier@imgtec.com>

Implement functionality to get the TLS pointer for the metag
architecture using regsets.

This provides multi-threaded debug support for GDB.

Signed-off-by: Paul Clothier <Paul.Clothier@imgtec.com>
---
 arch/metag/kernel/ptrace.c | 34 ++++++++++++++++++++++++++++++++++
 include/uapi/linux/elf.h   |  1 +
 2 files changed, 35 insertions(+)

diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c
index 47a8828..7563628 100644
--- a/arch/metag/kernel/ptrace.c
+++ b/arch/metag/kernel/ptrace.c
@@ -288,10 +288,36 @@ static int metag_rp_state_set(struct task_struct *target,
 	return metag_rp_state_copyin(regs, pos, count, kbuf, ubuf);
 }
 
+static int metag_tls_get(struct task_struct *target,
+			const struct user_regset *regset,
+			unsigned int pos, unsigned int count,
+			void *kbuf, void __user *ubuf)
+{
+	void __user *tls = target->thread.tls_ptr;
+	return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
+}
+
+static int metag_tls_set(struct task_struct *target,
+			const struct user_regset *regset,
+			unsigned int pos, unsigned int count,
+			const void *kbuf, const void __user *ubuf)
+{
+	int ret;
+	void __user *tls;
+
+	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
+	if (ret)
+		return ret;
+
+	target->thread.tls_ptr = tls;
+	return ret;
+}
+
 enum metag_regset {
 	REGSET_GENERAL,
 	REGSET_CBUF,
 	REGSET_READPIPE,
+	REGSET_TLS,
 };
 
 static const struct user_regset metag_regsets[] = {
@@ -319,6 +345,14 @@ static const struct user_regset metag_regsets[] = {
 		.get = metag_rp_state_get,
 		.set = metag_rp_state_set,
 	},
+	[REGSET_TLS] = {
+		.core_note_type = NT_METAG_TLS,
+		.n = 1,
+		.size = sizeof(void *),
+		.align = sizeof(void *),
+		.get = metag_tls_get,
+		.set = metag_tls_set,
+	},
 };
 
 static const struct user_regset_view user_metag_view = {
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index 8072d35..ef6103b 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -397,6 +397,7 @@ typedef struct elf64_shdr {
 #define NT_ARM_HW_WATCH	0x403		/* ARM hardware watchpoint registers */
 #define NT_METAG_CBUF	0x500		/* Metag catch buffer registers */
 #define NT_METAG_RPIPE	0x501		/* Metag read pipeline state */
+#define NT_METAG_TLS	0x502		/* Metag TLS pointer */
 
 
 /* Note header in a PT_NOTE section */
-- 
1.8.1.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] metag: export _metag_da_present and cpu_2_hwthread_id
  2013-03-27 14:35 [PATCH 0/3] metag: misc improvements James Hogan
  2013-03-27 14:35 ` [PATCH 1/3] metag: ptrace: Implement NT_METAG_TLS James Hogan
@ 2013-03-27 14:35 ` James Hogan
  2013-03-27 14:35 ` [PATCH 3/3] metag: add exported <asm/ech.h> for extended context handling James Hogan
  2 siblings, 0 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 14:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan

Export the symbols _metag_da_present and cpu_2_hwthread_id to modules
(GPL only) to allow the imgdafs file system to be built as a module.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 arch/metag/kernel/da.c    | 2 ++
 arch/metag/kernel/setup.c | 1 +
 2 files changed, 3 insertions(+)

diff --git a/arch/metag/kernel/da.c b/arch/metag/kernel/da.c
index 52aabb6..a35dbed 100644
--- a/arch/metag/kernel/da.c
+++ b/arch/metag/kernel/da.c
@@ -5,12 +5,14 @@
  */
 
 
+#include <linux/export.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <asm/da.h>
 #include <asm/metag_mem.h>
 
 bool _metag_da_present;
+EXPORT_SYMBOL_GPL(_metag_da_present);
 
 int __init metag_da_probe(void)
 {
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 8792461..4f5726f 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -124,6 +124,7 @@ struct machine_desc *machine_desc __initdata;
 u8 cpu_2_hwthread_id[NR_CPUS] __read_mostly = {
 	[0 ... NR_CPUS-1] = BAD_HWTHREAD_ID
 };
+EXPORT_SYMBOL_GPL(cpu_2_hwthread_id);
 
 /*
  * Map a hardware thread ID to a Linux CPU number
-- 
1.8.1.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] metag: add exported <asm/ech.h> for extended context handling
  2013-03-27 14:35 [PATCH 0/3] metag: misc improvements James Hogan
  2013-03-27 14:35 ` [PATCH 1/3] metag: ptrace: Implement NT_METAG_TLS James Hogan
  2013-03-27 14:35 ` [PATCH 2/3] metag: export _metag_da_present and cpu_2_hwthread_id James Hogan
@ 2013-03-27 14:35 ` James Hogan
  2 siblings, 0 replies; 4+ messages in thread
From: James Hogan @ 2013-03-27 14:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: James Hogan

Add an exported header file <asm/ech.h> containing the definitions of
some bits which can be set in D0.8 to indicate to the kernel that
certain DSP state should be preserved. The definitions have the same
names and values as the ones in the kernel-internal <asm/tbx.h>, to
make it easier for DSP assembly code to be compatible between Linux and
non-Linux operating systems.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
 arch/metag/include/uapi/asm/Kbuild |  1 +
 arch/metag/include/uapi/asm/ech.h  | 15 +++++++++++++++
 2 files changed, 16 insertions(+)
 create mode 100644 arch/metag/include/uapi/asm/ech.h

diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild
index 876c71f..84e09fe 100644
--- a/arch/metag/include/uapi/asm/Kbuild
+++ b/arch/metag/include/uapi/asm/Kbuild
@@ -2,6 +2,7 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 header-y += byteorder.h
+header-y += ech.h
 header-y += ptrace.h
 header-y += resource.h
 header-y += sigcontext.h
diff --git a/arch/metag/include/uapi/asm/ech.h b/arch/metag/include/uapi/asm/ech.h
new file mode 100644
index 0000000..ac94d1c
--- /dev/null
+++ b/arch/metag/include/uapi/asm/ech.h
@@ -0,0 +1,15 @@
+#ifndef _UAPI_METAG_ECH_H
+#define _UAPI_METAG_ECH_H
+
+/*
+ * These bits can be set in the top half of the D0.8 register when DSP context
+ * switching is enabled, in order to support partial DSP context save/restore.
+ */
+
+#define TBICTX_XEXT_BIT	0x1000	/* Enable extended context save */
+#define TBICTX_XTDP_BIT	0x0800	/* DSP accumulators/RAM/templates */
+#define TBICTX_XHL2_BIT	0x0400	/* Hardware loops */
+#define TBICTX_XAXX_BIT	0x0200	/* Extended AX registers (A*.4-7) */
+#define TBICTX_XDX8_BIT	0x0100	/* Extended DX registers (D*.8-15) */
+
+#endif /* _UAPI_METAG_ECH_H */
-- 
1.8.1.2



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-27 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-27 14:35 [PATCH 0/3] metag: misc improvements James Hogan
2013-03-27 14:35 ` [PATCH 1/3] metag: ptrace: Implement NT_METAG_TLS James Hogan
2013-03-27 14:35 ` [PATCH 2/3] metag: export _metag_da_present and cpu_2_hwthread_id James Hogan
2013-03-27 14:35 ` [PATCH 3/3] metag: add exported <asm/ech.h> for extended context handling James Hogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®