Message ID | 20250620172751.94231-17-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | accel/split/arm: Run EL2 using TCG and EL1/EL0 in hardware with HVF | expand |
On 6/20/25 10:27, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > accel/split/split-accel-ops.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c > index 65feb929404..80efbd82091 100644 > --- a/accel/split/split-accel-ops.c > +++ b/accel/split/split-accel-ops.c > @@ -165,7 +165,16 @@ static void split_synchronize_post_init(CPUState *cpu) > > static void split_synchronize_state(CPUState *cpu) > { > - g_assert_not_reached(); > + SplitAccelState *sas = SPLIT_ACCEL(cpu->accel->accel); > + AccelClass *hwc = ACCEL_GET_CLASS(sas->hw); > + AccelClass *swc = ACCEL_GET_CLASS(sas->sw); > + > + if (hwc->ops->synchronize_state) { > + hwc->ops->synchronize_state(cpu); > + } > + if (swc->ops->synchronize_state) { > + swc->ops->synchronize_state(cpu); > + } > } I suppose in the short-term this is ok, but it does more work than it should. Let's make the simplifying assumption that even if there is another sw emulator, it'll still use CPUArchState. So the "sync" to sw is pointless. But syncing state to hw is only applicable when use_hw is true. I'm not sure how to do the pointer chasing to find that from here. r~
On 6/21/25 19:52, Richard Henderson wrote: > On 6/20/25 10:27, Philippe Mathieu-Daudé wrote: >> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> >> --- >> accel/split/split-accel-ops.c | 11 ++++++++++- >> 1 file changed, 10 insertions(+), 1 deletion(-) >> >> diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c >> index 65feb929404..80efbd82091 100644 >> --- a/accel/split/split-accel-ops.c >> +++ b/accel/split/split-accel-ops.c >> @@ -165,7 +165,16 @@ static void split_synchronize_post_init(CPUState *cpu) >> static void split_synchronize_state(CPUState *cpu) >> { >> - g_assert_not_reached(); >> + SplitAccelState *sas = SPLIT_ACCEL(cpu->accel->accel); >> + AccelClass *hwc = ACCEL_GET_CLASS(sas->hw); >> + AccelClass *swc = ACCEL_GET_CLASS(sas->sw); >> + >> + if (hwc->ops->synchronize_state) { >> + hwc->ops->synchronize_state(cpu); >> + } >> + if (swc->ops->synchronize_state) { >> + swc->ops->synchronize_state(cpu); >> + } >> } > > I suppose in the short-term this is ok, but it does more work than it should. > > Let's make the simplifying assumption that even if there is another sw emulator, it'll > still use CPUArchState. So the "sync" to sw is pointless. > > But syncing state to hw is only applicable when use_hw is true. > I'm not sure how to do the pointer chasing to find that from here. The same applies to patches 14-18. r~
diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c index 65feb929404..80efbd82091 100644 --- a/accel/split/split-accel-ops.c +++ b/accel/split/split-accel-ops.c @@ -165,7 +165,16 @@ static void split_synchronize_post_init(CPUState *cpu) static void split_synchronize_state(CPUState *cpu) { - g_assert_not_reached(); + SplitAccelState *sas = SPLIT_ACCEL(cpu->accel->accel); + AccelClass *hwc = ACCEL_GET_CLASS(sas->hw); + AccelClass *swc = ACCEL_GET_CLASS(sas->sw); + + if (hwc->ops->synchronize_state) { + hwc->ops->synchronize_state(cpu); + } + if (swc->ops->synchronize_state) { + swc->ops->synchronize_state(cpu); + } } static void split_synchronize_pre_loadvm(CPUState *cpu)
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/split/split-accel-ops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)