From patchwork Tue Sep 19 17:50:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jing Zhang X-Patchwork-Id: 13391743 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 7B13FCE79AA for ; Tue, 19 Sep 2023 17:51:49 +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=YSWlf+TkuoV45BAsJ+R5wFwDP1fsuy/HIYlDoBZXeRk=; b=Hx/vMldgto7c/kIMGfwYx+1Adj jI7z2GiIEHwUQ4s5zC4zbR8MJTYuJ0yakby/qxHhApoyGC6YlxsbUWCSpMZ8Y0Wgao5WsaGyu2EcT fCSR7iJR3ewCIE60G+xiv2B/kdjqW4c9qN5Rh+DebWzMImJjI9S++GSxs8GGoicidLXS/lssVIn9S 9FJJ2Tc3FxcYs3EPxwfndJ2JbprBjV2p5p++Ut3pRJb7Ryg+3btAo3pGv7ptHZVOxzE42mKl9FkU4 AlBU7IImswlxM5KHJwcn6KIpjC8M8j/ER0dB0ANmEYKDdC58iCuQ2iLaxzhnAbwtza2vY8yCwFB+0 CW9GrqVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiesi-000zv5-04; Tue, 19 Sep 2023 17:51:28 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qierl-000zHz-2i for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 17:50:33 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59c0327b75dso56246467b3.2 for ; Tue, 19 Sep 2023 10:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695145827; x=1695750627; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NNgnTGU4YpsPoVFc3PtBmlT7XDV3ZwiZBqdVlE5z4mo=; b=tj2pkU+NBWc3Kffat3JoHxNElqZWwLX5x3ANDe/wxTOXgrwhxi6fu59kUo4Jg1fQ9o RWV+kY/ollGCq+lHSrwzdaPNIqbF8794TD8AoLYu0+Eg7pQpgfY7dXN0B58NImaubNzn tJaHG8dhnt2Z2syJpwVYokYrCzILogH42B39MtVI56P60rJPoZmio7W8TeH3u33riheK Dt/LtBjWbLgsZ1l+Nb2PLwafHGo++rPvhvAZ0yzTMYC4j1AMl+O5zCWnlfyF9DX2C79Y wxxPMKiP0c4SXPRnFoODZq/fT1EpUfebiAsngC09zlAew3Vm20yX3CX2quymNsfoTbzf u0Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695145827; x=1695750627; 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=NNgnTGU4YpsPoVFc3PtBmlT7XDV3ZwiZBqdVlE5z4mo=; b=FBBxknlEnN2TVQP83cuYcUxg4WFhO7gmy19I4/rNeaSbrB7wS+HmnD0UxktXZ0TgeZ GU7yf721CrGJRKKzOTNInL5Yx9bEMCQ+6IqpbDQu0O86Y0SsfdUVhocodvB52DU0jSkn LJ4zPNzZ55ziTPgtDT2A9rYutoE5yUh0QVYXqE5WVS+2x+MEzMRSo5v0hKveW9QTmERV Txa4hNrnQeJjs55f7pBOCB9PBZmBbRA9uDKqK/h64BDYDcd+1Hk8Ggz4VbFUdj3ym5+V oWmDMeWkBZBiwyPiGWisaggWVfA7R+m87RlXseRZSqy2Zn9ox5QaY5QOFBJPOp+Sj4+j 07sA== X-Gm-Message-State: AOJu0YwOO/nr3cQNLftH/pj0E22zghKwTAcACKjI4ZGqf0GAurzYJ255 nI7Z8MZDrp01kvhJGais4mSX4xDgaH2A4KsyDw== X-Google-Smtp-Source: AGHT+IEu56riQdG7TAOdvAS2CxA7zpebYty6rvbyBf23leV5Zz1VX6/KIxfw4Os8Nq3PKH1WkglynetaSy09CpEecQ== X-Received: from jgzg.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1acf]) (user=jingzhangos job=sendgmr) by 2002:a25:8d0d:0:b0:d84:c154:9b7d with SMTP id n13-20020a258d0d000000b00d84c1549b7dmr6424ybl.12.1695145827325; Tue, 19 Sep 2023 10:50:27 -0700 (PDT) Date: Tue, 19 Sep 2023 10:50:14 -0700 In-Reply-To: <20230919175017.538312-1-jingzhangos@google.com> Mime-Version: 1.0 References: <20230919175017.538312-1-jingzhangos@google.com> X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230919175017.538312-3-jingzhangos@google.com> Subject: [PATCH v1 2/4] KVM: arm64: Document KVM_ARM_GET_REG_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 , Suraj Jitindar Singh , Cornelia Huck , Shaoqin Huang , Jing Zhang X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_105029_899847_F8530D11 X-CRM114-Status: GOOD ( 15.74 ) 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 | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 21a7578142a1..2defb5e198ce 100644 --- a/Documentation/virt/kvm/api.rst +++ b/Documentation/virt/kvm/api.rst @@ -6070,6 +6070,48 @@ 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_REG_WRITABLE_MASKS +------------------------------------------- + +:Capability: KVM_CAP_ARM_SUPPORTED_FEATURE_ID_RANGES +:Architectures: arm64 +:Type: vm ioctl +:Parameters: struct reg_mask_range (in/out) +:Returns: 0 on success, < 0 on error + + +:: + + #define ARM64_FEATURE_ID_SPACE_SIZE (3 * 8 * 8) + #define ARM64_FEATURE_ID_RANGE_IDREGS BIT(0) + + struct reg_mask_range { + __u64 addr; /* Pointer to mask array */ + __u32 range; /* Requested range */ + __u32 reserved[13]; + }; + +This ioctl copies the writable masks for Feature ID registers to userspace. +The Feature ID space is defined as the AArch64 System register space with +op0==3, op1=={0, 1, 3}, CRn==0, CRm=={0-7}, op2=={0-7}. + +The mask array pointed to by ``addr`` is indexed by the macro +``ARM64_FEATURE_ID_SPACE_IDX(op0, op1, crn, crm, op2)``, allowing userspace +to know what bits can be changed for the system register described by ``op0, +op1, crn, crm, op2``. + +The ``range`` field describes the requested range of registers. The valid +ranges can be retrieved by checking the return value of +KVM_CAP_CHECK_EXTENSION_VM for the KVM_CAP_ARM_SUPPORTED_FEATURE_ID_RANGES +capability, which will return a bitmask of the supported ranges. Each bit +set in the return value represents a possible value for the ``range`` +field. At the time of writing, only bit 0 is returned set by the +capability, meaning that only the value ``ARM64_FEATURE_ID_RANGE_IDREGS`` +is valid for ``range``. + +The ``reserved[13]`` array is reserved for future use and should be 0, or +KVM may return an error. + 5. The kvm_run structure ========================