On 26/09/2016 18:20, Andreas Färber wrote:
> Am 26.09.2016 um 18:17 schrieb Richard Henderson:
>> On 09/26/2016 05:20 AM, Paolo Bonzini wrote:
>>> On 26/09/2016 12:56, Sagar Karandikar wrote:
>>>> -cpu-qom.h merged into cpu.h
>>>
>>> Please follow the model of other targets.  RISCVCPUClass and the
>>> RISCVCPU typedef should be in cpu-qom.h.
>>
>> I thought we had this discussion before, and cpu-qom.h is sort of a
>> legacy header, and that new targets shouldn't use it.
> 
> Yes, a concept that didn't quite work out, sadly. Just cpu.h is fine.

Hmm, maybe since 2.7.0 it started working out better? :)

The point of cpu-qom.h is to allow using the RISCVCPU symbol in target-
specific header files, without forcing all files including said header 
to be compiled per-target.  See for example

    commit 4da6f8d954429c0cd1471d25cb9dbe909607374e
    Author: Paolo Bonzini <pbonz...@redhat.com>
    Date:   Tue Mar 15 13:49:25 2016 +0100

    target-i386: make cpu-qom.h not target specific
    
    Make X86CPU an opaque type within cpu-qom.h, and move all definitions of
    private methods, as well as all type definitions that require knowledge
    of the layout to cpu.h.  This helps making files independent of NEED_CPU_H
    if they only need to pass around CPU pointers.
    
    Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>


You cannot include the definition of struct FooCPU in cpu-qom.h, because
it embeds "CPUFooState env;" and CPUFooState uses target_long.   Still it's
a nice improvement, for example it's now possible to compile device models
common to arm-softmmu and aarch64-softmmu (or sh4/sh4eb, etc.) just once.

Paolo

Reply via email to