qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command.
@ 2012-08-31 15:30 Don Slutz
  2012-08-31 16:22 ` Jan Kiszka
  2012-08-31 17:20 ` [Qemu-devel] [PATCH v2] " Don Slutz
  0 siblings, 2 replies; 9+ messages in thread
From: Don Slutz @ 2012-08-31 15:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: Don Slutz

This is known is linux as VMWARE_PORT_CMD_GETHZ.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 hw/vmport.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/hw/vmport.c b/hw/vmport.c
index a4f52ee..37dbf91 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -26,13 +26,15 @@
 #include "pc.h"
 #include "kvm.h"
 #include "qdev.h"
+#include "qemu-timer.h"
 
 //#define VMPORT_DEBUG
 
 #define VMPORT_CMD_GETVERSION 0x0a
 #define VMPORT_CMD_GETRAMSIZE 0x14
+#define VMPORT_CMD_GETHZ      0x2d
 
-#define VMPORT_ENTRIES 0x2c
+#define VMPORT_ENTRIES 0x2e
 #define VMPORT_MAGIC   0x564D5868
 
 typedef struct _VMPortState
@@ -102,6 +104,23 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
     return ram_size;
 }
 
+static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
+{
+    CPUX86State *env = cpu_single_env;
+    uint64_t value;
+
+    value = (uint64_t)env->tsc_khz * 1000;
+    if (value) {
+        /* apic-frequency (bus speed) */
+        env->regs[R_ECX] = (uint32_t)get_ticks_per_sec();
+        /* High part of tsc-frequency */
+        env->regs[R_EBX] = (uint32_t)(value >> 32);
+        /* Low part of tsc-frequency */
+        return (uint32_t)value;
+    } else
+        return env->regs[R_EAX];
+}
+
 /* vmmouse helpers */
 void vmmouse_get_data(uint32_t *data)
 {
@@ -141,6 +160,7 @@ static int vmport_initfn(ISADevice *dev)
     /* Register some generic port commands */
     vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
     vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
+    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
     return 0;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command.
  2012-08-31 15:30 [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command Don Slutz
@ 2012-08-31 16:22 ` Jan Kiszka
  2012-08-31 16:57   ` Don Slutz
  2012-08-31 17:20 ` [Qemu-devel] [PATCH v2] " Don Slutz
  1 sibling, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2012-08-31 16:22 UTC (permalink / raw)
  To: Don Slutz; +Cc: qemu-devel

On 2012-08-31 17:30, Don Slutz wrote:
> This is known is linux as VMWARE_PORT_CMD_GETHZ.
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  hw/vmport.c |   22 +++++++++++++++++++++-
>  1 files changed, 21 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/vmport.c b/hw/vmport.c
> index a4f52ee..37dbf91 100644
> --- a/hw/vmport.c
> +++ b/hw/vmport.c
> @@ -26,13 +26,15 @@
>  #include "pc.h"
>  #include "kvm.h"
>  #include "qdev.h"
> +#include "qemu-timer.h"

Won't be needed, see below.

>  
>  //#define VMPORT_DEBUG
>  
>  #define VMPORT_CMD_GETVERSION 0x0a
>  #define VMPORT_CMD_GETRAMSIZE 0x14
> +#define VMPORT_CMD_GETHZ      0x2d
>  
> -#define VMPORT_ENTRIES 0x2c
> +#define VMPORT_ENTRIES 0x2e
>  #define VMPORT_MAGIC   0x564D5868
>  
>  typedef struct _VMPortState
> @@ -102,6 +104,23 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
>      return ram_size;
>  }
>  
> +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
> +{
> +    CPUX86State *env = cpu_single_env;
> +    uint64_t value;
> +
> +    value = (uint64_t)env->tsc_khz * 1000;
> +    if (value) {
> +        /* apic-frequency (bus speed) */
> +        env->regs[R_ECX] = (uint32_t)get_ticks_per_sec();

So this is 1MHz. That happens to be what we return in
get_ticks_per_sec(), but I don't see the logical relation between both.
Better set a constant, none of our APIC emulations will change it.

> +        /* High part of tsc-frequency */
> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
> +        /* Low part of tsc-frequency */
> +        return (uint32_t)value;

EDX is unused by GETHZ? Just wondering if there is spec.

> +    } else
> +        return env->regs[R_EAX];

Use checkpatch.pl, please.

> +}
> +
>  /* vmmouse helpers */
>  void vmmouse_get_data(uint32_t *data)
>  {
> @@ -141,6 +160,7 @@ static int vmport_initfn(ISADevice *dev)
>      /* Register some generic port commands */
>      vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
>      vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>      return 0;
>  }
>  
> 

Looks good otherwise.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command.
  2012-08-31 16:22 ` Jan Kiszka
@ 2012-08-31 16:57   ` Don Slutz
  2012-08-31 17:00     ` Jan Kiszka
  0 siblings, 1 reply; 9+ messages in thread
From: Don Slutz @ 2012-08-31 16:57 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel

On 08/31/12 12:22, Jan Kiszka wrote:
> On 2012-08-31 17:30, Don Slutz wrote:
>> This is known is linux as VMWARE_PORT_CMD_GETHZ.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>   hw/vmport.c |   22 +++++++++++++++++++++-
>>   1 files changed, 21 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/vmport.c b/hw/vmport.c
>> index a4f52ee..37dbf91 100644
>> --- a/hw/vmport.c
>> +++ b/hw/vmport.c
>> @@ -26,13 +26,15 @@
>>   #include "pc.h"
>>   #include "kvm.h"
>>   #include "qdev.h"
>> +#include "qemu-timer.h"
> Won't be needed, see below.
>
>>   
>>   //#define VMPORT_DEBUG
>>   
>>   #define VMPORT_CMD_GETVERSION 0x0a
>>   #define VMPORT_CMD_GETRAMSIZE 0x14
>> +#define VMPORT_CMD_GETHZ      0x2d
>>   
>> -#define VMPORT_ENTRIES 0x2c
>> +#define VMPORT_ENTRIES 0x2e
>>   #define VMPORT_MAGIC   0x564D5868
>>   
>>   typedef struct _VMPortState
>> @@ -102,6 +104,23 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
>>       return ram_size;
>>   }
>>   
>> +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
>> +{
>> +    CPUX86State *env = cpu_single_env;
>> +    uint64_t value;
>> +
>> +    value = (uint64_t)env->tsc_khz * 1000;
>> +    if (value) {
>> +        /* apic-frequency (bus speed) */
>> +        env->regs[R_ECX] = (uint32_t)get_ticks_per_sec();
> So this is 1MHz. That happens to be what we return in
> get_ticks_per_sec(), but I don't see the logical relation between both.
> Better set a constant, none of our APIC emulations will change it.
>
>> +        /* High part of tsc-frequency */
>> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
>> +        /* Low part of tsc-frequency */
>> +        return (uint32_t)value;
> EDX is unused by GETHZ? Just wondering if there is spec.
I have not been able to find a SPEC.  Testing on real VMware systems 
showed that EDX is not changed. And the linux kernel ignored EDX output.
>
>> +    } else
>> +        return env->regs[R_EAX];
> Use checkpatch.pl, please.
I did:
     don-760:~/tmp/qemu>./scripts/checkpatch.pl 
outgoing/0001-hw-Add-VMware-s-GETHZ-command.patch
     total: 0 errors, 0 warnings, 46 lines checked

     outgoing/0001-hw-Add-VMware-s-GETHZ-command.patch has no obvious 
style problems and is ready for submission.
Will fix.
>
>> +}
>> +
>>   /* vmmouse helpers */
>>   void vmmouse_get_data(uint32_t *data)
>>   {
>> @@ -141,6 +160,7 @@ static int vmport_initfn(ISADevice *dev)
>>       /* Register some generic port commands */
>>       vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
>>       vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
>> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>>       return 0;
>>   }
>>   
>>
> Looks good otherwise.
>
> Jan
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command.
  2012-08-31 16:57   ` Don Slutz
@ 2012-08-31 17:00     ` Jan Kiszka
  0 siblings, 0 replies; 9+ messages in thread
From: Jan Kiszka @ 2012-08-31 17:00 UTC (permalink / raw)
  To: Don Slutz; +Cc: qemu-devel@nongnu.org

On 2012-08-31 18:57, Don Slutz wrote:
> On 08/31/12 12:22, Jan Kiszka wrote:
>> On 2012-08-31 17:30, Don Slutz wrote:
>>> This is known is linux as VMWARE_PORT_CMD_GETHZ.
>>>
>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>> ---
>>>   hw/vmport.c |   22 +++++++++++++++++++++-
>>>   1 files changed, 21 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/hw/vmport.c b/hw/vmport.c
>>> index a4f52ee..37dbf91 100644
>>> --- a/hw/vmport.c
>>> +++ b/hw/vmport.c
>>> @@ -26,13 +26,15 @@
>>>   #include "pc.h"
>>>   #include "kvm.h"
>>>   #include "qdev.h"
>>> +#include "qemu-timer.h"
>> Won't be needed, see below.
>>
>>>   
>>>   //#define VMPORT_DEBUG
>>>   
>>>   #define VMPORT_CMD_GETVERSION 0x0a
>>>   #define VMPORT_CMD_GETRAMSIZE 0x14
>>> +#define VMPORT_CMD_GETHZ      0x2d
>>>   
>>> -#define VMPORT_ENTRIES 0x2c
>>> +#define VMPORT_ENTRIES 0x2e
>>>   #define VMPORT_MAGIC   0x564D5868
>>>   
>>>   typedef struct _VMPortState
>>> @@ -102,6 +104,23 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
>>>       return ram_size;
>>>   }
>>>   
>>> +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
>>> +{
>>> +    CPUX86State *env = cpu_single_env;
>>> +    uint64_t value;
>>> +
>>> +    value = (uint64_t)env->tsc_khz * 1000;
>>> +    if (value) {
>>> +        /* apic-frequency (bus speed) */
>>> +        env->regs[R_ECX] = (uint32_t)get_ticks_per_sec();
>> So this is 1MHz. That happens to be what we return in
>> get_ticks_per_sec(), but I don't see the logical relation between both.
>> Better set a constant, none of our APIC emulations will change it.
>>
>>> +        /* High part of tsc-frequency */
>>> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
>>> +        /* Low part of tsc-frequency */
>>> +        return (uint32_t)value;
>> EDX is unused by GETHZ? Just wondering if there is spec.
> I have not been able to find a SPEC.  Testing on real VMware systems 
> showed that EDX is not changed. And the linux kernel ignored EDX output.
>>
>>> +    } else
>>> +        return env->regs[R_EAX];
>> Use checkpatch.pl, please.
> I did:
>      don-760:~/tmp/qemu>./scripts/checkpatch.pl 
> outgoing/0001-hw-Add-VMware-s-GETHZ-command.patch
>      total: 0 errors, 0 warnings, 46 lines checked
> 
>      outgoing/0001-hw-Add-VMware-s-GETHZ-command.patch has no obvious 
> style problems and is ready for submission.

Hmm, sorry. Someone has to fix our checker...

Jan

> Will fix.
>>
>>> +}
>>> +
>>>   /* vmmouse helpers */
>>>   void vmmouse_get_data(uint32_t *data)
>>>   {
>>> @@ -141,6 +160,7 @@ static int vmport_initfn(ISADevice *dev)
>>>       /* Register some generic port commands */
>>>       vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
>>>       vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
>>> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>>>       return 0;
>>>   }
>>>   
>>>
>> Looks good otherwise.
>>
>> Jan
>>
> 

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH v2] hw: Add VMware's GETHZ command.
  2012-08-31 15:30 [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command Don Slutz
  2012-08-31 16:22 ` Jan Kiszka
@ 2012-08-31 17:20 ` Don Slutz
  2012-08-31 17:27   ` Jan Kiszka
  1 sibling, 1 reply; 9+ messages in thread
From: Don Slutz @ 2012-08-31 17:20 UTC (permalink / raw)
  To: qemu-devel, jan.kiszka; +Cc: Don Slutz

This is known is linux as VMWARE_PORT_CMD_GETHZ.

Signed-off-by: Don Slutz <Don@CloudSwitch.com>
---
 hw/vmport.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/hw/vmport.c b/hw/vmport.c
index a4f52ee..e856255 100644
--- a/hw/vmport.c
+++ b/hw/vmport.c
@@ -31,8 +31,9 @@
 
 #define VMPORT_CMD_GETVERSION 0x0a
 #define VMPORT_CMD_GETRAMSIZE 0x14
+#define VMPORT_CMD_GETHZ      0x2d
 
-#define VMPORT_ENTRIES 0x2c
+#define VMPORT_ENTRIES 0x2e
 #define VMPORT_MAGIC   0x564D5868
 
 typedef struct _VMPortState
@@ -102,6 +103,25 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
     return ram_size;
 }
 
+static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
+{
+    CPUX86State *env = cpu_single_env;
+    uint64_t value;
+    const uint32_t apicHz = 1000000000L;
+
+    value = (uint64_t)env->tsc_khz * 1000;
+    if (value) {
+        /* apic-frequency (bus speed) */
+        env->regs[R_ECX] = apicHz;
+        /* High part of tsc-frequency */
+        env->regs[R_EBX] = (uint32_t)(value >> 32);
+        /* Low part of tsc-frequency */
+        return (uint32_t)value;
+    } else {
+        return env->regs[R_EAX];
+    }
+}
+
 /* vmmouse helpers */
 void vmmouse_get_data(uint32_t *data)
 {
@@ -141,6 +161,7 @@ static int vmport_initfn(ISADevice *dev)
     /* Register some generic port commands */
     vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
     vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
+    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
     return 0;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw: Add VMware's GETHZ command.
  2012-08-31 17:20 ` [Qemu-devel] [PATCH v2] " Don Slutz
@ 2012-08-31 17:27   ` Jan Kiszka
  2012-09-05 20:24     ` Don Slutz
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Kiszka @ 2012-08-31 17:27 UTC (permalink / raw)
  To: Don Slutz; +Cc: qemu-devel@nongnu.org

On 2012-08-31 19:20, Don Slutz wrote:
> This is known is linux as VMWARE_PORT_CMD_GETHZ.
> 
> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
> ---
>  hw/vmport.c |   23 ++++++++++++++++++++++-
>  1 files changed, 22 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/vmport.c b/hw/vmport.c
> index a4f52ee..e856255 100644
> --- a/hw/vmport.c
> +++ b/hw/vmport.c
> @@ -31,8 +31,9 @@
>  
>  #define VMPORT_CMD_GETVERSION 0x0a
>  #define VMPORT_CMD_GETRAMSIZE 0x14
> +#define VMPORT_CMD_GETHZ      0x2d
>  
> -#define VMPORT_ENTRIES 0x2c
> +#define VMPORT_ENTRIES 0x2e
>  #define VMPORT_MAGIC   0x564D5868
>  
>  typedef struct _VMPortState
> @@ -102,6 +103,25 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
>      return ram_size;
>  }
>  
> +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
> +{
> +    CPUX86State *env = cpu_single_env;
> +    uint64_t value;
> +    const uint32_t apicHz = 1000000000L;
> +
> +    value = (uint64_t)env->tsc_khz * 1000;
> +    if (value) {
> +        /* apic-frequency (bus speed) */
> +        env->regs[R_ECX] = apicHz;
> +        /* High part of tsc-frequency */
> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
> +        /* Low part of tsc-frequency */
> +        return (uint32_t)value;
> +    } else {
> +        return env->regs[R_EAX];
> +    }
> +}
> +
>  /* vmmouse helpers */
>  void vmmouse_get_data(uint32_t *data)
>  {
> @@ -141,6 +161,7 @@ static int vmport_initfn(ISADevice *dev)
>      /* Register some generic port commands */
>      vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
>      vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>      return 0;
>  }
>  
> 

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v2] hw: Add VMware's GETHZ command.
  2012-08-31 17:27   ` Jan Kiszka
@ 2012-09-05 20:24     ` Don Slutz
  2012-09-17 14:31       ` [Qemu-devel] PING " Don Slutz
  0 siblings, 1 reply; 9+ messages in thread
From: Don Slutz @ 2012-09-05 20:24 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel@nongnu.org

On 08/31/12 13:27, Jan Kiszka wrote:
> On 2012-08-31 19:20, Don Slutz wrote:
>> This is known is linux as VMWARE_PORT_CMD_GETHZ.
>>
>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>> ---
>>   hw/vmport.c |   23 ++++++++++++++++++++++-
>>   1 files changed, 22 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/vmport.c b/hw/vmport.c
>> index a4f52ee..e856255 100644
>> --- a/hw/vmport.c
>> +++ b/hw/vmport.c
>> @@ -31,8 +31,9 @@
>>   
>>   #define VMPORT_CMD_GETVERSION 0x0a
>>   #define VMPORT_CMD_GETRAMSIZE 0x14
>> +#define VMPORT_CMD_GETHZ      0x2d
>>   
>> -#define VMPORT_ENTRIES 0x2c
>> +#define VMPORT_ENTRIES 0x2e
>>   #define VMPORT_MAGIC   0x564D5868
>>   
>>   typedef struct _VMPortState
>> @@ -102,6 +103,25 @@ static uint32_t vmport_cmd_ram_size(void *opaque, uint32_t addr)
>>       return ram_size;
>>   }
>>   
>> +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
>> +{
>> +    CPUX86State *env = cpu_single_env;
>> +    uint64_t value;
>> +    const uint32_t apicHz = 1000000000L;
>> +
>> +    value = (uint64_t)env->tsc_khz * 1000;
>> +    if (value) {
>> +        /* apic-frequency (bus speed) */
>> +        env->regs[R_ECX] = apicHz;
>> +        /* High part of tsc-frequency */
>> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
>> +        /* Low part of tsc-frequency */
>> +        return (uint32_t)value;
>> +    } else {
>> +        return env->regs[R_EAX];
>> +    }
>> +}
>> +
>>   /* vmmouse helpers */
>>   void vmmouse_get_data(uint32_t *data)
>>   {
>> @@ -141,6 +161,7 @@ static int vmport_initfn(ISADevice *dev)
>>       /* Register some generic port commands */
>>       vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, NULL);
>>       vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, NULL);
>> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>>       return 0;
>>   }
>>   
>>
> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
>
Any thing else I need to do to get this into 1.3?
    -Don Slutz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] PING Re:  [PATCH v2] hw: Add VMware's GETHZ command.
  2012-09-05 20:24     ` Don Slutz
