* [PATCH v2] powerpc/powernv: Initialise nest mmu
@ 2016-12-05 1:59 Michael Ellerman
2016-12-05 6:32 ` Balbir Singh
2016-12-05 7:23 ` Aneesh Kumar K.V
0 siblings, 2 replies; 11+ messages in thread
From: Michael Ellerman @ 2016-12-05 1:59 UTC (permalink / raw)
To: linuxppc-dev; +Cc: alistair
From: Alistair Popple <alistair@popple.id.au>
POWER9 contains an off core mmu called the nest mmu (NMMU). This is used
by other hardware units on the chip to translate virtual addresses into
real addresses. The unit attempting an address translation provides the
majority of the context required for the translation request except for
the base address of the partition table (ie. the PTCR) which needs to be
programmed into the NMMU.
This patch adds a call to OPAL to set the PTCR for the nest mmu in
opal_init().
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/include/asm/opal-api.h | 3 ++-
arch/powerpc/include/asm/opal.h | 7 +++++++
arch/powerpc/mm/pgtable-radix.c | 2 ++
arch/powerpc/mm/pgtable_64.c | 7 +++++--
arch/powerpc/platforms/powernv/opal-wrappers.S | 1 +
arch/powerpc/platforms/powernv/opal.c | 11 +++++++++++
6 files changed, 28 insertions(+), 3 deletions(-)
v2: Rebased onto powerpc#next.
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index 0e2e57bcab50..a0aa285869b5 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -167,7 +167,8 @@
#define OPAL_INT_EOI 124
#define OPAL_INT_SET_MFRR 125
#define OPAL_PCI_TCE_KILL 126
-#define OPAL_LAST 126
+#define OPAL_NMMU_SET_PTCR 127
+#define OPAL_LAST 127
/* Device tree flags */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 5c7db0f1a708..a3f9578614db 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -232,6 +232,7 @@ int64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
int64_t opal_rm_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
uint32_t pe_num, uint32_t tce_size,
uint64_t dma_addr, uint32_t npages);
+int64_t opal_nmmu_set_ptcr(uint64_t chip_id, uint64_t ptcr);
/* Internal functions */
extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
@@ -310,6 +311,12 @@ static inline int opal_get_async_rc(struct opal_msg msg)
void opal_wake_poller(void);
+#ifdef CONFIG_PPC_POWERNV
+extern void powernv_set_ptcr(unsigned long ptcr);
+#else
+static inline void powernv_set_ptcr(unsigned long ptcr) { }
+#endif
+
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_OPAL_H */
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 623a0dc9a9fa..8af5ece4d0b3 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -12,6 +12,7 @@
#include <linux/memblock.h>
#include <linux/of_fdt.h>
+#include <asm/opal.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/dma.h>
@@ -434,6 +435,7 @@ void radix__mmu_cleanup_all(void)
lpcr = mfspr(SPRN_LPCR);
mtspr(SPRN_LPCR, lpcr & ~LPCR_UPRT);
mtspr(SPRN_PTCR, 0);
+ powernv_set_ptcr(0);
radix__flush_tlb_all();
}
}
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 8bca7f58afc4..461c902efbb7 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -44,6 +44,7 @@
#include <asm/mmu_context.h>
#include <asm/pgtable.h>
#include <asm/mmu.h>
+#include <asm/opal.h>
#include <asm/smp.h>
#include <asm/machdep.h>
#include <asm/tlb.h>
@@ -435,7 +436,7 @@ void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
#ifdef CONFIG_PPC_BOOK3S_64
void __init mmu_partition_table_init(void)
{
- unsigned long patb_size = 1UL << PATB_SIZE_SHIFT;
+ unsigned long ptcr, patb_size = 1UL << PATB_SIZE_SHIFT;
BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 36), "Partition table size too large.");
partition_tb = __va(memblock_alloc_base(patb_size, patb_size,
@@ -448,7 +449,9 @@ void __init mmu_partition_table_init(void)
* update partition table control register,
* 64 K size.
*/
- mtspr(SPRN_PTCR, __pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
+ ptcr = __pa(partition_tb) | (PATB_SIZE_SHIFT - 12);
+ mtspr(SPRN_PTCR, ptcr);
+ powernv_set_ptcr(ptcr);
}
void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 3aa40f1b20f5..f7c19c9c57ed 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -311,4 +311,5 @@ OPAL_CALL_REAL(opal_rm_int_eoi, OPAL_INT_EOI);
OPAL_CALL(opal_int_set_mfrr, OPAL_INT_SET_MFRR);
OPAL_CALL_REAL(opal_rm_int_set_mfrr, OPAL_INT_SET_MFRR);
OPAL_CALL(opal_pci_tce_kill, OPAL_PCI_TCE_KILL);
+OPAL_CALL(opal_nmmu_set_ptcr, OPAL_NMMU_SET_PTCR);
OPAL_CALL_REAL(opal_rm_pci_tce_kill, OPAL_PCI_TCE_KILL);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 282293572dc8..efc20e93cd36 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -875,6 +875,17 @@ int opal_error_code(int rc)
}
}
+void powernv_set_ptcr(unsigned long ptcr)
+{
+ int rc;
+
+ if (firmware_has_feature(FW_FEATURE_OPAL)) {
+ rc = opal_nmmu_set_ptcr(-1UL, ptcr);
+ if (rc != OPAL_SUCCESS || rc != OPAL_UNSUPPORTED)
+ pr_warn("%s: Unable to set nest mmu ptcr\n", __func__);
+ }
+}
+
EXPORT_SYMBOL_GPL(opal_poll_events);
EXPORT_SYMBOL_GPL(opal_rtc_read);
EXPORT_SYMBOL_GPL(opal_rtc_write);
--
2.7.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-05 1:59 [PATCH v2] powerpc/powernv: Initialise nest mmu Michael Ellerman
@ 2016-12-05 6:32 ` Balbir Singh
2016-12-05 7:23 ` Aneesh Kumar K.V
1 sibling, 0 replies; 11+ messages in thread
From: Balbir Singh @ 2016-12-05 6:32 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: alistair
On 05/12/16 12:59, Michael Ellerman wrote:
> From: Alistair Popple <alistair@popple.id.au>
>
> POWER9 contains an off core mmu called the nest mmu (NMMU). This is used
> by other hardware units on the chip to translate virtual addresses into
> real addresses. The unit attempting an address translation provides the
> majority of the context required for the translation request except for
> the base address of the partition table (ie. the PTCR) which needs to be
> programmed into the NMMU.
>
> This patch adds a call to OPAL to set the PTCR for the nest mmu in
> opal_init().
>
> Signed-off-by: Alistair Popple <alistair@popple.id.au>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-05 1:59 [PATCH v2] powerpc/powernv: Initialise nest mmu Michael Ellerman
2016-12-05 6:32 ` Balbir Singh
@ 2016-12-05 7:23 ` Aneesh Kumar K.V
1 sibling, 0 replies; 11+ messages in thread
From: Aneesh Kumar K.V @ 2016-12-05 7:23 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev; +Cc: alistair
Michael Ellerman <mpe@ellerman.id.au> writes:
> From: Alistair Popple <alistair@popple.id.au>
>
> POWER9 contains an off core mmu called the nest mmu (NMMU). This is used
> by other hardware units on the chip to translate virtual addresses into
> real addresses. The unit attempting an address translation provides the
> majority of the context required for the translation request except for
> the base address of the partition table (ie. the PTCR) which needs to be
> programmed into the NMMU.
>
> This patch adds a call to OPAL to set the PTCR for the nest mmu in
> opal_init().
>
> Signed-off-by: Alistair Popple <alistair@popple.id.au>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
> arch/powerpc/include/asm/opal-api.h | 3 ++-
> arch/powerpc/include/asm/opal.h | 7 +++++++
> arch/powerpc/mm/pgtable-radix.c | 2 ++
> arch/powerpc/mm/pgtable_64.c | 7 +++++--
> arch/powerpc/platforms/powernv/opal-wrappers.S | 1 +
> arch/powerpc/platforms/powernv/opal.c | 11 +++++++++++
> 6 files changed, 28 insertions(+), 3 deletions(-)
>
> v2: Rebased onto powerpc#next.
>
> diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
> index 0e2e57bcab50..a0aa285869b5 100644
> --- a/arch/powerpc/include/asm/opal-api.h
> +++ b/arch/powerpc/include/asm/opal-api.h
> @@ -167,7 +167,8 @@
> #define OPAL_INT_EOI 124
> #define OPAL_INT_SET_MFRR 125
> #define OPAL_PCI_TCE_KILL 126
> -#define OPAL_LAST 126
> +#define OPAL_NMMU_SET_PTCR 127
> +#define OPAL_LAST 127
>
> /* Device tree flags */
>
> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index 5c7db0f1a708..a3f9578614db 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -232,6 +232,7 @@ int64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
> int64_t opal_rm_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
> uint32_t pe_num, uint32_t tce_size,
> uint64_t dma_addr, uint32_t npages);
> +int64_t opal_nmmu_set_ptcr(uint64_t chip_id, uint64_t ptcr);
>
> /* Internal functions */
> extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
> @@ -310,6 +311,12 @@ static inline int opal_get_async_rc(struct opal_msg msg)
>
> void opal_wake_poller(void);
>
> +#ifdef CONFIG_PPC_POWERNV
> +extern void powernv_set_ptcr(unsigned long ptcr);
> +#else
> +static inline void powernv_set_ptcr(unsigned long ptcr) { }
> +#endif
> +
> #endif /* __ASSEMBLY__ */
>
> #endif /* _ASM_POWERPC_OPAL_H */
> diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
> index 623a0dc9a9fa..8af5ece4d0b3 100644
> --- a/arch/powerpc/mm/pgtable-radix.c
> +++ b/arch/powerpc/mm/pgtable-radix.c
> @@ -12,6 +12,7 @@
> #include <linux/memblock.h>
> #include <linux/of_fdt.h>
>
> +#include <asm/opal.h>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> #include <asm/dma.h>
> @@ -434,6 +435,7 @@ void radix__mmu_cleanup_all(void)
> lpcr = mfspr(SPRN_LPCR);
> mtspr(SPRN_LPCR, lpcr & ~LPCR_UPRT);
> mtspr(SPRN_PTCR, 0);
> + powernv_set_ptcr(0);
> radix__flush_tlb_all();
> }
That is confusing, we do set ptcr before that powernv_set_prtc(). So we
now have
mtspr(SPRN_PTCR, 0);
powernv_set_ptcr(0);
May be rename powernv_set_ptrc() to powernv_set_nmmu_ptcr() ?
> }
> diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
> index 8bca7f58afc4..461c902efbb7 100644
> --- a/arch/powerpc/mm/pgtable_64.c
> +++ b/arch/powerpc/mm/pgtable_64.c
> @@ -44,6 +44,7 @@
> #include <asm/mmu_context.h>
> #include <asm/pgtable.h>
> #include <asm/mmu.h>
> +#include <asm/opal.h>
> #include <asm/smp.h>
> #include <asm/machdep.h>
> #include <asm/tlb.h>
> @@ -435,7 +436,7 @@ void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
> #ifdef CONFIG_PPC_BOOK3S_64
> void __init mmu_partition_table_init(void)
> {
> - unsigned long patb_size = 1UL << PATB_SIZE_SHIFT;
> + unsigned long ptcr, patb_size = 1UL << PATB_SIZE_SHIFT;
>
> BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 36), "Partition table size too large.");
> partition_tb = __va(memblock_alloc_base(patb_size, patb_size,
> @@ -448,7 +449,9 @@ void __init mmu_partition_table_init(void)
> * update partition table control register,
> * 64 K size.
> */
> - mtspr(SPRN_PTCR, __pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
> + ptcr = __pa(partition_tb) | (PATB_SIZE_SHIFT - 12);
> + mtspr(SPRN_PTCR, ptcr);
> + powernv_set_ptcr(ptcr);
> }
>
> void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
> diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
> index 3aa40f1b20f5..f7c19c9c57ed 100644
> --- a/arch/powerpc/platforms/powernv/opal-wrappers.S
> +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
> @@ -311,4 +311,5 @@ OPAL_CALL_REAL(opal_rm_int_eoi, OPAL_INT_EOI);
> OPAL_CALL(opal_int_set_mfrr, OPAL_INT_SET_MFRR);
> OPAL_CALL_REAL(opal_rm_int_set_mfrr, OPAL_INT_SET_MFRR);
> OPAL_CALL(opal_pci_tce_kill, OPAL_PCI_TCE_KILL);
> +OPAL_CALL(opal_nmmu_set_ptcr, OPAL_NMMU_SET_PTCR);
> OPAL_CALL_REAL(opal_rm_pci_tce_kill, OPAL_PCI_TCE_KILL);
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 282293572dc8..efc20e93cd36 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -875,6 +875,17 @@ int opal_error_code(int rc)
> }
> }
>
> +void powernv_set_ptcr(unsigned long ptcr)
> +{
> + int rc;
> +
> + if (firmware_has_feature(FW_FEATURE_OPAL)) {
> + rc = opal_nmmu_set_ptcr(-1UL, ptcr);
> + if (rc != OPAL_SUCCESS || rc != OPAL_UNSUPPORTED)
> + pr_warn("%s: Unable to set nest mmu ptcr\n", __func__);
> + }
> +}
> +
> EXPORT_SYMBOL_GPL(opal_poll_events);
> EXPORT_SYMBOL_GPL(opal_rtc_read);
> EXPORT_SYMBOL_GPL(opal_rtc_write);
> --
> 2.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] powerpc/powernv: Initialise nest mmu
@ 2016-12-02 5:29 Alistair Popple
2016-12-02 9:24 ` Michael Ellerman
2016-12-02 11:04 ` Balbir Singh
0 siblings, 2 replies; 11+ messages in thread
From: Alistair Popple @ 2016-12-02 5:29 UTC (permalink / raw)
To: mpe; +Cc: linuxppc-dev, bsingharora, Alistair Popple
POWER9 contains an off core mmu called the nest mmu (NMMU). This is
used by other hardware units on the chip to translate virtual
addresses into real addresses. The unit attempting an address
translation provides the majority of the context required for the
translation request except for the base address of the partition table
(ie. the PTCR) which needs to be programmed into the NMMU.
This patch adds a call to OPAL to set the PTCR for the nest mmu in
opal_init().
Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
arch/powerpc/include/asm/opal-api.h | 3 ++-
arch/powerpc/include/asm/opal.h | 1 +
arch/powerpc/mm/pgtable-radix.c | 8 ++++++--
arch/powerpc/platforms/powernv/opal-wrappers.S | 1 +
arch/powerpc/platforms/powernv/opal.c | 11 +++++++++++
arch/powerpc/platforms/powernv/powernv.h | 6 ++++++
6 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h
index 0e2e57b..a0aa285 100644
--- a/arch/powerpc/include/asm/opal-api.h
+++ b/arch/powerpc/include/asm/opal-api.h
@@ -167,7 +167,8 @@
#define OPAL_INT_EOI 124
#define OPAL_INT_SET_MFRR 125
#define OPAL_PCI_TCE_KILL 126
-#define OPAL_LAST 126
+#define OPAL_NMMU_SET_PTCR 127
+#define OPAL_LAST 127
/* Device tree flags */
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index e958b70..b61c3d3 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -229,6 +229,7 @@ int64_t opal_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
int64_t opal_rm_pci_tce_kill(uint64_t phb_id, uint32_t kill_type,
uint32_t pe_num, uint32_t tce_size,
uint64_t dma_addr, uint32_t npages);
+int64_t opal_nmmu_set_ptcr(uint64_t chip_id, uint64_t ptcr);
/* Internal functions */
extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 688b545..b9ae2a1 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -18,6 +18,7 @@
#include <asm/machdep.h>
#include <asm/mmu.h>
#include <asm/firmware.h>
+#include <platforms/powernv/powernv.h>
#include <trace/events/thp.h>
@@ -177,7 +178,7 @@ static void __init radix_init_pgtable(void)
static void __init radix_init_partition_table(void)
{
- unsigned long rts_field;
+ unsigned long rts_field, ptcr;
rts_field = radix__get_tree_size();
@@ -193,7 +194,9 @@ static void __init radix_init_partition_table(void)
* update partition table control register,
* 64 K size.
*/
- mtspr(SPRN_PTCR, __pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
+ ptcr = __pa(partition_tb) | (PATB_SIZE_SHIFT - 12);
+ mtspr(SPRN_PTCR, ptcr);
+ powernv_set_ptcr(ptcr);
}
void __init radix_init_native(void)
@@ -408,6 +411,7 @@ void radix__mmu_cleanup_all(void)
lpcr = mfspr(SPRN_LPCR);
mtspr(SPRN_LPCR, lpcr & ~LPCR_UPRT);
mtspr(SPRN_PTCR, 0);
+ powernv_set_ptcr(0);
radix__flush_tlb_all();
}
}
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 44d2d84..894639b 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -308,4 +308,5 @@ OPAL_CALL(opal_int_set_cppr, OPAL_INT_SET_CPPR);
OPAL_CALL(opal_int_eoi, OPAL_INT_EOI);
OPAL_CALL(opal_int_set_mfrr, OPAL_INT_SET_MFRR);
OPAL_CALL(opal_pci_tce_kill, OPAL_PCI_TCE_KILL);
+OPAL_CALL(opal_nmmu_set_ptcr, OPAL_NMMU_SET_PTCR);
OPAL_CALL_REAL(opal_rm_pci_tce_kill, OPAL_PCI_TCE_KILL);
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 6c9a65b..054e774 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -885,6 +885,17 @@ int opal_error_code(int rc)
}
}
+void powernv_set_ptcr(unsigned long ptcr)
+{
+ int rc;
+
+ if (firmware_has_feature(FW_FEATURE_OPAL)) {
+ rc = opal_nmmu_set_ptcr(-1UL, ptcr);
+ if (rc != OPAL_SUCCESS || rc != OPAL_UNSUPPORTED)
+ pr_warn("%s: Unable to set nest mmu ptcr\n", __func__);
+ }
+}
+
EXPORT_SYMBOL_GPL(opal_poll_events);
EXPORT_SYMBOL_GPL(opal_rtc_read);
EXPORT_SYMBOL_GPL(opal_rtc_write);
diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
index da7c843..6fa9551 100644
--- a/arch/powerpc/platforms/powernv/powernv.h
+++ b/arch/powerpc/platforms/powernv/powernv.h
@@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
struct pci_dev;
+#ifdef CONFIG_PPC_POWERNV
+extern void powernv_set_ptcr(unsigned long ptcr);
+#else
+static inline void powernv_set_ptcr(unisigned long ptcr) { }
+#endif
+
#ifdef CONFIG_PCI
extern void pnv_pci_init(void);
extern void pnv_pci_shutdown(void);
--
2.1.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-02 5:29 Alistair Popple
@ 2016-12-02 9:24 ` Michael Ellerman
2016-12-03 0:08 ` Alistair Popple
2016-12-03 1:33 ` Tyrel Datwyler
2016-12-02 11:04 ` Balbir Singh
1 sibling, 2 replies; 11+ messages in thread
From: Michael Ellerman @ 2016-12-02 9:24 UTC (permalink / raw)
To: Alistair Popple; +Cc: linuxppc-dev, bsingharora, Alistair Popple
Alistair Popple <alistair@popple.id.au> writes:
> diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
> index da7c843..6fa9551 100644
> --- a/arch/powerpc/platforms/powernv/powernv.h
> +++ b/arch/powerpc/platforms/powernv/powernv.h
> @@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
>
> struct pci_dev;
>
> +#ifdef CONFIG_PPC_POWERNV
> +extern void powernv_set_ptcr(unsigned long ptcr);
> +#else
> +static inline void powernv_set_ptcr(unisigned long ptcr) { }
^
Your shout next time we're at the pub ;)
cheers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-02 9:24 ` Michael Ellerman
@ 2016-12-03 0:08 ` Alistair Popple
2016-12-03 1:33 ` Tyrel Datwyler
1 sibling, 0 replies; 11+ messages in thread
From: Alistair Popple @ 2016-12-03 0:08 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, bsingharora
On Fri, 2 Dec 2016 08:24:09 PM Michael Ellerman wrote:
> Alistair Popple <alistair@popple.id.au> writes:
>
> > diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
> > index da7c843..6fa9551 100644
> > --- a/arch/powerpc/platforms/powernv/powernv.h
> > +++ b/arch/powerpc/platforms/powernv/powernv.h
> > @@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
> >
> > struct pci_dev;
> >
> > +#ifdef CONFIG_PPC_POWERNV
> > +extern void powernv_set_ptcr(unsigned long ptcr);
> > +#else
> > +static inline void powernv_set_ptcr(unisigned long ptcr) { }
> ^
> Your shout next time we're at the pub ;)
Whoops. Guess I was too keen to get there myself. Thanks for picking that up!
> cheers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-02 9:24 ` Michael Ellerman
2016-12-03 0:08 ` Alistair Popple
@ 2016-12-03 1:33 ` Tyrel Datwyler
1 sibling, 0 replies; 11+ messages in thread
From: Tyrel Datwyler @ 2016-12-03 1:33 UTC (permalink / raw)
To: linuxppc-dev
On 12/02/2016 01:24 AM, Michael Ellerman wrote:
> Alistair Popple <alistair@popple.id.au> writes:
>
>> diff --git a/arch/powerpc/platforms/powernv/powernv.h b/arch/powerpc/platforms/powernv/powernv.h
>> index da7c843..6fa9551 100644
>> --- a/arch/powerpc/platforms/powernv/powernv.h
>> +++ b/arch/powerpc/platforms/powernv/powernv.h
>> @@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
>>
>> struct pci_dev;
>>
>> +#ifdef CONFIG_PPC_POWERNV
>> +extern void powernv_set_ptcr(unsigned long ptcr);
>> +#else
>> +static inline void powernv_set_ptcr(unisigned long ptcr) { }
> ^
> Your shout next time we're at the pub ;)
>
> cheers
>
Ah, the elusive unicorn of signed longs!
-Tyrel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-02 5:29 Alistair Popple
2016-12-02 9:24 ` Michael Ellerman
@ 2016-12-02 11:04 ` Balbir Singh
2016-12-03 10:56 ` Michael Ellerman
1 sibling, 1 reply; 11+ messages in thread
From: Balbir Singh @ 2016-12-02 11:04 UTC (permalink / raw)
To: Alistair Popple; +Cc: Michael Ellerman, linuxppc-dev
<snip>
> static void __init radix_init_partition_table(void)
> {
> - unsigned long rts_field;
> + unsigned long rts_field, ptcr;
I think these functions have changed, check for conflicts against
http://git.kernel.org/cgit/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id=9d66195807ac6cb8a14231fd055ff755977c5fca
>
> rts_field = radix__get_tree_size();
>
> @@ -193,7 +194,9 @@ static void __init radix_init_partition_table(void)
> * update partition table control register,
> * 64 K size.
> */
<snip>
>
> +#ifdef CONFIG_PPC_POWERNV
> +extern void powernv_set_ptcr(unsigned long ptcr);
> +#else
> +static inline void powernv_set_ptcr(unisigned long ptcr) { }
Michael caught you for this already
Balbir
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-02 11:04 ` Balbir Singh
@ 2016-12-03 10:56 ` Michael Ellerman
2016-12-03 11:40 ` Michael Ellerman
0 siblings, 1 reply; 11+ messages in thread
From: Michael Ellerman @ 2016-12-03 10:56 UTC (permalink / raw)
To: Balbir Singh, Alistair Popple; +Cc: linuxppc-dev
Balbir Singh <bsingharora@gmail.com> writes:
> <snip>
>
>> static void __init radix_init_partition_table(void)
>> {
>> - unsigned long rts_field;
>> + unsigned long rts_field, ptcr;
>
> I think these functions have changed, check for conflicts against
> http://git.kernel.org/cgit/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id=9d66195807ac6cb8a14231fd055ff755977c5fca
They did, I ended up with:
https://github.com/linuxppc/linux/commit/fb7314c5d6b00dbaaac14c28a52a87dee7e726df
modified arch/powerpc/mm/pgtable_64.c
@@ -44,6 +44,7 @@
#include <asm/mmu_context.h>
#include <asm/pgtable.h>
#include <asm/mmu.h>
+#include <asm/opal.h>
#include <asm/smp.h>
#include <asm/machdep.h>
#include <asm/tlb.h>
@@ -435,7 +436,7 @@ void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift)
#ifdef CONFIG_PPC_BOOK3S_64
void __init mmu_partition_table_init(void)
{
- unsigned long patb_size = 1UL << PATB_SIZE_SHIFT;
+ unsigned long ptcr, patb_size = 1UL << PATB_SIZE_SHIFT;
BUILD_BUG_ON_MSG((PATB_SIZE_SHIFT > 36), "Partition table size too large.");
partition_tb = __va(memblock_alloc_base(patb_size, patb_size,
@@ -448,7 +449,9 @@ void __init mmu_partition_table_init(void)
* update partition table control register,
* 64 K size.
*/
- mtspr(SPRN_PTCR, __pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
+ ptcr = __pa(partition_tb) | (PATB_SIZE_SHIFT - 12);
+ mtspr(SPRN_PTCR, ptcr);
+ powernv_set_ptcr(ptcr);
}
void mmu_partition_table_set_entry(unsigned int lpid, unsigned long dw0,
cheers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-03 10:56 ` Michael Ellerman
@ 2016-12-03 11:40 ` Michael Ellerman
2016-12-05 0:02 ` Alistair Popple
0 siblings, 1 reply; 11+ messages in thread
From: Michael Ellerman @ 2016-12-03 11:40 UTC (permalink / raw)
To: Balbir Singh, Alistair Popple; +Cc: linuxppc-dev
Michael Ellerman <mpe@ellerman.id.au> writes:
> Balbir Singh <bsingharora@gmail.com> writes:
>
>> <snip>
>>
>>> static void __init radix_init_partition_table(void)
>>> {
>>> - unsigned long rts_field;
>>> + unsigned long rts_field, ptcr;
>>
>> I think these functions have changed, check for conflicts against
>> http://git.kernel.org/cgit/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id=9d66195807ac6cb8a14231fd055ff755977c5fca
>
> They did, I ended up with:
>
> https://github.com/linuxppc/linux/commit/fb7314c5d6b00dbaaac14c28a52a87dee7e726df
It's not happy on mambo:
WARNING: 20856759: (20856757): Invalid address 0x0000000028096258 in XSCOM range, SCOM=0x00280962b
WARNING: 20856759: (20856757): Attempt to store non-existent address 0x00001A0028096258
20856759: (20856757): 0x000000003002DA08 : stdcix r26,r0,r3
FATAL ERROR: 20856759: (20856757): Check Stop for 0:0: Machine Check with ME bit of MSR off
Which looks to be one of the xscom_write()'s from opal_nmmu_set_ptcr().
Do I need a newer mambo?
cheers
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] powerpc/powernv: Initialise nest mmu
2016-12-03 11:40 ` Michael Ellerman
@ 2016-12-05 0:02 ` Alistair Popple
0 siblings, 0 replies; 11+ messages in thread
From: Alistair Popple @ 2016-12-05 0:02 UTC (permalink / raw)
To: Michael Ellerman; +Cc: Balbir Singh, linuxppc-dev
Hi,
On Sat, 3 Dec 2016 10:40:58 PM Michael Ellerman wrote:
> Michael Ellerman <mpe@ellerman.id.au> writes:
>
> > Balbir Singh <bsingharora@gmail.com> writes:
> >
> >> <snip>
> >>
> >>> static void __init radix_init_partition_table(void)
> >>> {
> >>> - unsigned long rts_field;
> >>> + unsigned long rts_field, ptcr;
> >>
> >> I think these functions have changed, check for conflicts against
> >> http://git.kernel.org/cgit/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next&id=9d66195807ac6cb8a14231fd055ff755977c5fca
> >
> > They did, I ended up with:
> >
> > https://github.com/linuxppc/linux/commit/fb7314c5d6b00dbaaac14c28a52a87dee7e726df
>
> It's not happy on mambo:
>
> WARNING: 20856759: (20856757): Invalid address 0x0000000028096258 in XSCOM range, SCOM=0x00280962b
> WARNING: 20856759: (20856757): Attempt to store non-existent address 0x00001A0028096258
> 20856759: (20856757): 0x000000003002DA08 : stdcix r26,r0,r3
> FATAL ERROR: 20856759: (20856757): Check Stop for 0:0: Machine Check with ME bit of MSR off
>
> Which looks to be one of the xscom_write()'s from opal_nmmu_set_ptcr().
Weird. Do you happen to know which one? It should only be touching the NMMU
PTCR register which is defined as 0x5012c4b.
> Do I need a newer mambo?
I'm not sure to be honest. I do all of my testing under Simics which uses Mambo
internally but provides some additional models. Perhaps Mambo is missing a
required model? Will see if I can recreate it under Simics with that branch.
- Alistair
> cheers
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-12-05 7:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-05 1:59 [PATCH v2] powerpc/powernv: Initialise nest mmu Michael Ellerman
2016-12-05 6:32 ` Balbir Singh
2016-12-05 7:23 ` Aneesh Kumar K.V
-- strict thread matches above, loose matches on Subject: below --
2016-12-02 5:29 Alistair Popple
2016-12-02 9:24 ` Michael Ellerman
2016-12-03 0:08 ` Alistair Popple
2016-12-03 1:33 ` Tyrel Datwyler
2016-12-02 11:04 ` Balbir Singh
2016-12-03 10:56 ` Michael Ellerman
2016-12-03 11:40 ` Michael Ellerman
2016-12-05 0:02 ` Alistair Popple
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).