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 X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 135F1C388F7 for ; Tue, 10 Nov 2020 12:37:26 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F62120780 for ; Tue, 10 Nov 2020 12:37:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="1OwW+BxU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hF5fRLVF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F62120780 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=XodzWIhofcmFE40tNscFKZa0ahrv3L9vhOq4qJ0fEbY=; b=1OwW+BxUTq9y+NULzHbGEMqZh ebz+tUoVJmS2R3eOMjbwgQlh7+O3llZrSLjkCHMqvfhaTma4HSLQdZfo6DHMH2PYjY5/Wo6rU4JAj WzSWaBhsvyccwuPicBhm1LaycWmzwJKUs8PNzGlgpkjuVE+D2WbI7d1oQAYhnMBbdfsts5FKNnorR hR6oBDHvQgq2o0zkLrEI5tNy7+kL6cNlFNwIP4B78UUPkTAn39skoOzUiGQjEBmehMIq4bKEJMqj8 es1BgqxRrgNXv9noP7M1edsajui70Ozb/I+g6wUb9OPWAaPJj0DDcsL0uiUr89v/mJpTJNol0Q4U2 daVc6pYWw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcSsR-0005BI-7s; Tue, 10 Nov 2020 12:35:59 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcSsO-0005Aq-FA for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 12:35:57 +0000 Received: by mail-qt1-x841.google.com with SMTP id m65so8339770qte.11 for ; Tue, 10 Nov 2020 04:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=60bLFzbvvDvulZgHHBLzky6FOxllzSiEPloCjEA8pOo=; b=hF5fRLVFXreI/vBVlZwd3WVd2GWIdaLhN4xkNAnh5Na2ltyYUTpJ7JKX9EZfPAeTIY LMu87JVZjdpEyr++y+cz7Mt2uM24qk37umOuc0c0sWWQCXxfRDE7acTDCMOyGqYsIBNp VjcfixBnRaRSFhGkn4jpAOTBk010HsZnYvSifyNGa4un9GJEu2e98aqGHJJ24rqrofao RnZoSwUPpNB9+BS8PrRAUlRQ3y4EU2eRNHzkIr5yw7m/vxJFl5z3PYmUiO/jsOkkTFD+ dl1VhAU062OpycQUIjrKVlDcA0cfUwMtRQ/PBeC37XaECr6gg3/9sCG3RQeWREsqYpb8 +ZYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=60bLFzbvvDvulZgHHBLzky6FOxllzSiEPloCjEA8pOo=; b=CI1Bqyvav++wqS5iuyvUyLA3oRG3Kq6ygw91ARxnSU3fP6u6piU9ivCaBYybKTqb3/ 7oKHGsMUD5vRH97tu/oKUqDp6xLEmWfjprcagDAigGRe55TBu0uGlmqTF2EeFpVeHpYh 75SJJcF9rtodUOLBE9rIOMAD/aVsqanmgZLtwmgTbCBDct9PfEJOSyHKejpw4tftYZqu +jCzPNXBqB4floZgSXaQkeVr4DpeIGPBmOkDmqtxXyEJLrrLuXCxEjy8WQQz+vozX6UW nr9Yn0Evn9TGmlw4HZU6onUBlqY2HfTwS3EEeQzHxBk7xCla6urpkU0uN1XHjDGi+CLx wcbQ== X-Gm-Message-State: AOAM531uHH+IbHcmiWwycA+dzsk5/TfEVbZualfQBhyxHM/bRm/nDARi NnGG1QZ2UkpeGq3wss1UzLo= X-Google-Smtp-Source: ABdhPJxaW679A5HSdRapxYTFAnw2LNRFRTVmYzW8mwUq6VN/j+tL20nYkl8eh7AzLwt3bxrbi+eKpQ== X-Received: by 2002:ac8:832:: with SMTP id u47mr17900656qth.376.1605011754845; Tue, 10 Nov 2020 04:35:54 -0800 (PST) Received: from shinobu (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id a206sm8154425qkb.64.2020.11.10.04.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2020 04:35:53 -0800 (PST) Date: Tue, 10 Nov 2020 07:35:38 -0500 From: William Breathitt Gray To: Michal Simek Subject: Re: [PATCH v12 4/4] gpio: xilinx: Utilize generic bitmap_get_value and _set_value Message-ID: <20201110123538.GA3193@shinobu> References: <20201101150033.GA68138@shinobu> <20201109123411.GA19869@syed> <20201109134128.GA5596@shinobu> <20201109164529.GA28710@syed.domain.name> <20201109171140.GA14045@shinobu> <20201109172220.GI4077@smile.fi.intel.com> <20201109173107.GA14643@shinobu> MIME-Version: 1.0 In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_073556_537906_F9BF3D3A X-CRM114-Status: GOOD ( 28.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Bartosz Golaszewski , Linus Walleij , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , Andrew Morton , Andy Shevchenko , Syed Nayyar Waris , Linux ARM Content-Type: multipart/mixed; boundary="===============7312117121880650317==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============7312117121880650317== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="SUOF0GtieIMvvwua" Content-Disposition: inline --SUOF0GtieIMvvwua Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 10, 2020 at 11:02:43AM +0100, Michal Simek wrote: >=20 >=20 > On 09. 11. 20 18:31, William Breathitt Gray wrote: > > On Mon, Nov 09, 2020 at 07:22:20PM +0200, Andy Shevchenko wrote: > >> On Mon, Nov 09, 2020 at 12:11:40PM -0500, William Breathitt Gray wrote: > >>> On Mon, Nov 09, 2020 at 10:15:29PM +0530, Syed Nayyar Waris wrote: > >>>> On Mon, Nov 09, 2020 at 03:41:53PM +0100, Arnd Bergmann wrote: > >> > >> ... > >> > >>>> static inline void bitmap_set_value(unsigned long *map, > >>>> - unsigned long value, > >>>> + unsigned long value, const size= _t length, > >>>> unsigned long start, unsigned l= ong nbits) > >>>> { > >>>> const size_t index =3D BIT_WORD(start); > >>>> @@ -15,6 +15,10 @@ static inline void bitmap_set_value(unsigned long= *map, > >>>> } else { > >>>> map[index + 0] &=3D ~BITMAP_FIRST_WORD_MASK(start); > >>>> map[index + 0] |=3D value << offset; > >>>> + > >>>> + if (index + 1 >=3D length) > >>>> + __builtin_unreachable(); > >>>> + > >>>> map[index + 1] &=3D ~BITMAP_LAST_WORD_MASK(start + = nbits); > >>>> map[index + 1] |=3D value >> space; > >>>> } > >>> > >>> Hi Syed, > >>> > >>> Let's rename 'length' to 'nbits' as Arnd suggested, and rename 'nbits' > >>> to value_width. > >> > >> length here is in longs. I guess this is the point of entire patch. > >=20 > > Ah yes, this should become 'const unsigned long nbits' and represent the > > length of the bitmap in bits and not longs. > >=20 > >> But to me sounds like it would be better to have simply bitmap_set_val= ue64() / > >> bitmap_set_value32() with proper optimization done and forget about va= riadic > >> ones for now. > >=20 > > The gpio-xilinx driver can have arbitrary sizes for width[0] and > > width[1], so unfortunately that means we don't know the start position > > nor the width of the value beforehand. >=20 > Start position should be all the time zero. You can't configure this IP > to start from bit 2. Width can vary but start is IMHO all the time from > 0 bit. >=20 > Thanks, > Michal Hi Michal, I'm referring to the mask creation, not the data bus transfer; see the implementation of the xgpio_set_multiple() function in linux-next for reference: . To generate the old mask we call the following: bitmap_set_value(old, state[0], 0, width[0]); bitmap_set_value(old, state[1], width[0], width[1]); Here, width[0] and width[1] can vary, which makes the exact values of the start and nbits parameters unknown beforehand (although we do know they are within the bitmap boundary). Regardless, this is not an issue because we know the bitmap_set_value() is supposed to be called with valid values. We just need a way to hint to GCC that this is the case, without increasing the latency of the function -- which I think is possible if we use __builtin_unreachable() for the conditional path checking the index against the length of the bitmap. William Breathitt Gray --SUOF0GtieIMvvwua Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAl+qiQsACgkQhvpINdm7 VJK9rxAAjpxkczIhzwXaz+E4XRuM/XqMuez8iWkXN5UVvCVejFZ07j6ryXCEfUea GCIhwymRQewCfGC6thkhclYXJRdlpn2B8/8cwStvpgmlNYL0YNwvw1d1ngaxK3f6 6Xjjl0mdLa41wEj3PooLgCI7gK3gTUqtFQbsOleoTEpJ1ACxTdWqLLC16qnyeK8r cmp8U6u+Kt8YUK728+ROBWa1DzJtBSZ81f+nFzzpBVTi9i0mOuKdDQea2aX4uSUx HQ+hqlSYnjYrqY67rqtONM6nTONI/e/ZaN+sHx80NcuBuFOBBUrges+dn4iDJlzX bGFz5UmomsUz9WJeD8QHMvW7fFjOvUU6ma9n+VhWZPzVNx8p4J/xWEgbZLhGvf88 8lfyBHBk9ToIUF4hsPCBgb2jI+rNRH1a+ux0EzTqu+vzpkrR3goxokt4Cu41CRbg YzMCMD9rsBpzzuHu+wnyFtQEhlOdw8QwBJVubKKEsdLoirueLUQAdYuNQZVwA6Mh vFnZgqXfuyNVgVbs8gF9mVn1W0Tu0BIzVQ2prIJQL4ZJTL3P7jCqpZBHBu2AFeXK cnppEAX6JH0X8YnQCctbkWP6rVtt1dP/0FdPLJ6uD0mKxB4TXCvbN1rzud80st2s N9FVm09Yc4E24LANBH/SwiigiOIh/3EisQAit81kz74X6P2d2jQ= =WLlC -----END PGP SIGNATURE----- --SUOF0GtieIMvvwua-- --===============7312117121880650317== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============7312117121880650317==--