@ 2012-09-17 14:31       ` Don Slutz
  2012-09-17 19:33         ` Anthony Liguori
  0 siblings, 1 reply; 9+ messages in thread
From: Don Slutz @ 2012-09-17 14:31 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: qemu-devel@nongnu.org

On 09/05/12 16:24, Don Slutz wrote:
> On 08/31/12 13:27, Jan Kiszka wrote:
>> On 2012-08-31 19:20, Don Slutz wrote:
>>> This is known is linux as VMWARE_PORT_CMD_GETHZ.
>>>
>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>> ---
>>>   hw/vmport.c |   23 ++++++++++++++++++++++-
>>>   1 files changed, 22 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/hw/vmport.c b/hw/vmport.c
>>> index a4f52ee..e856255 100644
>>> --- a/hw/vmport.c
>>> +++ b/hw/vmport.c
>>> @@ -31,8 +31,9 @@
>>>     #define VMPORT_CMD_GETVERSION 0x0a
>>>   #define VMPORT_CMD_GETRAMSIZE 0x14
>>> +#define VMPORT_CMD_GETHZ      0x2d
>>>   -#define VMPORT_ENTRIES 0x2c
>>> +#define VMPORT_ENTRIES 0x2e
>>>   #define VMPORT_MAGIC   0x564D5868
>>>     typedef struct _VMPortState
>>> @@ -102,6 +103,25 @@ static uint32_t vmport_cmd_ram_size(void 
>>> *opaque, uint32_t addr)
>>>       return ram_size;
>>>   }
>>>   +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
>>> +{
>>> +    CPUX86State *env = cpu_single_env;
>>> +    uint64_t value;
>>> +    const uint32_t apicHz = 1000000000L;
>>> +
>>> +    value = (uint64_t)env->tsc_khz * 1000;
>>> +    if (value) {
>>> +        /* apic-frequency (bus speed) */
>>> +        env->regs[R_ECX] = apicHz;
>>> +        /* High part of tsc-frequency */
>>> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
>>> +        /* Low part of tsc-frequency */
>>> +        return (uint32_t)value;
>>> +    } else {
>>> +        return env->regs[R_EAX];
>>> +    }
>>> +}
>>> +
>>>   /* vmmouse helpers */
>>>   void vmmouse_get_data(uint32_t *data)
>>>   {
>>> @@ -141,6 +161,7 @@ static int vmport_initfn(ISADevice *dev)
>>>       /* Register some generic port commands */
>>>       vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, 
>>> NULL);
>>>       vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, 
>>> NULL);
>>> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>>>       return 0;
>>>   }
>>>
>> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
>>
> Any thing else I need to do to get this into 1.3?
>    -Don Slutz
>
Ping.
   -Don Slutz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] PING Re: [PATCH v2] hw: Add VMware's GETHZ command.
  2012-09-17 14:31       ` [Qemu-devel] PING " Don Slutz
@ 2012-09-17 19:33         ` Anthony Liguori
  0 siblings, 0 replies; 9+ messages in thread
