linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Mihai Caraman <mihai.caraman@freescale.com>
To: <kvm-ppc@vger.kernel.org>
Cc: Mihai Caraman <mihai.caraman@freescale.com>,
	linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org
Subject: [PATCH 12/12] KVM: PPC: booke: Get/set guest EPCR register using ONE_REG interface
Date: Thu, 11 Oct 2012 19:13:29 +0300	[thread overview]
Message-ID: <1349972009-23027-13-git-send-email-mihai.caraman@freescale.com> (raw)
In-Reply-To: <1349972009-23027-1-git-send-email-mihai.caraman@freescale.com>

Implement ONE_REG interface for EPCR register adding KVM_REG_PPC_EPCR to
the list of ONE_REG PPC supported registers.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
 Documentation/virtual/kvm/api.txt |    1 +
 arch/powerpc/include/asm/kvm.h    |    2 ++
 arch/powerpc/kvm/booke.c          |   16 ++++++++++++++++
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index e726d76..c78dff4 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1773,6 +1773,7 @@ registers, find a list below:
   PPC   | KVM_REG_PPC_VPA_ADDR  | 64
   PPC   | KVM_REG_PPC_VPA_SLB   | 128
   PPC   | KVM_REG_PPC_VPA_DTL   | 128
+  PPC   | KVM_REG_PPC_EPCR	| 32
 
 4.69 KVM_GET_ONE_REG
 
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
index b89ae4d..beb6b20 100644
--- a/arch/powerpc/include/asm/kvm.h
+++ b/arch/powerpc/include/asm/kvm.h
@@ -386,4 +386,6 @@ struct kvm_book3e_206_tlb_params {
 #define KVM_REG_PPC_VPA_SLB	(KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83)
 #define KVM_REG_PPC_VPA_DTL	(KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84)
 
+#define KVM_REG_PPC_EPCR	(KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85)
+
 #endif /* __LINUX_KVM_POWERPC_H */
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d396374..60b8237 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1395,6 +1395,12 @@ int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
 				 &vcpu->arch.dbg_reg.dac[dac], sizeof(u64));
 		break;
 	}
+#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV)
+	case KVM_REG_PPC_EPCR:
+		r = copy_to_user((u32 __user *)(long)reg->addr,
+				 &vcpu->arch.epcr, sizeof(u32));
+		break;
+#endif
 	default:
 		break;
 	}
@@ -1422,6 +1428,16 @@ int kvm_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
 			     (u64 __user *)(long)reg->addr, sizeof(u64));
 		break;
 	}
+#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_BOOKE_HV)
+	case KVM_REG_PPC_EPCR: {
+		u32 new_epcr;
+		r = copy_from_user(&new_epcr,
+			     (u32 __user *)(long)reg->addr, sizeof(u32));
+		if (r == 0)
+			kvmppc_set_epcr(vcpu, new_epcr);
+		break;
+	}
+#endif
 	default:
 		break;
 	}
-- 
1.7.4.1

  parent reply	other threads:[~2012-10-11 16:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 16:13 [PATCH 00/12] KVM: PPC: 64-bit Book3E arch support Mihai Caraman
2012-10-11 16:13 ` [PATCH 01/12] KVM: PPC: e500: Silence bogus GCC warning in tlb code Mihai Caraman
2012-10-11 16:13 ` [PATCH 02/12] KVM: PPC: booke: Fix get_tb() compile error on 64-bit Mihai Caraman
2012-10-11 16:13 ` [PATCH 03/12] KVM: PPC: bookehv: Remove GET_VCPU macro from exception handler Mihai Caraman
2012-10-11 16:13 ` [PATCH 04/12] KVM: PPC64: bookehv: Add support for interrupt handling Mihai Caraman
2012-10-11 16:13 ` [PATCH 05/12] KVM: PPC: e500: Add emulation helper for getting instruction ea Mihai Caraman
2012-12-01 13:28   ` Alexander Graf
2012-12-01 13:32     ` Alexander Graf
2012-10-11 16:13 ` [PATCH 06/12] KVM: PPC: Mask ea's high 32-bits in 32/64 instr emulation Mihai Caraman
2012-10-11 16:13 ` [PATCH 07/12] KVM: PPC: e500: Mask MAS2 EPN high 32-bits in 32/64 tlbwe emulation Mihai Caraman
2012-10-11 16:13 ` [PATCH 08/12] KVM: PPC: booke: Extend MAS2 EPN mask for 64-bit Mihai Caraman
2012-10-11 16:13 ` [PATCH 09/12] KVM: PPC: bookehv: Add guest computation mode for irq delivery Mihai Caraman
2012-12-01 13:42   ` Alexander Graf
2012-10-11 16:13 ` [PATCH 10/12] KVM: PPC: bookehv: Add EPCR support in mtspr/mfspr emulation Mihai Caraman
2012-12-01 13:59   ` Alexander Graf
2012-10-11 16:13 ` [PATCH 11/12] KVM: PPC: booke: Add EPCR support in sregs Mihai Caraman
2012-12-01 14:02   ` Alexander Graf
2012-10-11 16:13 ` Mihai Caraman [this message]
2012-12-01 14:15   ` [PATCH 12/12] KVM: PPC: booke: Get/set guest EPCR register using ONE_REG interface Alexander Graf
2012-12-01 15:06 ` [PATCH 00/12] KVM: PPC: 64-bit Book3E arch support Alexander Graf

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=1349972009-23027-13-git-send-email-mihai.caraman@freescale.com \
    --to=mihai.caraman@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.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).