From patchwork Fri Feb 24 15:06:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13151342 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 0B1F2C678D5 for ; Fri, 24 Feb 2023 15:06:52 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.501139.772765 (Exim 4.92) (envelope-from ) id 1pVZem-0006uc-RN; Fri, 24 Feb 2023 15:06:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 501139.772765; Fri, 24 Feb 2023 15:06:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pVZem-0006uP-OZ; Fri, 24 Feb 2023 15:06:44 +0000 Received: by outflank-mailman (input) for mailman id 501139; Fri, 24 Feb 2023 15:06:43 +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 1pVZel-0006Ou-Ew for xen-devel@lists.xenproject.org; Fri, 24 Feb 2023 15:06:43 +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 d91818c7-b454-11ed-88bb-e56d68cac8db; Fri, 24 Feb 2023 16:06:43 +0100 (CET) Received: by mail-lf1-x12a.google.com with SMTP id k14so17292528lfj.7 for ; Fri, 24 Feb 2023 07:06:43 -0800 (PST) Received: from 34-6F-24-FC-D2-65.. (46.204.108.92.nat.umts.dynamic.t-mobile.pl. [46.204.108.92]) by smtp.gmail.com with ESMTPSA id d23-20020ac25457000000b004d863fa8681sm1492443lfn.173.2023.02.24.07.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Feb 2023 07:06:42 -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: d91818c7-b454-11ed-88bb-e56d68cac8db 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=X/gSRFTkaEkbR97ZxT3k+xBfRgzno3qG9xfy82tbgR4=; b=KpaLs9XDqIEFJGBISyk8iVLbk6s7isw+z2/FCAbm6+7xC6SY7A0ewqbumbWNCnrMvQ JvoYHnJPaW24kXfuzDH1Bf5hTs7vltWdDTSNGyk4Zu95zdXgZABR4i35RRK6rtRrpo0Z YwN0jQ6/cuWW8gL1gifIpgFs7ARDBFaISO7ndeSJC46aYexrRwhlt0LHHikRMoDzCusi ElJwvIkyD2ub4iEtAzRa1ttQttyYojZm+oz1kwydk1kuM3CALwpPEkex4KlbdHVaSWuH 56JDKXoJKHHwscrKrZwptmos84T2OMkUhyLxAUgm9shR12+SzJ8d41/yDxrlluoexxkm iaaQ== 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=X/gSRFTkaEkbR97ZxT3k+xBfRgzno3qG9xfy82tbgR4=; b=x5IkIonnvJNKuVdWyr/Tge7mu0Re9OuPGo8cw91jut2n1tF+aCfvTW3mmYRdeUAzOM iRxKS+V5zPuShQwkvekuikQB5FIoaPOPwbwoq57vkr8f4Vvp/kGoar/wqIO+7eTLuiwB lg+oDi0XwW54h+CFcIDmiLnEbronSQAhy/Yb/R5iMiIzB1ro0WXrKlcPvZqbR1VzcSYi k4Lt21y6Pqb/Nrebn7dU+xIdbuFjXTsjuNAvWPpph38SnDBimJlVesPapT434a5ilPyZ pFhsFX9G2BuJ1wp4m2rkGQVqxHpLZPQM4VEwzQIjzJ3NbrABDNVVI7TEgGnH7NiPikbz hGHw== X-Gm-Message-State: AO0yUKWo1nCl8eaxba9dXtLt6OizDV0xHkxenwPhF4xrUrK1ecnyjVpi tfQi1TXoGzllsBfEGxKAHVlT+XjLbFc= X-Google-Smtp-Source: AK7set9qr9ZwCV993coDibwSZiYqqCn2yTQnL7BMb3eCLn+q32l0dNLfCPvrA7NMVssXL087GeITSg== X-Received: by 2002:a19:700d:0:b0:4dc:554b:d27e with SMTP id h13-20020a19700d000000b004dc554bd27emr5013319lfc.65.1677251202580; Fri, 24 Feb 2023 07:06:42 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Andrew Cooper , Stefano Stabellini , Gianluca Guida , Oleksii Kurochko , Bob Eshleman , Alistair Francis , Connor Davis Subject: [PATCH v1 2/3] xen/riscv: setup initial pagetables Date: Fri, 24 Feb 2023 17:06:34 +0200 Message-Id: <83444f8f90cf2adf431762d919ba958a25ff8ce4.1677250203.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: References: MIME-Version: 1.0 Calculate load and linker linker image addresses and setup initial pagetables. Signed-off-by: Oleksii Kurochko --- xen/arch/riscv/setup.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index b7cd438a1d..f69bc278bb 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,9 +1,11 @@ #include #include #include +#include #include #include +#include #include /* Xen stack for bringing up the first CPU. */ @@ -43,6 +45,11 @@ static void __init disable_fpu(void) void __init noreturn start_xen(void) { + unsigned long load_start = (unsigned long)start; + unsigned long load_end = load_start + (unsigned long)(_end - _start); + unsigned long linker_start = (unsigned long)_start; + unsigned long linker_end = (unsigned long)_end; + /* * The following things are passed by bootloader: * a0 -> hart_id @@ -65,6 +72,10 @@ void __init noreturn start_xen(void) test_macros_from_bug_h(); + setup_initial_pagetables(load_start, load_end, linker_start, linker_end); + + early_printk("MMU has been enabled\n"); + for ( ;; ) asm volatile ("wfi");