From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BE10C5479D for ; Mon, 9 Jan 2023 21:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237741AbjAIVAB (ORCPT ); Mon, 9 Jan 2023 16:00:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237829AbjAIU6f (ORCPT ); Mon, 9 Jan 2023 15:58:35 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E83CB8F2B3 for ; Mon, 9 Jan 2023 12:55:30 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673297709; 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=QtBImeerWqPbZp6EK7tFNjHJVrZNpD+SilDk05oqvCs=; b=W8EX8KUkOiJUCEBol4TyA4Mu8Wg6t/S9Qz3eIBTrQil77AwbF3rNePtwiIbUwS7WH0c9pv 7oXiOpGqwTLG8M7b7IQ1x54fnKy+k4wSUUiONTbpOAY9OudzOYuwqaLp7TkhpGvsebMG0M PzunNy2dDldo8XXUhGtfE3hmIABwEMP1Jk8WPbYMh4Z5WzDWwTAveBpKSvKcGfWBR1gGIk ssSQ8TS1B6zQ+DHpS2cxDvKoi7hKhQo3xuuLHORZyjV84Ww7R8cAtcki9Gh0d09s12vI0p ZSgR/G+4pLDCxnTW3ugPwEyej0teoZ+YC4nWUZnoxrXOzr9DZ4DaFtxJpUIYsg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673297709; 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=QtBImeerWqPbZp6EK7tFNjHJVrZNpD+SilDk05oqvCs=; b=42LcaGX/RTqEr417RNiI5wDQpG7HDbzqohNSYZfEdyoTrP85SSL2O5tGhiUOHjrRGUZtbf /4WKRRt6UYjjUxBw== To: Yann Sionneau Cc: Yann Sionneau , Christian Brauner , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Clement Leger , Guillaume Thouvenin , Julian Vetter , Julien Villette , Marius Gligor Subject: Re: [RFC PATCH 12/25] kvx: Add system call support In-Reply-To: <20230103164359.24347-13-ysionneau@kalray.eu> References: <20230103164359.24347-1-ysionneau@kalray.eu> <20230103164359.24347-13-ysionneau@kalray.eu> Date: Mon, 09 Jan 2023 21:55:08 +0100 Message-ID: <87pmbnjumr.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 03 2023 at 17:43, Yann Sionneau wrote: > +/*********************************************************************** > +* Common exception return path > +***********************************************************************/ > +/** > + * Restore registers after exception > + * When entering this macro, $sp must be located right before regs > + * storage. > + */ > +EXCEPTION_ENTRY(return_from_exception) > +#ifdef CONFIG_DEBUG_EXCEPTION_STACK > + ld $r1 = 0[$sp] > + ;; > + sbfd $r1 = $r1, $sp > + ;; > + cb.deqz $r1, _check_ok > + ;; > + make $r2 = panic > + make $r0 = stack_error_panic_str_label > + ;; > + icall $r2 > + ;; > +_check_ok: > + addd $sp = $sp, STACK_REG_SIZE > + ;; > +#endif > + get $r11 = $sr > + /* Load sps value from saved registers */ > + ld $r6 = PT_SPS[$sp] > + ;; > + /* Disable interrupt to check task flags atomically */ > + disable_interrupt $r60 > + ;; > + /* Check PL bit of sps, if set, then it means we are returning > + * to a lower privilege level (ie to user), if so, we need to > + * check work pending. If coming from kernel, directly go to > + * register restoration */ > + cb.even $r6? _restore_regs > + ld $r1 = TASK_TI_FLAGS[$r11] > + ;; > + /* Do we have work pending ? */ > + andd $r5 = $r1, _TIF_WORK_MASK Please use the generic entry code to handle pending work, tracing etc. All over the place.... Thanks, tglx