From patchwork Tue Apr 19 06:55:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12817515 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 ECF74C433EF for ; Tue, 19 Apr 2022 07:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=V5wfjQgYIHuj7SIOBS4Q3UcvMHSL5p4DVBZEHMoE5uc=; b=zkuBvHrMTbvXVMiWOrxdcRM3pM 8PD8YDfp4y23raWMbSwQ4zjcR1eP+Bo9Jtv3tNNczgivj9oIE8W9iEZSlKhLyIdWrFFdSdJHjUdyR vQ7m/B04DMtMCCdhYz/fvjc3o2Zng9ok98YgKGTJKWFt/6RTQ1lTc9D6iwxP2lUYaUeH1NLRnGIHL poGoWs/RYkO7D0/nrMl+krM3cemCXHi1P/uhYXytWBQUJYwIpKVYQyWIvfLM46I8IvT/Pcpm7PR07 5FaUmaMA4r2kAKPjHezcXuiGGZGQ7COzW/wmJDBC2V7wzUsm6XwDdnLv4gQTPARhGHeDJ06rYdXdr KIX+y6xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghu0-001q7k-Pi; Tue, 19 Apr 2022 07:03:57 +0000 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghnp-001nWe-DI for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2022 06:57:35 +0000 Received: by mail-pl1-x649.google.com with SMTP id ij17-20020a170902ab5100b00158f6f83068so3269191plb.19 for ; Mon, 18 Apr 2022 23:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=+RIFV+GBe2M89AsHlXZMsb8M9PH2fcdCA31lX27Exl0=; b=jHfDWDQBRdFMX1KUZ7M8h7PpM144EBI9vT9022UC7DTugoUZgKVXh5XxcMJR3sxN70 aoQkPuceSyyGP29G1menl9lnaI1m0kUA+fvRB7mzGNAWeYz5l/fUgvMoob1N9gab1My7 UWCic2ZNLYXUgeFFIn4H97XVTt+viw27rpDxXWVHJgA1B6p2CmVNcKJ6TLveWXxE/xQk ydfiv5X53K1FVVmXor1T/C4gL3g0lIyJ9MLApM8nzmMIH6pNamH5H0+iUvJ4kqd03eXW b47bh5b8cCNcl9sSjgo+NkhW9d2Yibv3AQ7C9gI5XGp8J4zhObzXeuECjtA3WNtmsgOr Pefg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=+RIFV+GBe2M89AsHlXZMsb8M9PH2fcdCA31lX27Exl0=; b=hRkf4qWtnx2+CfGCBupgtHJL3D+MHG7GLpKOWY5wnrrORUK90ZYTnS6W1uLHQ/UW4S 42rS3cRD2jg7xye/8W+s7hiS0Tv6rr3oj2f7BuMu+oAwbAZl80lg9ha/mwxMNahnbzuf c3BsMCCw64jSAxkeoy1tsxwm9y/eWQ6TOpfaZPozUANiMjgfeFYPp0OEfD+XahYrawbi Pt/QxX422Z3EctKQ8s/nVyvsYkb90ojEucsppE3Ivcr+BjzexIJqZ3k8cuPpb5MRNw+m TYsnHYua+Y05guwaaS1JRI4CfIEcFyEfab/xJ4dU+nTQGSgIpNHCYfP74R/KzrMAPTFP Y4fA== X-Gm-Message-State: AOAM530oC2x61OtU1z4SYvzjld3cU0YsjAL7ALw4Ih/8wW7h/EyVMxr9 gr16ZjRcPBPiOdAyq9nUC6NijioA3vA= X-Google-Smtp-Source: ABdhPJxyzd0FpvVmJHlsUoLjVst/BJV+186a7Jt7JsU7eedDcva2Fw/AIAC6p8ib5uPpHPfQ2iIiPlO8PG0= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a05:6a00:234f:b0:4f6:f0c0:ec68 with SMTP id j15-20020a056a00234f00b004f6f0c0ec68mr16406433pfj.14.1650351451950; Mon, 18 Apr 2022 23:57:31 -0700 (PDT) Date: Mon, 18 Apr 2022 23:55:22 -0700 In-Reply-To: <20220419065544.3616948-1-reijiw@google.com> Message-Id: <20220419065544.3616948-17-reijiw@google.com> Mime-Version: 1.0 References: <20220419065544.3616948-1-reijiw@google.com> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog Subject: [PATCH v7 16/38] KVM: arm64: KVM: arm64: Make ID_DFR1_EL1 writable From: Reiji Watanabe To: Marc Zyngier , kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Will Deacon , Andrew Jones , Fuad Tabba , Peng Liang , Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata , Reiji Watanabe X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220418_235733_515949_34E462B2 X-CRM114-Status: GOOD ( 10.60 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch adds id_reg_desc for ID_DFR1_EL1 to make it writable by userspace. Signed-off-by: Reiji Watanabe --- arch/arm64/kvm/sys_regs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 9eca085886f5..3892278deb09 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -4142,6 +4142,13 @@ static struct id_reg_desc id_dfr0_el1_desc = { .vcpu_mask = vcpu_mask_id_dfr0_el1, }; +static struct id_reg_desc id_dfr1_el1_desc = { + .reg_desc = ID_SANITISED(ID_DFR1_EL1), + .ftr_bits = { + S_FTR_BITS(FTR_LOWER_SAFE, ID_DFR1_MTPMU_SHIFT, 0xf), + }, +}; + #define ID_DESC(id_reg_name, id_reg_desc) \ [IDREG_IDX(SYS_##id_reg_name)] = (id_reg_desc) @@ -4150,6 +4157,9 @@ static struct id_reg_desc *id_reg_desc_table[KVM_ARM_ID_REG_MAX_NUM] = { /* CRm=1 */ ID_DESC(ID_DFR0_EL1, &id_dfr0_el1_desc), + /* CRm=3 */ + ID_DESC(ID_DFR1_EL1, &id_dfr1_el1_desc), + /* CRm=4 */ ID_DESC(ID_AA64PFR0_EL1, &id_aa64pfr0_el1_desc), ID_DESC(ID_AA64PFR1_EL1, &id_aa64pfr1_el1_desc),