From: Sam Bobroff <hidden> Date: 2016-07-06 06:06:03
Introduce a new KVM capability, KVM_CAP_PPC_HTM, that can be queried to
determine if a PowerPC KVM guest should use HTM (Hardware Transactional
Memory).
This will be used by QEMU to populate the pa-features bits in the
guest's device tree.
Signed-off-by: Sam Bobroff <redacted>
---
arch/powerpc/kvm/powerpc.c | 4 ++++
include/uapi/linux/kvm.h | 1 +
2 files changed, 5 insertions(+)
@@ -588,6 +588,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)r=1;break;#endif+caseKVM_CAP_PPC_HTM:+r=cpu_has_feature(CPU_FTR_TM)+&&is_kvmppc_hv_enabled(kvm);+break;default:r=0;break;
On Wed, 2016-07-06 at 16:05 +1000, Sam Bobroff wrote:
Introduce a new KVM capability, KVM_CAP_PPC_HTM, that can be queried to
determine if a PowerPC KVM guest should use HTM (Hardware Transactional
Memory).
This will be used by QEMU to populate the pa-features bits in the
guest's device tree.
Signed-off-by: Sam Bobroff <redacted>
---
Makes sense
Acked-by: Balbir Singh <bsingharora@gmail.com>
From: David Gibson <hidden> Date: 2016-07-07 00:24:47
On Wed, Jul 06, 2016 at 04:05:54PM +1000, Sam Bobroff wrote:
Introduce a new KVM capability, KVM_CAP_PPC_HTM, that can be queried to
determine if a PowerPC KVM guest should use HTM (Hardware Transactional
Memory).
This will be used by QEMU to populate the pa-features bits in the
guest's device tree.
Signed-off-by: Sam Bobroff <redacted>
@@ -588,6 +588,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)r=1;break;#endif+caseKVM_CAP_PPC_HTM:+r=cpu_has_feature(CPU_FTR_TM)+&&is_kvmppc_hv_enabled(kvm);+break;default:r=0;break;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
@@ -588,6 +588,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)r=1;break;#endif+caseKVM_CAP_PPC_HTM:+r=cpu_has_feature(CPU_FTR_TM)+&&is_kvmppc_hv_enabled(kvm);
I think it should be using CPU_FTR_TM_COMP.
And AFAICS you don't need to break that line.
cheers
@@ -588,6 +588,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)r=1;break;#endif+caseKVM_CAP_PPC_HTM:+r=cpu_has_feature(CPU_FTR_TM)+&&is_kvmppc_hv_enabled(kvm);
I think it should be using CPU_FTR_TM_COMP.
Oh, why is that? I'm happy to respin the patch I'm just curious.
(I did it that way becuase that seems to be the way the other flags are used,
e.g. CPU_FTR_ALTIVEC).
If I read the code correctly, using CPU_FTR_TM_COMP will work fine: it should
cause the cpu_has_feature() test to always return false if CPU_FTR_TM_COMP is
0.
@@ -588,6 +588,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)r=1;break;#endif+caseKVM_CAP_PPC_HTM:+r=cpu_has_feature(CPU_FTR_TM)+&&is_kvmppc_hv_enabled(kvm);
I think it should be using CPU_FTR_TM_COMP.
Oh, why is that? I'm happy to respin the patch I'm just curious.
(I did it that way becuase that seems to be the way the other flags are used,
e.g. CPU_FTR_ALTIVEC).
If I read the code correctly, using CPU_FTR_TM_COMP will work fine: it should
cause the cpu_has_feature() test to always return false if CPU_FTR_TM_COMP is
0.
CPU_FTR_TM says the CPU supports TM.
CPU_FTR_TM_COMP says the CPU supports TM *and* the kernel is built with
TM support.
The distinction exists because currently the assembly patching macros
don't deal correctly with a feature bit that is defined to 0. (And
possibly other reasons I don't remember)
We should fix that, but until we have, anything that is advertising
support to userspace should be using the COMP bits, when they exist.
cheers