[Qemu-devel] [RFC QEMU v2 1/2] arm/virt: Initialize generic timer scale factor dynamically

2018-11-27 Thread Bijan Mottahedeh
Initialize the generic timer scale factor based on the counter frequency register cntfrq_el0, and default to the current static value if necessary. Always use the default value for TCG. Signed-off-by: Bijan Mottahedeh --- hw/arm/virt.c | 17 + target/arm/helper.c

[Qemu-devel] [RFC QEMU v2 0/2] arm/virt: Account for guest pause time

2018-11-27 Thread Bijan Mottahedeh
= {clock = 0x097ddad0 , mask = 72057594037927935, cycle_last = 271809294296, mult = 335544320, shift = 24, xtime_nsec = 345610649600, base = 5435795172160, base_real = 15391264550} This would explain why without any pause time accounting, the both hwclock and date comman

[Qemu-devel] [RFC QEMU v2 2/2] arm/virt: Account for guest pause time

2018-11-27 Thread Bijan Mottahedeh
Accumulate the total guest pause time and update the virtual counter offset register accordingly in order to account for that time before resuming the guest. Signed-off-by: Bijan Mottahedeh --- hw/intc/arm_gicv3_kvm.c | 39 +++ target/arm/cpu.h| 3

Re: [Qemu-devel] [RFC QEMU 1/2] arm/virt: Initialize generic timer scale factor dynamically

2018-11-09 Thread Bijan Mottahedeh
On 11/8/2018 6:21 AM, Richard Henderson wrote: On 11/7/18 7:48 PM, Bijan Mottahedeh wrote: +static void set_system_clock_scale(void) +{ +unsigned long cntfrq_el0; + +asm volatile("mrs %0, cntfrq_el0" : "=r"(cntfrq_el0)); + +if (cntfrq_el0 == 0) {

[Qemu-devel] [RFC QEMU 0/2] arm/virt: Account for guest pause time

2018-11-07 Thread Bijan Mottahedeh
6, mult = 335544320, shift = 24, xtime_nsec = 345610649600, base = 5435795172160, base_real = 15391264550} This would explain why without any pause time accounting, the both hwclock and date command show the same time after the guest is resume from a pause, e.g. with the following seque

[Qemu-devel] [RFC QEMU 1/2] arm/virt: Initialize generic timer scale factor dynamically

2018-11-07 Thread Bijan Mottahedeh
Initialize the generic timer scale factor based on the counter frequency register cntfrq_el0, and default to the current static value if necessary. Signed-off-by: Bijan Mottahedeh --- hw/arm/virt.c | 15 +++ target/arm/helper.c| 19 --- target/arm

[Qemu-devel] [RFC QEMU 2/2] arm/virt: Account for guest pause time

2018-11-07 Thread Bijan Mottahedeh
Accumulate the total guest pause time and update the virtual counter offset register accordingly in order to account for that time before resuming the guest. Signed-off-by: Bijan Mottahedeh --- hw/intc/arm_gicv3_kvm.c | 39 +++ target/arm/cpu.h| 3