Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp496657rdb; Thu, 8 Feb 2024 11:49:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUz+YNu+VXpia6iFZZnJzcS21+e5yUxusj33bEB+Bzg690ky98c2sS7BLQ5ld14ZZxEUhOTurcUbT6N8ozLNrNJrxDFyReW487GCQX/eg== X-Google-Smtp-Source: AGHT+IHiqCBooZZGb+AI+G40oOwTwBZpRPweroKldWteahLzN6SkkXrk1POqQGyUe3gLPKlxTGo+ X-Received: by 2002:a17:906:b16:b0:a38:40fc:2bcf with SMTP id u22-20020a1709060b1600b00a3840fc2bcfmr274960ejg.60.1707421754417; Thu, 08 Feb 2024 11:49:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707421754; cv=pass; d=google.com; s=arc-20160816; b=PdcN2arPlo7nO4TST5uckdBtxjhlNweScGN2kMeDyQTM/Io2j4Bfcv2iEjNBbOjaSm YtQ4K7Xj2EW4czEq88C9Gn/pFp6Z+CE7L3p/3S6ZbGUNE+r/BdZBIM/Kz4hNL7L4MVq4 zphdHtta3/UH7HXO7CTMq9wtmxWfbNTjf+/u5CKduv/iEfxlV1K7N4v6JXcuavy+DYqT QVRlKGMTA4eNQo8qw9nIUoL6UvblNJAv8k/P22aSnrwiLu+BUnFaVcjuSg/2nFn5OW49 zvN35CdpbiBUyZwlpwGD5otAPy3wa+VKnU2KSoMirnqCiWKi6vqn2yMSwhASRW6G3S+1 8SEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=dYU+tToT0he5YJK/l/vEknqRPhGomDmqgLIpkl/sAVg=; fh=/EL+elw11FYobptSYvSih/KGNikML2GtmF4Scgab/G8=; b=BYRcj1alny+y4qegPRQCkLnXYApt7sMH3p1rTlTi6FutjyhmFPksVDWTlj8sTYQQ0R owhWsMdm06ZiM7j89iR22OjuLf+1/j41z3nPjU5mtK8tfNqpgMdK6F13I5YiGAkl8/yx mv8CwervnDIMOusLLcPgezDnio6Tc7aJcW7srsTnaf0cCsyR3DbBJ9AWhKeWj6WDUceC ulw+pmsPUIUA2Gsn9dppKDL6aSvIp//MVN2Z7qHOVLhbBTF2VTt+oBomqP4javrC+CxL zaJZp5gNGSXE0L1wTpWnoNDvn0gpWZwpccO+gUx3v8PlNHrHVIQ17ogGDI9ztdybTVOC QgIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=INj0GR5b; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58636-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVo6Pe4fHBRN5lIGM2nA/Zn+MYzemR8Z++fBGFlxQ6pRBkFsScMSOxssP7TCcWcZz4yR83KppVOmTzrfGBVosTaWFgdOz5Ot2aT5Xgsyg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kf23-20020a17090776d700b00a3ba6fe0851si1519ejc.867.2024.02.08.11.49.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 11:49:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58636-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=INj0GR5b; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58636-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58636-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2E4101F3149A for ; Thu, 8 Feb 2024 19:49:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D342381CE; Thu, 8 Feb 2024 19:49:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="INj0GR5b" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 5F02C381C5 for ; Thu, 8 Feb 2024 19:49:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707421748; cv=none; b=EgIbk1wUyRYjknecvM7eZivpvMPXCoWcVl6FRJ4+QPCZFuVK03HNhkpf4S9kl0uK7+apNns3mGdFdJxlRG6lTIC8JqdZ1pyiM/vEVV4Eit5jfOcHoUU7iYESJWr0U+gSyuWbx/G5dFyyBLrrAeUVW+E2vu6EmaUYwpd0fMCnvS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707421748; c=relaxed/simple; bh=H1wnzpQqk2/6BK+Tq9CYC38MWNkImYKdMoqD2FjiBVg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TNcgdVS87BZ/Rl/zDqKK+l2l6jdhVJxw2FF0KlTBjPLqvNqbBTQIkOHQlllZaTksAn5koo423/S7bfo1DIk/bb0XTNLYDJmU+uLj7kNILCtIHNtFpvfxo1h7zw/f3tl1mUAzVJXCWivkKlrX3dySlorLHcYk9wlb1Blfn31d9y0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=INj0GR5b; arc=none smtp.client-ip=134.134.136.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707421746; x=1738957746; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=H1wnzpQqk2/6BK+Tq9CYC38MWNkImYKdMoqD2FjiBVg=; b=INj0GR5b8odUE+HsNzPFUD1Zky3y77C6xSx7aB20EZVx/7JuKu87dAVW 15YVjoHjjiqNk4c/kNLxTBbno7cotdR3+sI7XTuAKl/zBN80dxYnG2o3K Cy803IvQ2FK6Z1Z5LiqNpaDJXYTbI7wRmsSytL4ccfZxF2Ly6Ziz654m+ VJbbx50EnfWP9KhjJF2P7vCYBv13zX8HQvV/VcfxaJl8lES106RP3VO1V QF0UP4p4dmmIQb57orHgCuC7n1OoiVr/+648VNkaxK9qa1S1JmLD1xXj4 vdP14n3Eg4syPbsnPTILeoXvdp/WvlMRZS+u5SnlQ/KTQdp25xtQgDMBf Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="395720816" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="395720816" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 11:49:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="24976779" Received: from udig-mobl1.ger.corp.intel.com (HELO intel.com) ([10.246.32.229]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 11:49:01 -0800 Date: Thu, 8 Feb 2024 20:48:59 +0100 From: Andi Shyti To: Lucas De Marchi Cc: Yury Norov , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Andy Shevchenko , Jani Nikula , intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, Jani Nikula Subject: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks Message-ID: References: <20240208074521.577076-1-lucas.demarchi@intel.com> <20240208074521.577076-2-lucas.demarchi@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240208074521.577076-2-lucas.demarchi@intel.com> Hi Lucas and Yury, On Wed, Feb 07, 2024 at 11:45:19PM -0800, Lucas De Marchi wrote: > From: Yury Norov > > Generalize __GENMASK() to support different types, and implement > fixed-types versions of GENMASK() based on it. The fixed-type version > allows more strict checks to the min/max values accepted, which is > useful for defining registers like implemented by i915 and xe drivers > with their REG_GENMASK*() macros. > > The strict checks rely on shift-count-overflow compiler check to > fail the build if a number outside of the range allowed is passed. > Example: > > #define FOO_MASK GENMASK_U32(33, 4) > > will generate a warning like: > > ../include/linux/bits.h:41:31: error: left shift count >= width of type [-Werror=shift-count-overflow] > 41 | (((t)~0ULL - ((t)(1) << (l)) + 1) & \ > | ^~ > > Signed-off-by: Yury Norov > Signed-off-by: Lucas De Marchi > Acked-by: Jani Nikula Lucas' SoB should be at the bottom here. In any case, nice patch: Reviewed-by: Andi Shyti Thanks, Andi