From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 312781E528 for ; Thu, 3 Aug 2023 13:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691068846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SMsAApeVsUKCtcw77w2tHWzG/2gWwfjt/a0cgmISXuo=; b=FxlukFfWKy5KMCi9BSlkh7ikKxVpwBOCqJnPwM3ylGdKnfnmY8uiG+kmGkI5zUI6vidos7 PCzrLU/x5n0PEAE/hnqjxk9sp2KPlpM/0hp1MGAShuHNrAIcX6f2YgPGL0IXbdstT3IJrw WWxS1ysWxt+X5caIW97iwngMmnZk74g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-ACCy8DQmMtyjZz5FrcpV9Q-1; Thu, 03 Aug 2023 09:20:43 -0400 X-MC-Unique: ACCy8DQmMtyjZz5FrcpV9Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FDE0800159; Thu, 3 Aug 2023 13:20:42 +0000 (UTC) Received: from localhost (dhcp-192-239.str.redhat.com [10.33.192.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5659840C2063; Thu, 3 Aug 2023 13:20:42 +0000 (UTC) From: Cornelia Huck To: Oliver Upton , Jing Zhang Cc: KVM , KVMARM , ARMLinux , Marc Zyngier , Will Deacon , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Fuad Tabba , Reiji Watanabe , Raghavendra Rao Ananta , Suraj Jitindar Singh Subject: Re: [PATCH v7 01/10] KVM: arm64: Allow userspace to get the writable masks for feature ID registers In-Reply-To: Organization: Red Hat GmbH References: <20230801152007.337272-1-jingzhangos@google.com> <20230801152007.337272-2-jingzhangos@google.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Thu, 03 Aug 2023 15:20:41 +0200 Message-ID: <877cqc8dp2.fsf@redhat.com> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 On Wed, Aug 02 2023, Oliver Upton wrote: > On Wed, Aug 02, 2023 at 08:55:43AM -0700, Jing Zhang wrote: >> > > +#define ARM64_FEATURE_ID_SPACE_SIZE (3 * 8 * 8) >> > > + >> > > +struct feature_id_writable_masks { >> > > + __u64 mask[ARM64_FEATURE_ID_SPACE_SIZE]; >> > > +}; >> > >> > This UAPI is rather difficult to extend in the future. We may need to >> > support describing the masks of multiple ranges of registers in the >> > future. I was thinking something along the lines of: >> > >> > enum reg_mask_range_idx { >> > FEATURE_ID, >> > }; >> > >> > struct reg_mask_range { >> > __u64 idx; >> > __u64 *masks; >> > __u64 rsvd[6]; >> > }; >> > >> Since have the way to map sysregs encoding to the index in the mask >> array, we can extend the UAPI by just adding a size field in struct >> feature_id_writable_masks like below: >> struct feature_id_writable_masks { >> __u64 size; >> __u64 mask[ARM64_FEATURE_ID_SPACE_SIZE]; >> }; >> The 'size' field can be used as input for the size of 'mask' array and >> output for the number of masks actually read in. >> This way, we can freely add more ranges without breaking anything in userspace. >> WDYT? > > Sorry, 'index' is a bit overloaded in this context. The point I was > trying to get across is that we might want to describe a completely > different range of registers than the feature ID registers in the > future. Nonetheless, we shouldn't even presume the shape of future > extensions to the ioctl. > > struct reg_mask_range { > __u64 addr; /* pointer to mask array */ > __u64 rsvd[7]; > }; > > Then in KVM we should require ::rsvd be zero and fail the ioctl > otherwise. [I assume rsvd == reserved? I think I have tried to divine further meaning into this for far too long...] Is the idea here for userspace the request a mask array for FEATURE_ID and future ranges separately instead of getting all id-type regs in one go? From mboxrd@z Thu Jan 1 00:00:00 1970 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 5BC34C41513 for ; Thu, 3 Aug 2023 13:21:22 +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:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VpzuqdC02zCooyoht+bfEPh1Yu9MGQPycr4Qg53628c=; b=A8mdD5rNFgU6VF agU9KDFbFRZNszZAurpY+UMCPG4846e998RMvrRfQofrtNViq4NvuOHX6lP5HXX08vhZ10+aAMjub V1yfYFs2x+coB3KFBEp9xq8VMvbEkJOnbLpCK7Izo9Qxt0J6hM9zYbdWnBdmLf7pRckVbL5xU+kCs gJJmIe9ujrRwcIlsNoHUqsGyZHzmR4W7+Z67qRk5hzUKotmIwvoBCQL2PaY5oYxI6fxDhbOu/r4g7 Gh+iHntYz4QjbqQgu16RF6lL/zNt1ku3g8iM7oznNbl6sYnI78XxLwjcSyI8TjZ0LhdWp5wt5avxJ MS1zW06l4b9eZbfk8WrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRYG3-008utW-1m; Thu, 03 Aug 2023 13:20:51 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRYG0-008uqN-38 for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 13:20:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691068846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SMsAApeVsUKCtcw77w2tHWzG/2gWwfjt/a0cgmISXuo=; b=FxlukFfWKy5KMCi9BSlkh7ikKxVpwBOCqJnPwM3ylGdKnfnmY8uiG+kmGkI5zUI6vidos7 PCzrLU/x5n0PEAE/hnqjxk9sp2KPlpM/0hp1MGAShuHNrAIcX6f2YgPGL0IXbdstT3IJrw WWxS1ysWxt+X5caIW97iwngMmnZk74g= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-512-ACCy8DQmMtyjZz5FrcpV9Q-1; Thu, 03 Aug 2023 09:20:43 -0400 X-MC-Unique: ACCy8DQmMtyjZz5FrcpV9Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FDE0800159; Thu, 3 Aug 2023 13:20:42 +0000 (UTC) Received: from localhost (dhcp-192-239.str.redhat.com [10.33.192.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5659840C2063; Thu, 3 Aug 2023 13:20:42 +0000 (UTC) From: Cornelia Huck To: Oliver Upton , Jing Zhang Cc: KVM , KVMARM , ARMLinux , Marc Zyngier , Will Deacon , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Fuad Tabba , Reiji Watanabe , Raghavendra Rao Ananta , Suraj Jitindar Singh Subject: Re: [PATCH v7 01/10] KVM: arm64: Allow userspace to get the writable masks for feature ID registers In-Reply-To: Organization: Red Hat GmbH References: <20230801152007.337272-1-jingzhangos@google.com> <20230801152007.337272-2-jingzhangos@google.com> User-Agent: Notmuch/0.37 (https://notmuchmail.org) Date: Thu, 03 Aug 2023 15:20:41 +0200 Message-ID: <877cqc8dp2.fsf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230803_062049_100141_1D7E2E44 X-CRM114-Status: GOOD ( 23.29 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 02 2023, Oliver Upton wrote: > On Wed, Aug 02, 2023 at 08:55:43AM -0700, Jing Zhang wrote: >> > > +#define ARM64_FEATURE_ID_SPACE_SIZE (3 * 8 * 8) >> > > + >> > > +struct feature_id_writable_masks { >> > > + __u64 mask[ARM64_FEATURE_ID_SPACE_SIZE]; >> > > +}; >> > >> > This UAPI is rather difficult to extend in the future. We may need to >> > support describing the masks of multiple ranges of registers in the >> > future. I was thinking something along the lines of: >> > >> > enum reg_mask_range_idx { >> > FEATURE_ID, >> > }; >> > >> > struct reg_mask_range { >> > __u64 idx; >> > __u64 *masks; >> > __u64 rsvd[6]; >> > }; >> > >> Since have the way to map sysregs encoding to the index in the mask >> array, we can extend the UAPI by just adding a size field in struct >> feature_id_writable_masks like below: >> struct feature_id_writable_masks { >> __u64 size; >> __u64 mask[ARM64_FEATURE_ID_SPACE_SIZE]; >> }; >> The 'size' field can be used as input for the size of 'mask' array and >> output for the number of masks actually read in. >> This way, we can freely add more ranges without breaking anything in userspace. >> WDYT? > > Sorry, 'index' is a bit overloaded in this context. The point I was > trying to get across is that we might want to describe a completely > different range of registers than the feature ID registers in the > future. Nonetheless, we shouldn't even presume the shape of future > extensions to the ioctl. > > struct reg_mask_range { > __u64 addr; /* pointer to mask array */ > __u64 rsvd[7]; > }; > > Then in KVM we should require ::rsvd be zero and fail the ioctl > otherwise. [I assume rsvd == reserved? I think I have tried to divine further meaning into this for far too long...] Is the idea here for userspace the request a mask array for FEATURE_ID and future ranges separately instead of getting all id-type regs in one go? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel