arch/powerpc/prom_init: Parse the command line before calling CAS
PATCH v2 1/2 arch/powerpc/prom_init: Parse the command line before calling CAS
On POWER9 the hypervisor requires the guest to decide whether it would like to use a hash or radix mmu model at the time it calls ibm,client-architecture-support (CAS) based on what the hypervisor has said it's allowed to do. It is possible to disable radix by passing "disable_radix" on the command line. The next patch will add support for the new CAS format, thus we need to parse the command line before calling CAS so we can correctly select which mmu we would like to use.
---
V1 -> V2:
- Reword commit message for clarity. No functional change
--- arch/powerpc/kernel/prom_init.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/kernel/prom_init.c +5 -5
@@ -2993,6 +2993,11 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,*/ prom_check_initrd (r3, r4); +/* +* Do early parsing of command line +*/ +early_cmdline_parse (); +#if defined(CONFIG_PPC_PSERIES ) || defined(CONFIG_PPC_POWERNV )/* * On pSeries, inform the firmware about our capabilities
@@ -3009,11 +3014,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,copy_and_flush (0 , kbase,0x100 ,0 );/* -* Do early parsing of command line -*/ -early_cmdline_parse (); - -/* * Initialize memory management within prom_init */ prom_init_mem ();
Signature · 1 line
2.5.5
PATCH v2 2/2 arch/powerpc/CAS: Update to new option-vector-5 format for CAS
On POWER9 the ibm,client-architecture-support (CAS) negotiation process has been updated to change how the host to guest negotiation is done for the new hash/radix mmu as well as the nest mmu, process tables and guest translation shootdown (GTSE).
The host tells the guest which options it supports in ibm,arch-vec-5-platform-support. The guest then chooses a subset of these to request in the CAS call and these are agreed to in the ibm,architecture-vec-5 property of the chosen node.
Thus we read ibm,arch-vec-5-platform-support and make our selection before calling CAS. We then parse the ibm,architecture-vec-5 property of the chosen node to check whether we should run as hash or radix.
ibm,arch-vec-5-platform-support format:
index value pairs: <index, val> ... <index, val>
index: Option vector 5 byte number val: Some representation of supported values
---
V1 -> V2:
- Fix error where whole byte was compared for mmu support instead of only the first two bytes
- Break platform support parsing into multiple functions for clarity
- Instead of printing WARNING: messages on old hypervisors change to a debug message
--- arch/powerpc/include/asm/prom.h | 17 ++++-- arch/powerpc/kernel/prom_init.c | 120 ++++++++++++++++++++++++++++++++++++++-- arch/powerpc/mm/init_64.c | 36 ++++++++++-- 3 files changed, 157 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/prom.h +11 -6
@@ -158,12 +158,17 @@ struct of_drconf_cell {#define OV5_PFO_HW_ENCR 0x1120/* PFO Encryption Accelerator */ #define OV5_SUB_PROCESSORS 0x1501/* 1,2,or 4 Sub-Processors supported */ #define OV5_XIVE_EXPLOIT 0x1701/* XIVE exploitation supported */ -#define OV5_MMU_RADIX_300 0x1880/* ISA v3.00 radix MMU supported */ -#define OV5_MMU_HASH_300 0x1840/* ISA v3.00 hash MMU supported */ -#define OV5_MMU_SEGM_RADIX 0x1820/* radix mode (no segmentation) */ -#define OV5_MMU_PROC_TBL 0x1810/* hcall selects SLB or proc table */ -#define OV5_MMU_SLB 0x1800/* always use SLB */ -#define OV5_MMU_GTSE 0x1808/* Guest translation shootdown */ +/* MMU Base Architecture */ +#define OV5_MMU_SUPPORT 0x18C0/* MMU Mode Support Mask */ +#define OV5_MMU_HASH 0x00/* Hash MMU Only */ +#define OV5_MMU_RADIX 0x40/* Radix MMU Only */ +#define OV5_MMU_EITHER 0x80/* Hash or Radix Supported */ +#define OV5_NMMU 0x1820/* Nest MMU Available */ +/* Hash Table Extensions */ +#define OV5_HASH_SEG_TBL 0x1980/* In Memory Segment Tables Available */ +#define OV5_HASH_GTSE 0x1940/* Guest Translation Shoot Down Avail */ +/* Radix Table Extensions */ +#define OV5_RADIX_GTSE 0x1A40/* Guest Translation Shoot Down Avail */ /* Option Vector 6: IBM PAPR hints */ #define OV6_LINUX 0x02/* Linux is our OS */
arch/powerpc/kernel/prom_init.c +116 -4
157 lines not on this page · raw message
arch/powerpc/mm/init_64.c +30 -6
@@ -356,18 +356,42 @@ static void early_check_vec5(void)unsigned long root, chosen;int size;const u8 *vec5; +u8 mmu_supported; root =of_get_flat_dt_root (); chosen =of_get_flat_dt_subnode_by_name (root,"chosen" ); -if (chosen == -FDT_ERR_NOTFOUND ) +if (chosen == -FDT_ERR_NOTFOUND ) { + cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX ;return ; + } vec5 =of_get_flat_dt_prop (chosen,"ibm,architecture-vec-5" , &size); -if (!vec5) +if (!vec5) { + cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX ;return ; -if (size <=OV5_INDX (OV5_MMU_RADIX_300 ) || - !(vec5[OV5_INDX (OV5_MMU_RADIX_300 )] &OV5_FEAT (OV5_MMU_RADIX_300 ))) -/* Hypervisor doesn't support radix */ + } +if (size <=OV5_INDX (OV5_MMU_SUPPORT )) { cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX ; +return ; + } + +/* Check for supported configuration */ + mmu_supported = vec5[OV5_INDX (OV5_MMU_SUPPORT )] & +OV5_FEAT (OV5_MMU_SUPPORT ); +if (mmu_supported ==OV5_FEAT (OV5_MMU_RADIX )) { +/* Hypervisor only supports radix - check enabled && GTSE */ +if (!early_radix_enabled ()) { +pr_warn ("WARNING: Ignoring cmdline option disable_radix\n" ); + } +if (!(vec5[OV5_INDX (OV5_RADIX_GTSE )] & +OV5_FEAT (OV5_RADIX_GTSE ))) { +pr_warn ("WARNING: Hypervisor doesn't support RADIX with GTSE\n" ); + } +/* Do radix anyway - the hypervisor said we had to */ + cur_cpu_spec->mmu_features |=MMU_FTR_TYPE_RADIX ; + }else if (mmu_supported ==OV5_FEAT (OV5_MMU_HASH )) { +/* Hypervisor only supports hash - disable radix */ + cur_cpu_spec->mmu_features &= ~MMU_FTR_TYPE_RADIX ; + } }void __init mmu_early_init_devtree (void )
@@ -383,7 +407,7 @@ void __init mmu_early_init_devtree(void)* even though the ibm,architecture-vec-5 property created by * skiboot doesn't have the necessary bits set. */ -if (early_radix_enabled () && !(mfmsr () &MSR_HV )) +if (!(mfmsr () &MSR_HV ))early_check_vec5 ();if (early_radix_enabled ())
Signature · 1 line
2.5.5