From patchwork Wed Nov 3 06:25:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12600241 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9306BC433F5 for ; Wed, 3 Nov 2021 06:34:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5E10360EBD for ; Wed, 3 Nov 2021 06:34:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5E10360EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=Gq4Quaf2gvRkIJvHN7kCZX8gGvFSXEc5ycDUsOnE/+8=; b=k37BkZUqQ0SB3IK/MS/VlHolTe eSGwvvERGhAKVgS5ebhtaH+trVI4uuo2qRMBSGLAJEdGD6qaXRgIwLGYs0Mx/V/czXXvKx+dL5b81 llqXh7hh2RuqKFKilBwULGAIhXUvOixZ9paYkD36df2FBXD3GaEG/GmBbSGMQLZJVE/F538d8ihBv ZBT4m2Fbxm970A0boA964ShnKrhvzuOEXJEhweOvOiB8PCGzDDvzSFPKOofCZIstDm4g9YCp7Vfc1 EAfDCTgNF9yWorbSvcA1XEPAQOCjB1tIuZwCXHiLFLBi+l4MYNxUHLN53IFvIJ0ov/s2SE4BDjYHL pUQdC5MA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mi9op-004EQn-94; Wed, 03 Nov 2021 06:32:20 +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 1mi9kx-004CQo-8L for linux-arm-kernel@lists.infradead.org; Wed, 03 Nov 2021 06:28:20 +0000 Received: by mail-pl1-x649.google.com with SMTP id ba4-20020a170902720400b0013a432f7556so678054plb.4 for ; Tue, 02 Nov 2021 23:28:18 -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=Esyigd24VZzPo59EpEVlVJ1Fgs9fgw4MXQuf865VkCM=; b=F+nZxkxoiWIyyns/e6YvCovwVFgHwrPCf4W/omxTTZKZxPeieOLU5DGarIx6iQBnRA AwDOAjRjA/RTb348aoIOxmxsGOLFGENIy+5whxqZNRq2weovTQtDpvjwDDS/X/bVB5Oc 3Hksfyo6u3r8/r+WY1rwl3twBXaLZL30HbuxcePUi7SummLqW7NN8HBHD562Q92RPCB8 IYHOfGZtQruMMArAwh5rkXIi6EftMSA9wzKz2yuC9O/WL/hANK5OkQecfL7Yf7PH4cld rUB0NfkdHf/CKIXzlxHKTBdEQoiAN6AGqNtwOmqQ1pzZzKBCXDxuE5wGgmn1Fd2VVxyD oggw== 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=Esyigd24VZzPo59EpEVlVJ1Fgs9fgw4MXQuf865VkCM=; b=MDCowGGjHpfgkhKJBB97iThPZqJgcEdHSCUWX1sgqAhwikEnRpHyFzhmRUWuCOqU35 Tdpo3ODSty/3veF/gnNzkaiQbD8QnvMA5/pSIFVBIBZOk0kTtbasiP0jAF3rHnfGE+0X Dyw81gmYQ8iUvECKXL4ean0rtkGdg/6q2OLAWlxnKwI82EMXtfn+CnEsJZ3lowZaCaiQ i+hIE8LGMGXrzrQ/4G7cPFT/pOOlIDSe8ya9jVkmPxwvQ2Ws4RugRiPcq59oHatTo+f2 xMeNzj3O7zuLDOG4HcVV7QJD2j0rbLTT1BQQlXm/MhLwxzpTTxZ+N/6X5rQpCpnSWD85 +7eA== X-Gm-Message-State: AOAM532bwWjtP2pskKSBXOtQClrsBoDJrqlETpmvHqeIxBr8rxIOWO8Y 2Ac32VhVPDsqHoUHpZy/naSKNt7UUMA= X-Google-Smtp-Source: ABdhPJy8zAxunqRArXzuJB5aGkOf3dPMAfmrH4e8aF0KnNXPQWSWpgHh4j0Xv7zu5BhBikqibRcVNu8SQBM= 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:244d:b0:44d:c279:5155 with SMTP id d13-20020a056a00244d00b0044dc2795155mr41787826pfj.0.1635920897698; Tue, 02 Nov 2021 23:28:17 -0700 (PDT) Date: Tue, 2 Nov 2021 23:25:06 -0700 In-Reply-To: <20211103062520.1445832-1-reijiw@google.com> Message-Id: <20211103062520.1445832-15-reijiw@google.com> Mime-Version: 1.0 References: <20211103062520.1445832-1-reijiw@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [RFC PATCH v2 14/28] KVM: arm64: Make ID_MMFR0_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 , 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-20211102_232819_345059_144879C6 X-CRM114-Status: GOOD ( 11.26 ) 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_info for ID_MMFR0_EL1 to make it writable by userspace. Signed-off-by: Reiji Watanabe --- arch/arm64/kvm/sys_regs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index f04067fdaa85..cfa3624ee081 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -840,6 +840,12 @@ static struct id_reg_info id_dfr1_el1_info = { .ftr_check_types = S_FCT(ID_DFR1_MTPMU_SHIFT, FCT_LOWER_SAFE), }; +static struct id_reg_info id_mmfr0_el1_info = { + .sys_reg = SYS_ID_MMFR0_EL1, + .ftr_check_types = S_FCT(ID_MMFR0_INNERSHR_SHIFT, FCT_LOWER_SAFE) | + S_FCT(ID_MMFR0_OUTERSHR_SHIFT, FCT_LOWER_SAFE), +}; + /* * An ID register that needs special handling to control the value for the * guest must have its own id_reg_info in id_reg_info_table. @@ -850,6 +856,7 @@ static struct id_reg_info id_dfr1_el1_info = { #define GET_ID_REG_INFO(id) (id_reg_info_table[IDREG_IDX(id)]) static struct id_reg_info *id_reg_info_table[KVM_ARM_ID_REG_MAX_NUM] = { [IDREG_IDX(SYS_ID_DFR0_EL1)] = &id_dfr0_el1_info, + [IDREG_IDX(SYS_ID_MMFR0_EL1)] = &id_mmfr0_el1_info, [IDREG_IDX(SYS_ID_DFR1_EL1)] = &id_dfr1_el1_info, [IDREG_IDX(SYS_ID_AA64PFR0_EL1)] = &id_aa64pfr0_el1_info, [IDREG_IDX(SYS_ID_AA64PFR1_EL1)] = &id_aa64pfr1_el1_info,