qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1] s390x/cpumodel: wire up cpu type + id for TC


From: David Hildenbrand
Subject: Re: [Qemu-devel] [PATCH v1] s390x/cpumodel: wire up cpu type + id for TCG
Date: Fri, 2 Jun 2017 12:52:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

>> +
>> +#ifndef CONFIG_USER_ONLY
>> +void HELPER(stidp)(CPUS390XState *env, uint64_t addr)
>> +{
>> +    S390CPU *cpu = s390_env_get_cpu(env);
>> +    uint64_t cpuid = s390_cpuid_from_cpu_model(cpu->model);
>> +
>> +    if (addr & 0x7) {
>> +        program_interrupt(env, PGM_SPECIFICATION, ILEN_LATER_INC);
>> +        return;
>> +    }
>> +
>> +    /* basic mode, write the cpu address into the first 4 bit of the ID */
>> +    cpuid |= ((uint64_t)env->cpu_num & 0xf) << 54;
>> +    cpu_stq_data(env, addr, cpuid);
>> +}
>> +#endif
> 
> I don't really see the point of using an helper instead of just updating
> the existing code. From what I understand the cpuid does not change at
> runtime, so the s390_cpuid_from_cpu_model function can also be called 
> from translate.c.
> 
> Aurelien
> 

>From what I can see, conditional exceptions are more complicated to
implement without helpers (involves generating compares, jumps and so
on). As this function is not expected to be executed on hot paths, I
think moving it into a helper is the right thing to do.

-- 

Thanks,

David



reply via email to

[Prev in Thread] Current Thread [Next in Thread]