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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 BA935C433ED for ; Mon, 17 May 2021 18:05:17 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 7DD1C61028 for ; Mon, 17 May 2021 18:05:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DD1C61028 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc: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=bXocxRZG/2oWMU8kh8C2lP/kLP/+h9Qp2Spjm8I+UHM=; b=lv0YyYxqWZEpaqpgdOqa9XzvC+ 9dc6CghJddELwwkFV15pi2u1+QgdJAADmI2iCyLg/KysM/W1ukVHONQpXCXM4uOClgbAQhCvbKzcL i1GFXJBWvpAVCTBETynkZW7frI64qofYLnQdGN5kzJMk/HnDIXca+XizBIMiKFZ8hplJBJdZ+MD0F 42tiCn0LiySd6ycQdri3xFbtg+gYOgCWxMH4IiyWyqYsywwxDXL8UBpujJMeTX0VEsRyXfW5O/6TA HJbDyoK3xx33LAN/+9zPACXghjtChwqa19NnxtSJpWk13Fcr4c9KWNiGgSSP+uZ17DuewT+YXkQ9/ gw1fKsWw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liha6-00FkFo-PB; Mon, 17 May 2021 18:03:07 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liha1-00FkFC-9u for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 18:03:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=VYLqjf0vyfE3y5h25+LkLlU9oxA3hBncbgXDACFrSzc=; b=iLxatS7J7A/H4kVzQ27hbAWxBv PNb4g1WIB7ybFdaAWjxApWE848kDbFbAMi2vY2UJ/JBDAxdXf1WVTFA8w/078qB9jfH63q2/YLxsm gZ0qodXJHDIdMEvvZicngAkSXTQaalYLBqg25lbn2X7z+wu46NTVksXBI2GYD6W2La3DaIYa7XJf+ 0ZVV54RpDaCyQ7Q3zEQOx1IJvRw06v4Ffgm/AdT6+muB1I2OqaIVA8ezTrV/DkWYkPVh8KATOeyFW NC5/2VHaQp198ht0EqH7phqxsMatX1itskpMtNU0v7y9aZ90Jc017m/BYTJDE66cht+/4QeW/EuTl sQOrOITA==; Received: from mail-oi1-f180.google.com ([209.85.167.180]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lihZy-00E2ZC-RA for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 18:03:00 +0000 Received: by mail-oi1-f180.google.com with SMTP id z3so7272540oib.5 for ; Mon, 17 May 2021 11:02:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=VYLqjf0vyfE3y5h25+LkLlU9oxA3hBncbgXDACFrSzc=; b=rfsX6gIRX8F0EG2k0oZA4KdlHCN29T1MQs5guBASJjmd2RyizsTu1fKg2mxl8aXqZu PaRy7fs15OQKCubUrJyDbMN/c4olRVCL48MMZI5C5iDIqf3AGsOhbfbwyTuD3uMF0nuz oTNAAY1+KLctOXh6Xu3pOK9w7uq6LJOtmkZSxxIysFZpDnf+i5qXCRsMJQAHpcNpEW/j iahu4N//HrC38x4TrvrW9jgi2rEeuOVSAy46zdYUsVKWaNKyBU/cQVe6XmHV6gkcnx6x HbhazCzFgW5slVxrrroHX77CTFfAB2IQgeT9JVCJAI/6thrKHUA3qa90tvLbkKooJmjo jaJQ== X-Gm-Message-State: AOAM532s0CRIOx+guEckadMSrCBTZEyAf5p1vyd16j+6PGZXVC9MXbHl 0mHrNqTLGH34f++qkxK7UQ== X-Google-Smtp-Source: ABdhPJxZiAH8XT9zaFGAiudRZk/xrdRRvKbGPnSWoG8LIgC03MUsqo6Goc+Ws0Xr1ai7a3wrciCLhg== X-Received: by 2002:a54:4396:: with SMTP id u22mr275101oiv.118.1621274577832; Mon, 17 May 2021 11:02:57 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id e7sm3285952oos.15.2021.05.17.11.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 11:02:57 -0700 (PDT) From: Rob Herring To: Will Deacon , Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, Raphael Gault Subject: [PATCH v2] arm64: Restrict undef hook for cpufeature registers Date: Mon, 17 May 2021 13:02:56 -0500 Message-Id: <20210517180256.2881891-1-robh@kernel.org> 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-20210517_110258_898530_2886E86A X-CRM114-Status: GOOD ( 14.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 From: Raphael Gault This commit modifies the mask of the mrs_hook declared in arch/arm64/kernel/cpufeatures.c which emulates only feature register access. This is necessary because this hook's mask was too large and thus masking any mrs instruction, even if not related to the emulated registers which made the pmu emulation inefficient. Signed-off-by: Raphael Gault Signed-off-by: Rob Herring --- I don't *think* I'm going to need this for the perf userspace counter access, but this patch stands on its own as the PMU registers are not emulated. So please apply it. v2: - Fix warning for set but unused sys_reg --- arch/arm64/kernel/cpufeature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index efed2830d141..c773f7c3c007 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -2905,8 +2905,8 @@ static int emulate_mrs(struct pt_regs *regs, u32 insn) } static struct undef_hook mrs_hook = { - .instr_mask = 0xfff00000, - .instr_val = 0xd5300000, + .instr_mask = 0xffff0000, + .instr_val = 0xd5380000, .pstate_mask = PSR_AA32_MODE_MASK, .pstate_val = PSR_MODE_EL0t, .fn = emulate_mrs, -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel