public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "kvm@vger.kernel.org list" <kvm@vger.kernel.org>
Cc: Avi Kivity <avi@redhat.com>,
	kvm-ppc@vger.kernel.org, Paul Mackerras <paulus@samba.org>
Subject: [PATCH 08/17] powerpc: Set up LPCR for running guest partitions
Date: Mon,  4 Jul 2011 16:12:45 +0200	[thread overview]
Message-ID: <1309788774-13644-9-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1309788774-13644-1-git-send-email-agraf@suse.de>

From: Paul Mackerras <paulus@samba.org>

In hypervisor mode, the LPCR controls several aspects of guest
partitions, including virtual partition memory mode, and also controls
whether the hypervisor decrementer interrupts are enabled.  This sets
up LPCR at boot time so that guest partitions will use a virtual real
memory area (VRMA) composed of 16MB large pages, and hypervisor
decrementer interrupts are disabled.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/include/asm/reg.h         |    4 ++++
 arch/powerpc/kernel/cpu_setup_power7.S |   18 +++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index c5cae0d..d879a6b 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -232,10 +232,12 @@
 #define   LPCR_VPM0	(1ul << (63-0))
 #define   LPCR_VPM1	(1ul << (63-1))
 #define   LPCR_ISL	(1ul << (63-2))
+#define   LPCR_VC_SH	(63-2)
 #define   LPCR_DPFD_SH	(63-11)
 #define   LPCR_VRMA_L	(1ul << (63-12))
 #define   LPCR_VRMA_LP0	(1ul << (63-15))
 #define   LPCR_VRMA_LP1	(1ul << (63-16))
+#define   LPCR_VRMASD_SH (63-16)
 #define   LPCR_RMLS    0x1C000000      /* impl dependent rmo limit sel */
 #define   LPCR_ILE     0x02000000      /* !HV irqs set MSR:LE */
 #define   LPCR_PECE	0x00007000	/* powersave exit cause enable */
@@ -243,8 +245,10 @@
 #define     LPCR_PECE1	0x00002000	/* decrementer can cause exit */
 #define     LPCR_PECE2	0x00001000	/* machine check etc can cause exit */
 #define   LPCR_MER	0x00000800	/* Mediated External Exception */
+#define   LPCR_LPES    0x0000000c
 #define   LPCR_LPES0   0x00000008      /* LPAR Env selector 0 */
 #define   LPCR_LPES1   0x00000004      /* LPAR Env selector 1 */
+#define   LPCR_LPES_SH	2
 #define   LPCR_RMI     0x00000002      /* real mode is cache inhibit */
 #define   LPCR_HDICE   0x00000001      /* Hyp Decr enable (HV,PR,EE) */
 #define SPRN_LPID	0x13F	/* Logical Partition Identifier */
diff --git a/arch/powerpc/kernel/cpu_setup_power7.S b/arch/powerpc/kernel/cpu_setup_power7.S
index 4f9a93f..2ef6749 100644
--- a/arch/powerpc/kernel/cpu_setup_power7.S
+++ b/arch/powerpc/kernel/cpu_setup_power7.S
@@ -61,19 +61,23 @@ __init_LPCR:
 	 *   LPES = 0b01 (HSRR0/1 used for 0x500)
 	 *   PECE = 0b111
 	 *   DPFD = 4
+	 *   HDICE = 0
+	 *   VC = 0b100 (VPM0=1, VPM1=0, ISL=0)
+	 *   VRMASD = 0b10000 (L=1, LP=00)
 	 *
 	 * Other bits untouched for now
 	 */
 	mfspr	r3,SPRN_LPCR
-	ori	r3,r3,(LPCR_LPES0|LPCR_LPES1)
-	xori	r3,r3, LPCR_LPES0
+	li	r5,1
+	rldimi	r3,r5, LPCR_LPES_SH, 64-LPCR_LPES_SH-2
 	ori	r3,r3,(LPCR_PECE0|LPCR_PECE1|LPCR_PECE2)
