qemu-s390x
[Top][All Lists]
Advanced

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

Re: [qemu-s390x] [PATCH v2 3/7] s390x/tcg: properly implement the TOD


From: David Hildenbrand
Subject: Re: [qemu-s390x] [PATCH v2 3/7] s390x/tcg: properly implement the TOD
Date: Wed, 20 Jun 2018 22:33:07 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 20.06.2018 21:33, Richard Henderson wrote:
> On 06/20/2018 12:08 AM, David Hildenbrand wrote:
>> +/* Converts ns to s390's clock format */
>> +static inline uint64_t time2tod(uint64_t ns)
>> +{
>> +    return (ns << 9) / 125;
>> +}
>> +
>> +/* Converts s390's clock format to ns */
>> +static inline uint64_t tod2time(uint64_t t)
>> +{
>> +    return (t * 125) >> 9;
>> +}
> 

In this patch I'm only moving the code. If we find this is a problem,
this should go into a separate patch.

> How many significant bits on input here?

Basically all are significant, and as it is a clock, we will reach these
bits at one point.

> Do you in fact want to be using muldiv64?

Looking at linux:

arch/s390/include/asm/timex.h

They have a lengthy documentation, resulting in (a spli to avoid overflows)

return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);

Maybe we should do the same?

> 
> 
> r~
> 


-- 

Thanks,

David / dhildenb



reply via email to

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