On 18/09/19 10:07, Jianyong Wu wrote:
> +     case ARM_SMCCC_VENDOR_HYP_KVM_PTP_FUNC_ID:
> +             getnstimeofday(ts);

This is not Y2038-safe.  Please use ktime_get_real_ts64 instead, and
split the 64-bit seconds value between val[0] and val[1].

However, it seems to me that the new function is not needed and you can
just use ktime_get_snapshot.  You'll get the time in
systime_snapshot->real and the cycles value in systime_snapshot->cycles.

> +             get_current_counterval(&sc);
> +             val[0] = ts->tv_sec;
> +             val[1] = ts->tv_nsec;
> +             val[2] = sc.cycles;
> +             val[3] = 0;
> +             break;

This should return a guest-cycles value.  If the cycles values always
the same between the host and the guest on ARM, then okay.  If not, you
have to apply whatever offset exists.

Thanks,

Paolo

Reply via email to