lkml.org 
[lkml]   [2023]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 08/25] kvx: Add exception/interrupt handling
Date
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 <linux/irqdomain.h>
> +#include <linux/irqflags.h>
> +#include <linux/hardirq.h>
> +#include <linux/irqchip.h>
> +#include <linux/bitops.h>
> +#include <linux/init.h>
> +
> +#include <asm/dame.h>
> +
> +#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

\
 
 \ /
  Last update: 2023-03-26 23:33    [W:0.585 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site