aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <danielhb413@gmail.com>2021-03-01 09:41:33 -0300
committerDavid Gibson <david@gibson.dropbear.id.au>2021-03-10 09:07:09 +1100
commit4515a5f786024fabf0bef4cf3d28adf5647e6e82 (patch)
tree6499b4ee6bc825ac039be968ecf08a9d169d0170 /hw/ppc
parente35dfbd22780aafbcd4b6da5130a00fc085fd5de (diff)
downloadqemu-4515a5f786024fabf0bef4cf3d28adf5647e6e82.zip
qemu-4515a5f786024fabf0bef4cf3d28adf5647e6e82.tar.gz
qemu-4515a5f786024fabf0bef4cf3d28adf5647e6e82.tar.bz2
qemu_timer.c: add timer_deadline_ms() helper
The pSeries machine is using QEMUTimer internals to return the timeout in seconds for a timer object, in hw/ppc/spapr.c, function spapr_drc_unplug_timeout_remaining_sec(). Create a helper in qemu-timer.c to retrieve the deadline for a QEMUTimer object, in ms, to avoid exposing timer internals to the PPC code. CC: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Message-Id: <20210301124133.23800-2-danielhb413@gmail.com> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r--hw/ppc/spapr_drc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 8c4997d..98b626a 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -421,9 +421,8 @@ void spapr_drc_unplug_request(SpaprDrc *drc)
int spapr_drc_unplug_timeout_remaining_sec(SpaprDrc *drc)
{
- if (drc->unplug_requested && timer_pending(drc->unplug_timeout_timer)) {
- return (qemu_timeout_ns_to_ms(drc->unplug_timeout_timer->expire_time) -
- qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)) / 1000;
+ if (drc->unplug_requested) {
+ return timer_deadline_ms(drc->unplug_timeout_timer) / 1000;
}
return 0;