Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp238721rdb; Thu, 8 Feb 2024 04:50:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUxUS/Hfxgz/LubXhtBaP4MFDGMf0Wmd7vPZCKyH/CPTuqGR6Mf+N+DZQ+7hr/z5KygJNkDPN8EZt+URF7FAZZEfkf+onBo4d7opPG+jw== X-Google-Smtp-Source: AGHT+IHX/LHJdZxdBLF+YiXJuf8+uqxqklYAWvamdLfQ8LcyxqdfB9NLuXTUEx6Eq4pd22N6tvOW X-Received: by 2002:a37:de0e:0:b0:785:9f20:e7e7 with SMTP id h14-20020a37de0e000000b007859f20e7e7mr2975330qkj.33.1707396650128; Thu, 08 Feb 2024 04:50:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707396650; cv=pass; d=google.com; s=arc-20160816; b=desUj9J5qZXgGkSSXfLMEiYfKCvv6wUXm2IGXXJIwDq87VWGTbMmsu+vAT4fYU7Ngv ky82KXijwM8p6SckYwNwKQECxGqfbZUnEh9dFKboceX1BHB3QMjOk2CN7VdcnO0S+wzA GT8UAmSAPT8kMDl/g++CrZG1UbsSTRaFrh1PnckqNWMnlLLlN+ILqjQN7krmcU0R9hZK xDnTTX6YkhyxHdfEN19hFPNpsVn8ME4A702u9d28HDCzpckj9SZUksgb0IWvOdP5qCv2 Gft1DZVVg3UJVcKR54AY0jAc3oAmCWrAFIvTfNT0wp9GHJT8BZixYY3s7hEk/v7MAZ7W 6h1A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=r1Ntcs6TArSEByGrfYBv42mtvLCGWYdIiz0cdfgr9+g=; fh=7fqIko3R3nO5GAFJefD7ygHKdJhmHHGEjaR4L9ZLbdE=; b=VovO+fTBCyT/tnVhHWQVP3pD6ksh7S8bzFa5aDDUWH7wuuDTsxSS7lPk4X35JaCzcW ZfFOhPHCLBcx7zfHTyUUhwS2z3Ebtjs3aIoMcOex6ygB1SvklslnAffp/rhoOJVvkbMO iD+ZE92ROoHcFhgJpC8shPQXpqTD+t6dmOW8CjpAEZoJFj6ZZl5Kk6cMKb81xcRS23c8 AbaTNMogYNGUtGA69Tx45rvraoSH/6VmoGY2ZmBrkzOZzGcUnqxWeqt5jewpyo/SMx4R cHocCgwyl45PK+5WOuozqpnv+1wfLERJKf91toM8wuivEtzFEc5sQRCMNqk1ZuAMXiMy tCFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=alpha.franken.de); spf=pass (google.com: domain of linux-kernel+bounces-58091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58091-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCXl6DPow36YS6vv1DKRcrHT6nPIhJzOSyqPfOf6MwggzcxDZlWVAtd6UQWCgxmHo33VY03tTwZ2RDE5ZFxlZnKPItKsggdHsRjR96X1Uw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y12-20020a37e30c000000b00783f7a6219dsi3060065qki.216.2024.02.08.04.50.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 04:50:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=alpha.franken.de); spf=pass (google.com: domain of linux-kernel+bounces-58091-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58091-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 67B111C2611C for ; Thu, 8 Feb 2024 12:50:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 33F182EB1A; Thu, 8 Feb 2024 12:49:57 +0000 (UTC) Received: from elvis.franken.de (elvis.franken.de [193.175.24.41]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2736F763E4; Thu, 8 Feb 2024 12:49:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.175.24.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707396596; cv=none; b=d0Nr/f+7ma081radKxGGQCHdVceTUse6PkxPQQhCU0n5BCdms3KnbBZCv6l4k2tzwLdw40tseht9PoccG3//b2j9KYE3DaY/boWrus0U2EwrS9bxYxfItbc/fxtXbnvfjcIwH1+FGpQdyZQT3pcpiQ4yQ/C3hmLvhDC0ZAtOPIQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707396596; c=relaxed/simple; bh=/raue+ELhkH2hPh2pJ5EPvccB2rMfZ0AyREnP0RN1h4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PuBEsCiJOflRC6iThJPN6gDHJcbZCEyOvBc54MZc0KVzffFSlGX/EGyEUX91lN6FP1X3B1XsLXsS1hYei0sS8oEiXAFk9XlYfKNy1AL4EtmZKEPlxIMAq5rrTYFl7JTAQBgl8+AnillPd+GTvP+eu3Sbjhp22GDbMueGchjlEK0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de; spf=pass smtp.mailfrom=alpha.franken.de; arc=none smtp.client-ip=193.175.24.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=alpha.franken.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alpha.franken.de Received: from uucp by elvis.franken.de with local-rmail (Exim 3.36 #1) id 1rY3Mr-000327-00; Thu, 08 Feb 2024 13:19:01 +0100 Received: by alpha.franken.de (Postfix, from userid 1000) id 71A38C0267; Thu, 8 Feb 2024 13:11:30 +0100 (CET) Date: Thu, 8 Feb 2024 13:11:30 +0100 From: Thomas Bogendoerfer To: Gregory CLEMENT Cc: Paul Burton , linux-mips@vger.kernel.org, Jiaxun Yang , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , Tawfik Bayouk , Alexandre Belloni , =?iso-8859-1?Q?Th=E9o?= Lebrun , Thomas Petazzoni Subject: Re: [PATCH v7 03/14] MIPS: Allows relocation exception vectors everywhere Message-ID: References: <20240205153503.574468-1-gregory.clement@bootlin.com> <20240205153503.574468-4-gregory.clement@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > > 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 > Signed-off-by: Gregory CLEMENT > --- > 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 > #include > #include > +#include > #include > #include > #include > @@ -25,7 +26,34 @@ > #include > #include > > +#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 ]