linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au,
	Anton Blanchard <anton@ozlabs.org>
Cc: linuxppc-dev@lists.ozlabs.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: [RFC PATCH 10/17] powerpc/mm: Add new firmware feature HASH API
Date: Wed,  2 Aug 2017 11:10:09 +0530	[thread overview]
Message-ID: <20170802054016.8927-11-aneesh.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170802054016.8927-1-aneesh.kumar@linux.vnet.ibm.com>

We will use this feature to check whether hypervisor implements hash based
remove and protect hcalls

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/firmware.h       | 3 ++-
 arch/powerpc/kvm/powerpc.c                | 4 ++++
 arch/powerpc/platforms/pseries/firmware.c | 1 +
 include/uapi/linux/kvm.h                  | 1 +
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index 8645897472b1..152d704ac3c3 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -51,6 +51,7 @@
 #define FW_FEATURE_BEST_ENERGY	ASM_CONST(0x0000000080000000)
 #define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
 #define FW_FEATURE_PRRN		ASM_CONST(0x0000000200000000)
+#define FW_FEATURE_HASH_API	ASM_CONST(0x0000000400000000)
 
 #ifndef __ASSEMBLY__
 
@@ -67,7 +68,7 @@ enum {
 		FW_FEATURE_CMO | FW_FEATURE_VPHN | FW_FEATURE_XCMO |
 		FW_FEATURE_SET_MODE | FW_FEATURE_BEST_ENERGY |
 		FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN |
-		FW_FEATURE_HPT_RESIZE,
+		FW_FEATURE_HPT_RESIZE | FW_FEATURE_HASH_API,
 	FW_FEATURE_PSERIES_ALWAYS = 0,
 	FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL,
 	FW_FEATURE_POWERNV_ALWAYS = 0,
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 1a75c0b5f4ca..bd551edfa155 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -632,6 +632,10 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
 		/* Disable this on POWER9 until code handles new HPTE format */
 		r = !!hv_enabled && !cpu_has_feature(CPU_FTR_ARCH_300);
 		break;
+	case KVM_CAP_SPAPR_HASH_API:
+		/* Only enable for HV kvm */
+		r = is_kvmppc_hv_enabled(kvm);
+		break;
 #endif
 #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
 	case KVM_CAP_PPC_FWNMI:
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 63cc82ad58ac..32081d4406e8 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -65,6 +65,7 @@ hypertas_fw_features_table[] = {
 	{FW_FEATURE_SET_MODE,		"hcall-set-mode"},
 	{FW_FEATURE_BEST_ENERGY,	"hcall-best-energy-1*"},
 	{FW_FEATURE_HPT_RESIZE,		"hcall-hpt-resize"},
+	{FW_FEATURE_HASH_API,		"hcall-hash-api"},
 };
 
 /* Build up the firmware features bitmask using the contents of
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 6cd63c18708a..698b202b4c53 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -929,6 +929,7 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_PPC_SMT_POSSIBLE 147
 #define KVM_CAP_HYPERV_SYNIC2 148
 #define KVM_CAP_HYPERV_VP_INDEX 149
+#define KVM_CAP_SPAPR_HASH_API 150
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
-- 
2.13.3

  parent reply	other threads:[~2017-08-02  5:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02  5:39 [RFC PATCH 00/17] Remove slot tracking from linux page table Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 01/17] powerpc/mm: Update native_hpte_find to return hash pte Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 02/17] powerpc/pseries: Update hpte find helper to take hash value Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 03/17] powerpc/ps3/mm: Add helper for finding hash pte slot using " Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 04/17] powerpc/mm: Add hash invalidate callback Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 05/17] powerpc/mm: use hash_invalidate for __kernel_map_pages() Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 06/17] powerpc/mm: Switch flush_hash_range to not use slot Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 07/17] powerpc/mm: Add hash updatepp callback Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 08/17] powerpc/mm/hash: Don't track hash pte slot number in linux page table Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 09/17] powerpc/mm: Remove unused flag arg in global_invalidates Aneesh Kumar K.V
2017-08-02  5:40 ` Aneesh Kumar K.V [this message]
2017-08-02  5:40 ` [RFC PATCH 11/17] powerpc/kvm/hash: Implement HASH_REMOVE hcall Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 12/17] powerpc/kvm/hash: Implement HASH_PROTECT hcall Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 13/17] powerpc/kvm/hash: Implement HASH_BULK_REMOVE hcall Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 14/17] powerpc/mm/pseries: Use HASH_PROTECT hcall in guest Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 15/17] powerpc/mm/pseries: Use HASH_REMOVE " Aneesh Kumar K.V
2017-08-02  5:40 ` [RFC PATCH 16/17] powerpc/mm/pseries: Move slot based bulk remove to helper Aneesh Kumar K.V
2017-08-02 12:50   ` Segher Boessenkool
2017-08-02  5:40 ` [RFC PATCH 17/17] powerpc/mm/pseries: Use HASH_BULK_REMOVE hcall in guest Aneesh Kumar K.V

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170802054016.8927-11-aneesh.kumar@linux.vnet.ibm.com \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=anton@ozlabs.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).