From patchwork Tue Aug 1 15:19:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jing Zhang X-Patchwork-Id: 13336933 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 9062AC04FDF for ; Tue, 1 Aug 2023 15:21:00 +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:Message-ID: References:Mime-Version: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=ByY7+MgxCY/GKYuiaEhD4JzpxlZeqnDZsgTdLHi+GGU=; b=NX6Gotn5QYSUezwJKnTWI1Wj3j JIdfr0yLnjUoCKlMffaAG+V+/MlHZ36KEamTomipX1y6QvSasOZuPQLzga2MTl6CU4f3pJlwJ/dab kUebXxn6DgChkU+UOWDwWico+CUhtK/cMJJCj1oZZkm1EdHAMH2e1NWhsJ3iCvWGm9DECVmLp+1o1 Eo1ps9CuommUzcgTjpOdYw/lGSI67M7gWgtSZNxQLVv2kPCxDUORO7IMF7fBvBqQ6arATzf35bi43 Q5EryyUc8mda1SGUM4f9A4SeWdY7a3EAF+fO61jq4UcypqqVhbpo8QRnN3vljrhhEnCcSWNwiq+Ra E+LODckA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qQrAk-002hgO-1u; Tue, 01 Aug 2023 15:20:30 +0000 Received: from mail-pj1-x1049.google.com ([2607:f8b0:4864:20::1049]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qQrAh-002haT-2F for linux-arm-kernel@lists.infradead.org; Tue, 01 Aug 2023 15:20:29 +0000 Received: by mail-pj1-x1049.google.com with SMTP id 98e67ed59e1d1-267f61da571so5871885a91.0 for ; Tue, 01 Aug 2023 08:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690903215; x=1691508015; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=a5ITWAYN9R9rtf6GERIf9S362dBjLzTbE/fVZh0ZgOI=; b=fTiv3bmYN2oeWLkbMRJWsRtibsFGBoi0gQkakqnsftyey8XKIY3KI9TWKC8m7nSIjs NU3H7wmRc2rc7oOlaOdQL2IBo45YKH5vcbK0iGjj0t4gfvif1gUgKclwpH/iyXmxh1NC 3xDB8SEk5B/REEVEbmivjGhpoLf7jrnXFq/6HiJ5bOtUsLoETZHjbgsRNPpMjw+B5Eqx Kk721CF0oK4/0A+jq8UCjBsKLFh2/nHmEeOqzZNrY+cZac9cU8hOVCWV/eZ7Z3XeSSHj Tfpkt3e+/dxWeOl1WibUD/ZMPoJo1dGQoeKBly6GsqqSic3dS7+AYCkOAScuEABTaNdU 4mzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690903215; x=1691508015; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a5ITWAYN9R9rtf6GERIf9S362dBjLzTbE/fVZh0ZgOI=; b=HitAa6YS0MEjAwXg2i3La1Vx4ovMd6K+PsW7PW8wyOGID/LG32sVdEewyfgUMvmAj7 oigXO33ZLJtk0gY+LzAPROjeHvHffVie07Xj3CRcyaXm9cF0UvLsvBDxLdVFeTjxSKeg u/aNYfTHaC6ELNXro+9g32GwfC0aneTiI6TQy8QN1jtHqKwghJ6SNfCst+1n+rO3FWkq QjHei4A/GNcflwdmPw+zb50BOT+n1nzy6ePSTEySVkY8dIyy9pB9bjP8VxoCTLFI1J3s ZNXRFT7ZMZloQ90Ru1Yo16RgSGr4UkGRFLgTahqE+8gvYviaVGui1r3ijFNFUbjyWB4T 8b2g== X-Gm-Message-State: ABy/qLZ9yYsfBu7Tcg53j8fPahppsFMzHj16QIRDj3T6DKVt6pAImKnK K2lKpR2NGwL6VmlHchBoilF/VJXO1EUc+rgkLA== X-Google-Smtp-Source: APBJJlEnPd5fAD0Aj5PY28l23CVy0dGlj5CAymKDeYm7SNgmyFCz9I6QMeDLMfXxJSbBI+IkBdoRqH8Wa5L+RyznOw== X-Received: from jgzg.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1acf]) (user=jingzhangos job=sendgmr) by 2002:a17:903:1cb:b0:1bb:cf58:532f with SMTP id e11-20020a17090301cb00b001bbcf58532fmr62253plh.0.1690903215344; Tue, 01 Aug 2023 08:20:15 -0700 (PDT) Date: Tue, 1 Aug 2023 08:19:58 -0700 In-Reply-To: <20230801152007.337272-1-jingzhangos@google.com> Mime-Version: 1.0 References: <20230801152007.337272-1-jingzhangos@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801152007.337272-3-jingzhangos@google.com> Subject: [PATCH v7 02/10] KVM: arm64: Document KVM_ARM_GET_FEATURE_ID_WRITABLE_MASKS From: Jing Zhang To: KVM , KVMARM , ARMLinux , Marc Zyngier , Oliver Upton Cc: Will Deacon , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Fuad Tabba , Reiji Watanabe , Raghavendra Rao Ananta , Suraj Jitindar Singh , Cornelia Huck , Jing Zhang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230801_082027_735404_5EBFE49F X-CRM114-Status: GOOD ( 13.50 ) 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 Add some basic documentation on how to get feature ID register writable masks from userspace. Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index c0ddd3035462..e6cda4169764 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -6068,6 +6068,32 @@ writes to the CNTVCT_EL0 and CNTPCT_EL0 registers using the SET_ONE_REG interface. No error will be returned, but the resulting offset will not be applied. +4.139 KVM_ARM_GET_FEATURE_ID_WRITABLE_MASKS +------------------------------------------- + +:Capability: none +:Architectures: arm64 +:Type: vm ioctl +:Parameters: struct feature_id_writable_masks (out) +:Returns: 0 on success, < 0 on error + + +:: + + #define ARM64_FEATURE_ID_SPACE_SIZE (3 * 8 * 8) + + struct feature_id_writable_masks { + __u64 mask[ARM64_FEATURE_ID_SPACE_SIZE]; + }; + +This ioctl would copy the writable masks for feature ID registers to userspace. +The Feature ID space is defined as the System register space in AArch64 with +op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}. +To get the index in ``mask`` array for a specified feature ID register, use the +macro ``ARM64_FEATURE_ID_SPACE_IDX(op0, op1, crn, crm, op2)``. +This allows the userspace to know upfront whether it can actually tweak the +contents of a feature ID register or not. + 5. The kvm_run structure ========================