Message ID | 20250620172751.94231-11-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: > AccelCPUState is where we store per-vCPU accelerator > related information. > > FIXME: structures might clash so add padding (ok with TCG+HVF) > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > accel/split/split-accel.h | 7 +++++++ > accel/split/split-accel-ops.c | 9 ++++++++- > 2 files changed, 15 insertions(+), 1 deletion(-) > > diff --git a/accel/split/split-accel.h b/accel/split/split-accel.h > index 19fb530f207..87a08454ce6 100644 > --- a/accel/split/split-accel.h > +++ b/accel/split/split-accel.h > @@ -38,4 +38,11 @@ struct SplitAccelState { > char *sw_name; > }; > > +struct AccelCPUState { > + char pad[128]; That's a pretty big fixme. Is this a problem of name overloading? r~ > + > + AccelState *accel; > + bool use_hw; > +}; > + > #endif /* SPLIT_ACCEL_H */ > diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c > index 294ea79420e..efef0d60fde 100644 > --- a/accel/split/split-accel-ops.c > +++ b/accel/split/split-accel-ops.c > @@ -12,10 +12,13 @@ > #include "exec/cpu-common.h" > #include "system/accel-ops.h" > #include "system/cpus.h" > +#include "split-accel.h" > > static void *split_cpu_thread_routine(void *arg) > { > + AccelState *as = current_accel(); > CPUState *cpu = arg; > + AccelCPUState *acs; > int r; > > /* TODO: check accel allowed */ > @@ -29,7 +32,10 @@ static void *split_cpu_thread_routine(void *arg) > current_cpu = cpu; > > /* TODO: init_vcpu_thread() */ > - /* TODO: allocate AccelCPUState */ > + cpu->accel = g_renew(AccelCPUState, cpu->accel, 1); /* XXX only with current TCG */ > + acs = cpu->accel; > + acs->accel = as; > + acs->use_hw = false; > > /* signal CPU creation */ > cpu_thread_signal_created(cpu); > @@ -60,6 +66,7 @@ static void *split_cpu_thread_routine(void *arg) > */ > break; > case EXCP_ATOMIC: > + assert(!acs->use_hw); > bql_unlock(); > cpu_exec_step_atomic(cpu); > bql_lock();
diff --git a/accel/split/split-accel.h b/accel/split/split-accel.h index 19fb530f207..87a08454ce6 100644 --- a/accel/split/split-accel.h +++ b/accel/split/split-accel.h @@ -38,4 +38,11 @@ struct SplitAccelState { char *sw_name; }; +struct AccelCPUState { + char pad[128]; + + AccelState *accel; + bool use_hw; +}; + #endif /* SPLIT_ACCEL_H */ diff --git a/accel/split/split-accel-ops.c b/accel/split/split-accel-ops.c index 294ea79420e..efef0d60fde 100644 --- a/accel/split/split-accel-ops.c +++ b/accel/split/split-accel-ops.c @@ -12,10 +12,13 @@ #include "exec/cpu-common.h" #include "system/accel-ops.h" #include "system/cpus.h" +#include "split-accel.h" static void *split_cpu_thread_routine(void *arg) { + AccelState *as = current_accel(); CPUState *cpu = arg; + AccelCPUState *acs; int r; /* TODO: check accel allowed */ @@ -29,7 +32,10 @@ static void *split_cpu_thread_routine(void *arg) current_cpu = cpu; /* TODO: init_vcpu_thread() */ - /* TODO: allocate AccelCPUState */ + cpu->accel = g_renew(AccelCPUState, cpu->accel, 1); /* XXX only with current TCG */ + acs = cpu->accel; + acs->accel = as; + acs->use_hw = false; /* signal CPU creation */ cpu_thread_signal_created(cpu); @@ -60,6 +66,7 @@ static void *split_cpu_thread_routine(void *arg) */ break; case EXCP_ATOMIC: + assert(!acs->use_hw); bql_unlock(); cpu_exec_step_atomic(cpu); bql_lock();
AccelCPUState is where we store per-vCPU accelerator related information. FIXME: structures might clash so add padding (ok with TCG+HVF) Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/split/split-accel.h | 7 +++++++ accel/split/split-accel-ops.c | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)