From: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
To: David Gibson <david@gibson.dropbear.id.au>,
qemu-ppc@nongnu.org, aik@ozlabs.ru
Cc: qemu-devel@nongnu.org, agraf@suse.de, thuth@redhat.com,
lvivier@redhat.com, mdroth@linux.vnet.ibm.com, paulus@samba.org
Subject: Re: [Qemu-devel] [PATCH 3/6] target/ppc: SDR1 is a hypervisor resource
Date: Thu, 23 Feb 2017 15:32:04 +1100 [thread overview]
Message-ID: <1487824324.23895.10.camel@gmail.com> (raw)
In-Reply-To: <20170223020936.29220-4-david@gibson.dropbear.id.au>
On Thu, 2017-02-23 at 13:09 +1100, David Gibson wrote:
> At present the SDR1 register - the base of the system's hashed page
> table
> (HPT) - is represented as an SPR with supervisor read and write
> permission.
> However, on CPUs which have a hypervisor mode, the SDR1 is a
> hypervisor
> only resource. Change the permission checking on the SPR to reflect
> this.
>
> Now that this is done, we don't need to check for an external HPT
> executing
> mtsdr1: an external HPT only applies when we're emulating the
> behaviour of
> a hypervisor, rather than modelling the CPU's hypervisor mode
> internally,
> so if we're permitted to execute mtsdr1, we don't have an external
> HPT.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> target/ppc/misc_helper.c | 8 +++-----
> target/ppc/translate_init.c | 20 ++++++++++++++++----
> 2 files changed, 19 insertions(+), 9 deletions(-)
>
> diff --git a/target/ppc/misc_helper.c b/target/ppc/misc_helper.c
> index ab432ba..fa573dd 100644
> --- a/target/ppc/misc_helper.c
> +++ b/target/ppc/misc_helper.c
> @@ -82,11 +82,9 @@ void helper_store_sdr1(CPUPPCState *env,
> target_ulong val)
> {
> PowerPCCPU *cpu = ppc_env_get_cpu(env);
>
> - if (!env->external_htab) {
> - if (env->spr[SPR_SDR1] != val) {
> - ppc_store_sdr1(env, val);
> - tlb_flush(CPU(cpu));
> - }
It may have been the case we didn't have to check this before anyway...
Oh well
> + if (env->spr[SPR_SDR1] != val) {
> + ppc_store_sdr1(env, val);
> + tlb_flush(CPU(cpu));
> }
> }
>
> diff --git a/target/ppc/translate_init.c
> b/target/ppc/translate_init.c
> index a1405e9..c92435d 100644
> --- a/target/ppc/translate_init.c
> +++ b/target/ppc/translate_init.c
> @@ -740,10 +740,22 @@ static void gen_spr_ne_601 (CPUPPCState *env)
> &spr_read_decr, &spr_write_decr,
> 0x00000000);
> /* Memory management */
> - spr_register(env, SPR_SDR1, "SDR1",
> - SPR_NOACCESS, SPR_NOACCESS,
> - &spr_read_generic, &spr_write_sdr1,
> - 0x00000000);
> +#ifndef CONFIG_USER_ONLY
> + if (env->has_hv_mode) {
> + /* SDR1 is a hypervisor resource on CPUs which have a
> + * hypervisor mode */
> + spr_register_hv(env, SPR_SDR1, "SDR1",
> + SPR_NOACCESS, SPR_NOACCESS,
> + SPR_NOACCESS, SPR_NOACCESS,
> + &spr_read_generic, &spr_write_sdr1,
> + 0x00000000);
> + } else {
> + spr_register(env, SPR_SDR1, "SDR1",
> + SPR_NOACCESS, SPR_NOACCESS,
> + &spr_read_generic, &spr_write_sdr1,
> + 0x00000000);
> + }
> +#endif
> }
>
> /* BATs 0-3 */
Reviewed-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
next prev parent reply other threads:[~2017-02-23 4:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 2:09 [Qemu-devel] [PATCH 0/6] Cleanups to handling of hash MMU David Gibson
2017-02-23 2:09 ` [Qemu-devel] [PATCH 1/6] pseries: Minor cleanups to HPT management hypercalls David Gibson
2017-02-23 4:08 ` Suraj Jitindar Singh
2017-02-23 2:09 ` [Qemu-devel] [PATCH 2/6] target/ppc: Merge cpu_ppc_set_vhyp() with cpu_ppc_set_papr() David Gibson
2017-02-23 4:27 ` Suraj Jitindar Singh
2017-02-23 2:09 ` [Qemu-devel] [PATCH 3/6] target/ppc: SDR1 is a hypervisor resource David Gibson
2017-02-23 4:32 ` Suraj Jitindar Singh [this message]
2017-02-23 5:11 ` David Gibson
2017-02-23 2:09 ` [Qemu-devel] [PATCH 4/6] target/ppc: Cleanup HPTE accessors for 64-bit hash MMU David Gibson
2017-02-23 5:02 ` Alexey Kardashevskiy
2017-02-23 5:23 ` David Gibson
2017-02-27 5:06 ` David Gibson
2017-02-23 5:37 ` Suraj Jitindar Singh
2017-02-24 5:25 ` David Gibson
2017-02-23 2:09 ` [Qemu-devel] [PATCH 5/6] target/ppc: Eliminate htab_base and htab_mask variables David Gibson
2017-02-23 5:43 ` Alexey Kardashevskiy
2017-02-24 5:30 ` David Gibson
2017-02-23 5:52 ` Suraj Jitindar Singh
2017-02-24 3:45 ` David Gibson
2017-02-24 5:34 ` David Gibson
2017-02-23 2:09 ` [Qemu-devel] [PATCH 6/6] target/ppc: Manage external HPT via virtual hypervisor David Gibson
2017-02-23 6:20 ` Suraj Jitindar Singh
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=1487824324.23895.10.camel@gmail.com \
--to=sjitindarsingh@gmail.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=paulus@samba.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--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.