On 04.01.2013, at 11:32, Bhushan Bharat-R65777 wrote:

> 
> 
>> -----Original Message-----
>>>>> 
>>>>> Int timer_func(CPUxxState env)
>>>>> {
>>>>>  Struct timer_regs;
>>>>>  read_regs_type((env, &timer_regs,TIMER_REGS);
>>>>>  //update env->timer_registers
>>>>>  Write_regs_type(env, TIMER_REGS)
>>>>> }
>>>>> 
>>>>> This will get one type of register_types and can cause multiple
>>>>> IOCTL per
>>>> entry to QEMU.
>>>> 
>>>> This is still too explicit. How about
>>>> 
>>>> static inline void ppc_set_tsr(CPUState *env, target_ulong val) {
>>>>   env->kvm_sync_extra |= SYNC_TIMER_REGS;
>>>>   cpu_synchronize_registers(env);
>>>>   env->spr[SPR_TSR] = val;
>>> 
>>> You also want env->kvm_sync_dirty also, right?
>> 
>> Not quite, since SYNC_TIMER_REGS spans more than only TSR. So we need to make
>> sure we fetch the non-TSR register values before we can declare TIMER_REGS as
>> dirty.
> 
> Right , I actually want communicate mark dirty the TIMER_REGS only :)

Imagine TIMER_REGS includes TSR and TCR. Then

ppc_set_tsr();

should still work without a respective ppc_set_tcr() call. So we can't just 
mark it dirty here. The only way we could optimize this bit would be by either 
splitting the bitmap per register or by extending the setter functions to the 
full scope of the sync:

static inline void ppc_set_timer_regs(CPUState *env, target_ulong tsr, 
target_ulong tcr)
{
    ...
}


Alex


Reply via email to