From patchwork Tue Jan 10 15:17:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13095266 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 35E73C46467 for ; Tue, 10 Jan 2023 15:18:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.474742.736059 (Exim 4.92) (envelope-from ) id 1pFGO9-0005PR-0L; Tue, 10 Jan 2023 15:18:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 474742.736059; Tue, 10 Jan 2023 15:18:08 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGO8-0005Nl-Rl; Tue, 10 Jan 2023 15:18:08 +0000 Received: by outflank-mailman (input) for mailman id 474742; Tue, 10 Jan 2023 15:18:07 +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 1pFGO7-0005Fu-CE for xen-devel@lists.xenproject.org; Tue, 10 Jan 2023 15:18:07 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fb20730a-90f9-11ed-b8d0-410ff93cb8f0; Tue, 10 Jan 2023 16:18:05 +0100 (CET) Received: by mail-lf1-x135.google.com with SMTP id g13so18965052lfv.7 for ; Tue, 10 Jan 2023 07:18:05 -0800 (PST) Received: from fedora.. ([195.234.76.149]) by smtp.gmail.com with ESMTPSA id y19-20020a0565123f1300b00498fc3d4cfdsm2203396lfa.189.2023.01.10.07.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:04 -0800 (PST) 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: fb20730a-90f9-11ed-b8d0-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=u7sI+87rn5yOEodXtae6iqX6/XNkgcCetji6u3zffsM=; b=Wcd+e1vaZ7jCFWNGH/6ZmgG8lMqmO5xhPnKN3ktZfI/PnHoeOzqYtwbZUeK5YQQekf Bz4qNhSrO8EAwQih9+bzTsTAVeEmzIC9aVW4edgZNrLDVMu5nsQTnoi0MnDdYo4QpgwM IKV1zFPVZdfctGAafPDgpzEQrwSkQmMWNIpSk6PBpVShrD1B2JcgLwdidmx2wR0h16yr tceSmVuJcbWls4L16BoDbD9tsqkZHI986vyx2Q6P7KpHproyAV6Wj94ndIQ9M6qu+ZWQ tvNQiQutSpyc4deTvrAn5PGz1eJCn7JOjyJREbamG7WbXx9E+ZdhpH6eNaoNl8LwKgqu 8INw== 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=u7sI+87rn5yOEodXtae6iqX6/XNkgcCetji6u3zffsM=; b=8J26y+XR2RHbK1gRxuPFHR2TgJKmYXmDqFmcwumAEraL4wnPTAWgL/9s/kuyvOtD7y cLztmqosxfjQnAsUdXhguB6+aYkA7qXYlRtKSvS3bFfn/3cZ4KGdlYT+bx0scig6m7zf hMeQF8y3WcXZylhnmgw2euRh7YWXJ+1+6l9egbtsfoVC01B/nsW850UyRUhGhnoTWWeG rpOlaf4mgZ1Y6uyHA58S4faly8+DkimGsPH+gRXRsQal6es5CuFg9SsXhFPhPS8MXOWf NgA/h1LYYMKwXK10muIjFt6/Eark+a3oRHDUf9wEubHexqklYRS5j4l+FmIDwj+llebW Oo/Q== X-Gm-Message-State: AFqh2krfKYRRxYMRYmDfuj+9qLKMkonAQX/FwCk7nWU2UFLEinn9T/pM ABpjwf2URQvqmbEDpnwVcdJr6UTjJTLKUEUq X-Google-Smtp-Source: AMrXdXu6J6iJ2CHmwuWTqgPYwkvNGDt8B1Nj6qG/RDyMjRIDl6ZmqknoP7CuZmRNXuvTQOHUt8Aeqw== X-Received: by 2002:a05:6512:b27:b0:4b6:eaed:f18f with SMTP id w39-20020a0565120b2700b004b6eaedf18fmr21721242lfu.38.1673363884715; Tue, 10 Jan 2023 07:18:04 -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 v3 1/6] xen/riscv: introduce dummy asm/init.h Date: Tue, 10 Jan 2023 17:17:54 +0200 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 The following patches require which includes Signed-off-by: Oleksii Kurochko --- Changes in V3: - Nothing changed --- Changes in V2: - Add explanation comment to the comment message --- xen/arch/riscv/include/asm/init.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 xen/arch/riscv/include/asm/init.h diff --git a/xen/arch/riscv/include/asm/init.h b/xen/arch/riscv/include/asm/init.h new file mode 100644 index 0000000000..237ec25e4e --- /dev/null +++ b/xen/arch/riscv/include/asm/init.h @@ -0,0 +1,12 @@ +#ifndef _XEN_ASM_INIT_H +#define _XEN_ASM_INIT_H + +#endif /* _XEN_ASM_INIT_H */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Tue Jan 10 15:17:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13095272 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 D043CC678D7 for ; Tue, 10 Jan 2023 15:18:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.474743.736064 (Exim 4.92) (envelope-from ) id 1pFGO9-0005Re-7W; Tue, 10 Jan 2023 15:18:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 474743.736064; Tue, 10 Jan 2023 15:18:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGO9-0005Qw-2b; Tue, 10 Jan 2023 15:18:09 +0000 Received: by outflank-mailman (input) for mailman id 474743; Tue, 10 Jan 2023 15:18:08 +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 1pFGO8-0005Fu-CU for xen-devel@lists.xenproject.org; Tue, 10 Jan 2023 15:18:08 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fba76ff9-90f9-11ed-b8d0-410ff93cb8f0; Tue, 10 Jan 2023 16:18:06 +0100 (CET) Received: by mail-lf1-x12c.google.com with SMTP id m6so18937020lfj.11 for ; Tue, 10 Jan 2023 07:18:06 -0800 (PST) Received: from fedora.. ([195.234.76.149]) by smtp.gmail.com with ESMTPSA id y19-20020a0565123f1300b00498fc3d4cfdsm2203396lfa.189.2023.01.10.07.18.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:05 -0800 (PST) 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: fba76ff9-90f9-11ed-b8d0-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=GDdmAaTmfRPA7/hoydJZPcOqFW6WO2Afa2sA0FosFio=; b=NEM8j9tyoYg5poO13W2TCJj3Us3bcZztoSFaeK51xO9v2vjzt/4x/SAKmRlJDzpp6J wD7Ws/2wnbVb8EYWs1Hn1RE9SPTb/mKzgWwvtZs814huxoBRsBgBvQsrrjxYUAXfzb4t o028CXIN+4Ofa4UM8B6PhJFmnIme18puLhWbYEmOMHbR97mTwtrmkBRIczssJEFhRO2s 0QqzKSA+1r+qYq0W16LsB8Ou0hJ7lkXdjb9dYGdV9QBc319Uzz7TglhmqKn5z8gpc/t1 FQKkFXRiRlWxpcCurzLJxbIkeUxR15z9QtlmUCA1lRKihUMUBoVkGSPyWBhO/oMZWJPw itXA== 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=GDdmAaTmfRPA7/hoydJZPcOqFW6WO2Afa2sA0FosFio=; b=bNUBWrFyWg1L0KawxXVYPn8CPmT6v89FiA1Q+1sqgIiuiAt3L7HMhbt+jKJdi4Sn86 YqXRWiWKaFKtJZMXX1P860x+bufJfwq1B/NbtK6knXsOmjhPeIGjYQhq7RXLSsygQIEp b9ypry9Mc9qD1aDS8oRiaCGwsfzR5oH5JvaKCVG2xmjSdPeJQO82c0rVNN6l8kyz0DB5 kFCFLfN78JoZPCSikzyQKn4kfXdzzAoq8noCZe48mHYX0dUDwJS6rKOPzJTmGSvuMFZ3 4jV6euxS900YAQXDjEOIXJYLITbaaWUDi/OefFvWrz+CemExP1xfiozBqDRPwxPpSmHt 1qYQ== X-Gm-Message-State: AFqh2kq7p4NqOS7OPN62x3U7V3r3ob3j6ELD/lC5Irz1iZuTFJIztu6m Mkk71k9451NlZtlWHvOX4h33pwhv5mb6wj6T X-Google-Smtp-Source: AMrXdXvWG7xcUGOUpgh3YFTt+CPFUf7TwcKA+mL7/QGv6LAVJKwcJ5XHoU93PSXd60PvcRq90rS7Bw== X-Received: by 2002:ac2:5dce:0:b0:4b5:b988:b409 with SMTP id x14-20020ac25dce000000b004b5b988b409mr18504737lfq.21.1673363885739; Tue, 10 Jan 2023 07:18:05 -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 v3 2/6] xen/riscv: introduce asm/types.h header file Date: Tue, 10 Jan 2023 17:17:55 +0200 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Signed-off-by: Oleksii Kurochko --- Changes in V3: - Nothing changed --- Changes in V2: - Remove unneeded now types from --- xen/arch/riscv/include/asm/types.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 xen/arch/riscv/include/asm/types.h diff --git a/xen/arch/riscv/include/asm/types.h b/xen/arch/riscv/include/asm/types.h new file mode 100644 index 0000000000..fbe352ef20 --- /dev/null +++ b/xen/arch/riscv/include/asm/types.h @@ -0,0 +1,22 @@ +#ifndef __RISCV_TYPES_H__ +#define __RISCV_TYPES_H__ + +#ifndef __ASSEMBLY__ + +#if defined(__SIZE_TYPE__) +typedef __SIZE_TYPE__ size_t; +#else +typedef unsigned long size_t; +#endif + +#endif /* __ASSEMBLY__ */ + +#endif /* __RISCV_TYPES_H__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ From patchwork Tue Jan 10 15:17:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13095268 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 B4449C54EBC for ; Tue, 10 Jan 2023 15:18:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.474744.736085 (Exim 4.92) (envelope-from ) id 1pFGOA-0005zt-Kw; Tue, 10 Jan 2023 15:18:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 474744.736085; Tue, 10 Jan 2023 15:18:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGOA-0005z7-Fu; Tue, 10 Jan 2023 15:18:10 +0000 Received: by outflank-mailman (input) for mailman id 474744; Tue, 10 Jan 2023 15:18:08 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGO8-0005G6-L7 for xen-devel@lists.xenproject.org; Tue, 10 Jan 2023 15:18:08 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fc4704db-90f9-11ed-91b6-6bf2151ebd3b; Tue, 10 Jan 2023 16:18:07 +0100 (CET) Received: by mail-lf1-x131.google.com with SMTP id bt23so18918759lfb.5 for ; Tue, 10 Jan 2023 07:18:07 -0800 (PST) Received: from fedora.. ([195.234.76.149]) by smtp.gmail.com with ESMTPSA id y19-20020a0565123f1300b00498fc3d4cfdsm2203396lfa.189.2023.01.10.07.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:06 -0800 (PST) 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: fc4704db-90f9-11ed-91b6-6bf2151ebd3b 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=k39j5USYdhYFET9upYnjISkYGgRbZovPpm53v/syNJU=; b=K0+5gplvcbHPCg9qsE3dFmBBiOcnrjo7e6fXQMSMTGWGGAkkmvAC0kMBUKdVS2/g/U odrC33pI1EF18bSUdwqhQKOffPEh/O4yIR5P8EOrxbxTeK/jDhC8EqSvgqu6kuQaeke5 14M5BY4Pmc4xSv3ceefcgEzduhQHIbbd9E7WXat//1mle4drpoRcN9dj3077OkcNEQPo 6fYJyXpFSwlGVYBmZLNwdLk6u9Pzlr0YpLMtwxwQOjvBqI+HkfJ8Q9oFx1gH/PFUqRwP xhYSl/sWvt8fli6ksgToIm3RPkCvqF47ovfn/wqXcCfP0GQjsHG2UwzEWzxmH1orYIRo EnLA== 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=k39j5USYdhYFET9upYnjISkYGgRbZovPpm53v/syNJU=; b=mP7fzz2MW/qWLlpjwZjRhZhmXMWDprpLQehnlXc6czbdVBoRnO0DRGlyhPe+BjbuVj 0F6LUDUWb8wCFX6sN/dVeQtbPWrvnHqTm5RgAg/MvJjzA0TWJjQGks7hys6vU9AVIGam JLVrEvFvB8POwgOp0u8hJcA7i7oT/uhLRPlcH3q/zjNhGYxDhs6j2Nqi/p37Quncp7Bh +pa9Z3NeO0qt5M/jQyXKC4rd88DKRmTD/MrWDs/db+fSzaKHXemT793NQXIATUmIdu23 Fh04BPUtyaLxEFDcVKL5JezKk2GA5VvjSDeU8hRrNtVwlOmEAws63jY1xbRUPa8dQPQC LmqA== X-Gm-Message-State: AFqh2ko2X7k5DRI2zeWRRpebcawh/xYKCrVRhzaWfnpX/Sq/V9jNdnBY x5Szv3+MhWSjrjWFnpErV1kStT/gxmThqIFU X-Google-Smtp-Source: AMrXdXv0v/qAB6MI2pI2Ns3onWDvlHjYdHBeV1ydTInGa27X5jo6bnrF+YFaC+5dYBGgv/vaRENlvA== X-Received: by 2002:ac2:446b:0:b0:4b5:8504:feea with SMTP id y11-20020ac2446b000000b004b58504feeamr16675149lfl.24.1673363886777; Tue, 10 Jan 2023 07:18:06 -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 v3 3/6] xen/riscv: introduce stack stuff Date: Tue, 10 Jan 2023 17:17:56 +0200 Message-Id: <7d89e3811e6ea4f307862d6552ad7c7e58176518.1673362493.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 The patch introduces and sets up a stack in order to go to C environment Signed-off-by: Oleksii Kurochko Reviewed-by: Alistair Francis --- Changes in V3: - reorder headers in alphabetical order - merge changes related to start_xen() function from "[PATCH v2 7/8] xen/riscv: print hello message from C env" to this patch - remove unneeded parentheses in definition of STACK_SIZE --- Changes in V2: - introduce STACK_SIZE define. - use consistent padding between instruction mnemonic and operand(s) --- xen/arch/riscv/Makefile | 1 + xen/arch/riscv/include/asm/config.h | 2 ++ xen/arch/riscv/riscv64/head.S | 6 +++++- xen/arch/riscv/setup.c | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 xen/arch/riscv/setup.c diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index 248f2cbb3e..5a67a3f493 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_RISCV_64) += riscv64/ +obj-y += setup.o $(TARGET): $(TARGET)-syms $(OBJCOPY) -O binary -S $< $@ diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h index 0370f865f3..763a922a04 100644 --- a/xen/arch/riscv/include/asm/config.h +++ b/xen/arch/riscv/include/asm/config.h @@ -43,6 +43,8 @@ #define SMP_CACHE_BYTES (1 << 6) +#define STACK_SIZE PAGE_SIZE + #endif /* __RISCV_CONFIG_H__ */ /* * Local variables: diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S index 990edb70a0..d444dd8aad 100644 --- a/xen/arch/riscv/riscv64/head.S +++ b/xen/arch/riscv/riscv64/head.S @@ -1,4 +1,8 @@ .section .text.header, "ax", %progbits ENTRY(start) - j start + la sp, cpu0_boot_stack + li t0, STACK_SIZE + add sp, sp, t0 + + tail start_xen diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c new file mode 100644 index 0000000000..13e24e2fe1 --- /dev/null +++ b/xen/arch/riscv/setup.c @@ -0,0 +1,14 @@ +#include +#include + +/* Xen stack for bringing up the first CPU. */ +unsigned char __initdata cpu0_boot_stack[STACK_SIZE] + __aligned(STACK_SIZE); + +void __init noreturn start_xen(void) +{ + for ( ;; ) + asm volatile ("wfi"); + + unreachable(); +} From patchwork Tue Jan 10 15:17:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13095267 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 C589AC678D5 for ; Tue, 10 Jan 2023 15:18:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.474745.736090 (Exim 4.92) (envelope-from ) id 1pFGOA-00063d-WD; Tue, 10 Jan 2023 15:18:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 474745.736090; Tue, 10 Jan 2023 15:18:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGOA-00062R-OB; Tue, 10 Jan 2023 15:18:10 +0000 Received: by outflank-mailman (input) for mailman id 474745; Tue, 10 Jan 2023 15:18:09 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGO9-0005G6-6Y for xen-devel@lists.xenproject.org; Tue, 10 Jan 2023 15:18:09 +0000 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [2a00:1450:4864:20::12e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fcf25e3e-90f9-11ed-91b6-6bf2151ebd3b; Tue, 10 Jan 2023 16:18:08 +0100 (CET) Received: by mail-lf1-x12e.google.com with SMTP id cf42so18983025lfb.1 for ; Tue, 10 Jan 2023 07:18:08 -0800 (PST) Received: from fedora.. ([195.234.76.149]) by smtp.gmail.com with ESMTPSA id y19-20020a0565123f1300b00498fc3d4cfdsm2203396lfa.189.2023.01.10.07.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:07 -0800 (PST) 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: fcf25e3e-90f9-11ed-91b6-6bf2151ebd3b 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=TVqSKi3nBOpTA6dXyBr5PLcPAxdksP3ri3d2O1B85MY=; b=e2u5zuLmD7mk4FxQARC1xRPXgyKyXnF3t4Yk95+zbf8PkkCQhdV7QU9z0YjZZsD6qI cmAw/MNs2iw1wZEbQjHLjeNOigxMPX6cmixeVIZaCwIHK51wKDb5nvrDcObYubWFzD+c S6Sz7Fw8ztE40Cb7wBCn1cyN9Tx72k28cD1nISynFxkcqfn4Dd87EuQkZavg0ihrrxKO ue29Tp3yoyJFBy4tf8D8kG02PwjrGx1CWtqcelIw+lqiZ0WQj1vSq9WBFKJJ6IJxDFin W7tiSBtmRyADQyhuTHq+BjTYMVQXlVtQdIoKUC6vyp7pzUrLAwgT/GusaQNxQLwX1nxD m7+A== 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=TVqSKi3nBOpTA6dXyBr5PLcPAxdksP3ri3d2O1B85MY=; b=JCDwHbqrIfGjLo9FFcjyizeL3hFM3uyD34c+yAM/aCRpfGVo0iQpYh4Nwu+D7dYSYJ T8+l61DkQY7+Cnu8yIITv69qnVH+b8/dAX2iELTOqz3nMJX4Mf7nAoKm4/kAKbFIlG+m lkLnnl4npQg/B5Y5cb8tpzd4HF319z1T6LICFumeKaml5EhIM0laadYMhlnA+/wdKpgG Cu6lj8cK62hF8aqY4tpqvX6AFhZuys+66/8Xo/+1vPoIkI5VeuvHg6ahKFIGsUf3LPft LmTufIJR8RHIjzUTeLyoRI+vG3TEBvH/T+3c4hl5+LVhqfghIpevS5Q9O5qTVJg6yZ9b 2lSQ== X-Gm-Message-State: AFqh2kpIBfUlN8e0soFnwZICXrL4Z3XMY2aKlAw9ant4ErMWM9/2CEN1 uUg1URpynkBpDLitIoyrGUFUdUwGM+6FGP12 X-Google-Smtp-Source: AMrXdXvEEnHVFscJyoj3h6ACK+mgIxiDwomDke1B0mbazKc+zfgoTaWIWDhMTSP1SuM7C7x5V83Fkw== X-Received: by 2002:a05:6512:3d11:b0:4b5:2ef3:fd2a with SMTP id d17-20020a0565123d1100b004b52ef3fd2amr32153648lfv.47.1673363887859; Tue, 10 Jan 2023 07:18:07 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Julien Grall , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Bobby Eshleman , Bob Eshleman , Alistair Francis , Connor Davis , Oleksii Kurochko Subject: [PATCH v3 4/6] xen/riscv: introduce sbi call to putchar to console Date: Tue, 10 Jan 2023 17:17:57 +0200 Message-Id: X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 From: Bobby Eshleman Originally SBI implementation for Xen was introduced by Bobby Eshleman but it was removed all the stuff for simplicity except SBI call for putting character to console. The patch introduces sbi_putchar() SBI call which is necessary to implement initial early_printk. Signed-off-by: Bobby Eshleman Signed-off-by: Oleksii Kurochko --- Changes in V3: - update copyright's year - rename define __CPU_SBI_H__ to __ASM_RISCV_SBI_H__ - fix identations - change an author of the commit --- Changes in V2: - add an explanatory comment about sbi_console_putchar() function. - order the files alphabetically in Makefile --- xen/arch/riscv/Makefile | 1 + xen/arch/riscv/include/asm/sbi.h | 34 ++++++++++++++++++++++++ xen/arch/riscv/sbi.c | 45 ++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 xen/arch/riscv/include/asm/sbi.h create mode 100644 xen/arch/riscv/sbi.c diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index 5a67a3f493..fd916e1004 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -1,4 +1,5 @@ obj-$(CONFIG_RISCV_64) += riscv64/ +obj-y += sbi.o obj-y += setup.o $(TARGET): $(TARGET)-syms diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h new file mode 100644 index 0000000000..0e6820a4ed --- /dev/null +++ b/xen/arch/riscv/include/asm/sbi.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: (GPL-2.0-or-later) */ +/* + * Copyright (c) 2021-2023 Vates SAS. + * + * Taken from xvisor, modified by Bobby Eshleman (bobby.eshleman@gmail.com). + * + * Taken/modified from Xvisor project with the following copyright: + * + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + */ + +#ifndef __ASM_RISCV_SBI_H__ +#define __ASM_RISCV_SBI_H__ + +#define SBI_EXT_0_1_CONSOLE_PUTCHAR 0x1 + +struct sbiret { + long error; + long value; +}; + +struct sbiret sbi_ecall(unsigned long ext, unsigned long fid, + unsigned long arg0, unsigned long arg1, + unsigned long arg2, unsigned long arg3, + unsigned long arg4, unsigned long arg5); + +/** + * Writes given character to the console device. + * + * @param ch The data to be written to the console. + */ +void sbi_console_putchar(int ch); + +#endif /* __ASM_RISCV_SBI_H__ */ diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c new file mode 100644 index 0000000000..dc0eb44bc6 --- /dev/null +++ b/xen/arch/riscv/sbi.c @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Taken and modified from the xvisor project with the copyright Copyright (c) + * 2019 Western Digital Corporation or its affiliates and author Anup Patel + * (anup.patel@wdc.com). + * + * Modified by Bobby Eshleman (bobby.eshleman@gmail.com). + * + * Copyright (c) 2019 Western Digital Corporation or its affiliates. + * Copyright (c) 2021-2023 Vates SAS. + */ + +#include +#include + +struct sbiret sbi_ecall(unsigned long ext, unsigned long fid, + unsigned long arg0, unsigned long arg1, + unsigned long arg2, unsigned long arg3, + unsigned long arg4, unsigned long arg5) +{ + struct sbiret ret; + + register unsigned long a0 asm ("a0") = arg0; + register unsigned long a1 asm ("a1") = arg1; + register unsigned long a2 asm ("a2") = arg2; + register unsigned long a3 asm ("a3") = arg3; + register unsigned long a4 asm ("a4") = arg4; + register unsigned long a5 asm ("a5") = arg5; + register unsigned long a6 asm ("a6") = fid; + register unsigned long a7 asm ("a7") = ext; + + asm volatile ("ecall" + : "+r" (a0), "+r" (a1) + : "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7) + : "memory"); + ret.error = a0; + ret.value = a1; + + return ret; +} + +void sbi_console_putchar(int ch) +{ + sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0); +} From patchwork Tue Jan 10 15:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13095270 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 CCCA3C67871 for ; Tue, 10 Jan 2023 15:18:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.474746.736096 (Exim 4.92) (envelope-from ) id 1pFGOB-00068P-Ap; Tue, 10 Jan 2023 15:18:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 474746.736096; Tue, 10 Jan 2023 15:18:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGOB-00065E-0t; Tue, 10 Jan 2023 15:18:11 +0000 Received: by outflank-mailman (input) for mailman id 474746; Tue, 10 Jan 2023 15:18:10 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGOA-0005G6-AI for xen-devel@lists.xenproject.org; Tue, 10 Jan 2023 15:18:10 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fd9ff4e1-90f9-11ed-91b6-6bf2151ebd3b; Tue, 10 Jan 2023 16:18:09 +0100 (CET) Received: by mail-lf1-x134.google.com with SMTP id v25so18922394lfe.12 for ; Tue, 10 Jan 2023 07:18:09 -0800 (PST) Received: from fedora.. ([195.234.76.149]) by smtp.gmail.com with ESMTPSA id y19-20020a0565123f1300b00498fc3d4cfdsm2203396lfa.189.2023.01.10.07.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:08 -0800 (PST) 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: fd9ff4e1-90f9-11ed-91b6-6bf2151ebd3b 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=+4b0mCw5TWzzOfe9k1UrEZyIfTtwrFP3j0Uq+Wi1atU=; b=XvQ0/I+z48juzNDTq8nzooq2ZPekH2xUSqZvlbohxfYhFJZ81wYOyb19SIA/idZOET 1LSYl7gVq2SJgJDIeDVMmj8OLR6bvModgWrPzFBBngFOChV4+SYXxO9/gxkKwm2EUikJ 6seJ1954bJ4UVpnCtNHN2g3te/FnsdUEgj92ZKZNWevHNUqWgTOrErEybjqAVHdDkoLg cy6MKyKYXyEsEChdUziQU2BxLcb1JXg+nnb6WWP7Ryh4veGy2x00te/wwlWrUhREEcG6 JkJKI/ceOiTsKHPaG68MNGuHGhZ6o4ZTrfXwWbqiD1NNnfrV7hP9e148/5puEI9xrj7q ot3A== 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=+4b0mCw5TWzzOfe9k1UrEZyIfTtwrFP3j0Uq+Wi1atU=; b=GPBQlco/ktccUHrALcHrWZC8Q81cWryEH0oKPRgTqzbo5pLOlamJTM1CpHX5B5v6o9 CFjF6cw+efEn0Qw4oWxnZSQfo4e0n36/3TXjgaXicnhezlXDvqgjFJGo9Jrsz3x3qRFr mx7V5AeQDSXdr8ZaFAji02DMiokFIYD+EAOuiimZdGL/eN8U1vDL5OyVlAghlNkYIwer QwSJhXD4ukQuurrttGeq3eDHfbSatqcqWSxGVQO3u05otvwXLzqfXh5DVf7KZCYQOYAW 3UgoXqsOZrOEqypvfPv69HP0XSn730OD/P9sp0rRSwVY4VswQB5nkBKd+zdsPnes5vzX Bdhw== X-Gm-Message-State: AFqh2koRSiNbEksNL8Fon5RkYz5lwU3fA0EIP+m0SLzFbqaoZCv32KKH tdJ7W3WLcmwgRy9S0UOyFz+tgdCtwnYUU6cG X-Google-Smtp-Source: AMrXdXsaqM3PTnIRlw1RNlmG8XdcZtW5YW9PgDIR2zm2mvrS1lTxNUQV4v/ttVeXp1U7869rBWk4Yw== X-Received: by 2002:a05:6512:3d94:b0:4a4:68b8:f4f4 with SMTP id k20-20020a0565123d9400b004a468b8f4f4mr24770124lfv.58.1673363889023; Tue, 10 Jan 2023 07:18:09 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Julien Grall , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Bobby Eshleman , Bob Eshleman , Alistair Francis , Connor Davis , Oleksii Kurochko Subject: [PATCH v3 5/6] xen/riscv: introduce early_printk basic stuff Date: Tue, 10 Jan 2023 17:17:58 +0200 Message-Id: <25cd3586fa51980279f25a82eed5ded1622bc212.1673362493.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 From: Bobby Eshleman The patch introduces a basic stuff of early_printk functionality which will be enough to print 'hello from C environment". early_printk() function was changed in comparison with original as common isn't being built now so there is no vscnprintf. Because printk() relies on a serial driver (like the ns16550 driver) and drivers require working virtual memory (ioremap()) there is not print functionality early in Xen boot. This commit adds early printk implementation built on the putc SBI call. As sbi_console_putchar() is being already planned for deprecation it is used temporary now and will be removed or reworked after real uart will be ready. Signed-off-by: Bobby Eshleman Signed-off-by: Oleksii Kurochko --- Changes in V3: - reorder "include
" in erly_printk.c - change an author of the commit --- Changes in V2: - add license to early_printk.c - add signed-off-by Bobby - add RISCV_32 to Kconfig.debug to EARLY_PRINTK config - update commit message - order the files alphabetically in Makefile --- xen/arch/riscv/Kconfig.debug | 7 +++++ xen/arch/riscv/Makefile | 1 + xen/arch/riscv/early_printk.c | 33 +++++++++++++++++++++++ xen/arch/riscv/include/asm/early_printk.h | 12 +++++++++ xen/arch/riscv/setup.c | 4 +++ 5 files changed, 57 insertions(+) create mode 100644 xen/arch/riscv/early_printk.c create mode 100644 xen/arch/riscv/include/asm/early_printk.h diff --git a/xen/arch/riscv/Kconfig.debug b/xen/arch/riscv/Kconfig.debug index e69de29bb2..e21649781d 100644 --- a/xen/arch/riscv/Kconfig.debug +++ b/xen/arch/riscv/Kconfig.debug @@ -0,0 +1,7 @@ +config EARLY_PRINTK + bool "Enable early printk" + default DEBUG + depends on RISCV_64 || RISCV_32 + help + + Enables early printk debug messages diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile index fd916e1004..1a4f1a6015 100644 --- a/xen/arch/riscv/Makefile +++ b/xen/arch/riscv/Makefile @@ -1,3 +1,4 @@ +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_RISCV_64) += riscv64/ obj-y += sbi.o obj-y += setup.o diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c new file mode 100644 index 0000000000..348c21bdaa --- /dev/null +++ b/xen/arch/riscv/early_printk.c @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * RISC-V early printk using SBI + * + * Copyright (C) 2021 Bobby Eshleman + */ +#include +#include + +/* + * TODO: + * sbi_console_putchar is already planned for deprecation + * so it should be reworked to use UART directly. +*/ +void early_puts(const char *s, size_t nr) +{ + while ( nr-- > 0 ) + { + if (*s == '\n') + sbi_console_putchar('\r'); + sbi_console_putchar(*s); + s++; + } +} + +void early_printk(const char *str) +{ + while (*str) + { + early_puts(str, 1); + str++; + } +} diff --git a/xen/arch/riscv/include/asm/early_printk.h b/xen/arch/riscv/include/asm/early_printk.h new file mode 100644 index 0000000000..05106e160d --- /dev/null +++ b/xen/arch/riscv/include/asm/early_printk.h @@ -0,0 +1,12 @@ +#ifndef __EARLY_PRINTK_H__ +#define __EARLY_PRINTK_H__ + +#include + +#ifdef CONFIG_EARLY_PRINTK +void early_printk(const char *str); +#else +static inline void early_printk(const char *s) {}; +#endif + +#endif /* __EARLY_PRINTK_H__ */ diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 13e24e2fe1..d09ffe1454 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,12 +1,16 @@ #include #include +#include + /* Xen stack for bringing up the first CPU. */ unsigned char __initdata cpu0_boot_stack[STACK_SIZE] __aligned(STACK_SIZE); void __init noreturn start_xen(void) { + early_printk("Hello from C env\n"); + for ( ;; ) asm volatile ("wfi"); From patchwork Tue Jan 10 15:17:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13095271 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 B4C28C678D6 for ; Tue, 10 Jan 2023 15:18:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.474747.736118 (Exim 4.92) (envelope-from ) id 1pFGOD-0006rO-Oj; Tue, 10 Jan 2023 15:18:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 474747.736118; Tue, 10 Jan 2023 15:18:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGOD-0006qz-KG; Tue, 10 Jan 2023 15:18:13 +0000 Received: by outflank-mailman (input) for mailman id 474747; Tue, 10 Jan 2023 15:18:11 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pFGOB-0005G6-E0 for xen-devel@lists.xenproject.org; Tue, 10 Jan 2023 15:18:11 +0000 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [2a00:1450:4864:20::12a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id fe5a9a3b-90f9-11ed-91b6-6bf2151ebd3b; Tue, 10 Jan 2023 16:18:10 +0100 (CET) Received: by mail-lf1-x12a.google.com with SMTP id d30so14048152lfv.8 for ; Tue, 10 Jan 2023 07:18:10 -0800 (PST) Received: from fedora.. ([195.234.76.149]) by smtp.gmail.com with ESMTPSA id y19-20020a0565123f1300b00498fc3d4cfdsm2203396lfa.189.2023.01.10.07.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 07:18:09 -0800 (PST) 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: fe5a9a3b-90f9-11ed-91b6-6bf2151ebd3b 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=0syX+Z8ZsLO1K+qpK4hh/FiHzxvRksi171obTN3jJ5s=; b=Seey/dkCQRMk/iJocB/HBc0GgJnYzseGgxmfJDzEi5gt6+ob6lcNEkTYzUt+FwXLLG qXUCORaM5iafVcoX8VoTRr5loffmCABlS2bqkcTCtW9lt92+CRD8pzuuuDbRMuvo0nqN OFuf+ihwuoohMSMxzc7qjx0pZ7ksSdIjysXs3HvSSHe92nm61P0QwvswqVKUUd4i47Zz 4cTmCmK0ftorLJzQvV2smQgFZfGCyDDBJYE1WLaJB4f9Ps1JnLDSJDbZ99oArjjNwrXO gFknI3JZAL8zCz4R5wsa2pkM6VMdxpcQBk3yYqCy2FpsVfUUOKGMzZegd8sSplxS4+it pWnw== 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=0syX+Z8ZsLO1K+qpK4hh/FiHzxvRksi171obTN3jJ5s=; b=FZ75vsgLIvgYPXaIxSIiNlWf0Eav7MNooaOKN+ijmY08Mj8xshKi1LHNMiIL2rXRNt HVU2HUobHmZVPu0NtnkFcPoaV3dcthIlHawyk2+H0cNlyqE4nMJbox4sJemXF4bNGrGE 4qVpisfsgZgNRL2HI6eT9fWxH59JV0T/+SWiau30q3nuJWs53TjCXmiB0q9bACs3a8Oa GUWJsN9O1bEHN/3+RLfJdagOchrbim0PHrvm1b9h7lZAhSIev6kObrOYDgtMQQ1Y545D +aq+GwgV9wrRrls1v/nR2JEz6Dr85YaWSVkyDDydK7/457cK0jeNWc73zZMZh4PMvrQe Gj1g== X-Gm-Message-State: AFqh2kprWF0rW0Y1KmsaygF2UGSxVca1kOZA14SOAMMKVmVwC1wtrRLe 8hmb8TpbynUEjBSh8TYrZXkZi6jJddwvo2Le X-Google-Smtp-Source: AMrXdXsFr5BRkDWcCuVCxV1t9ah3Jggix5v9K7BgRPKnGRUnn6vsP+toxhtmFOCv3YC5BZh9d6NRBg== X-Received: by 2002:a05:6512:400d:b0:4b5:936e:69df with SMTP id br13-20020a056512400d00b004b5936e69dfmr22497064lfb.53.1673363890034; Tue, 10 Jan 2023 07:18:10 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Julien Grall , Andrew Cooper , Stefano Stabellini , Gianluca Guida , Oleksii Kurochko , Doug Goldstein Subject: [PATCH v3 6/6] automation: add RISC-V smoke test Date: Tue, 10 Jan 2023 17:17:59 +0200 Message-Id: <7a7eeba57589465e34be00f3d031866abe53e466.1673362493.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 Add check if there is a message 'Hello from C env' presents in log file to be sure that stack is set and C part of early printk is working. Signed-off-by: Oleksii Kurochko Acked-by: Stefano Stabellini --- Changes in V3: - Nothing changed - All mentioned comments by Stefano in Xen mailing list will be fixed as a separate patch out of this patch series. --- Changes in V2: - Move changes in the dockerfile to separate patch and send it to mailing list separately: [PATCH] automation: add qemu-system-riscv to riscv64.dockerfile - Update test.yaml to wire up smoke test --- automation/gitlab-ci/test.yaml | 20 ++++++++++++++++++++ automation/scripts/qemu-smoke-riscv64.sh | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 automation/scripts/qemu-smoke-riscv64.sh diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml index afd80adfe1..64f47a0ab9 100644 --- a/automation/gitlab-ci/test.yaml +++ b/automation/gitlab-ci/test.yaml @@ -54,6 +54,19 @@ tags: - x86_64 +.qemu-riscv64: + extends: .test-jobs-common + variables: + CONTAINER: archlinux:riscv64 + LOGFILE: qemu-smoke-riscv64.log + artifacts: + paths: + - smoke.serial + - '*.log' + when: always + tags: + - x86_64 + .yocto-test: extends: .test-jobs-common script: @@ -234,6 +247,13 @@ qemu-smoke-x86-64-clang-pvh: needs: - debian-unstable-clang-debug +qemu-smoke-riscv64-gcc: + extends: .qemu-riscv64 + script: + - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE} + needs: + - riscv64-cross-gcc + # Yocto test jobs yocto-qemuarm64: extends: .yocto-test-arm64 diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh new file mode 100755 index 0000000000..e0f06360bc --- /dev/null +++ b/automation/scripts/qemu-smoke-riscv64.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -ex + +# Run the test +rm -f smoke.serial +set +e + +timeout -k 1 2 \ +qemu-system-riscv64 \ + -M virt \ + -smp 1 \ + -nographic \ + -m 2g \ + -kernel binaries/xen \ + |& tee smoke.serial + +set -e +(grep -q "Hello from C env" smoke.serial) || exit 1 +exit 0