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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 206BEC6FA86 for ; Fri, 16 Sep 2022 12:22:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DADAC84BAC; Fri, 16 Sep 2022 14:22:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="XwRXc7aK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 799F884822; Thu, 15 Sep 2022 14:45:50 +0200 (CEST) Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0CCD5841B7 for ; Thu, 15 Sep 2022 14:45:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kconsul@ventanamicro.com Received: by mail-pg1-x52f.google.com with SMTP id g4so17268224pgc.0 for ; Thu, 15 Sep 2022 05:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=8NLiHb6Em14t3dCCYWL57wgMFjbxT2p7SlaZZ/ri59I=; b=XwRXc7aKd0sqQ9STAV1wwFYw5oycoAybf8uiSvMJOnYQLrScGo76425w5ytqHv0CZJ MJTfImuzJ+x1iLOTITn411WOKt7f2Rt7kxk7pSHwPg4US0CAuAOakIFeRHzdv/b/je1w KyuQkWzoH5QP/IMxoFPPNC817foDouS9ou8pb+GGZ1o+XoUZA2i+noXDsbXeXo16mSIA SGZ4XADm74dMjoRn3J63R9Tv1ABoMVNbAWNrUOmLXVL9ID3KwvWjNNsPXNOOpneQNwCe JsCypWUPAxtMRfgXGSMo/AGERyMPVcFGadTrR7QbkLG0PYuldPm5TxaxLZKSCSbPIC2Q OLPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=8NLiHb6Em14t3dCCYWL57wgMFjbxT2p7SlaZZ/ri59I=; b=FkhqX13Zznab+4zCEaDvdvR2IqNQGjctunQK6QcGqoxPRAzU8RJf45pHOMwEVeMAFs SZDMLMFwjx2/ENrDGmtzIPa8Znx7UbC5EFLMJJCPLSlCvRUPVrxb+1zeaPr8cN5jkEmr uJlQEAmASYdbp7yS3pWc9/tZnYGWOq6ovSLKxWV1li8z7Im2h9ZjjgDEKS3dwcGX9kyg AEFNDknP1zIfj7Z6HgphhEdZHitXTlgBhFDS68bWD35GfAqoGt8SwGEUu/rGwiIOUrzc RwuPuA0s8YVhSFTw803sZscfPcfEJwW0HvS0yXajdWCVnz6BpDQfJgKlSw7fxhcOgEwX U0qw== X-Gm-Message-State: ACgBeo0FIdmU0ZGW9L3rIrV71bcwAtxoUMSLaGAz57nxj+ViWfwtvsL8 4lSnBMQ40h3ctzp3BJ5L2ujgYQ== X-Google-Smtp-Source: AA6agR4QGgLnaRp0YGmoVfUuNimY+X5ahhKV1nR4BcatP7wviLNjR5fRpBW+H+XrR1vfzgnEDmhSrQ== X-Received: by 2002:a63:6cc7:0:b0:42b:7d8f:7136 with SMTP id h190-20020a636cc7000000b0042b7d8f7136mr35749077pgc.15.1663245940976; Thu, 15 Sep 2022 05:45:40 -0700 (PDT) Received: from performance-PowerEdge-T440.. ([103.97.165.210]) by smtp.googlemail.com with ESMTPSA id p15-20020a17090a680f00b002005114fbf5sm1595539pjj.22.2022.09.15.05.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 05:45:39 -0700 (PDT) From: Kautuk Consul To: Rick Chen , Leo , Sean Anderson , Bin Meng , Anup Patel , Heinrich Schuchardt Cc: u-boot@lists.denx.de, Kautuk Consul Subject: [PATCH 0/2] Add riscv semihosting support in u-boot Date: Thu, 15 Sep 2022 18:15:24 +0530 Message-Id: <20220915124526.1106011-1-kconsul@ventanamicro.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 16 Sep 2022 14:22:08 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Semihosting is a mechanism that enables code running on a target to communicate and use the Input/Output facilities on a host computer that is running a debugger. This patchset adds support for semihosting in u-boot for RISCV64 targets. Compilation and test commands for SPL and S-mode configurations ================================================================= U-Boot S-mode on QEMU virt ---------------------------- // Compilation of S-mode u-boot ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- make qemu-riscv64_smode_defconfig make // Run riscv 64-bit u-boot with opensbi on qemu qemu-system-riscv64 -M virt -m 256M -display none -serial stdio -bios\ opensbi/build/platform/generic/firmware/fw_jump.bin -kernel\ u-boot/u-boot.bin U-Boot SPL on QEMU virt ------------------------ // Compilation of u-boot-spl ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- make qemu-riscv64_spl_defconfig make OPENSBI=opensbi/build/platform/generic/firmware/fw_dynamic.bin // Run 64-bit u-boot-spl in qemu qemu-system-riscv64 -M virt -m 256M -display none -serial stdio -bios\ u-boot/spl/u-boot-spl.bin -device\ loader,file=u-boot/u-boot.itb,addr=0x80200000 Kautuk Consul (2): arch/riscv: add semihosting support for RISC-V board: qemu-riscv: enable semihosting arch/riscv/Kconfig | 45 ++++++++ arch/riscv/include/asm/semihosting.h | 11 ++ arch/riscv/include/asm/spl.h | 1 + arch/riscv/lib/Makefile | 7 ++ arch/riscv/lib/semihosting.c | 166 +++++++++++++++++++++++++++ arch/riscv/lib/semihosting_mmode.c | 77 +++++++++++++ arch/riscv/lib/semihosting_smode.c | 77 +++++++++++++ configs/qemu-riscv32_defconfig | 4 + configs/qemu-riscv32_smode_defconfig | 4 + configs/qemu-riscv32_spl_defconfig | 5 + configs/qemu-riscv64_defconfig | 4 + configs/qemu-riscv64_smode_defconfig | 4 + configs/qemu-riscv64_spl_defconfig | 5 + include/configs/qemu-riscv.h | 2 + 14 files changed, 412 insertions(+) create mode 100644 arch/riscv/include/asm/semihosting.h create mode 100644 arch/riscv/lib/semihosting.c create mode 100644 arch/riscv/lib/semihosting_mmode.c create mode 100644 arch/riscv/lib/semihosting_smode.c -- 2.34.1