* [PATCH AUTOSEL 4.14 07/10] MIPS: Restore Au1300 support
[not found] <20230531134606.3385210-1-sashal@kernel.org>
@ 2023-05-31 13:46 ` Sasha Levin
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 08/10] MIPS: Alchemy: fix dbdma2 Sasha Levin
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 09/10] mips: Move initrd_start check after initrd address sanitisation Sasha Levin
2 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2023-05-31 13:46 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Manuel Lauss, Thomas Bogendoerfer, Sasha Levin, jiaxun.yang,
linux-mips
From: Manuel Lauss <manuel.lauss@gmail.com>
[ Upstream commit f2041708dee30a3425f680265c337acd28293782 ]
The Au1300, at least the one I have to test, uses the NetLogic vendor
ID, but commit 95b8a5e0111a ("MIPS: Remove NETLOGIC support") also
dropped Au1300 detection. Restore Au1300 detection.
Tested on DB1300 with Au1380 chip.
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/kernel/cpu-probe.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index cf3fd549e16d0..f9368071a6bd9 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -1686,6 +1686,10 @@ static inline void cpu_probe_alchemy(struct cpuinfo_mips *c, unsigned int cpu)
break;
}
break;
+ case PRID_IMP_NETLOGIC_AU13XX:
+ c->cputype = CPU_ALCHEMY;
+ __cpu_name[cpu] = "Au1300";
+ break;
}
}
@@ -1988,6 +1992,7 @@ void cpu_probe(void)
cpu_probe_mips(c, cpu);
break;
case PRID_COMP_ALCHEMY:
+ case PRID_COMP_NETLOGIC:
cpu_probe_alchemy(c, cpu);
break;
case PRID_COMP_SIBYTE:
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH AUTOSEL 4.14 08/10] MIPS: Alchemy: fix dbdma2
[not found] <20230531134606.3385210-1-sashal@kernel.org>
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 07/10] MIPS: Restore Au1300 support Sasha Levin
@ 2023-05-31 13:46 ` Sasha Levin
2023-06-16 19:29 ` Pavel Machek
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 09/10] mips: Move initrd_start check after initrd address sanitisation Sasha Levin
2 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2023-05-31 13:46 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Manuel Lauss, Thomas Bogendoerfer, Sasha Levin, linux-mips
From: Manuel Lauss <manuel.lauss@gmail.com>
[ Upstream commit 2d645604f69f3a772d58ead702f9a8e84ab2b342 ]
Various fixes for the Au1200/Au1550/Au1300 DBDMA2 code:
- skip cache invalidation if chip has working coherency circuitry.
- invalidate KSEG0-portion of the (physical) data address.
- force the dma channel doorbell write out to bus immediately with
a sync.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/alchemy/common/dbdma.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/arch/mips/alchemy/common/dbdma.c b/arch/mips/alchemy/common/dbdma.c
index fc482d900dddb..122f8c0d258ef 100644
--- a/arch/mips/alchemy/common/dbdma.c
+++ b/arch/mips/alchemy/common/dbdma.c
@@ -30,6 +30,7 @@
*
*/
+#include <linux/dma-map-ops.h> /* for dma_default_coherent */
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -623,17 +624,18 @@ u32 au1xxx_dbdma_put_source(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
dp->dscr_cmd0 &= ~DSCR_CMD0_IE;
/*
- * There is an errata on the Au1200/Au1550 parts that could result
- * in "stale" data being DMA'ed. It has to do with the snoop logic on
- * the cache eviction buffer. DMA_NONCOHERENT is on by default for
- * these parts. If it is fixed in the future, these dma_cache_inv will
- * just be nothing more than empty macros. See io.h.
+ * There is an erratum on certain Au1200/Au1550 revisions that could
+ * result in "stale" data being DMA'ed. It has to do with the snoop
+ * logic on the cache eviction buffer. dma_default_coherent is set
+ * to false on these parts.
*/
- dma_cache_wback_inv((unsigned long)buf, nbytes);
+ if (!dma_default_coherent)
+ dma_cache_wback_inv(KSEG0ADDR(buf), nbytes);
dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
wmb(); /* drain writebuffer */
dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
ctp->chan_ptr->ddma_dbell = 0;
+ wmb(); /* force doorbell write out to dma engine */
/* Get next descriptor pointer. */
ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
@@ -685,17 +687,18 @@ u32 au1xxx_dbdma_put_dest(u32 chanid, dma_addr_t buf, int nbytes, u32 flags)
dp->dscr_source1, dp->dscr_dest0, dp->dscr_dest1);
#endif
/*
- * There is an errata on the Au1200/Au1550 parts that could result in
- * "stale" data being DMA'ed. It has to do with the snoop logic on the
- * cache eviction buffer. DMA_NONCOHERENT is on by default for these
- * parts. If it is fixed in the future, these dma_cache_inv will just
- * be nothing more than empty macros. See io.h.
+ * There is an erratum on certain Au1200/Au1550 revisions that could
+ * result in "stale" data being DMA'ed. It has to do with the snoop
+ * logic on the cache eviction buffer. dma_default_coherent is set
+ * to false on these parts.
*/
- dma_cache_inv((unsigned long)buf, nbytes);
+ if (!dma_default_coherent)
+ dma_cache_inv(KSEG0ADDR(buf), nbytes);
dp->dscr_cmd0 |= DSCR_CMD0_V; /* Let it rip */
wmb(); /* drain writebuffer */
dma_cache_wback_inv((unsigned long)dp, sizeof(*dp));
ctp->chan_ptr->ddma_dbell = 0;
+ wmb(); /* force doorbell write out to dma engine */
/* Get next descriptor pointer. */
ctp->put_ptr = phys_to_virt(DSCR_GET_NXTPTR(dp->dscr_nxtptr));
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH AUTOSEL 4.14 08/10] MIPS: Alchemy: fix dbdma2
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 08/10] MIPS: Alchemy: fix dbdma2 Sasha Levin
@ 2023-06-16 19:29 ` Pavel Machek
[not found] ` <CAOLZvyHQL7T33O9fSdBZMtjrLKO2uN6Gr6g_p0oKVUtnMuXheQ@mail.gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2023-06-16 19:29 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Manuel Lauss, Thomas Bogendoerfer,
linux-mips
[-- Attachment #1: Type: text/plain, Size: 749 bytes --]
Hi!
> From: Manuel Lauss <manuel.lauss@gmail.com>
>
> [ Upstream commit 2d645604f69f3a772d58ead702f9a8e84ab2b342 ]
>
> Various fixes for the Au1200/Au1550/Au1300 DBDMA2 code:
>
> - skip cache invalidation if chip has working coherency circuitry.
> - invalidate KSEG0-portion of the (physical) data address.
> - force the dma channel doorbell write out to bus immediately with
> a sync.
>
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
I believe author's signoff is missing here.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH AUTOSEL 4.14 09/10] mips: Move initrd_start check after initrd address sanitisation.
[not found] <20230531134606.3385210-1-sashal@kernel.org>
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 07/10] MIPS: Restore Au1300 support Sasha Levin
2023-05-31 13:46 ` [PATCH AUTOSEL 4.14 08/10] MIPS: Alchemy: fix dbdma2 Sasha Levin
@ 2023-05-31 13:46 ` Sasha Levin
2 siblings, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2023-05-31 13:46 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Liviu Dudau, Thomas Bogendoerfer, Sasha Levin, nathan, yury.norov,
Jason, linux-mips
From: Liviu Dudau <liviu@dudau.co.uk>
[ Upstream commit 4897a898a216058dec55e5e5902534e6e224fcdf ]
PAGE_OFFSET is technically a virtual address so when checking the value of
initrd_start against it we should make sure that it has been sanitised from
the values passed by the bootloader. Without this change, even with a bootloader
that passes correct addresses for an initrd, we are failing to load it on MT7621
boards, for example.
Signed-off-by: Liviu Dudau <liviu@dudau.co.uk>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
arch/mips/kernel/setup.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index abd7ee9e90ab0..d205d3875e2c2 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -257,10 +257,6 @@ static unsigned long __init init_initrd(void)
pr_err("initrd start must be page aligned\n");
goto disable;
}
- if (initrd_start < PAGE_OFFSET) {
- pr_err("initrd start < PAGE_OFFSET\n");
- goto disable;
- }
/*
* Sanitize initrd addresses. For example firmware
@@ -273,6 +269,11 @@ static unsigned long __init init_initrd(void)
initrd_end = (unsigned long)__va(end);
initrd_start = (unsigned long)__va(__pa(initrd_start));
+ if (initrd_start < PAGE_OFFSET) {
+ pr_err("initrd start < PAGE_OFFSET\n");
+ goto disable;
+ }
+
ROOT_DEV = Root_RAM0;
return PFN_UP(end);
disable:
--
2.39.2
^ permalink raw reply related [flat|nested] 6+ messages in thread