From patchwork Wed Nov 17 06:43:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reiji Watanabe X-Patchwork-Id: 12692837 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 AC5DEC433F5 for ; Wed, 17 Nov 2021 06:58:05 +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 7065861265 for ; Wed, 17 Nov 2021 06:58:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7065861265 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=w5/ot1lEtnexDlaX2pNsajulUD8l+dJTfUgzAkodW60=; b=NYryurbvG7k2RuGOo2yfYLqNkC pZtUY2GCEBW7KmZtjhaGft3ejIoLIn0SOznbIyFl+r3ExE3t3WmVeu5vOB5pDgFMsfr43ZDbLRx89 pnTA6WAr2CeQplvLNrz6bD5KIIWLsPHoQT2xQ0hBSigpaof8EZTLD61sfPi88DESwT/EVuhzvOxjU AYvak2alrQ24h3Iy+FEKdF8CWwKnpSUBtj0/2Um4JQK6K3RKcm2hmnfaTLk/ggG7b/MGWDkab88OL egGF5ZNrHabxXbFgAlS1BN1XojfKuoZWsszDwYWqhgFvfDaFH4fENgh4SnI+kFlu1W8tVomySnLDk 5tZCHlkQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnErc-003av2-Ik; Wed, 17 Nov 2021 06:56:13 +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 1mnEot-003ZlU-6I for linux-arm-kernel@lists.infradead.org; Wed, 17 Nov 2021 06:53:24 +0000 Received: by mail-pl1-x649.google.com with SMTP id v23-20020a170902bf9700b001421d86afc4so568705pls.9 for ; Tue, 16 Nov 2021 22:53:22 -0800 (PST) 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=qC/eXS2nFGbe5LWPRqIYtTbFYtBHmQ7GJKQdVVP+A0A=; b=ghbQ96p4mvC9twAH0Tuj9lFaRHB0m+8uJQPFzZ/CIBytnHC1y3VVqa5GIPtE6fyT9m +nnTxOjPfBRykrURArKpX2lWueXwUYmbzzd1B19UzxxMpqE4r5tms+Hsh7VPek4W+Kh3 w3pKoJUfdsAarCISRa5BiPct5PvoCMPMOX+U7d+0giU2WFUZ06dfLr+8kseGJABiQtfO uIN6ChXyDtLWyDwej87qXdsZippbWA6S84KHonLZMfYhMIK4+n/AZWFLeoAqSGsIDWoP OGFO9nIob2MxsERrirI2PCI8fIqEfdqOZGLzdc5U3v0awu3fxsk7lv4JAfnpteT3tp1Z CymQ== 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=qC/eXS2nFGbe5LWPRqIYtTbFYtBHmQ7GJKQdVVP+A0A=; b=HR8Md9gpZLOg651LdeynDqGrj4UH2ATeXlwaZ0AEkZ9IHhVNUvbXuqtvC2Zg0F9Ehq UYTFYFdARkzK7KhMfQ3fStEkxVjGhqsfhtsb0nWaFQay++OyNy8Jdn6AEXoNU0F0aHL5 P+2JLFafoRzXubMNaR+GvSsZMNvj7tbuNdFIyrSo6Ds1YZEh24rUhDqh4QeD3S/9CBKi eYC93a5KTAGN5Fiv+kPA4PRYM8Z3xc+QKVn4pnxlFNhzDRHMSI50Avzvo45e1hPRynQK 5UT6UdJpRXUj5I9Mb1MsfWmyJ932Wmw8gg21nZf+rp+QxZnDsNk1nVZ8519JTweN99vt 5vPQ== X-Gm-Message-State: AOAM532DgsQlGdISc6kvH5rR4WFyvsHfZvFDOwlXUaucib9ZEjIwrHAq JcFhZ0CuNN6obsi4/t7tftRf1xBpGhk= X-Google-Smtp-Source: ABdhPJwC4wjg1VuToYTvSJudxfPpKWjHgt+8qmyxs2CKjFyvyU3SEzO1OSgLiJ1kbIUegF9tuwn3xYxJOOg= X-Received: from reiji-vws-sp.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3d59]) (user=reijiw job=sendgmr) by 2002:a17:902:748c:b0:142:5f2f:1828 with SMTP id h12-20020a170902748c00b001425f2f1828mr52715009pll.4.1637132001549; Tue, 16 Nov 2021 22:53:21 -0800 (PST) Date: Tue, 16 Nov 2021 22:43:42 -0800 In-Reply-To: <20211117064359.2362060-1-reijiw@google.com> Message-Id: <20211117064359.2362060-13-reijiw@google.com> Mime-Version: 1.0 References: <20211117064359.2362060-1-reijiw@google.com> X-Mailer: git-send-email 2.34.0.rc1.387.gb447b232ab-goog Subject: [RFC PATCH v3 12/29] 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 , 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-20211116_225323_277397_99CE14C3 X-CRM114-Status: GOOD ( 10.98 ) 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_DFR1_EL1 to make it writable by userspace. Signed-off-by: Reiji Watanabe --- arch/arm64/kvm/sys_regs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index fbd335ac5e6b..dda7001959f6 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -859,6 +859,11 @@ static struct id_reg_info id_dfr0_el1_info = { .get_reset_val = get_reset_id_dfr0_el1, }; +static struct id_reg_info id_dfr1_el1_info = { + .sys_reg = SYS_ID_DFR1_EL1, + .ftr_check_types = S_FCT(ID_DFR1_MTPMU_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. @@ -869,6 +874,7 @@ static struct id_reg_info id_dfr0_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_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, [IDREG_IDX(SYS_ID_AA64DFR0_EL1)] = &id_aa64dfr0_el1_info,