From mboxrd@z Thu Jan 1 00:00:00 1970 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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 0B354C64E8A for ; Mon, 30 Nov 2020 17:50:32 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 B0D0B20789 for ; Mon, 30 Nov 2020 17:50:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UTkaIqcm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B0D0B20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=CwuxozjoXVyT7g5vxRGKo6erPr/a2X/VkOy/XLMc4qQ=; b=UTkaIqcmhfefQiPSThU70+MkcV ++M2OqEozKoyt0/rWeT7ZGjJlA8d/q+6OqCK4aX+U26C26Y+h3Lg2+9LVoVnKb/1wpBYhbOjGAwK9 6xTyKSKgsNdspbeh5I3mpb92IVGSngKhlNavCX+wE1KNW/+UM/vI/PluPxVwhDJyEQyydUjjx6HZV 2jL8Xnio2alHRa0fn9wkeOfpABXaBOlt8gi/gvOMKH1JtahqNrFoqZU+cVM9qviyCDDShtpPGPek3 3yAhSA86zkRzoVuOhV09w/tdSz07y1EK4k/ntyjAOMSDkfpNRzxhsLttWDvgU8znNLAs3cEysoOpC AYQD+xEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjnIZ-0005RD-OT; Mon, 30 Nov 2020 17:49:16 +0000 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kjnIG-0005KX-7M for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2020 17:48:58 +0000 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R121e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04407; MF=rongwei.wang@linux.alibaba.com; NM=1; PH=DS; RN=16; SR=0; TI=SMTPD_---0UH3N1OB_1606758525; Received: from localhost.localdomain(mailfrom:rongwei.wang@linux.alibaba.com fp:SMTPD_---0UH3N1OB_1606758525) by smtp.aliyun-inc.com(127.0.0.1); Tue, 01 Dec 2020 01:48:46 +0800 From: Rongwei Wang To: catalin.marinas@arm.com, will@kernel.org, bjorn.andersson@linaro.org, shawnguo@kernel.org Subject: [PATCH 0/3] arm64:msr: Add MSR driver Date: Tue, 1 Dec 2020 01:48:30 +0800 Message-Id: <20201130174833.41315-1-rongwei.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201130_124856_499196_1192B738 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gshan@redhat.com, geert+renesas@glider.be, Anson.Huang@nxp.com, masahiroy@kernel.org, michael@walle.cc, krzk@kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, olof@lixom.net, vincenzo.frascino@arm.com, ardb@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi MSR ARM driver aims to provide interfacs for user to read or write data to all system registers. Its functions is same as MSR driver (x86 platform). It mainly depends on kprobe and undef exception to read or write system registers dynamicly. In addition, this module create interfaces for each core. We have tested in the virtual machine using tree command: $ tree /dev/cpu /dev/cpu |-- 0 | `-- msr |-- 1 | `-- msr |-- 2 | `-- msr |-- 3 | `-- msr |-- 4 | `-- msr |-- 5 | `-- msr |-- 6 | `-- msr `-- 7 `-- msr 8 directories, 8 files The interfaces of this module is same as MSR module in user space, and to solve the problem that ARM platform has no similar MSR module. Using this interface, we did some pressure tests to test the stability and security of MSR driver. The test results show that the driver will not cause system panic if various illegal values and multithreading concurrent access are passed through the interface. We also designed a user space tool: system-register-tools. We have open sourced this tool, which link as follows: https://github.com/alibaba/system-register-tools In this tools, we provide two command: rdasr and wrasr, the aboving MSR driver has been tested by: $ rdasr -t 0: OSDTRRX_EL1 : UNDEFINED or unreadable! 1: DBGBVR0_EL1 : 0x0 2: DBGBCR0_EL1 : 0x1e0 3: DBGWVR0_EL1 : 0x0 4: DBGWCR0_EL1 : 0x0 5: DBGBVR1_EL1 : 0x0 6: DBGBCR1_EL1 : 0x1e0 7: DBGWVR1_EL1 : 0x0 8: DBGWCR1_EL1 : 0x0 9: MDCCINT_EL1 : 0x0 10: MDSCR_EL1 : 0x1000 11: DBGBVR2_EL1 : 0x0 ... ... 598: ICC_IGRPEN1_EL3 : UNDEFINED or unreadable! 599: TPIDR_EL3 : UNDEFINED or unreadable! 600: SCXTNUM_EL3 : UNDEFINED or unreadable! 601: CNTPS_TVAL_EL1 : UNDEFINED or unreadable! 602: CNTPS_CTL_EL1 : UNDEFINED or unreadable! 603: CNTPS_CVAL_EL1 : UNDEFINED or unreadable! 604: CNTPS_CVAL_EL1 : UNDEFINED or unreadable! The test ended and no system exception occurred! Undefined or unreadable registers: 409 Readable registers: 196 The above is a test of more than 600 system registers, and no system exception occurred Rongwei Wang (3): arm64:insn: Export the symbol to modify code text arm64:msr: Introduce MSR ARM driver arm64:msr: Enable MSR ARM driver arch/arm64/Kconfig | 9 + arch/arm64/configs/defconfig | 1 + arch/arm64/include/asm/msr_arm.h | 80 ++++++++ arch/arm64/kernel/Makefile | 3 +- arch/arm64/kernel/insn.c | 1 + arch/arm64/kernel/msr_arm.c | 406 +++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/msr_smp.c | 297 ++++++++++++++++++++++++++++ 7 files changed, 796 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/include/asm/msr_arm.h create mode 100644 arch/arm64/kernel/msr_arm.c create mode 100644 arch/arm64/kernel/msr_smp.c -- 1.8.3.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel