diff mbox

KVM: x86: Allow ARAT CPU feature

Message ID 5561ECBE.7010408@web.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kiszka May 24, 2015, 3:22 p.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

There is no reason to deny this feature to guests. We are emulating the
APIC timer, thus are exposing it without stops in power-saving states.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/kvm/cpuid.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini May 25, 2015, 1:24 p.m. UTC | #1
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



On 24/05/2015 17:22, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> There is no reason to deny this feature to guests. We are
> emulating the APIC timer, thus are exposing it without stops in
> power-saving states.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

Thanks, looks good.

Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJVYyJyAAoJEL/70l94x66DuA8H/isaX6grqCJRUAj15LJAJJrw
nP39iVN+pMcmivoOxWRzIJspZerb06pEZMWAlSaxdkykYVkD23agCqXGBbFO1YTX
pB3X4y+5TPbhwxkJs0ElusThUr0R/I4Y5Nj9rwfA13+JA9IRDJhlAZJKfQvNFNqj
Q8PV/JD/c1ScWFsfVys9oZfjFKa5Wg9js9ayeWP0dLKiLRNQC/6LJJwHPN9zOouP
tYf6HejpHqybF89g7nLfP3ihIPHHoIWtn8pikBN+idCqB7szpwNpBoe0RVcCDA7k
3rdJk6zGxss7Fruw3qVtKk5ze9u5H4kCrLovOGgboYvRYC5flS/0y/zH/4dHiOQ=
=/JKw
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yong Wang May 26, 2015, 1:37 a.m. UTC | #2
On Mon, May 25, 2015 at 03:24:05PM +0200, Paolo Bonzini wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 
> 
> On 24/05/2015 17:22, Jan Kiszka wrote:
> > From: Jan Kiszka <jan.kiszka@siemens.com>
> > 
> > There is no reason to deny this feature to guests. We are
> > emulating the APIC timer, thus are exposing it without stops in
> > power-saving states.
> > 
> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Thanks, looks good.
> 

What's the motivation of exposing ARAT to guests?

Thanks
-Yong

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kiszka May 26, 2015, 4:36 a.m. UTC | #3
On 2015-05-26 03:37, Yong Wang wrote:
> On Mon, May 25, 2015 at 03:24:05PM +0200, Paolo Bonzini wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>>
>>
>> On 24/05/2015 17:22, Jan Kiszka wrote:
>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>> There is no reason to deny this feature to guests. We are
>>> emulating the APIC timer, thus are exposing it without stops in
>>> power-saving states.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Thanks, looks good.
>>
> 
> What's the motivation of exposing ARAT to guests?

First of all, another step towards feature correctness for real CPU
models. But I also have a setup where Linux only has APICs as
clockevents (Jailhouse non-root cells), thus has no broadcast source. In
that case it depends on ARAT to switch to highres mode.

Jan
diff mbox

Patch

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 59b69f6..6d84a9e 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -411,6 +411,12 @@  static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		}
 		break;
 	}
+	case 6: /* Thermal management */
+		entry->eax = 0x4; /* allow ARAT */
+		entry->ebx = 0;
+		entry->ecx = 0;
+		entry->edx = 0;
+		break;
 	case 7: {
 		entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
 		/* Mask ebx against host capability word 9 */
@@ -587,7 +593,6 @@  static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
 		break;
 	case 3: /* Processor serial number */
 	case 5: /* MONITOR/MWAIT */
-	case 6: /* Thermal management */
 	case 0xC0000002:
 	case 0xC0000003:
 	case 0xC0000004: