82 lines
3.3 KiB
Diff
82 lines
3.3 KiB
Diff
From efd4f6469f9f5f6d3a34d250cd80faf59a8dc373 Mon Sep 17 00:00:00 2001
|
|
From: Jiri Denemark <jdenemar@redhat.com>
|
|
Date: Wed, 11 Nov 2020 16:50:16 +0100
|
|
Subject: [PATCH 068/108] conf: Use unsigned long long for timer frequency
|
|
|
|
Although the code in qemuProcessStartValidateTSC works as if the
|
|
timer frequency was already unsigned long long (by using an appropriate
|
|
temporary variable), the virDomainTimerDef structure actually defines
|
|
frequency as unsigned long, which is not guaranteed to be 64b.
|
|
|
|
Fixes support for frequencies higher than 2^32 - 1 on 32b systems.
|
|
|
|
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
|
(cherry picked from commit 3c7c7cd4d82c2f9a5a59bbd06673b8cd1eb23ce3)
|
|
---
|
|
src/conf/domain_conf.c | 6 +++---
|
|
src/conf/domain_conf.h | 2 +-
|
|
src/qemu/qemu_command.c | 2 +-
|
|
3 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
index a33f9144f5..9c83f4e347 100644
|
|
--- a/src/conf/domain_conf.c
|
|
+++ b/src/conf/domain_conf.c
|
|
@@ -13951,7 +13951,7 @@ virDomainTimerDefParseXML(xmlNodePtr node,
|
|
}
|
|
}
|
|
|
|
- ret = virXPathULong("string(./@frequency)", ctxt, &def->frequency);
|
|
+ ret = virXPathULongLong("string(./@frequency)", ctxt, &def->frequency);
|
|
if (ret == -1) {
|
|
def->frequency = 0;
|
|
} else if (ret < 0) {
|
|
@@ -22259,7 +22259,7 @@ virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src,
|
|
if (src->name == VIR_DOMAIN_TIMER_NAME_TSC) {
|
|
if (src->frequency != dst->frequency) {
|
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
- _("Target TSC frequency %lu does not match source %lu"),
|
|
+ _("Target TSC frequency %llu does not match source %llu"),
|
|
dst->frequency, src->frequency);
|
|
return false;
|
|
}
|
|
@@ -27355,7 +27355,7 @@ virDomainTimerDefFormat(virBufferPtr buf,
|
|
|
|
if (def->name == VIR_DOMAIN_TIMER_NAME_TSC) {
|
|
if (def->frequency > 0)
|
|
- virBufferAsprintf(buf, " frequency='%lu'", def->frequency);
|
|
+ virBufferAsprintf(buf, " frequency='%llu'", def->frequency);
|
|
|
|
if (def->mode != -1) {
|
|
const char *mode
|
|
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
index 15b9e79d69..c0a323d465 100644
|
|
--- a/src/conf/domain_conf.h
|
|
+++ b/src/conf/domain_conf.h
|
|
@@ -2078,7 +2078,7 @@ struct _virDomainTimerDef {
|
|
int track; /* host|guest */
|
|
|
|
/* frequency & mode are only valid for name='tsc' */
|
|
- unsigned long frequency; /* in Hz, unspecified = 0 */
|
|
+ unsigned long long frequency; /* in Hz, unspecified = 0 */
|
|
int mode; /* auto|native|emulate|paravirt */
|
|
};
|
|
|
|
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
index 27b2eef8e5..42f6e10b33 100644
|
|
--- a/src/qemu/qemu_command.c
|
|
+++ b/src/qemu/qemu_command.c
|
|
@@ -6761,7 +6761,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|
break;
|
|
case VIR_DOMAIN_TIMER_NAME_TSC:
|
|
if (timer->frequency > 0)
|
|
- virBufferAsprintf(&buf, ",tsc-frequency=%lu", timer->frequency);
|
|
+ virBufferAsprintf(&buf, ",tsc-frequency=%llu", timer->frequency);
|
|
break;
|
|
case VIR_DOMAIN_TIMER_NAME_ARMVTIMER:
|
|
switch (timer->tickpolicy) {
|
|
--
|
|
2.33.0
|
|
|