From: Anthony Liguori @ 2012-09-17 19:33 UTC (permalink / raw)
  To: Don Slutz, Jan Kiszka; +Cc: qemu-devel@nongnu.org

Don Slutz <Don@CloudSwitch.Com> writes:

> On 09/05/12 16:24, Don Slutz wrote:
>> On 08/31/12 13:27, Jan Kiszka wrote:
>>> On 2012-08-31 19:20, Don Slutz wrote:
>>>> This is known is linux as VMWARE_PORT_CMD_GETHZ.
>>>>
>>>> Signed-off-by: Don Slutz <Don@CloudSwitch.com>
>>>> ---
>>>>   hw/vmport.c |   23 ++++++++++++++++++++++-
>>>>   1 files changed, 22 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/hw/vmport.c b/hw/vmport.c
>>>> index a4f52ee..e856255 100644
>>>> --- a/hw/vmport.c
>>>> +++ b/hw/vmport.c
>>>> @@ -31,8 +31,9 @@
>>>>     #define VMPORT_CMD_GETVERSION 0x0a
>>>>   #define VMPORT_CMD_GETRAMSIZE 0x14
>>>> +#define VMPORT_CMD_GETHZ      0x2d
>>>>   -#define VMPORT_ENTRIES 0x2c
>>>> +#define VMPORT_ENTRIES 0x2e
>>>>   #define VMPORT_MAGIC   0x564D5868
>>>>     typedef struct _VMPortState
>>>> @@ -102,6 +103,25 @@ static uint32_t vmport_cmd_ram_size(void 
>>>> *opaque, uint32_t addr)
>>>>       return ram_size;
>>>>   }
>>>>   +static uint32_t vmport_cmd_get_hz(void *opaque, uint32_t addr)
>>>> +{
>>>> +    CPUX86State *env = cpu_single_env;
>>>> +    uint64_t value;
>>>> +    const uint32_t apicHz = 1000000000L;
>>>> +
>>>> +    value = (uint64_t)env->tsc_khz * 1000;
>>>> +    if (value) {
>>>> +        /* apic-frequency (bus speed) */
>>>> +        env->regs[R_ECX] = apicHz;
>>>> +        /* High part of tsc-frequency */
>>>> +        env->regs[R_EBX] = (uint32_t)(value >> 32);
>>>> +        /* Low part of tsc-frequency */
>>>> +        return (uint32_t)value;
>>>> +    } else {
>>>> +        return env->regs[R_EAX];
>>>> +    }
>>>> +}
>>>> +
>>>>   /* vmmouse helpers */
>>>>   void vmmouse_get_data(uint32_t *data)
>>>>   {
>>>> @@ -141,6 +161,7 @@ static int vmport_initfn(ISADevice *dev)
>>>>       /* Register some generic port commands */
>>>>       vmport_register(VMPORT_CMD_GETVERSION, vmport_cmd_get_version, 
>>>> NULL);
>>>>       vmport_register(VMPORT_CMD_GETRAMSIZE, vmport_cmd_ram_size, 
>>>> NULL);
>>>> +    vmport_register(VMPORT_CMD_GETHZ, vmport_cmd_get_hz, NULL);
>>>>       return 0;
>>>>   }
>>>>
>>> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>> Any thing else I need to do to get this into 1.3?
>>    -Don Slutz
>>
> Ping.

Please top post new patches in the future.  Otherwise they are easily
lost.

Regards,

Anthony Liguori

>    -Don Slutz

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-09-17 19:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-31 15:30 [Qemu-devel] [PATCH] hw: Add VMware's GETHZ command Don Slutz
2012-08-31 16:22 ` Jan Kiszka
2012-08-31 16:57   ` Don Slutz
2012-08-31 17:00     ` Jan Kiszka
2012-08-31 17:20 ` [Qemu-devel] [PATCH v2] " Don Slutz
2012-08-31 17:27   ` Jan Kiszka
2012-09-05 20:24     ` Don Slutz
2012-09-17 14:31       ` [Qemu-devel] PING " Don Slutz
2012-09-17 19:33         ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).