]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Change to common source file not applicable to open-vm-tools.
authorKruti Pendharkar <kp025370@broadcom.com>
Tue, 22 Jul 2025 07:06:53 +0000 (00:06 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Tue, 22 Jul 2025 07:06:53 +0000 (00:06 -0700)
open-vm-tools/lib/include/vm_atomic.h
open-vm-tools/lib/misc/hostinfoPosix.c

index 809472e17f67cd325ca0db575e0b4ebd9d0ec28c..2586a1d04d7f9495770695ede379077c20a43bad 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (c) 1998-2024 Broadcom. All rights reserved.
+ * Copyright (c) 1998-2024 Broadcom. All Rights Reserved.
  * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
index 54219577653f6aa239c038c70f4ef971d8ec6221..10b3a0605d94e9fbe3a6d93389aaecaa207f33d8 100644 (file)
@@ -3540,7 +3540,7 @@ Hostinfo_GetRatedCpuMhz(int32 cpuNumber,  // IN:
       return FALSE;
    }
 
-   *mHz = hz / 1000000;
+   *mHz = (hz + 500000) / 1000000;
 
    return TRUE;
 #  else
@@ -3549,16 +3549,16 @@ Hostinfo_GetRatedCpuMhz(int32 cpuNumber,  // IN:
 #else
 #if defined(VMX86_SERVER)
    if (HostType_OSIsVMK()) {
-      uint32 tscKhzEstimate;
-      VMK_ReturnStatus status = VMKernel_GetTSCkhzEstimate(&tscKhzEstimate);
+      uint64 cpuHzEstimate;
+      VMK_ReturnStatus status = VMKPrivate_GetProcessorHzEstimate(&cpuHzEstimate);
 
       /*
-       * The TSC frequency matches the CPU frequency in all modern CPUs.
-       * Regardless, the TSC frequency is a much better estimate of
-       * reality than failing or returning zero.
+       * TSC and CPU frequencies match on the modern x86 processors but
+       * not on the Arm processors. Therefore, use the processor frequency
+       * estimate directly.
        */
 
-      *mHz = tscKhzEstimate / 1000;
+      *mHz = (cpuHzEstimate + 500000) / 1000000;
 
       return (status == VMK_OK);
    }