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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 8C0F6C4167B for ; Thu, 7 Dec 2023 15:37:48 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.650007.1015185 (Exim 4.92) (envelope-from ) id 1rBGRR-0003pM-4m; Thu, 07 Dec 2023 15:37:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 650007.1015185; Thu, 07 Dec 2023 15:37:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rBGRR-0003pF-1x; Thu, 07 Dec 2023 15:37:33 +0000 Received: by outflank-mailman (input) for mailman id 650007; Thu, 07 Dec 2023 15:37:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rBGRQ-0003p7-3w for xen-devel@lists.xenproject.org; Thu, 07 Dec 2023 15:37:32 +0000 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [2a00:1450:4864:20::332]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 887e603c-9516-11ee-98e7-6d05b1d4d9a1; Thu, 07 Dec 2023 16:37:30 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40c2308faedso11213715e9.1 for ; Thu, 07 Dec 2023 07:37:30 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b004090798d29csm37973wmo.15.2023.12.07.07.37.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 07:37:30 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 887e603c-9516-11ee-98e7-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1701963450; x=1702568250; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=aU18r7pJhdouh6dLMlGHN3SET1Bd8uMHRetUqhiyRTE=; b=Z72HzBKuDtYzMJpx1mOCUEH+Cu1gCtM7dQZxyGyshwS6LO18OGnJ4xIpW2BFhx3qHg JK791hF/NAEV2+FCiVnJGdmtMwexIodX0OjrAfT1yfMKWMAwx1iKXe2qvzyjfNjpqDCj WRLHFFWzQHtvgoc7kKBWc542baFU7UddxoPlrKKuW/cPWSRNHZQuBqRDSmuSUgqb33m+ i1cBjZ/LQBfAAAX4zRlLNfrANvpquQDt1j0qk4xRo3FiWHPzSyI9xa9u5aav5npUVPC8 a5VsA2hbWFyfH960YEUBGjUcvAEjI1RKpFq6V3nTv2u6TVeiORBfd2585K6OlTOYvryT YC8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701963450; x=1702568250; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=aU18r7pJhdouh6dLMlGHN3SET1Bd8uMHRetUqhiyRTE=; b=qoto9KuWWs/Eksg7kDz7nyfiON8dpsi8vyPrnKqAb6lndHjzOfOamo02jw4imQjU3i InaUfZ0iLZEndmrbrBQmvqobOCsmS4jPh+7hboTKnqqS2gOAb3JO5+7S0eHzXsUuDhkv bRk1dTugd3CYn6dJxdbW9YByimgW5FAMwdRhKPmmuasqgauXXYbozylS5AuhqgCiUOym 6r7Vzgpm7HJGbPw3RlPzVlN8BTx+PRkrUIhLcfcGOp7wknIpiTAC+kyM/ke4pasJ+3Ws zzXW19hc0KOXF7uBCHCB5cnZCrNF8tJ/GQzhbU4PkikEFw+W/FucCdCSUlX0ZLNNR/yX DPpQ== X-Gm-Message-State: AOJu0Yx7CgnWuWiDXXSjsVdLKCt2BBlmhQnxEJPKqFb4WFHpKaUjw7cp uko/XKr0UFqjJAzh0eQLiI9i X-Google-Smtp-Source: AGHT+IHY3c4IDdWOk5rdJAAB6ZOEYrN4UPK5yorsSXLmTfN6W2maRoiU0ODA+a1xbX4+C5SvkEs14w== X-Received: by 2002:a1c:7214:0:b0:40b:5e21:d369 with SMTP id n20-20020a1c7214000000b0040b5e21d369mr1683310wmc.114.1701963450224; Thu, 07 Dec 2023 07:37:30 -0800 (PST) Message-ID: Date: Thu, 7 Dec 2023 16:37:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 14/39] xen/riscv: introduce bitops.h Content-Language: en-US To: Oleksii Kurochko Cc: Alistair Francis , Bob Eshleman , Connor Davis , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , xen-devel@lists.xenproject.org References: From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1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uqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 24.11.2023 11:30, Oleksii Kurochko wrote: > Signed-off-by: Oleksii Kurochko So this looks to have been taken from Linux, which could do with saying (including which version or most recent commit). It may e.g. justify you using tab indentation here, albeit ... > --- /dev/null > +++ b/xen/arch/riscv/include/asm/bitops.h > @@ -0,0 +1,288 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* Copyright (C) 2012 Regents of the University of California */ > + > +#ifndef _ASM_RISCV_BITOPS_H > +#define _ASM_RISCV_BITOPS_H > + > +#include > + > +#define BITOP_BITS_PER_WORD 32 > +#define BITOP_MASK(nr) (1UL << ((nr) % BITOP_BITS_PER_WORD)) > +#define BITOP_WORD(nr) ((nr) / BITOP_BITS_PER_WORD) > +#define BITS_PER_BYTE 8 > + > +#define __set_bit(n,p) set_bit(n,p) > +#define __clear_bit(n,p) clear_bit(n,p) ... then please consistently. Other style related remarks made on the system.h patch apply here as well (unless again there's a goal of keeping the diff to the Linux original small; yet then I guess the delta to the Linux file is already pretty large). > +/* Based on linux/include/asm-generic/bitops/find.h */ > + > +#ifndef find_next_bit > +/** > + * find_next_bit - find the next set bit in a memory region > + * @addr: The address to base the search on > + * @offset: The bitnumber to start searching at > + * @size: The bitmap size in bits > + */ > +extern unsigned long find_next_bit(const unsigned long *addr, unsigned long > + size, unsigned long offset); > +#endif > + > +#ifndef find_next_zero_bit > +/** > + * find_next_zero_bit - find the next cleared bit in a memory region > + * @addr: The address to base the search on > + * @offset: The bitnumber to start searching at > + * @size: The bitmap size in bits > + */ > +extern unsigned long find_next_zero_bit(const unsigned long *addr, unsigned > + long size, unsigned long offset); > +#endif > + > +/** > + * find_first_bit - find the first set bit in a memory region > + * @addr: The address to start the search at > + * @size: The maximum size to search > + * > + * Returns the bit number of the first set bit. > + */ > +extern unsigned long find_first_bit(const unsigned long *addr, > + unsigned long size); > + > +/** > + * find_first_zero_bit - find the first cleared bit in a memory region > + * @addr: The address to start the search at > + * @size: The maximum size to search > + * > + * Returns the bit number of the first cleared bit. > + */ > +extern unsigned long find_first_zero_bit(const unsigned long *addr, > + unsigned long size); Looking over the titles of the rest of the series, I can't spot where these are going to be implemented. The again maybe you indeed can get away without those, at least initially. > +#define ffs(x) ({ unsigned int __t = (x); fls(__t & -__t); }) This wants to use ISOLATE_LSB() now. Jan