Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2484145rdb; Fri, 8 Dec 2023 09:21:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHimB4pTSbecZiNptp0RkjwUVSM+gjYJ9w/TJFRL4RL42/KJKx3CCdv0CHS27LouAhkQgTs X-Received: by 2002:a17:903:2448:b0:1cf:dbf8:f242 with SMTP id l8-20020a170903244800b001cfdbf8f242mr315353pls.13.1702056091040; Fri, 08 Dec 2023 09:21:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702056091; cv=none; d=google.com; s=arc-20160816; b=CFp21mWWRk1riQXXkHy4D3CsWP45stAlHcZP15B4NfqawNd3VXxhyCvX/jprRbHKqz RQVArix2LhJ/ZGUQz/bVu/+MNbLLv4UsswZIXZm4H9fRmZZ/6tdL19sy7q4hFxm+OLzk PoC7AU1X504e9MeQOLdtW6veHnUGAddCGAOV1RjVVLBZPdRmBBAmFQNUgK/USWH9I8qt kvy1LhToVTCMdTVbYxdpZye9IEPVV6EZE+KSywZ8amd5ZDRB7TNsdSPgrMuAzIN71BjA XDHxUugRQYsamWhLdojQKofahO8J8f7SFGy8PGX9YoFilf8CS/YxvWl2hUbpqs4f/kQS eMbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=xyjBnXy373rKFZHkw6ZdILQWY6NS6y247eNXduy4P+4=; fh=4ceizjbic+bV4OQheHSfiR1nb1zdT9ouEN0tgKMHg/w=; b=d+Ka/aXN28LCjwTgTl3FRfa7F2Y8j9LEL8AEdnHKvIBRQYYaGWuHktLqMCe53EMHaT 4JxUkKogJWD6i6HYY0yZKz1Od+UeWTfzNE1lJAjarWCiBsXf8YHjg7rN3JdK3kM18aNQ KnHKZpmnCMELO9ZJA2nRm1XaI6hrc6SznoBZH3/kTHXi6g/c+rp6AZzojCoX/9VFgjYd A3PU18Tkh5XlS36lcYdwh5i1bmw252mz/psuIO3o1qw5cUldiMBQK2gDQXY9+7ifhaM0 ptriibGWwuVpeRFd1jv5J9HiI0jaPBmH3liMOP+22rAcroVjlacUyJKQ8N/cOSBir8ye VoDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id m9-20020a170902db0900b001ce5b8081a5si1873867plx.382.2023.12.08.09.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 09:21:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8D2E284C2989; Fri, 8 Dec 2023 09:21:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236022AbjLHRUb (ORCPT + 99 others); Fri, 8 Dec 2023 12:20:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236033AbjLHRUR (ORCPT ); Fri, 8 Dec 2023 12:20:17 -0500 Received: from mx01.omp.ru (mx01.omp.ru [90.154.21.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B5C22D40; Fri, 8 Dec 2023 09:19:52 -0800 (PST) Received: from [192.168.1.104] (178.176.72.145) by msexch01.omp.ru (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.1258.12; Fri, 8 Dec 2023 20:19:49 +0300 Subject: Re: [PATCH v4 09/22] MIPS: traps: Handle CPU with non standard vint offset To: Gregory CLEMENT , Paul Burton , Thomas Bogendoerfer , , Jiaxun Yang , Rob Herring , Krzysztof Kozlowski , , CC: Vladimir Kondratiev , Tawfik Bayouk , Alexandre Belloni , =?UTF-8?Q?Th=c3=a9o_Lebrun?= , Thomas Petazzoni References: <20231208161249.1827174-1-gregory.clement@bootlin.com> <20231208161249.1827174-10-gregory.clement@bootlin.com> From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: <94e4bafb-7c4d-d6bf-7440-f487243a1a59@omp.ru> Date: Fri, 8 Dec 2023 20:19:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20231208161249.1827174-10-gregory.clement@bootlin.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [178.176.72.145] X-ClientProxiedBy: msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru (10.188.4.12) X-KSE-ServerInfo: msexch01.omp.ru, 9 X-KSE-AntiSpam-Interceptor-Info: scan successful X-KSE-AntiSpam-Version: 6.0.0, Database issued on: 12/08/2023 17:00:03 X-KSE-AntiSpam-Status: KAS_STATUS_NOT_DETECTED X-KSE-AntiSpam-Method: none X-KSE-AntiSpam-Rate: 0 X-KSE-AntiSpam-Info: Lua profiles 181987 [Dec 08 2023] X-KSE-AntiSpam-Info: Version: 6.0.0.2 X-KSE-AntiSpam-Info: Envelope from: s.shtylyov@omp.ru X-KSE-AntiSpam-Info: LuaCore: 6 0.3.6 62f5a4619c57459c9a142aa1486ed27913162963 X-KSE-AntiSpam-Info: {rep_avail} X-KSE-AntiSpam-Info: {Tracking_from_domain_doesnt_match_to} X-KSE-AntiSpam-Info: d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2;omp.ru:7.1.1 X-KSE-AntiSpam-Info: ApMailHostAddress: 178.176.72.145 X-KSE-AntiSpam-Info: Rate: 0 X-KSE-AntiSpam-Info: Status: not_detected X-KSE-AntiSpam-Info: Method: none X-KSE-AntiSpam-Info: Auth:dmarc=temperror header.from=omp.ru;spf=temperror smtp.mailfrom=omp.ru;dkim=none X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Heuristic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 12/08/2023 17:07:00 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 12/8/2023 1:21:00 PM X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: InTheLimit X-Spam-Status: No, score=0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 08 Dec 2023 09:21:13 -0800 (PST) On 12/8/23 7:12 PM, Gregory CLEMENT wrote: > From: Jiaxun Yang > > Some BMIPS cpus has none standard start offset for vector interrupts. > > Handle those CPUs in vector size calculation and handler setup process. > > Signed-off-by: Jiaxun Yang > --- > arch/mips/kernel/traps.c | 32 +++++++++++++++++++++++--------- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c > index ea59d321f713e..651c9ec6265a9 100644 > --- a/arch/mips/kernel/traps.c > +++ b/arch/mips/kernel/traps.c > @@ -74,7 +74,6 @@ > > #include "access-helper.h" > > -#define MAX(a, b) ((a) >= (b) ? (a) : (b)) > > extern void check_wait(void); > extern asmlinkage void rollback_handle_int(void); > @@ -2005,6 +2004,7 @@ void __noreturn nmi_exception_handler(struct pt_regs *regs) > unsigned long ebase; > EXPORT_SYMBOL_GPL(ebase); > unsigned long exception_handlers[32]; > +static unsigned long vi_vecbase; > unsigned long vi_handlers[64]; > > void reserve_exception_space(phys_addr_t addr, unsigned long size) > @@ -2074,7 +2074,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs) > handler = (unsigned long) addr; > vi_handlers[n] = handler; > > - b = (unsigned char *)(ebase + 0x200 + n*VECTORSPACING); > + b = (unsigned char *)(vi_vecbase + n*VECTORSPACING); Add spaces around * for consistency please. [...] > @@ -2370,20 +2370,33 @@ void __init trap_init(void) > extern char except_vec3_generic; > extern char except_vec4; > extern char except_vec3_r4000; > - unsigned long i, vec_size; > + unsigned long i, vec_size, vi_vec_offset; > phys_addr_t ebase_pa; > > check_wait(); > > + if (cpu_has_veic || cpu_has_vint) { > + switch (current_cpu_type()) { > + case CPU_BMIPS3300: > + case CPU_BMIPS4380: > + vi_vec_offset = 0x400; > + break; > + case CPU_BMIPS5000: > + vi_vec_offset = 0x1000; > + break; > + default: > + vi_vec_offset = 0x200; > + break; > + } > + vec_size = vi_vec_offset + VECTORSPACING*64; Here as well... [...] MBR, Sergey