hv_exc: Add support for resetting stolen time delta

This is useful to re-sync AGX, since it shares the same timebase as the
CPU.

Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
Asahi Lina 2022-08-17 14:01:49 +09:00
parent 8cd2865c1f
commit b6d2cc127c
4 changed files with 7 additions and 5 deletions

View file

@ -1018,8 +1018,8 @@ class M1N1Proxy(Reloadable):
return self.request(self.P_HV_START_SECONDARY, cpu, entry, *args)
def hv_switch_cpu(self, cpu):
return self.request(self.P_HV_SWITCH_CPU, cpu)
def hv_set_time_stealing(self, enabled):
return self.request(self.P_HV_SET_TIME_STEALING, int(bool(enabled)))
def hv_set_time_stealing(self, enabled, reset):
return self.request(self.P_HV_SET_TIME_STEALING, int(bool(enabled)), int(bool(reset)))
def hv_pin_cpu(self, cpu):
return self.request(self.P_HV_PIN_CPU, cpu)

View file

@ -70,7 +70,7 @@ void hv_map_vuart(u64 base, int irq, iodev_id_t iodev);
/* Exceptions */
void hv_exc_proxy(struct exc_info *ctx, uartproxy_boot_reason_t reason, u32 type, void *extra);
void hv_set_time_stealing(bool enabled);
void hv_set_time_stealing(bool enabled, bool reset);
/* WDT */
void hv_wdt_pet(void);

View file

@ -139,9 +139,11 @@ void hv_exc_proxy(struct exc_info *ctx, uartproxy_boot_reason_t reason, u32 type
hv_maybe_switch_cpu(ctx, reason, type, extra);
}
void hv_set_time_stealing(bool enabled)
void hv_set_time_stealing(bool enabled, bool reset)
{
time_stealing = enabled;
if (reset)
stolen_time = 0;
}
static void hv_update_fiq(void)

View file

@ -468,7 +468,7 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply)
reply->retval = hv_switch_cpu(request->args[0]);
break;
case P_HV_SET_TIME_STEALING:
hv_set_time_stealing(request->args[0]);
hv_set_time_stealing(request->args[0], request->args[1]);
break;
case P_HV_PIN_CPU:
hv_pin_cpu(request->args[0]);