linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: linuxppc-dev@ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Subject: [PATCH 16/18] KVM: PPC: Book3S HV: Make HPT-specific hypercalls return error in radix mode
Date: Thu, 12 Jan 2017 20:07:24 +1100	[thread overview]
Message-ID: <1484212046-29591-17-git-send-email-paulus@ozlabs.org> (raw)
In-Reply-To: <1484212046-29591-1-git-send-email-paulus@ozlabs.org>

If the guest is in radix mode, then it doesn't have a hashed page
table (HPT), so all of the hypercalls that manipulate the HPT can't
work and should return an error.  This adds checks to make them
return H_FUNCTION ("function not supported").

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/kvm/book3s_hv_rm_mmu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv_rm_mmu.c b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
index 9ef3c4b..6c1ac3d 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
@@ -182,6 +182,8 @@ long kvmppc_do_h_enter(struct kvm *kvm, unsigned long flags,
 	unsigned long mmu_seq;
 	unsigned long rcbits, irq_flags = 0;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	psize = hpte_page_size(pteh, ptel);
 	if (!psize)
 		return H_PARAMETER;
@@ -458,6 +460,8 @@ long kvmppc_do_h_remove(struct kvm *kvm, unsigned long flags,
 	struct revmap_entry *rev;
 	u64 pte, orig_pte, pte_r;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	if (pte_index >= kvm->arch.hpt_npte)
 		return H_PARAMETER;
 	hpte = (__be64 *)(kvm->arch.hpt_virt + (pte_index << 4));
@@ -529,6 +533,8 @@ long kvmppc_h_bulk_remove(struct kvm_vcpu *vcpu)
 	struct revmap_entry *rev, *revs[4];
 	u64 hp0, hp1;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	global = global_invalidates(kvm, 0);
 	for (i = 0; i < 4 && ret == H_SUCCESS; ) {
 		n = 0;
@@ -642,6 +648,8 @@ long kvmppc_h_protect(struct kvm_vcpu *vcpu, unsigned long flags,
 	unsigned long v, r, rb, mask, bits;
 	u64 pte_v, pte_r;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	if (pte_index >= kvm->arch.hpt_npte)
 		return H_PARAMETER;
 
@@ -711,6 +719,8 @@ long kvmppc_h_read(struct kvm_vcpu *vcpu, unsigned long flags,
 	int i, n = 1;
 	struct revmap_entry *rev = NULL;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	if (pte_index >= kvm->arch.hpt_npte)
 		return H_PARAMETER;
 	if (flags & H_READ_4) {
@@ -750,6 +760,8 @@ long kvmppc_h_clear_ref(struct kvm_vcpu *vcpu, unsigned long flags,
 	unsigned long *rmap;
 	long ret = H_NOT_FOUND;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	if (pte_index >= kvm->arch.hpt_npte)
 		return H_PARAMETER;
 
@@ -796,6 +808,8 @@ long kvmppc_h_clear_mod(struct kvm_vcpu *vcpu, unsigned long flags,
 	unsigned long *rmap;
 	long ret = H_NOT_FOUND;
 
+	if (kvm_is_radix(kvm))
+		return H_FUNCTION;
 	if (pte_index >= kvm->arch.hpt_npte)
 		return H_PARAMETER;
 
-- 
2.7.4

  parent reply	other threads:[~2017-01-12  9:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  9:07 [PATCH 00/18] Support for radix guest and host on POWER9 Paul Mackerras
2017-01-12  9:07 ` [PATCH 01/18] powerpc/64: Don't try to use radix MMU under a hypervisor Paul Mackerras
2017-01-12 16:48   ` Balbir Singh
2017-01-12  9:07 ` [PATCH 02/18] powerpc/64: Fixes for the ibm, client-architecture-support options Paul Mackerras
2017-01-12  9:07 ` [PATCH 03/18] powerpc/64: Always enable radix support for 64-bit Book 3S kernels Paul Mackerras
2017-01-12  9:07 ` [PATCH 04/18] powerpc/64: Enable use of radix MMU under hypervisor on POWER9 Paul Mackerras
2017-01-22  2:17   ` kbuild test robot
2017-01-12  9:07 ` [PATCH 05/18] powerpc/64: More definitions for POWER9 Paul Mackerras
2017-01-12  9:07 ` [PATCH 06/18] powerpc/64: Export pgtable_cache and pgtable_cache_add for KVM Paul Mackerras
2017-01-12  9:07 ` [PATCH 07/18] powerpc/64: Make type of partition table flush depend on partition type Paul Mackerras
2017-01-12  9:07 ` [PATCH 08/18] KVM: PPC: Book3S HV: Don't try to signal cpu -1 Paul Mackerras
2017-01-12  9:07 ` [PATCH 09/18] KVM: PPC: Book3S HV: Add userspace interfaces for POWER9 MMU Paul Mackerras
2017-01-12  9:07 ` [PATCH 10/18] KVM: PPC: Book3S HV: Set process table for HPT guests on POWER9 Paul Mackerras
2017-01-23  2:39   ` Suraj Jitindar Singh
2017-01-23  4:37     ` Paul Mackerras
2017-01-12  9:07 ` [PATCH 11/18] KVM: PPC: Book3S HV: Add basic infrastructure for radix guests Paul Mackerras
2017-01-12  9:07 ` [PATCH 12/18] KVM: PPC: Book3S HV: Modify guest entry/exit paths to handle " Paul Mackerras
2017-01-12  9:07 ` [PATCH 13/18] KVM: PPC: Book3S HV: Page table construction and page faults for " Paul Mackerras
2017-01-23  3:17   ` Suraj Jitindar Singh
2017-01-23  4:38     ` Paul Mackerras
2017-01-12  9:07 ` [PATCH 14/18] KVM: PPC: Book3S HV: MMU notifier callbacks " Paul Mackerras
2017-01-23  3:21   ` Suraj Jitindar Singh
2017-01-12  9:07 ` [PATCH 15/18] KVM: PPC: Book3S HV: Implement dirty page logging " Paul Mackerras
2017-01-12  9:07 ` Paul Mackerras [this message]
2017-01-12  9:07 ` [PATCH 17/18] KVM: PPC: Book3S HV: Enable radix guest support Paul Mackerras
2017-01-23  3:31   ` Suraj Jitindar Singh
2017-01-12  9:07 ` [PATCH 18/18] KVM: PPC: Book3S HV: Use ASDR for HPT guests on POWER9 Paul Mackerras

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=1484212046-29591-17-git-send-email-paulus@ozlabs.org \
    --to=paulus@ozlabs.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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).