public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: "Paul Burton" <paulburton@kernel.org>,
	linux-mips@vger.kernel.org,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
	"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Théo Lebrun" <theo.lebrun@bootlin.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v7 03/14] MIPS: Allows relocation exception vectors everywhere
Date: Thu, 8 Feb 2024 13:11:30 +0100	[thread overview]
Message-ID: <ZcTE8nKCaKuaUvAe@alpha.franken.de> (raw)
In-Reply-To: <20240205153503.574468-4-gregory.clement@bootlin.com>

On Mon, Feb 05, 2024 at 04:34:49PM +0100, Gregory CLEMENT wrote:
> From: Jiaxun Yang <jiaxun.yang@flygoat.com>
> 
> Now the exception vector for CPS systems are allocated on-fly
> with memblock as well.
> 
> It will try to allocate from KSEG1 first, and then try to allocate
> in low 4G if possible.
> 
> The main reset vector is now generated by uasm, to avoid tons
> of patches to the code. Other vectors are copied to the location
> later.
> 
> gc: use the new macro CKSEG[0A1]DDR_OR_64BIT()
>     move 64bits fix in an other patch
>     fix cache issue with mips_cps_core_entry
>     rewrite the patch to reduce the diff stat
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
> ---
>  arch/mips/include/asm/mips-cm.h |   1 +
>  arch/mips/include/asm/smp-cps.h |   4 +-
>  arch/mips/kernel/cps-vec.S      |  48 ++-------
>  arch/mips/kernel/smp-cps.c      | 171 +++++++++++++++++++++++++++-----
>  4 files changed, 157 insertions(+), 67 deletions(-)
> [..]
> diff --git a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
> index dd55d59b88db3..f4cdd50177e0b 100644
> --- a/arch/mips/kernel/smp-cps.c
> +++ b/arch/mips/kernel/smp-cps.c
> @@ -7,6 +7,7 @@
>  #include <linux/cpu.h>
>  #include <linux/delay.h>
>  #include <linux/io.h>
> +#include <linux/memblock.h>
>  #include <linux/sched/task_stack.h>
>  #include <linux/sched/hotplug.h>
>  #include <linux/slab.h>
> @@ -25,7 +26,34 @@
>  #include <asm/time.h>
>  #include <asm/uasm.h>
>  
> +#define BEV_VEC_SIZE	0x500
> +#define BEV_VEC_ALIGN	0x1000
> +
> +#define A0		4
> +#define A1		5
> +#define T9		25
> +#define K0		26
> +#define K1		27
> +
> +#define C0_STATUS	12, 0
> +#define C0_CAUSE	13, 0
> +
> +#define ST0_NMI_BIT	19
> +#ifdef CONFIG_64BIT
> +#define ST0_KX_IF_64	ST0_KX
> +#else
> +#define ST0_KX_IF_64	0
> +#endif

please move this together with the other defines in arch/mips/kvm/entry.c
to a header file (arch/mips/include/asm/uasm.h sounds like a good fit).

> +static void __init setup_cps_vecs(void)
> +{
> +	extern void excep_tlbfill(void);
> +	extern void excep_xtlbfill(void);
> +	extern void excep_cache(void);
> +	extern void excep_genex(void);
> +	extern void excep_intex(void);
> +	extern void excep_ejtag(void);

I know this used a lot in arch/mips, but don't add another one and
put this to a header file. IMHO checkpatch should have warned you about
that.

> +	/* We want to ensure cache is clean before writing uncached mem */
> +	blast_dcache_range(CKSEG0ADDR_OR_64BIT(cps_vec_pa), CKSEG0ADDR_OR_64BIT(cps_vec_pa) + BEV_VEC_SIZE);
> +	bc_wback_inv(CKSEG0ADDR_OR_64BIT(cps_vec_pa), BEV_VEC_SIZE);
> +	__sync();

how about doint the generation with cached memory and flush caches
after that ?

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

  reply	other threads:[~2024-02-08 12:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 15:34 [PATCH v7 00/14] Add support for the Mobileye EyeQ5 SoC Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 01/14] MIPS: spaces: Define a couple of handy macros Gregory CLEMENT
2024-02-08 12:14   ` Thomas Bogendoerfer
2024-02-14 16:44     ` Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 02/14] MIPS: Fix set_uncached_handler for ebase in XKPHYS Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 03/14] MIPS: Allows relocation exception vectors everywhere Gregory CLEMENT
2024-02-08 12:11   ` Thomas Bogendoerfer [this message]
2024-02-14 16:48     ` Gregory CLEMENT
2024-02-14 19:14       ` Thomas Bogendoerfer
2024-02-05 15:34 ` [PATCH v7 04/14] MIPS: traps: Give more explanations if ebase doesn't belong to KSEG0 Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 05/14] MIPS: cps-vec: Use macros for 64bits access Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 06/14] dt-bindings: Add vendor prefix for Mobileye Vision Technologies Ltd Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 07/14] dt-bindings: mips: cpus: Sort the entries Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 08/14] dt-bindings: mips: cpu: Add I-Class I6500 Multiprocessor Core Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 09/14] dt-bindings: mips: Add bindings for Mobileye SoCs Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 10/14] MIPS: mobileye: Add EyeQ5 dtsi Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 11/14] MIPS: mobileye: Add EPM5 device tree Gregory CLEMENT
2024-02-05 15:34 ` [PATCH v7 12/14] MIPS: Share generic kernel code with other architecture Gregory CLEMENT
2024-02-08  9:38   ` Jiaxun Yang
2024-02-05 15:34 ` [PATCH v7 13/14] MIPS: Add support for Mobileye EyeQ5 Gregory CLEMENT
2024-02-08  9:38   ` Jiaxun Yang
2024-02-05 15:35 ` [PATCH v7 14/14] MAINTAINERS: Add entry for Mobileye MIPS SoCs Gregory CLEMENT
2024-02-08 12:18 ` [PATCH v7 00/14] Add support for the Mobileye EyeQ5 SoC Thomas Bogendoerfer

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=ZcTE8nKCaKuaUvAe@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=paulburton@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tawfik.bayouk@mobileye.com \
    --cc=theo.lebrun@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.kondratiev@mobileye.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox