Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6818816rwl; Mon, 9 Jan 2023 13:32:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXujR3znGuhM/X7S7Rp+kgI6uXBobLCTSUJy2Lxtoqx4p0nl6iGuODMvQVRVv8js/zaYmMsh X-Received: by 2002:aa7:c998:0:b0:497:382a:6a4 with SMTP id c24-20020aa7c998000000b00497382a06a4mr9912832edt.0.1673299964474; Mon, 09 Jan 2023 13:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673299964; cv=none; d=google.com; s=arc-20160816; b=Xsd78glChywDFBgCEXhg6btEoB0e3RiRE/VbIXB0JQZAiapgvzP+SAEE1tdhX7tB6W 8QN9PPXGwYWJp6U9M/f8jlXpj0EU/FmZwKtAbjRSeel6TEmXVFOXhC6ZAdXhTa95FMZS xutJK6oQufMSgnxt3ll1QvkPoGo3iKS89XxcQLah/ESfIL26w/+xclwqEO3NA9zCfyVK BGMQyARNOWKdkFdnkY0j9ldBqzunhGenUN82blCkilL+OjH68NR5s/N67zKwo1q0KcLn uvsDiyDvB791Buz4ZOxbJFlEzFZB9tZdFgRop93jWpI1X6Z42QACk9BamoF55/9jcYne F8yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=8qeFEqQ4IOt0anyptkgiI7e33u5DzSFvrnoNG8eLIZQ=; b=ORCAZfzxJJRujwKAUwWhsaJ8UHaF70F8S3Xs5OLY1EEWS+umqFpQOEqpuWfNv8l61r yutD9lFxa433X7oqe0t5EszQ9Iq2RSsiPR47ZkAf3j6nW5VPtM36mWqwYS9b5p2TgUop oUzzajCM2AIzRpTCmzvJ6Yhm0nKzkrOqtrVfxzZWB66eLqi7SNKVpQPGLd0aQSf45yZG lKQvtlU5elHCpU9AIly3ZhNkgxLlCqLBk/N1Jv7ZYpiNza1deopaFCfICx9Ao7y9pyco 4bKueTsv/Tm4qtY3XTzj1ClZxRK5YBNi73ISjXLtZfK2CV5nMYanFhGgiD9oGuiymP1e VMbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ajGUQOrM; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f28-20020a50d55c000000b0048e927edec3si10200331edj.272.2023.01.09.13.32.31; Mon, 09 Jan 2023 13:32:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ajGUQOrM; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237783AbjAIU4g (ORCPT + 53 others); Mon, 9 Jan 2023 15:56:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237732AbjAIUzh (ORCPT ); Mon, 9 Jan 2023 15:55:37 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F3628B51F for ; Mon, 9 Jan 2023 12:54:36 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673297674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8qeFEqQ4IOt0anyptkgiI7e33u5DzSFvrnoNG8eLIZQ=; b=ajGUQOrML1zNkR0fk1KotYKMBAKwWsIx59GbeDyE0wI+qcgyK4U/vkgT/nPrjQVdVkGkw7 6+QXFbeM8O181U4mauwY+WOCSVrZwELqcTEJ+k5BQQ/X2EP+XjmWP25NpnmItu+4w/AI7F EDaJXZusSCZ6Ow0KFsCm2sQbwqMCmhcvjTL7M+ouoelK6yWgvEc7n9BFLcA4e/zjhCTN6h gd1OXwt7+L3leHEutPRSJndR4VnpzMGxIGrlXkf3N1PPKn8CW8waBY2trMDIFTJaksblD9 ea0aRLLCEEeIaqLxGm9QnaPZGjZ3JgJPsAeSpLpxPSunKIHu+PJ/p9rW1sGj2g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673297674; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8qeFEqQ4IOt0anyptkgiI7e33u5DzSFvrnoNG8eLIZQ=; b=FAbVYPDt08Nmj0VDublDd2siRaJWY8yB9QByTJvMOBEs/PM6eBJ1fKfRQMkUjcvSIj4hl0 Zu7v2rMJPNDl0YCg== To: Yann Sionneau Cc: Yann Sionneau , linux-kernel@vger.kernel.org, Clement Leger , Guillaume Thouvenin , Julian Vetter , Luc Michel , Marius Gligor Subject: Re: [RFC PATCH 08/25] kvx: Add exception/interrupt handling In-Reply-To: <20230103164359.24347-9-ysionneau@kalray.eu> References: <20230103164359.24347-1-ysionneau@kalray.eu> <20230103164359.24347-9-ysionneau@kalray.eu> Date: Mon, 09 Jan 2023 21:54:33 +0100 Message-ID: <87r0w3junq.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 03 2023 at 17:43, Yann Sionneau wrote: > --- /dev/null > +++ b/arch/kvx/kernel/irq.c > @@ -0,0 +1,78 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Copyright (C) 2017-2023 Kalray Inc. > + * Author(s): Clement Leger > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#define IT_MASK(__it) (KVX_SFR_ILL_ ## __it ## _MASK) > +#define IT_LEVEL(__it, __level) \ > + (__level##ULL << KVX_SFR_ILL_ ## __it ## _SHIFT) > + > +void do_IRQ(unsigned long hwirq_mask, struct pt_regs *regs) > +{ > + struct pt_regs *old_regs = set_irq_regs(regs); > + int irq; > + unsigned int hwirq; > + > + trace_hardirqs_off(); > + > + irq_enter(); Please use the generic entry code for interrupts to handle tracing, irq_enter() etc. correctly. > +/** > + * trap_handler - trap handler called by _trap_handler routine in trap_handler.S > + * This handler will redirect to other trap handlers if present > + * If not then it will do a generic action > + * @es: Exception Syndrome register value > + * @ea: Exception Address register > + * @regs: pointer to registers saved when trapping > + */ > +void trap_handler(uint64_t es, uint64_t ea, struct pt_regs *regs) > +{ > + enum ctx_state prev_state = exception_enter(); Please do not implement exception_enter/exit(). Use the generic entry handling code so your code is correct and extensible. Thanks, tglx