* [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes
@ 2024-06-03 11:52 Shivaprasad G Bhat
2024-06-03 11:52 ` [PATCH 1/2] target/ppc/cpu_init: Synchronize DEXCR with KVM for migration Shivaprasad G Bhat
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Shivaprasad G Bhat @ 2024-06-03 11:52 UTC (permalink / raw)
To: cohuck, pbonzini, npiggin, kvm, qemu-devel; +Cc: mst, danielhb413, qemu-ppc
The series fixes the issues exposed by the kvm-unit-tests[1]
sprs-migration test.
The sprs DEXCR and HASKKEYR are not registered with one-reg IDs
without which the Qemu is not setting them to their 'previous'
value during guest migreation at destination.
The two patches in the series take care of this. Also, the PPC
kvm header changes are selectively picked for the required
definitions posted here at [2].
References:
[1]: https://github.com/kvm-unit-tests/kvm-unit-tests
[2]: https://lore.kernel.org/kvm/171741323521.6631.11242552089199677395.stgit@linux.ibm.com
---
Shivaprasad G Bhat (2):
target/ppc/cpu_init: Synchronize DEXCR with KVM for migration
target/ppc/cpu_init: Synchronize HASHKEYR with KVM for migration
linux-headers/asm-powerpc/kvm.h | 2 ++
target/ppc/cpu_init.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
--
Signature
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] target/ppc/cpu_init: Synchronize DEXCR with KVM for migration
2024-06-03 11:52 [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes Shivaprasad G Bhat
@ 2024-06-03 11:52 ` Shivaprasad G Bhat
2024-06-03 11:53 ` [PATCH 2/2] target/ppc/cpu_init: Synchronize HASHKEYR " Shivaprasad G Bhat
2024-06-03 12:29 ` [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes Cornelia Huck
2 siblings, 0 replies; 5+ messages in thread
From: Shivaprasad G Bhat @ 2024-06-03 11:52 UTC (permalink / raw)
To: cohuck, pbonzini, npiggin, kvm, qemu-devel; +Cc: mst, danielhb413, qemu-ppc
The patch enables DEXCR migration by hooking with the
"KVM one reg" ID KVM_REG_PPC_DEXCR.
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
---
| 1 +
target/ppc/cpu_init.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
--git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
index 1691297a76..fcb947f656 100644
--- a/linux-headers/asm-powerpc/kvm.h
+++ b/linux-headers/asm-powerpc/kvm.h
@@ -645,6 +645,7 @@ struct kvm_ppc_cpu_char {
#define KVM_REG_PPC_SIER3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc3)
#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)
/* 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 c11a69fd90..b1422c2eab 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -5818,9 +5818,9 @@ static void register_power10_hash_sprs(CPUPPCState *env)
static void register_power10_dexcr_sprs(CPUPPCState *env)
{
- spr_register(env, SPR_DEXCR, "DEXCR",
+ spr_register_kvm(env, SPR_DEXCR, "DEXCR",
SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, &spr_write_generic,
+ &spr_read_generic, &spr_write_generic, KVM_REG_PPC_DEXCR,
0);
spr_register(env, SPR_UDEXCR, "UDEXCR",
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] target/ppc/cpu_init: Synchronize HASHKEYR with KVM for migration
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 ` Shivaprasad G Bhat
2024-06-04 5:58 ` Nicholas Piggin
2024-06-03 12:29 ` [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes Cornelia Huck
2 siblings, 1 reply; 5+ messages in thread
From: Shivaprasad G Bhat @ 2024-06-03 11:53 UTC (permalink / raw)
To: cohuck, pbonzini, npiggin, kvm, qemu-devel; +Cc: mst, danielhb413, qemu-ppc
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>
---
| 1 +
target/ppc/cpu_init.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
--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,
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes
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-03 12:29 ` Cornelia Huck
2 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2024-06-03 12:29 UTC (permalink / raw)
To: Shivaprasad G Bhat, pbonzini, npiggin, kvm, qemu-devel
Cc: mst, danielhb413, qemu-ppc
On Mon, Jun 03 2024, Shivaprasad G Bhat <sbhat@linux.ibm.com> wrote:
> The series fixes the issues exposed by the kvm-unit-tests[1]
> sprs-migration test.
>
> The sprs DEXCR and HASKKEYR are not registered with one-reg IDs
> without which the Qemu is not setting them to their 'previous'
> value during guest migreation at destination.
>
> The two patches in the series take care of this. Also, the PPC
> kvm header changes are selectively picked for the required
> definitions posted here at [2].
>
> References:
> [1]: https://github.com/kvm-unit-tests/kvm-unit-tests
> [2]: https://lore.kernel.org/kvm/171741323521.6631.11242552089199677395.stgit@linux.ibm.com
>
> ---
>
> Shivaprasad G Bhat (2):
> target/ppc/cpu_init: Synchronize DEXCR with KVM for migration
> target/ppc/cpu_init: Synchronize HASHKEYR with KVM for migration
>
>
> linux-headers/asm-powerpc/kvm.h | 2 ++
Please split out any changes under linux-headers/ into a separate patch;
those files need to be changed via a full header update against a
released kernel version. If the changes are not yet upstream in the
Linux kernel, please put in a clearly marked placeholder patch in the
meanwhile.
> target/ppc/cpu_init.c | 8 ++++----
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> --
> Signature
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] target/ppc/cpu_init: Synchronize HASHKEYR with KVM for migration
2024-06-03 11:53 ` [PATCH 2/2] target/ppc/cpu_init: Synchronize HASHKEYR " Shivaprasad G Bhat
@ 2024-06-04 5:58 ` Nicholas Piggin
0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Piggin @ 2024-06-04 5:58 UTC (permalink / raw)
To: Shivaprasad G Bhat, cohuck, pbonzini, kvm, qemu-devel
Cc: mst, danielhb413, qemu-ppc
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-04 6:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-06-03 12:29 ` [PATCH 0/2] ppc: spapr: Nested kvm guest migration fixes Cornelia Huck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).