* [PATCH v2 0/2] spapr: Make the nested code TCG only
@ 2022-03-25 22:11 Fabiano Rosas
2022-03-25 22:11 ` [PATCH v2 1/2] spapr: Move hypercall_register_softmmu Fabiano Rosas
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Fabiano Rosas @ 2022-03-25 22:11 UTC (permalink / raw)
To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, npiggin, david
The spapr virtual hypervisor implementation of the nested KVM API
depends on the first level guest to be emulated by TCG. So move the
whole code under CONFIG_TCG.
v2:
- Created hypercall_register_nested instead of reusing
hypercall_register_softmmu;
- Rearranged the ifdef a bit to keep the hypercall_register_*
functions closer;
- Dropped the more paranoid patch that checked for KVM at every
call. I couldn't convince myself anymore that it was necessary.
v1:
https://lists.nongnu.org/archive/html/qemu-ppc/2022-03/msg00412.html
Fabiano Rosas (2):
spapr: Move hypercall_register_softmmu
spapr: Move nested KVM hypercalls under a TCG only config.
hw/ppc/spapr_hcall.c | 74 ++++++++++++++++++++++++++------------------
1 file changed, 44 insertions(+), 30 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] spapr: Move hypercall_register_softmmu
2022-03-25 22:11 [PATCH v2 0/2] spapr: Make the nested code TCG only Fabiano Rosas
@ 2022-03-25 22:11 ` Fabiano Rosas
2022-03-29 8:24 ` Nicholas Piggin
2022-03-25 22:11 ` [PATCH v2 2/2] spapr: Move nested KVM hypercalls under a TCG only config Fabiano Rosas
2022-04-20 19:12 ` [PATCH v2 0/2] spapr: Make the nested code TCG only Daniel Henrique Barboza
2 siblings, 1 reply; 6+ messages in thread
From: Fabiano Rosas @ 2022-03-25 22:11 UTC (permalink / raw)
To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, npiggin, david
I'm moving this because next patch will add more code under the ifdef
and it will be cleaner if we keep them together.
Also switch the ifdef branches to make it more convenient to add code
under CONFIG_TCG in the next patch.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
hw/ppc/spapr_hcall.c | 50 ++++++++++++++++++++++----------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index f008290787..08b50590a8 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1473,31 +1473,6 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
return H_FUNCTION;
}
-#ifndef CONFIG_TCG
-static target_ulong h_softmmu(PowerPCCPU *cpu, SpaprMachineState *spapr,
- target_ulong opcode, target_ulong *args)
-{
- g_assert_not_reached();
-}
-
-static void hypercall_register_softmmu(void)
-{
- /* hcall-pft */
- spapr_register_hypercall(H_ENTER, h_softmmu);
- spapr_register_hypercall(H_REMOVE, h_softmmu);
- spapr_register_hypercall(H_PROTECT, h_softmmu);
- spapr_register_hypercall(H_READ, h_softmmu);
-
- /* hcall-bulk */
- spapr_register_hypercall(H_BULK_REMOVE, h_softmmu);
-}
-#else
-static void hypercall_register_softmmu(void)
-{
- /* DO NOTHING */
-}
-#endif
-
/* TCG only */
#define PRTS_MASK 0x1f
@@ -1825,6 +1800,31 @@ out_restore_l1:
spapr_cpu->nested_host_state = NULL;
}
+#ifdef CONFIG_TCG
+static void hypercall_register_softmmu(void)
+{
+ /* DO NOTHING */
+}
+#else
+static target_ulong h_softmmu(PowerPCCPU *cpu, SpaprMachineState *spapr,
+ target_ulong opcode, target_ulong *args)
+{
+ g_assert_not_reached();
+}
+
+static void hypercall_register_softmmu(void)
+{
+ /* hcall-pft */
+ spapr_register_hypercall(H_ENTER, h_softmmu);
+ spapr_register_hypercall(H_REMOVE, h_softmmu);
+ spapr_register_hypercall(H_PROTECT, h_softmmu);
+ spapr_register_hypercall(H_READ, h_softmmu);
+
+ /* hcall-bulk */
+ spapr_register_hypercall(H_BULK_REMOVE, h_softmmu);
+}
+#endif
+
static void hypercall_register_types(void)
{
hypercall_register_softmmu();
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] spapr: Move nested KVM hypercalls under a TCG only config.
2022-03-25 22:11 [PATCH v2 0/2] spapr: Make the nested code TCG only Fabiano Rosas
2022-03-25 22:11 ` [PATCH v2 1/2] spapr: Move hypercall_register_softmmu Fabiano Rosas
@ 2022-03-25 22:11 ` Fabiano Rosas
2022-03-29 8:24 ` Nicholas Piggin
2022-04-20 19:12 ` [PATCH v2 0/2] spapr: Make the nested code TCG only Daniel Henrique Barboza
2 siblings, 1 reply; 6+ messages in thread
From: Fabiano Rosas @ 2022-03-25 22:11 UTC (permalink / raw)
To: qemu-devel; +Cc: danielhb413, qemu-ppc, clg, npiggin, david
These are the spapr virtual hypervisor implementation of the nested
KVM API. They only make sense when running with TCG.
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
---
hw/ppc/spapr_hcall.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 08b50590a8..9244aa3ad8 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1473,7 +1473,7 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
return H_FUNCTION;
}
-/* TCG only */
+#ifdef CONFIG_TCG
#define PRTS_MASK 0x1f
static target_ulong h_set_ptbl(PowerPCCPU *cpu,
@@ -1800,18 +1800,35 @@ out_restore_l1:
spapr_cpu->nested_host_state = NULL;
}
-#ifdef CONFIG_TCG
+static void hypercall_register_nested(void)
+{
+ spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl);
+ spapr_register_hypercall(KVMPPC_H_ENTER_NESTED, h_enter_nested);
+ spapr_register_hypercall(KVMPPC_H_TLB_INVALIDATE, h_tlb_invalidate);
+ spapr_register_hypercall(KVMPPC_H_COPY_TOFROM_GUEST, h_copy_tofrom_guest);
+}
+
static void hypercall_register_softmmu(void)
{
/* DO NOTHING */
}
#else
+void spapr_exit_nested(PowerPCCPU *cpu, int excp)
+{
+ g_assert_not_reached();
+}
+
static target_ulong h_softmmu(PowerPCCPU *cpu, SpaprMachineState *spapr,
target_ulong opcode, target_ulong *args)
{
g_assert_not_reached();
}
+static void hypercall_register_nested(void)
+{
+ /* DO NOTHING */
+}
+
static void hypercall_register_softmmu(void)
{
/* hcall-pft */
@@ -1881,10 +1898,7 @@ static void hypercall_register_types(void)
spapr_register_hypercall(KVMPPC_H_UPDATE_DT, h_update_dt);
- spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl);
- spapr_register_hypercall(KVMPPC_H_ENTER_NESTED, h_enter_nested);
- spapr_register_hypercall(KVMPPC_H_TLB_INVALIDATE, h_tlb_invalidate);
- spapr_register_hypercall(KVMPPC_H_COPY_TOFROM_GUEST, h_copy_tofrom_guest);
+ hypercall_register_nested();
}
type_init(hypercall_register_types)
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] spapr: Move hypercall_register_softmmu
2022-03-25 22:11 ` [PATCH v2 1/2] spapr: Move hypercall_register_softmmu Fabiano Rosas
@ 2022-03-29 8:24 ` Nicholas Piggin
0 siblings, 0 replies; 6+ messages in thread
From: Nicholas Piggin @ 2022-03-29 8:24 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: danielhb413, qemu-ppc, clg, david
Excerpts from Fabiano Rosas's message of March 26, 2022 8:11 am:
> I'm moving this because next patch will add more code under the ifdef
> and it will be cleaner if we keep them together.
>
> Also switch the ifdef branches to make it more convenient to add code
> under CONFIG_TCG in the next patch.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
> hw/ppc/spapr_hcall.c | 50 ++++++++++++++++++++++----------------------
> 1 file changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index f008290787..08b50590a8 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1473,31 +1473,6 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
> return H_FUNCTION;
> }
>
> -#ifndef CONFIG_TCG
> -static target_ulong h_softmmu(PowerPCCPU *cpu, SpaprMachineState *spapr,
> - target_ulong opcode, target_ulong *args)
> -{
> - g_assert_not_reached();
> -}
> -
> -static void hypercall_register_softmmu(void)
> -{
> - /* hcall-pft */
> - spapr_register_hypercall(H_ENTER, h_softmmu);
> - spapr_register_hypercall(H_REMOVE, h_softmmu);
> - spapr_register_hypercall(H_PROTECT, h_softmmu);
> - spapr_register_hypercall(H_READ, h_softmmu);
> -
> - /* hcall-bulk */
> - spapr_register_hypercall(H_BULK_REMOVE, h_softmmu);
> -}
> -#else
> -static void hypercall_register_softmmu(void)
> -{
> - /* DO NOTHING */
> -}
> -#endif
> -
> /* TCG only */
> #define PRTS_MASK 0x1f
>
> @@ -1825,6 +1800,31 @@ out_restore_l1:
> spapr_cpu->nested_host_state = NULL;
> }
>
> +#ifdef CONFIG_TCG
> +static void hypercall_register_softmmu(void)
> +{
> + /* DO NOTHING */
> +}
> +#else
> +static target_ulong h_softmmu(PowerPCCPU *cpu, SpaprMachineState *spapr,
> + target_ulong opcode, target_ulong *args)
> +{
> + g_assert_not_reached();
> +}
> +
> +static void hypercall_register_softmmu(void)
> +{
> + /* hcall-pft */
> + spapr_register_hypercall(H_ENTER, h_softmmu);
> + spapr_register_hypercall(H_REMOVE, h_softmmu);
> + spapr_register_hypercall(H_PROTECT, h_softmmu);
> + spapr_register_hypercall(H_READ, h_softmmu);
> +
> + /* hcall-bulk */
> + spapr_register_hypercall(H_BULK_REMOVE, h_softmmu);
> +}
> +#endif
> +
> static void hypercall_register_types(void)
> {
> hypercall_register_softmmu();
> --
> 2.35.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] spapr: Move nested KVM hypercalls under a TCG only config.
2022-03-25 22:11 ` [PATCH v2 2/2] spapr: Move nested KVM hypercalls under a TCG only config Fabiano Rosas
@ 2022-03-29 8:24 ` Nicholas Piggin
0 siblings, 0 replies; 6+ messages in thread
From: Nicholas Piggin @ 2022-03-29 8:24 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: danielhb413, qemu-ppc, clg, david
Excerpts from Fabiano Rosas's message of March 26, 2022 8:11 am:
> These are the spapr virtual hypervisor implementation of the nested
> KVM API. They only make sense when running with TCG.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
>
> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
> ---
> hw/ppc/spapr_hcall.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 08b50590a8..9244aa3ad8 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1473,7 +1473,7 @@ target_ulong spapr_hypercall(PowerPCCPU *cpu, target_ulong opcode,
> return H_FUNCTION;
> }
>
> -/* TCG only */
> +#ifdef CONFIG_TCG
> #define PRTS_MASK 0x1f
>
> static target_ulong h_set_ptbl(PowerPCCPU *cpu,
> @@ -1800,18 +1800,35 @@ out_restore_l1:
> spapr_cpu->nested_host_state = NULL;
> }
>
> -#ifdef CONFIG_TCG
> +static void hypercall_register_nested(void)
> +{
> + spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl);
> + spapr_register_hypercall(KVMPPC_H_ENTER_NESTED, h_enter_nested);
> + spapr_register_hypercall(KVMPPC_H_TLB_INVALIDATE, h_tlb_invalidate);
> + spapr_register_hypercall(KVMPPC_H_COPY_TOFROM_GUEST, h_copy_tofrom_guest);
> +}
> +
> static void hypercall_register_softmmu(void)
> {
> /* DO NOTHING */
> }
> #else
> +void spapr_exit_nested(PowerPCCPU *cpu, int excp)
> +{
> + g_assert_not_reached();
> +}
> +
> static target_ulong h_softmmu(PowerPCCPU *cpu, SpaprMachineState *spapr,
> target_ulong opcode, target_ulong *args)
> {
> g_assert_not_reached();
> }
>
> +static void hypercall_register_nested(void)
> +{
> + /* DO NOTHING */
> +}
> +
> static void hypercall_register_softmmu(void)
> {
> /* hcall-pft */
> @@ -1881,10 +1898,7 @@ static void hypercall_register_types(void)
>
> spapr_register_hypercall(KVMPPC_H_UPDATE_DT, h_update_dt);
>
> - spapr_register_hypercall(KVMPPC_H_SET_PARTITION_TABLE, h_set_ptbl);
> - spapr_register_hypercall(KVMPPC_H_ENTER_NESTED, h_enter_nested);
> - spapr_register_hypercall(KVMPPC_H_TLB_INVALIDATE, h_tlb_invalidate);
> - spapr_register_hypercall(KVMPPC_H_COPY_TOFROM_GUEST, h_copy_tofrom_guest);
> + hypercall_register_nested();
> }
>
> type_init(hypercall_register_types)
> --
> 2.35.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/2] spapr: Make the nested code TCG only
2022-03-25 22:11 [PATCH v2 0/2] spapr: Make the nested code TCG only Fabiano Rosas
2022-03-25 22:11 ` [PATCH v2 1/2] spapr: Move hypercall_register_softmmu Fabiano Rosas
2022-03-25 22:11 ` [PATCH v2 2/2] spapr: Move nested KVM hypercalls under a TCG only config Fabiano Rosas
@ 2022-04-20 19:12 ` Daniel Henrique Barboza
2 siblings, 0 replies; 6+ messages in thread
From: Daniel Henrique Barboza @ 2022-04-20 19:12 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel; +Cc: qemu-ppc, clg, npiggin, david
Queued in gitlab.com/danielhb/qemu/tree/ppc-next. Thanks,
Daniel
On 3/25/22 19:11, Fabiano Rosas wrote:
> The spapr virtual hypervisor implementation of the nested KVM API
> depends on the first level guest to be emulated by TCG. So move the
> whole code under CONFIG_TCG.
>
> v2:
>
> - Created hypercall_register_nested instead of reusing
> hypercall_register_softmmu;
>
> - Rearranged the ifdef a bit to keep the hypercall_register_*
> functions closer;
>
> - Dropped the more paranoid patch that checked for KVM at every
> call. I couldn't convince myself anymore that it was necessary.
>
> v1:
> https://lists.nongnu.org/archive/html/qemu-ppc/2022-03/msg00412.html
>
> Fabiano Rosas (2):
> spapr: Move hypercall_register_softmmu
> spapr: Move nested KVM hypercalls under a TCG only config.
>
> hw/ppc/spapr_hcall.c | 74 ++++++++++++++++++++++++++------------------
> 1 file changed, 44 insertions(+), 30 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-04-20 19:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-25 22:11 [PATCH v2 0/2] spapr: Make the nested code TCG only Fabiano Rosas
2022-03-25 22:11 ` [PATCH v2 1/2] spapr: Move hypercall_register_softmmu Fabiano Rosas
2022-03-29 8:24 ` Nicholas Piggin
2022-03-25 22:11 ` [PATCH v2 2/2] spapr: Move nested KVM hypercalls under a TCG only config Fabiano Rosas
2022-03-29 8:24 ` Nicholas Piggin
2022-04-20 19:12 ` [PATCH v2 0/2] spapr: Make the nested code TCG only Daniel Henrique Barboza
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).