From patchwork Fri Dec 18 02:26:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yifei Jiang X-Patchwork-Id: 11981073 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D86F8C4361B for ; Fri, 18 Dec 2020 02:29:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0554023A62 for ; Fri, 18 Dec 2020 02:28:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0554023A62 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50612 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kq5Vq-00052J-O5 for qemu-devel@archiver.kernel.org; Thu, 17 Dec 2020 21:28:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kq5UU-0004AI-1Y; Thu, 17 Dec 2020 21:27:34 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:2614) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kq5UR-00053G-IK; Thu, 17 Dec 2020 21:27:33 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Cxt655GvKz7Gcx; Fri, 18 Dec 2020 10:26:37 +0800 (CST) Received: from huawei.com (10.174.186.236) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.498.0; Fri, 18 Dec 2020 10:27:06 +0800 From: Yifei Jiang To: , Subject: [PATCH v2 0/1] target-riscv: support QMP dump-guest-memory Date: Fri, 18 Dec 2020 10:26:52 +0800 Message-ID: <20201218022653.654-1-jiangyifei@huawei.com> X-Mailer: git-send-email 2.26.2.windows.1 MIME-Version: 1.0 X-Originating-IP: [10.174.186.236] X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.35; envelope-from=jiangyifei@huawei.com; helo=szxga07-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhang.zhanghailiang@huawei.com, sagark@eecs.berkeley.edu, kbastian@mail.uni-paderborn.de, victor.zhangxiaofeng@huawei.com, limingwang@huawei.com, Yifei Jiang , Alistair.Francis@wdc.com, palmer@dabbelt.com, fanliang@huawei.com, wu.wubin@huawei.com, dengkai1@huawei.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi, This patch supports QMP dump-guest-memory in RISC-V. We tested this feature by using following command: dump-guest-memory guest.memory. Then we used the gdb tool to debug guest.memory: gdb vmlinux guest.memory. The test result is as follow: 1. info registers ra 0xffffffe0008cb83c 0xffffffe0008cb83c <_raw_spin_lock_irqsave+28> sp 0xffffffe0012c3f70 0xffffffe0012c3f70 gp 0xffffffe0010d6048 0xffffffe0010d6048 <__compound_literal.109> tp 0xffffffe00127f200 0xffffffe00127f200 t0 0x1f8 504 t1 0x0 0 t2 0x3fd9bf5c3c 274236136508 fp 0xffffffe0012c3f80 0xffffffe0012c3f80 s1 0xffffffe0010d7228 -137421295064 a0 0x1 1 a1 0xffffffe00127f200 -137419558400 a2 0xffffffe00110a0b8 -137421086536 a3 0x3af32000 989011968 a4 0x35b2 13746 a5 0xffffffe03af6b880 -136449705856 a6 0x1c5d09af00 121820000000 a7 0x54494d45 1414090053 s2 0x1 1 s3 0xffffffe0010d73f0 -137421294608 s4 0x0 0 s5 0x0 0 s6 0x0 0 s7 0xc 12 s8 0x2000 8192 s9 0x80015708 2147571464 s10 0x0 0 s11 0x0 0 t3 0x2257d71 36011377 t4 0x0 0 t5 0x3ab0030 61538352 t6 0x3fffefb3a0 274876838816 pc 0xffffffe000201478 0xffffffe000201478 2. x/1024ux 0x80000000 0x80000000: 0x00050433 0x000584b3 0x00060933 0x62c000ef 0x80000010: 0x00050833 0x00040533 0x000485b3 0x00090633 0x80000020: 0x046358fd 0x1d630118 0x08171305 0x08130000 0x80000030: 0x48854868 0x0118282f 0x12081463 0x00000297 0x80000040: 0x48428293 0x00000317 0xfbc30313 0x0062b023 ... Changes since v1 1. Fix the build failure for RISC-V linux user. Yifei Jiang (1): target-riscv: support QMP dump-guest-memory target/riscv/arch_dump.c | 189 +++++++++++++++++++++++++++++++++++++++ target/riscv/cpu.c | 2 + target/riscv/cpu.h | 4 + target/riscv/cpu_bits.h | 1 + target/riscv/meson.build | 1 + 5 files changed, 197 insertions(+) create mode 100644 target/riscv/arch_dump.c