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, rkrcmar@redhat.com, cdall@linaro.org,
	david@redhat.com, lvivier@redhat.com, thuth@redhat.com
Subject: [PATCH kvm-unit-tests v2 02/12] arm/arm64: add pgtable to thread_info
Date: Wed, 17 Jan 2018 11:39:55 +0100	[thread overview]
Message-ID: <20180117104005.29211-3-drjones@redhat.com> (raw)
In-Reply-To: <20180117104005.29211-1-drjones@redhat.com>

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/arm/asm/thread_info.h | 1 +
 lib/arm/mmu.c             | 5 +++--
 lib/arm/processor.c       | 1 +
 lib/arm/smp.c             | 1 +
 lib/arm64/processor.c     | 1 +
 5 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/arm/asm/thread_info.h b/lib/arm/asm/thread_info.h
index c2ecebb47d5a..80ab3954a6b0 100644
--- a/lib/arm/asm/thread_info.h
+++ b/lib/arm/asm/thread_info.h
@@ -47,6 +47,7 @@ static inline void *thread_stack_alloc(void)
 struct thread_info {
 	int cpu;
 	unsigned int flags;
+	void *pgtable;
 #ifdef __arm__
 	exception_fn exception_handlers[EXCPTN_MAX];
 #else
diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
index 9e420269f1c0..b9387efe0065 100644
--- a/lib/arm/mmu.c
+++ b/lib/arm/mmu.c
@@ -54,12 +54,13 @@ void mmu_mark_disabled(int cpu)
 extern void asm_mmu_enable(phys_addr_t pgtable);
 void mmu_enable(pgd_t *pgtable)
 {
-	int cpu = current_thread_info()->cpu;
+	struct thread_info *info = current_thread_info();
 
 	asm_mmu_enable(__pa(pgtable));
 	flush_tlb_all();
 
-	mmu_mark_enabled(cpu);
+	info->pgtable = pgtable;
+	mmu_mark_enabled(info->cpu);
 }
 
 extern void asm_mmu_disable(void);
diff --git a/lib/arm/processor.c b/lib/arm/processor.c
index 54fdb87ef019..49e852c06527 100644
--- a/lib/arm/processor.c
+++ b/lib/arm/processor.c
@@ -124,6 +124,7 @@ void start_usr(void (*func)(void *arg), void *arg, unsigned long sp_usr)
 	sp_usr &= (~7UL); /* stack ptr needs 8-byte alignment */
 
 	thread_info_init(thread_info_sp(sp_usr), TIF_USER_MODE);
+	thread_info_sp(sp_usr)->pgtable = current_thread_info()->pgtable;
 
 	asm volatile(
 		"mrs	r0, cpsr\n"
diff --git a/lib/arm/smp.c b/lib/arm/smp.c
index 3c4e307489b2..27f6fcd07109 100644
--- a/lib/arm/smp.c
+++ b/lib/arm/smp.c
@@ -33,6 +33,7 @@ secondary_entry_fn secondary_cinit(void)
 	secondary_entry_fn entry;
 
 	thread_info_init(ti, 0);
+	ti->pgtable = mmu_idmap;
 	mmu_mark_enabled(ti->cpu);
 
 	/*
diff --git a/lib/arm64/processor.c b/lib/arm64/processor.c
index 165980a97d44..96995ccb7733 100644
--- a/lib/arm64/processor.c
+++ b/lib/arm64/processor.c
@@ -238,6 +238,7 @@ void start_usr(void (*func)(void *arg), void *arg, unsigned long sp_usr)
 	sp_usr &= (~15UL); /* stack ptr needs 16-byte alignment */
 
 	__thread_info_init(thread_info_sp(sp_usr), TIF_USER_MODE);
+	thread_info_sp(sp_usr)->pgtable = current_thread_info()->pgtable;
 
 	asm volatile(
 		"mov	x0, %0\n"
-- 
2.13.6

  parent reply	other threads:[~2018-01-17 10:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17 10:39 [PATCH kvm-unit-tests v2 00/12] arm/arm64: mmu fixes and feature Andrew Jones
2018-01-17 10:39 ` [PATCH kvm-unit-tests v2 01/12] arm/arm64: cleanup alloc.h includes Andrew Jones
2018-01-17 10:39 ` Andrew Jones [this message]
2018-01-17 10:39 ` [PATCH kvm-unit-tests v2 03/12] arm/arm64: fix virt_to_phys Andrew Jones
2018-01-17 10:39 ` [PATCH kvm-unit-tests v2 04/12] arm/arm64: flush page table cache when installing entries Andrew Jones
2018-01-17 10:39 ` [PATCH kvm-unit-tests v2 05/12] arm/arm64: setup: don't allow gaps in phys range Andrew Jones
2018-01-17 10:39 ` [PATCH kvm-unit-tests v2 06/12] phys_alloc: ensure we account all allocations Andrew Jones
2018-01-17 12:15   ` David Hildenbrand
2018-01-17 10:40 ` [PATCH kvm-unit-tests v2 07/12] page_alloc: allow initialization before setup_vm call Andrew Jones
2018-01-17 10:40 ` [PATCH kvm-unit-tests v2 08/12] bitops: add fls Andrew Jones
2018-01-17 10:40 ` [PATCH kvm-unit-tests v2 09/12] page_alloc: add yet another memalign Andrew Jones
2018-01-17 10:40 ` [PATCH kvm-unit-tests v2 10/12] lib/auxinfo: add flags field Andrew Jones
2018-01-17 10:40 ` [PATCH kvm-unit-tests v2 11/12] arm/arm64: allow setup_vm to be skipped Andrew Jones
2018-01-17 10:40 ` [PATCH kvm-unit-tests v2 12/12] arm/arm64: sieve should start with the mmu off Andrew Jones
2018-01-17 11:17 ` [PATCH kvm-unit-tests v2 00/12] arm/arm64: mmu fixes and feature David Hildenbrand

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=20180117104005.29211-3-drjones@redhat.com \
    --to=drjones@redhat.com \
    --cc=cdall@linaro.org \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=thuth@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.