From patchwork Tue Apr 19 06:55:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12817516 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 E00ADC433F5 for ; Tue, 19 Apr 2022 07:06:41 +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=yNtlZ+YfJogrYvm8sv4LXSdD7Z5knrCC4TUoVgypoZE=; b=P0PTXqw0pkdaUeW/hudFp9FoJ8 IvM9iUWm3hhD6CBeKjX5VDU2JVOIOXCTknySdF19zAiLm5W60dPtERwQWZymrkYxNAoDlFajqINl9 GAyjDISXFvyowGBO+a1qiCOJm6Hn/2yrjyKa1exhcRsZoohfl+yU4WdzGQvqkiwp6FnJ36fLV+Y7R QpLfW9UeVKRE6V+l8PwcNhQgMi1UJg+RpZkrfapQMcem5E/YyjTqQZ6EMyFSYs0sDOea7HiK57XNB AJTYO2iStoG2uzMg4VM/gRY6B6b0n4AKoVDOEe2/2VIyp+oZl7D+dWvCJjpmqAwoHseF4PeWVCK6V zft4iw0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghv5-001qZU-46; Tue, 19 Apr 2022 07:05:05 +0000 Received: from mail-pj1-x104a.google.com ([2607:f8b0:4864:20::104a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nghnq-001nXf-S5 for linux-arm-kernel@lists.infradead.org; Tue, 19 Apr 2022 06:57:36 +0000 Received: by mail-pj1-x104a.google.com with SMTP id r12-20020a17090a690c00b001cb9bce2284so10127939pjj.8 for ; Mon, 18 Apr 2022 23:57:34 -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=kOtruObnAwr73tGi5MZAsEqpA/uKhtQAPuGoRa00WMc=; b=mTJ21013PiSwkw5o3Gbtoin1gGUFTC2f11xhWGdUiETUkhecccbVgbMOAwtXaKBtqw 34ltnUdfLnvlsCBfBtytLBYdcq3Iprqi6xqpEewEB0sE+o7KVrPiafcRnuf2v6WzOaVz PEWZt6iQR+LcBRGuArYRWNqjokJGWZTYDaUxQIXIY/pYCFOQmIuyIaTXxmw/sbJbbr1C yyBD3zGKzxr9xv8DPDiQ998Qbyf/SibU/rYcpFowvPKU2y/xz0ceqb+fEZe2ToqdztS9 zbY7kgN2a91vAerHogjHLztkGGHsfqbki1OYpRjBk4DLs/AKRYh2bDlAC/YTvmeNZDxM WRYw== 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=kOtruObnAwr73tGi5MZAsEqpA/uKhtQAPuGoRa00WMc=; b=vcxKqMnjYEvqwqZ75kOvXo3DHiJGs/1hZh3DcmRs3nx76RSr31P+RMX16u/o2KziPA K8rQZNjXIuO/Z8loh7ArB1LB65qgXwvgdetE6Z62zCsBq1ovgmRJ5STMMraHRPQIpR+6 Vl9NTxVkEpDygjggk3B5hpoNNfxBTQh1mQNsSwCdb1NF3dz4i2YSYQIepDDDdOH5qWRH +QeOJqF3jV/sSOLdigsT7LAd0vbNOiLC/39yJ2eARw5PcoAi7ZqyJqk8fTpJW6Z/PUJa HAvwVVYcvWjNgsIZHHcBPCKQG5kdZ4OY6GUR5FgKm1L0Xk1vAKSa+tEmPafqkRtJOLsq CxHg== X-Gm-Message-State: AOAM531ZX+a8lUeIIiDsMfzshDIu0mi7nn07R5lNg/Gn0tjnZRTz16vW SYSYOWnO/uRZjcpS37M/PZoe57atFOU= X-Google-Smtp-Source: ABdhPJx6qDbSnrgYvhJroWf4jBAE01A6EcpohDsqf8ebCgDlStR+vqVIies+oFNL6BLxOeYZEqyR+y7SKVI= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a17:90b:2384:b0:1cb:5223:9dc4 with SMTP id mr4-20020a17090b238400b001cb52239dc4mr276854pjb.1.1650351453576; Mon, 18 Apr 2022 23:57:33 -0700 (PDT) Date: Mon, 18 Apr 2022 23:55:23 -0700 In-Reply-To: <20220419065544.3616948-1-reijiw@google.com> Message-Id: <20220419065544.3616948-18-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 17/38] KVM: arm64: 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 , 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_235734_980748_5707E37A X-CRM114-Status: GOOD ( 10.14 ) 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_MMFR0_EL1 to make it writable by userspace. Signed-off-by: Reiji Watanabe --- arch/arm64/kvm/sys_regs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 3892278deb09..dfcf95eee139 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -4149,6 +4149,14 @@ static struct id_reg_desc id_dfr1_el1_desc = { }, }; +static struct id_reg_desc id_mmfr0_el1_desc = { + .reg_desc = ID_SANITISED(ID_MMFR0_EL1), + .ftr_bits = { + S_FTR_BITS(FTR_LOWER_SAFE, ID_MMFR0_OUTERSHR_SHIFT, 0xf), + S_FTR_BITS(FTR_LOWER_SAFE, ID_MMFR0_INNERSHR_SHIFT, 0xf), + }, +}; + #define ID_DESC(id_reg_name, id_reg_desc) \ [IDREG_IDX(SYS_##id_reg_name)] = (id_reg_desc) @@ -4156,6 +4164,7 @@ static struct id_reg_desc id_dfr1_el1_desc = { 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), + ID_DESC(ID_MMFR0_EL1, &id_mmfr0_el1_desc), /* CRm=3 */ ID_DESC(ID_DFR1_EL1, &id_dfr1_el1_desc),