All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Jones <drjones@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [kvm-unit-tests PATCH 4/4] arm/arm64: make stack creation user friendly
Date: Fri, 15 Jan 2016 18:41:30 +0100	[thread overview]
Message-ID: <1452879690-14493-5-git-send-email-drjones@redhat.com> (raw)
In-Reply-To: <1452879690-14493-1-git-send-email-drjones@redhat.com>

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 arm/selftest.c            | 3 +--
 lib/arm/asm/thread_info.h | 7 +++++++
 lib/arm/smp.c             | 4 +---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/arm/selftest.c b/arm/selftest.c
index 3e13296410fc1..aad7eecd529ad 100644
--- a/arm/selftest.c
+++ b/arm/selftest.c
@@ -356,9 +356,8 @@ int main(int argc, char **argv)
 
 	} else if (strcmp(argv[0], "vectors-user") == 0) {
 
-		void *sp = memalign(THREAD_SIZE, THREAD_SIZE);
 		start_usr(check_vectors, NULL,
-				(unsigned long)sp + THREAD_START_SP);
+				(unsigned long)thread_stack_alloc());
 
 	} else if (strcmp(argv[0], "smp") == 0) {
 
diff --git a/lib/arm/asm/thread_info.h b/lib/arm/asm/thread_info.h
index 95058bff9d857..7eaac7c32953b 100644
--- a/lib/arm/asm/thread_info.h
+++ b/lib/arm/asm/thread_info.h
@@ -22,6 +22,7 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/processor.h>
+#include <alloc.h>
 
 #ifdef __arm__
 #include <asm/ptrace.h>
@@ -35,6 +36,12 @@
 #define THREAD_START_SP		(THREAD_SIZE - 16)
 #endif
 
+static inline void *thread_stack_alloc(void)
+{
+	void *sp = memalign(THREAD_SIZE, THREAD_SIZE);
+	return sp + THREAD_START_SP;
+}
+
 #define TIF_USER_MODE		(1U << 0)
 
 struct thread_info {
diff --git a/lib/arm/smp.c b/lib/arm/smp.c
index 390c53b5d84c3..bbaf9e60e9506 100644
--- a/lib/arm/smp.c
+++ b/lib/arm/smp.c
@@ -6,7 +6,6 @@
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
 #include <libcflat.h>
-#include <alloc.h>
 #include <asm/thread_info.h>
 #include <asm/cpumask.h>
 #include <asm/barrier.h>
@@ -43,10 +42,9 @@ secondary_entry_fn secondary_cinit(void)
 
 void smp_boot_secondary(int cpu, secondary_entry_fn entry)
 {
-	void *stack_base = memalign(THREAD_SIZE, THREAD_SIZE);
 	int ret;
 
-	secondary_data.stack = stack_base + THREAD_START_SP;
+	secondary_data.stack = thread_stack_alloc();
 	secondary_data.entry = entry;
 	mmu_mark_disabled(cpu);
 	ret = cpu_psci_cpu_boot(cpu);
-- 
2.4.3


  parent reply	other threads:[~2016-01-15 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 17:41 [kvm-unit-tests PATCH 0/4] arm/arm64: fixes and convenience Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 1/4] arm64: irq handlers don't use esr Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 2/4] arm64: start_usr: no default vectors Andrew Jones
2016-01-15 17:41 ` [kvm-unit-tests PATCH 3/4] arm64: include esr.h from processor.h Andrew Jones
2016-01-15 17:41 ` Andrew Jones [this message]
2016-01-19 14:29   ` [kvm-unit-tests PATCH 4/4] arm/arm64: make stack creation user friendly Paolo Bonzini
2016-01-19 14:30 ` [kvm-unit-tests PATCH 0/4] arm/arm64: fixes and convenience Paolo Bonzini

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=1452879690-14493-5-git-send-email-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.