public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Shivaprasad G Bhat" <sbhat@linux.ibm.com>, <cohuck@redhat.com>,
	<pbonzini@redhat.com>, <kvm@vger.kernel.org>,
	<qemu-devel@nongnu.org>
Cc: <mst@redhat.com>, <danielhb413@gmail.com>, <qemu-ppc@nongnu.org>
Subject: Re: [PATCH 2/2] target/ppc/cpu_init: Synchronize HASHKEYR with KVM for migration
Date: Tue, 04 Jun 2024 15:58:49 +1000	[thread overview]
Message-ID: <D1R03V1KZTWF.2BW5FQ7M7SGZ9@gmail.com> (raw)
In-Reply-To: <171741557432.11675.11683958406314165970.stgit@c0c876608f2d>

On Mon Jun 3, 2024 at 9:53 PM AEST, Shivaprasad G Bhat wrote:
> The patch enables HASHKEYR migration by hooking with the
> "KVM one reg" ID KVM_REG_PPC_HASHKEYR.
>
> Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
> ---
>  linux-headers/asm-powerpc/kvm.h |    1 +
>  target/ppc/cpu_init.c           |    4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
> index fcb947f656..23a0af739c 100644
> --- a/linux-headers/asm-powerpc/kvm.h
> +++ b/linux-headers/asm-powerpc/kvm.h
> @@ -646,6 +646,7 @@ struct kvm_ppc_cpu_char {
>  #define KVM_REG_PPC_DAWR1	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc4)
>  #define KVM_REG_PPC_DAWRX1	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc5)
>  #define KVM_REG_PPC_DEXCR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc6)
> +#define KVM_REG_PPC_HASHKEYR	(KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc7)
>  
>  /* Transactional Memory checkpointed state:
>   * This is all GPRs, all VSX regs and a subset of SPRs
> diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
> index b1422c2eab..cee0a609eb 100644
> --- a/target/ppc/cpu_init.c
> +++ b/target/ppc/cpu_init.c
> @@ -5805,10 +5805,10 @@ static void register_power10_hash_sprs(CPUPPCState *env)
>          ((uint64_t)g_rand_int(rand) << 32) | (uint64_t)g_rand_int(rand);
>      g_rand_free(rand);
>  #endif
> -    spr_register(env, SPR_HASHKEYR, "HASHKEYR",
> +    spr_register_kvm(env, SPR_HASHKEYR, "HASHKEYR",
>              SPR_NOACCESS, SPR_NOACCESS,
>              &spr_read_generic, &spr_write_generic,
> -            hashkeyr_initial_value);
> +            KVM_REG_PPC_HASHKEYR, hashkeyr_initial_value);
>      spr_register_hv(env, SPR_HASHPKEYR, "HASHPKEYR",
>              SPR_NOACCESS, SPR_NOACCESS,
>              SPR_NOACCESS, SPR_NOACCESS,

Hmm... now that I look at it, the hashpkey value also needs to be set
in the machine and migrated, right? That looks broken. I *think* if we
make this spr_register_kvm_hv, and you will also need to add a KVM
API for the register, that should get it working becuse SPRs will
be migrated for us.

Thanks,
Nick

  reply	other threads:[~2024-06-04  5:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 11:52 [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes Shivaprasad G Bhat
2024-06-03 11:52 ` [PATCH 1/2] target/ppc/cpu_init: Synchronize DEXCR with KVM for migration Shivaprasad G Bhat
2024-06-03 11:53 ` [PATCH 2/2] target/ppc/cpu_init: Synchronize HASHKEYR " Shivaprasad G Bhat
2024-06-04  5:58   ` Nicholas Piggin [this message]
2024-06-03 12:29 ` [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes Cornelia Huck

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=D1R03V1KZTWF.2BW5FQ7M7SGZ9@gmail.com \
    --to=npiggin@gmail.com \
    --cc=cohuck@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=sbhat@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox