From nobody Mon Feb 9 12:28:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1674828016; cv=none; d=zohomail.com; s=zohoarc; b=XmrZfmeHjAG8Y4w90LFPExEYpYfURG7Vrz17bz0nTP3SzCtzz6qmHh+ygIB7mMHrySpUwrn/D9Vqvi3KO5KAPpGlNRSZBkYuoNQYYqE0e+gcYtZ4UtCFKLZpsiYucC20cEzWIWYqJl/RwybxehO0L6HtGEEWPHQ1RvWpEy2DyaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674828016; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ow2bkBFPte3lViXpinOUB5QNvNEMi29RCIxf21SF5TY=; b=MJc8pMnv3qd1nvI96gLhzeucvGt/eFEwHWrgoPMA3K6y0mFiBFwhONB4hFcQR+sUe3WdFiMZ4Tk51NFv19NV/IFHAgPGtze2y9vqezHU1Qtl6XkeMbkADFOcSpwu/pFoRL2ZRZ5RnIn0Roes8mveylFsDuXXwRtsMJGbAXgMmLE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1674828016499170.84973882024053; Fri, 27 Jan 2023 06:00:16 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.485599.753012 (Exim 4.92) (envelope-from ) id 1pLPGo-0003dx-U5; Fri, 27 Jan 2023 13:59:58 +0000 Received: by outflank-mailman (output) from mailman id 485599.753012; Fri, 27 Jan 2023 13:59:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pLPGo-0003aT-Af; Fri, 27 Jan 2023 13:59:58 +0000 Received: by outflank-mailman (input) for mailman id 485599; Fri, 27 Jan 2023 13:59:56 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pLPGm-00023y-Cj for xen-devel@lists.xenproject.org; Fri, 27 Jan 2023 13:59:56 +0000 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [2a00:1450:4864:20::42d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e05a0442-9e4a-11ed-b8d1-410ff93cb8f0; Fri, 27 Jan 2023 14:59:54 +0100 (CET) Received: by mail-wr1-x42d.google.com with SMTP id m7so5048865wru.8 for ; Fri, 27 Jan 2023 05:59:54 -0800 (PST) Received: from localhost.localdomain (lfbn-gre-1-240-53.w90-112.abo.wanadoo.fr. [90.112.199.53]) by smtp.gmail.com with ESMTPSA id d3-20020adfe2c3000000b002bc7fcf08ddsm3971131wrj.103.2023.01.27.05.59.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 05:59:53 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e05a0442-9e4a-11ed-b8d1-410ff93cb8f0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ow2bkBFPte3lViXpinOUB5QNvNEMi29RCIxf21SF5TY=; b=SQ9/qh+TTheEDiNF2ViKLmE6RsZxhvokJSDTyyxL+oEz2Hch7XkqxYAmdVgl5sesS9 hAlEv758aA4Ynlqu71BYzwQxFLhiwSgJxiP/KK35f6at9wkK/CDPva3WHxPycOXM6UUe d6XOt5n0Ts5Sf2wtMSeSpQJ6P3AKh0EwUHI79o/tARJr8UW+5SFuyBgtbd+Ff6Q1mA9D /XAD9XlEsvoOjDKYcyP7cUmwE7qsh3MnUnFEk6AM2ZCFzY77uKk1yIQNsKTj9wqZHrB7 HMosOykw3R5agoEk7Dhnd0JUB6zAg5CWwaiBL7STGuaB7jG5B1dMdRMHo6YgaS+WYh7v yp3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ow2bkBFPte3lViXpinOUB5QNvNEMi29RCIxf21SF5TY=; b=lsGKchNKLtB0/7Y3OZfw5rZl5nJKhpPibX/gv1eAIJYpDQyZiJpWTvMkHxQQyJXrox ln4CDMws/1euK3sOi1rzj8/y6kKnUyYeZgLD4CaEr1OXOPYg/y6LhM2x+DwleqiuuZas 5tJIISY5BsLITwe+CX+y+2x2ggQFw1D5F8OAd6yfNXdXEDE6JlVWMMey1FT6IX2DGKh7 12xfNW/MaG9zLyrvIyY5oa1TXV8X71GNEPSkOlFxJFTpXQ3frgdb5c4H8pa+TUa7E9cB 4te0B5oxTYt3ZQe+T2cEQbUeiWypatfzeamo1DPhrDsQVwjlBQY5LZfJjOHLU/4TD3Hq wFJQ== X-Gm-Message-State: AO0yUKUmzklT+yv8CQ11ZCuPQS9YHjWpvy3NFJw4lG8ZTrpmFpXTtyVL 3yo+trC5m/PRtLTZWZzgLSi2ecmusTE= X-Google-Smtp-Source: AK7set/6CfDjk8PEmrwzMqgVJa9okxetml0QJgUZWoN2e+jkCFDXF3imEgzKvHUOUVjN76HrLwCvSw== X-Received: by 2002:adf:dd01:0:b0:2bf:c530:329e with SMTP id a1-20020adfdd01000000b002bfc530329emr5100646wrm.14.1674827994201; Fri, 27 Jan 2023 05:59:54 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Julien Grall , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v2 11/14] xen/riscv: introduce trap_init() Date: Fri, 27 Jan 2023 15:59:16 +0200 Message-Id: <1081e7e12f50227a4e15171129a468420b613273.1674818705.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1674828017404100015 Content-Type: text/plain; charset="utf-8" Signed-off-by: Oleksii Kurochko Reviewed-by: Alistair Francis --- Changes in V2: - Rename setup_trap_handler() to trap_init(). - Add Reviewed-by to the commit message. --- xen/arch/riscv/include/asm/traps.h | 1 + xen/arch/riscv/setup.c | 4 ++++ xen/arch/riscv/traps.c | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/as= m/traps.h index f3fb6b25d1..f1879294ef 100644 --- a/xen/arch/riscv/include/asm/traps.h +++ b/xen/arch/riscv/include/asm/traps.h @@ -7,6 +7,7 @@ =20 void do_trap(struct cpu_user_regs *cpu_regs); void handle_trap(void); +void trap_init(void); =20 #endif /* __ASSEMBLY__ */ =20 diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index d09ffe1454..c8513ca4f8 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,7 +1,9 @@ #include #include =20 +#include #include +#include =20 /* Xen stack for bringing up the first CPU. */ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] @@ -11,6 +13,8 @@ void __init noreturn start_xen(void) { early_printk("Hello from C env\n"); =20 + trap_init(); + for ( ;; ) asm volatile ("wfi"); =20 diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c index f2a1e1ffcf..31ed63e3c1 100644 --- a/xen/arch/riscv/traps.c +++ b/xen/arch/riscv/traps.c @@ -11,6 +11,13 @@ #include #include =20 +void trap_init(void) +{ + unsigned long addr =3D (unsigned long)&handle_trap; + + csr_write(CSR_STVEC, addr); +} + static const char *decode_trap_cause(unsigned long cause) { static const char *const trap_causes[] =3D { --=20 2.39.0