[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 21/30] target/ppc: Introduce PowerPCCPUClass::has_work()
- To: David Gibson <david@xxxxxxxxxxxxxxxxxxxxx>
- From: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
- Date: Fri, 3 Sep 2021 22:38:04 +0200
- Cc: Peter Maydell <peter.maydell@xxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, David Hildenbrand <david@xxxxxxxxxx>, Bin Meng <bin.meng@xxxxxxxxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, qemu-devel@xxxxxxxxxx, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Laurent Vivier <laurent@xxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Taylor Simpson <tsimpson@xxxxxxxxxxx>, haxm-team@xxxxxxxxx, Colin Xu <colin.xu@xxxxxxxxx>, Stafford Horne <shorne@xxxxxxxxx>, Marek Vasut <marex@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Yoshinori Sato <ysato@xxxxxxxxxxxxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Kamil Rytarowski <kamil@xxxxxxxxxx>, Reinoud Zandijk <reinoud@xxxxxxxxxx>, Claudio Fontana <cfontana@xxxxxxx>, Marcel Apfelbaum <marcel.apfelbaum@xxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Laurent Vivier <lvivier@xxxxxxxxxx>, Thomas Huth <thuth@xxxxxxxxxx>, Eduardo Habkost <ehabkost@xxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Greg Kurz <groug@xxxxxxxx>, Cameron Esfahani <dirty@xxxxxxxxx>, qemu-s390x@xxxxxxxxxx, qemu-arm@xxxxxxxxxx, Michael Rolnik <mrolnik@xxxxxxxxx>, Sunil Muthuswamy <sunilmut@xxxxxxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, qemu-riscv@xxxxxxxxxx, Bastian Koppelmann <kbastian@xxxxxxxxxxxxxxxxxxxxx>, Chris Wulff <crwulff@xxxxxxxxx>, Roman Bolshakov <r.bolshakov@xxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Wenchao Wang <wenchao.wang@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Aleksandar Rikalo <aleksandar.rikalo@xxxxxxxxxx>, Aurelien Jarno <aurelien@xxxxxxxxxxx>
- Delivery-date: Fri, 03 Sep 2021 20:38:12 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 9/3/21 2:50 AM, David Gibson wrote:
> On Thu, Sep 02, 2021 at 06:15:34PM +0200, Philippe Mathieu-Daudé wrote:
>> Each POWER cpu has its own has_work() implementation. Instead of
>> overloading CPUClass on each PowerPCCPUClass init, register the
>> generic ppc_cpu_has_work() handler, and have it call the POWER
>> specific has_work().
>
> I don't quite see the rationale for introducing a second layer of
> indirection here. What's wrong with switching the base has_work for
> each cpu variant?
>
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
>> ---
>> target/ppc/cpu-qom.h | 3 +++
>> target/ppc/cpu_init.c | 26 ++++++++++++++++++--------
>> 2 files changed, 21 insertions(+), 8 deletions(-)
>> @@ -8796,6 +8800,12 @@ static bool ppc_cpu_has_work(CPUState *cs)
>> PowerPCCPU *cpu = POWERPC_CPU(cs);
>> CPUPPCState *env = &cpu->env;
>>
>> + if (cs->halted) {
>> + PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu);
Maybe I should have kept the 'if (cs->halted)' for the next patch,
simply dispatch here, then in the next patch the code simplification
is more apparent. I thought this approach would involve less #ifdef'ry
but haven't checked the other way around. Will do now.
>> + return pcc->has_work(cs);
>> + }
>> +
>> return msr_ee && (cs->interrupt_request & CPU_INTERRUPT_HARD);
>> }
>> #endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
>
|