All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: linuxppc-dev@ozlabs.org, Benjamin Herrenschmidt <benh@ozlabs.org>,
	Michael Neuling <mikey@neuling.org>,
	Anton Blanchard <anton@ozlabs.org>
Subject: [PATCH RFC 4/4] powerpc/radix: Add support for microwatt's PRTBL SPR
Date: Sat, 9 May 2020 15:04:58 +1000	[thread overview]
Message-ID: <20200509050458.GE1464954@thinks.paulus.ozlabs.org> (raw)
In-Reply-To: <20200509050103.GA1464954@thinks.paulus.ozlabs.org>

Microwatt currently doesn't implement hypervisor mode and therefore
doesn't implement the partition table.  It does implement the process
table and radix page table walks.

This adds code to write the base address of the process table to the
PRTBL SPR, which has been assigned SPR 720 for now, as that is in the
range of SPR numbers assigned for experimental use.  PRTBL is only
written when we have neither the FW_FEATURE_LPAR feature nor the
CPU_FTR_HVMODE feature.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
---
 arch/powerpc/include/asm/reg.h           |  1 +
 arch/powerpc/mm/book3s64/radix_pgtable.c | 13 +++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 1aa46dff0957..6ea3fc42740d 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -721,6 +721,7 @@
 #endif
 #define SPRN_TIR	0x1BE	/* Thread Identification Register */
 #define SPRN_PTCR	0x1D0	/* Partition table control Register */
+#define SPRN_PRTBL	0x2D0	/* Process table pointer */
 #define SPRN_PSPB	0x09F	/* Problem State Priority Boost reg */
 #define SPRN_PTEHI	0x3D5	/* 981 7450 PTE HI word (S/W TLB load) */
 #define SPRN_PTELO	0x3D6	/* 982 7450 PTE LO word (S/W TLB load) */
diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
index dd1bea45325c..2e6a376c9d82 100644
--- a/arch/powerpc/mm/book3s64/radix_pgtable.c
+++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
@@ -600,10 +600,15 @@ void __init radix__early_init_mmu(void)
 	radix_init_pgtable();
 
 	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
-		lpcr = mfspr(SPRN_LPCR);
-		mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
-		radix_init_partition_table();
-		radix_init_amor();
+		if (cpu_has_feature(CPU_FTR_HVMODE)) {
+			lpcr = mfspr(SPRN_LPCR);
+			mtspr(SPRN_LPCR, lpcr | LPCR_UPRT | LPCR_HR);
+			radix_init_partition_table();
+			radix_init_amor();
+		} else {
+			mtspr(SPRN_PRTBL, (__pa(process_tb) |
+					   (PRTB_SIZE_SHIFT - 12)));
+		}
 	} else {
 		radix_init_pseries();
 	}
-- 
2.25.3


  parent reply	other threads:[~2020-05-09  5:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  5:01 [PATCH RFC 0/4] Add support for Microwatt-based SoCs Paul Mackerras
2020-05-09  5:02 ` [PATCH RFC 1/4] powerpc/radix: Fix compilation for radix with CONFIG_SMP=n Paul Mackerras
2020-05-09  7:52   ` Nicholas Piggin
2020-05-14  8:26     ` Joel Stanley
2020-05-09  5:02 ` [PATCH RFC 2/4] powerpc: Add Microwatt platform Paul Mackerras
2020-05-09  7:58   ` Nicholas Piggin
2020-05-09  8:36     ` Alistair Popple
2020-05-09  9:10       ` Nicholas Piggin
2020-05-12  1:56   ` Michael Ellerman
2020-05-09  5:03 ` [PATCH RFC 3/4] powerpc/microwatt: Add early debug UART support for Microwatt Paul Mackerras
2020-05-11  7:07   ` Segher Boessenkool
2020-05-12  1:57   ` Michael Ellerman
2020-05-09  5:04 ` Paul Mackerras [this message]
2020-05-09  8:02   ` [PATCH RFC 4/4] powerpc/radix: Add support for microwatt's PRTBL SPR Nicholas Piggin

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=20200509050458.GE1464954@thinks.paulus.ozlabs.org \
    --to=paulus@ozlabs.org \
    --cc=anton@ozlabs.org \
    --cc=benh@ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.