From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Jones <drjones@redhat.com>,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 1/3] arm/arm64: Introduce mmu_disable
Date: Fri, 3 Jul 2015 19:42:58 +0200 [thread overview]
Message-ID: <5596C9A2.6050304@redhat.com> (raw)
In-Reply-To: <1435257911-9715-2-git-send-email-drjones@redhat.com>
On 25/06/2015 20:45, Andrew Jones wrote:
> Allow unit test cpus to disable the MMU. Why not? We want the
> test framework to be as flexible as possible. Callers will have
> to deal with the cache coherency fallout... Cache flush support
> is still forthcoming to the framework though.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> arm/cstart.S | 9 +++++++++
> arm/cstart64.S | 8 ++++++++
> lib/arm/asm/mmu-api.h | 1 +
> lib/arm/mmu.c | 8 ++++++++
> 4 files changed, 26 insertions(+)
>
> diff --git a/arm/cstart.S b/arm/cstart.S
> index 2b7f8f3d200ef..3943867d2f219 100644
> --- a/arm/cstart.S
> +++ b/arm/cstart.S
> @@ -159,6 +159,15 @@ asm_mmu_enable:
>
> mov pc, lr
>
> +.globl asm_mmu_disable
> +asm_mmu_disable:
> + /* SCTLR */
> + mrc p15, 0, r0, c1, c0, 0
> + bic r0, #CR_M
> + mcr p15, 0, r0, c1, c0, 0
> + isb
> + mov pc, lr
> +
> /*
> * Vector stubs
> * Simplified version of the Linux kernel implementation
> diff --git a/arm/cstart64.S b/arm/cstart64.S
> index cdda13c17af9e..44cff32d0f18e 100644
> --- a/arm/cstart64.S
> +++ b/arm/cstart64.S
> @@ -146,6 +146,14 @@ asm_mmu_enable:
>
> ret
>
> +.globl asm_mmu_disable
> +asm_mmu_disable:
> + mrs x0, sctlr_el1
> + bic x0, x0, SCTLR_EL1_M
> + msr sctlr_el1, x0
> + isb
> + ret
> +
> /*
> * Vectors
> * Adapted from arch/arm64/kernel/entry.S
> diff --git a/lib/arm/asm/mmu-api.h b/lib/arm/asm/mmu-api.h
> index 68dc707d67241..c46c4b08b14cc 100644
> --- a/lib/arm/asm/mmu-api.h
> +++ b/lib/arm/asm/mmu-api.h
> @@ -4,6 +4,7 @@ extern pgd_t *mmu_idmap;
> extern bool mmu_enabled(void);
> extern void mmu_set_enabled(void);
> extern void mmu_enable(pgd_t *pgtable);
> +extern void mmu_disable(void);
> extern void mmu_enable_idmap(void);
> extern void mmu_init_io_sect(pgd_t *pgtable, unsigned long virt_offset);
> extern void mmu_set_range_sect(pgd_t *pgtable, unsigned long virt_offset,
> diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
> index 732000a8eb088..5966b408cb455 100644
> --- a/lib/arm/mmu.c
> +++ b/lib/arm/mmu.c
> @@ -35,6 +35,14 @@ void mmu_enable(pgd_t *pgtable)
> mmu_set_enabled();
> }
>
> +extern void asm_mmu_disable(void);
> +void mmu_disable(void)
> +{
> + struct thread_info *ti = current_thread_info();
> + cpumask_clear_cpu(ti->cpu, &mmu_enabled_cpumask);
> + asm_mmu_disable();
> +}
> +
> void mmu_set_range_ptes(pgd_t *pgtable, unsigned long virt_offset,
> unsigned long phys_start, unsigned long phys_end,
> pgprot_t prot)
>
Applied, thanks.
Paolo
next prev parent reply other threads:[~2015-07-03 17:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 18:45 [PATCH 0/3] arm/arm64: rework mmu_enabled, for spinlock speedup Andrew Jones
2015-06-25 18:45 ` [PATCH 1/3] arm/arm64: Introduce mmu_disable Andrew Jones
2015-07-03 17:42 ` Paolo Bonzini [this message]
2015-06-25 18:45 ` [PATCH 2/3] arm/arm64: drop mmu_set_enabled Andrew Jones
2015-07-03 17:39 ` Paolo Bonzini
2015-07-06 12:41 ` Andrew Jones
2015-06-25 18:45 ` [PATCH 3/3] arm/arm64: speed up spinlocks and atomic ops Andrew Jones
2015-07-03 17:43 ` 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=5596C9A2.6050304@redhat.com \
--to=pbonzini@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
/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.