From patchwork Fri Aug 2 13:54:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13751560 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D630EC52D6F for ; Fri, 2 Aug 2024 13:54:29 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.771220.1181806 (Exim 4.92) (envelope-from ) id 1sZsja-0003QE-3s; Fri, 02 Aug 2024 13:54:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 771220.1181806; Fri, 02 Aug 2024 13:54:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sZsjZ-0003Pn-Ta; Fri, 02 Aug 2024 13:54:17 +0000 Received: by outflank-mailman (input) for mailman id 771220; Fri, 02 Aug 2024 13:54:17 +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 1sZsjZ-00036y-6F for xen-devel@lists.xenproject.org; Fri, 02 Aug 2024 13:54:17 +0000 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [2a00:1450:4864:20::22f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b473272c-50d6-11ef-8776-851b0ebba9a2; Fri, 02 Aug 2024 15:54:15 +0200 (CEST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ef2cce8be8so101593261fa.1 for ; Fri, 02 Aug 2024 06:54:15 -0700 (PDT) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2f15e1ae4easm1684271fa.43.2024.08.02.06.54.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Aug 2024 06:54:13 -0700 (PDT) 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: b473272c-50d6-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722606854; x=1723211654; darn=lists.xenproject.org; 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=wIOcN4PHeriEnZEntkfGwdQOvLPTgN17YwTpAAoCcJk=; b=Nv0ZTqmwLLUqoDpTMXFSV94/6g8FuGWi7+eOUz4aKaKCBdayDXWuk5X3sMRkRpymco +5ikDiWC8pCIAQR78nXK3uKrMrf6yV9vBd/wCpLS08+ogC0u+8HCpPf+KXVlD6XEiLLH 88mqYOMYOSTEiahbrBfJGVN2u6Ea+5IUbNnHH9RDBMKfgC2tG0y/uhkWvCbg2v2TC2nL kLPe3EtYpYgOoOg0HjAcx5fp8lIAAKiE+Rk9DOkLIzsQH3QsHyI4gUKYj0LoG4TxYSzB Y5DRyq+frqMCe83pT6pGT3asv5vijmt1MkyeQ8R/MiQp4wTc6DGCclC8iN8MiXVswK7E GCMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722606854; x=1723211654; 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=wIOcN4PHeriEnZEntkfGwdQOvLPTgN17YwTpAAoCcJk=; b=N6eIBHJLjX0Ne581M8NRttPAsxnoKR+ZaSgi56VhjbER5TJitdLl4D2cj42KlhVUdA S5p7hOA8e36T0yKCVe+ujeDJobMehQdCY6N8dYqY29n5Orwa/6jF/XN91R4KUxbY8RM8 Qpe1ozFBIvaw6RCzZGbL98I9skyVFULZSzmDLoCoEp5NyNEkZ+rG4aD23ucEDTbv33D2 dWK9TwnqbWUh0zoh7liuaU+JhWB1k4ZiNxPB+RBMj6Pf1DMkuOtFTAWwAgfuuy1IqXlG wznComm84b2DDf00hZQqaoUN/97INKJm+/FA4tIT6eZAdDAKqje7h8V7pCbipdexskqZ P9cg== X-Gm-Message-State: AOJu0YwgiOLn15QOuI9bfquPQa7Wbd2Npou6jKcYQIKVe/nYc8xpaCvj 9YyDq0fa0gUr2yWpHZkhS+ZdT7Xy8hfjHmMSUDLs71gY0l/fN3sGryB2Aw== X-Google-Smtp-Source: AGHT+IEANmQhPUVt4MoYximYaBpIi4QWwle/e/k966V3fREoWHOCp71fE3RGalCYB+bkOiMMtOb0uA== X-Received: by 2002:a2e:884e:0:b0:2ef:2580:c0c6 with SMTP id 38308e7fff4ca-2f15aa9a091mr27091761fa.14.1722606854199; Fri, 02 Aug 2024 06:54:14 -0700 (PDT) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v12 2/3] xen/riscv: test basic exception handling stuff Date: Fri, 2 Aug 2024 15:54:08 +0200 Message-ID: X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 Introduces testing of some macros from . Also wraps this testing into SELF_TESTS config to not produce a noise in the log related to functionality testing ( in the current case, it is macros from xen/bug.h ) when CONFIG_SELF_TESTS is disabled. Signed-off-by: Oleksii Kurochko Acked-by: Alistair Francis --- Changes in V12: - Notrhing changed. Only rebase. --- Changes in V11: - update the commit message. --- Changes in V10: - wrap test_macros_from_bug_h() under "#ifdef CONFIG_SELF_TESTS" - update the commit title to: "xen/riscv: test basic exception handling stuff" --- Changes in V9: - s/early_printk/printk as common code is now available --- Changes in V5-V8: - Nothing changed. Only rebase. --- Changes in V4: - Add Acked-by: Alistair Francis --- Changes in V2-V3: - Nothing changed --- xen/arch/riscv/setup.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index a6a29a1508..4defad68f4 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -19,6 +19,22 @@ void arch_get_xen_caps(xen_capabilities_info_t *info) unsigned char __initdata cpu0_boot_stack[STACK_SIZE] __aligned(STACK_SIZE); +#ifdef CONFIG_SELF_TESTS +static void test_run_in_exception(const struct cpu_user_regs *regs) +{ + printk("If you see this message, "); + printk("run_in_exception_handler is most likely working\n"); +} + +static void test_macros_from_bug_h(void) +{ + run_in_exception_handler(test_run_in_exception); + WARN(); + printk("If you see this message, "); + printk("WARN is most likely working\n"); +} +#endif + void __init noreturn start_xen(unsigned long bootcpu_id, paddr_t dtb_addr) { @@ -26,6 +42,10 @@ void __init noreturn start_xen(unsigned long bootcpu_id, trap_init(); +#ifdef CONFIG_SELF_TESTS + test_macros_from_bug_h(); +#endif + printk("All set up\n"); for ( ;; )