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 D1648C04E69 for ; Wed, 2 Aug 2023 17:05:12 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/Kd7oCqk5V+gwr7HAnz5xjkgpxZv3byZ1YtvOzFB2pg=; b=MX8jWAiFLgiWoH 2jJfMEtA9QBr3SgFRAnVtXSKrvoOnM7dLxj0fSWO3Qw7v1DMkNZ8u91q19ug99vt4kbpbnSetRQZw C77Y1GkKJh64t8AOz1V0oKJsOci+TmkSmpkprEcKHy34LRt0pvdkA1NLFBWmtKsID4ksBscGVWzHO donY2QRFKQbmLE3xHdQ89eVI8hjXuqBL4MakzjP+oA7kHc+pyQU200/vuSM/N4DRj9HJdwpwQFK6+ giDp7o9uYZZzNQRIeskyJATMCCWm2lGFmTQdVoviu6I1pofSVYrcb1IgbtSvOeoTvSrUJlPSFQSJR a1vFrPVzFIvLUrGoYz5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRFHD-005S1v-1a; Wed, 02 Aug 2023 17:04:47 +0000 Received: from out-94.mta0.migadu.com ([91.218.175.94]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRFHA-005S1I-2Q for linux-arm-kernel@lists.infradead.org; Wed, 02 Aug 2023 17:04:46 +0000 Date: Wed, 2 Aug 2023 17:04:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1690995878; 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=WJgiPi3z5fgU4lTzUcaeihvoVV4/arRmDPqFGrxctos=; b=fkFkihM77h5zK99tash/Nlp41RcOozNnYYf++vLojGZDRyhHUYuWTDI7P5D79nJdokZhbq ZKcshmP9FPi6MpXqE6SJ4MyX+U8ZZawvQbvkh3bH5uacL3SUvpPWaMJTsSlHQy9Le9cSxl fYGgLtGp6N2nBXN+lITPi+y6pHfmvyA= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: 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 , Cornelia Huck Subject: Re: [PATCH v7 01/10] KVM: arm64: Allow userspace to get the writable masks for feature ID registers Message-ID: References: <20230801152007.337272-1-jingzhangos@google.com> <20230801152007.337272-2-jingzhangos@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_100444_931073_19E51B3B X-CRM114-Status: GOOD ( 16.99 ) 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 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. -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel