1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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>
This commit is contained in:
Jiri Denemark 2020-11-11 16:50:16 +01:00
parent 0c841f9b70
commit 3c7c7cd4d8
3 changed files with 5 additions and 5 deletions

View File

@ -14053,7 +14053,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) {
@ -22851,7 +22851,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;
}
@ -28166,7 +28166,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

View File

@ -2207,7 +2207,7 @@ struct _virDomainTimerDef {
int track; /* boot|guest|wall */
/* 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 */
};

View File

@ -6357,7 +6357,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) {