linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: <linuxppc-dev@ozlabs.org>
Cc: bsingharora@gmail.com, duwe@lst.de,
	<linux-kernel@vger.kernel.org>,
	rostedt@goodmis.org, kamalesh@linux.vnet.ibm.com,
	pmladek@suse.com, jeyu@redhat.com, jikos@kernel.org,
	live-patching@vger.kernel.org, mbenes@suse.cz
Subject: [PATCH 3/5] powerpc/livepatch: Add livepatch header
Date: Wed, 13 Apr 2016 22:53:21 +1000	[thread overview]
Message-ID: <1460552003-15409-4-git-send-email-mpe@ellerman.id.au> (raw)
In-Reply-To: <1460552003-15409-1-git-send-email-mpe@ellerman.id.au>

Add the powerpc specific livepatch definitions. In particular we provide
a non-default implementation of klp_get_ftrace_location().

This is required because the location of the mcount call is not constant
when using -mprofile-kernel (which we always do for live patching).

Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/livepatch.h | 54 ++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 arch/powerpc/include/asm/livepatch.h

diff --git a/arch/powerpc/include/asm/livepatch.h b/arch/powerpc/include/asm/livepatch.h
new file mode 100644
index 000000000000..ad36e8e34fa1
--- /dev/null
+++ b/arch/powerpc/include/asm/livepatch.h
@@ -0,0 +1,54 @@
+/*
+ * livepatch.h - powerpc-specific Kernel Live Patching Core
+ *
+ * Copyright (C) 2015-2016, SUSE, IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _ASM_POWERPC_LIVEPATCH_H
+#define _ASM_POWERPC_LIVEPATCH_H
+
+#include <linux/module.h>
+#include <linux/ftrace.h>
+
+#ifdef CONFIG_LIVEPATCH
+static inline int klp_check_compiler_support(void)
+{
+	return 0;
+}
+
+static inline int klp_write_module_reloc(struct module *mod, unsigned long
+		type, unsigned long loc, unsigned long value)
+{
+	/* This requires infrastructure changes; we need the loadinfos. */
+	return -ENOSYS;
+}
+
+static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
+{
+	regs->nip = ip;
+}
+
+#define klp_get_ftrace_location klp_get_ftrace_location
+static inline unsigned long klp_get_ftrace_location(unsigned long faddr)
+{
+	/*
+	 * Live patch works only with -mprofile-kernel on PPC. In this case,
+	 * the ftrace location is always within the first 16 bytes.
+	 */
+	return ftrace_location_range(faddr, faddr + 16);
+}
+#endif /* CONFIG_LIVEPATCH */
+
+#endif /* _ASM_POWERPC_LIVEPATCH_H */
-- 
2.5.0

  parent reply	other threads:[~2016-04-13 12:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 12:53 [PATCH 0/5] Live patching for powerpc Michael Ellerman
2016-04-13 12:53 ` [PATCH 1/5] ftrace: Make ftrace_location_range() global Michael Ellerman
2016-04-19 10:16   ` [1/5] " Michael Ellerman
2016-04-13 12:53 ` [PATCH 2/5] livepatch: Allow architectures to specify an alternate ftrace location Michael Ellerman
2016-04-14 12:01   ` Miroslav Benes
2016-04-14 13:06     ` Michael Ellerman
2016-04-14 14:06       ` Miroslav Benes
2016-04-19 10:16   ` [2/5] " Michael Ellerman
2016-04-13 12:53 ` Michael Ellerman [this message]
2016-04-14 12:18   ` [PATCH 3/5] powerpc/livepatch: Add livepatch header Miroslav Benes
2016-04-14 12:23     ` Miroslav Benes
2016-04-14 13:12       ` Michael Ellerman
2016-04-19 10:16   ` [3/5] " Michael Ellerman
2016-04-13 12:53 ` [PATCH 4/5] powerpc/livepatch: Add livepatch stack to struct thread_info Michael Ellerman
2016-04-19 10:16   ` [4/5] " Michael Ellerman
2016-04-13 12:53 ` [PATCH 5/5] powerpc/livepatch: Add live patching support on ppc64le Michael Ellerman
2016-04-19 10:16   ` [5/5] " Michael Ellerman
2016-04-13 13:01 ` [PATCH 0/5] Live patching for powerpc Miroslav Benes
2016-04-13 13:22   ` Jiri Kosina
2016-04-14  6:49     ` Michael Ellerman
2016-04-14 12:57       ` Torsten Duwe
2016-04-14 13:08         ` Michael Ellerman
2016-04-14 15:20           ` Torsten Duwe
2016-04-14 16:41             ` Josh Poimboeuf
2016-04-15 11:22               ` Michael Ellerman
2016-04-15 12:59                 ` Josh Poimboeuf
2016-04-15 13:21                   ` Michael Ellerman
2016-04-14 14:34         ` Jiri Kosina
2016-04-15 12:24           ` Michael Ellerman
2016-04-15 15:07       ` Jiri Kosina
2016-04-19 21:42         ` Balbir Singh
2016-04-19 21:52           ` Jiri Kosina
2016-04-13 18:22   ` Jessica Yu
2016-04-14 13:28     ` Miroslav Benes
2016-04-14 19:20       ` Jessica Yu
2016-04-15  8:28         ` Miroslav Benes
2016-04-15 10:01           ` Michael Ellerman

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=1460552003-15409-4-git-send-email-mpe@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=bsingharora@gmail.com \
    --cc=duwe@lst.de \
    --cc=jeyu@redhat.com \
    --cc=jikos@kernel.org \
    --cc=kamalesh@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).