-	li	r5,7
-	sldi	r5,r5,LPCR_DPFD_SH
-	andc	r3,r3,r5
 	li	r5,4
-	sldi	r5,r5,LPCR_DPFD_SH
-	or	r3,r3,r5
+	rldimi	r3,r5, LPCR_DPFD_SH, 64-LPCR_DPFD_SH-3
+	clrrdi	r3,r3,1		/* clear HDICE */
+	li	r5,4
+	rldimi	r3,r5, LPCR_VC_SH, 0
+	li	r5,0x10
+	rldimi	r3,r5, LPCR_VRMASD_SH, 64-LPCR_VRMASD_SH-5
 	mtspr	SPRN_LPCR,r3
 	isync
 	blr
-- 
1.6.0.2


  parent reply	other threads:[~2011-07-04 14:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04 14:12 [PULL 00/17] KVM PPC patch queue 2011-07-04 Alexander Graf
2011-07-04 14:12 ` [PATCH 01/17] KVM: PPC: Fix machine checks on 32-bit Book3S Alexander Graf
2011-07-04 14:12 ` [PATCH 02/17] KVM: PPC: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s Alexander Graf
2011-07-04 14:12 ` [PATCH 03/17] KVM: PPC: Split out code from book3s.c into book3s_pr.c Alexander Graf
2011-07-04 14:12 ` [PATCH 04/17] powerpc, KVM: Rework KVM checks in first-level interrupt handlers Alexander Graf
2011-07-04 14:12 ` [PATCH 05/17] KVM: PPC: Deliver program interrupts right away instead of queueing them Alexander Graf
2011-07-04 14:12 ` [PATCH 06/17] KVM: PPC: Pass init/destroy vm and prepare/commit memory region ops down Alexander Graf
2011-07-04 14:12 ` [PATCH 07/17] KVM: PPC: Move guest enter/exit down into subarch-specific code Alexander Graf
2011-07-04 14:12 ` Alexander Graf [this message]
2011-07-04 14:12 ` [PATCH 09/17] KVM: PPC: Split host-state fields out of kvmppc_book3s_shadow_vcpu Alexander Graf
2011-07-04 14:12 ` [PATCH 10/17] KVM: PPC: Add support for Book3S processors in hypervisor mode Alexander Graf
2011-07-04 14:12 ` [PATCH 11/17] KVM: PPC: Handle some PAPR hcalls in the kernel Alexander Graf
2011-07-04 14:12 ` [PATCH 12/17] KVM: PPC: Accelerate H_PUT_TCE by implementing it in real mode Alexander Graf
2011-07-04 14:12 ` [PATCH 13/17] KVM: PPC: Allow book3s_hv guests to use SMT processor modes Alexander Graf
2011-07-04 14:12 ` [PATCH 14/17] KVM: PPC: Allocate RMAs (Real Mode Areas) at boot for use by guests Alexander Graf
2011-07-04 14:12 ` [PATCH 15/17] powerpc, KVM: Split HVMODE_206 cpu feature bit into separate HV and architecture bits Alexander Graf
2011-07-04 14:12 ` [PATCH 16/17] KVM: PPC: book3s_hv: Add support for PPC970-family processors Alexander Graf
2011-07-04 14:12 ` [PATCH 17/17] KVM: PPC: Remove prog_flags Alexander Graf
2011-07-07  9:35 ` [PULL 00/17] KVM PPC patch queue 2011-07-04 Marcelo Tosatti
  -- strict thread matches above, loose matches on Subject: below --
2011-06-29 10:15 [PATCH 0/17] Hypervisor-mode KVM on POWER7 and PPC970 Paul Mackerras
2011-06-29 10:20 ` [PATCH 08/17] powerpc: Set up LPCR for running guest partitions 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=1309788774-13644-9-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=avi@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --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