All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: linuxppc-dev@ozlabs.org
Subject: [PATCH 03/11] powerpc/radix: Add support for microwatt's PRTBL SPR
Date: Tue, 15 Jun 2021 08:59:11 +1000	[thread overview]
Message-ID: <YMffP+s93uYSaU3J@thinks.paulus.ozlabs.org> (raw)
In-Reply-To: <YMfeswgEHeXSLOUF@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 da103e92c112..3200a2522d6c 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -729,6 +729,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 98f0b243c1ab..6595859173a7 100644
--- a/arch/powerpc/mm/book3s64/radix_pgtable.c
+++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
@@ -646,10 +646,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.31.1


  parent reply	other threads:[~2021-06-14 23:09 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 22:56 [PATCH 00/11] powerpc: Add support for Microwatt soft-core Paul Mackerras
2021-06-14 22:57 ` [PATCH 01/11] powerpc: Add Microwatt platform Paul Mackerras
2021-06-16 18:40   ` Segher Boessenkool
2021-06-16 22:24     ` Paul Mackerras
2021-06-14 22:58 ` [PATCH 02/11] powerpc: Add Microwatt device tree Paul Mackerras
2021-06-17  4:41   ` Michael Ellerman
2021-06-18  2:58     ` Paul Mackerras
2021-06-14 22:59 ` Paul Mackerras [this message]
2021-06-15  1:12   ` [PATCH 03/11] powerpc/radix: Add support for microwatt's PRTBL SPR Nicholas Piggin
2021-06-14 23:00 ` [PATCH 04/11] powerpc/microwatt: Populate platform bus from device-tree Paul Mackerras
2021-06-14 23:00 ` [PATCH 05/11] powerpc/xics: Add a native ICS backend for microwatt Paul Mackerras
2021-06-14 23:01 ` [PATCH 06/11] powerpc: microwatt: Use standard 16550 UART for console Paul Mackerras
2021-06-16 20:42   ` Segher Boessenkool
2021-06-14 23:02 ` [PATCH 07/11] powerpc: Add support for microwatt's hardware random number generator Paul Mackerras
2021-06-15  1:40   ` Nicholas Piggin
2021-06-16 13:16     ` Michael Ellerman
2021-06-16 22:22       ` Paul Mackerras
2021-06-14 23:02 ` [PATCH 08/11] powerpc/microwatt: Add microwatt_defconfig Paul Mackerras
2021-06-14 23:03 ` [PATCH 10/11] powerpc/microwatt: Add a boot wrapper for Microwatt Paul Mackerras
2021-06-14 23:04 ` [PATCH 09/11] powerpc: boot: Fixup device-tree on little endian Paul Mackerras
2021-06-14 23:05 ` [PATCH 11/11] powerpc/microwatt: Disable interrupts in boot wrapper main program Paul Mackerras
2021-06-15  1:21   ` Nicholas Piggin
2021-06-16 23:37   ` Segher Boessenkool
2021-06-17  1:40     ` Nicholas Piggin
2021-06-17  4:06       ` Michael Ellerman
2021-06-17 16:54       ` Segher Boessenkool

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=YMffP+s93uYSaU3J@thinks.paulus.ozlabs.org \
    --to=paulus@ozlabs.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 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.