[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v9 04/15] xen/bitops: put __ffs() into linux compatible header
- To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Michal Orzel <michal.orzel@xxxxxxx>
- Date: Wed, 15 May 2024 16:34:18 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gmail.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=na9INcQpOnXYA2PqNBCo4QBb/elEfAJ15EFW6fuAr3M=; b=LRzPQrmturGMSYqrdMWK5ok/NWPAtLVvksJ8uNe39nD/mp1DDU6LvYVrthWJxgFYv4ACDbPbX8dpfMAAd1C4LDVCYmrvI1cCRIi4MamgLIQb6fUJ6oukglC+81eH01tfe8CgHXk4mZe2pSM5c3d+viNRojAOr/rcuxNLXw6yMy18Nmm24TdX/6JvkVjX20WCt3FYgiC0ZsJx7JNVirzuj7GKo02idqftSrrPUSM1BMbxspKGjPlPd1cAGQo/6E3kiy2zS2fQACbbaozAGCiBygw9xURQM1jLB8RbYgWaF36EY8GqKP7W4Qnb96u2zMFXrfzxWZ6OWmJWn0Q4JPor1w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R5I5k/828S1h0q2SiFFgvpojhsLSPhpFGGyLvVLMyFoMmbZ88rpFA+Kj+e+BxszefHfF7JfG2JpDK0dmPl8ytiVSxWJO3Xe7fwB3kX7PHwxXgHhzbprwlBBu8YFj3u/wFaARESMcMezH34dENEA0wmdiHJFbqZP/M8l2B8eA9LrsaRjJF2Lq6wnbmsaD+a/kCA2emCNplXg/fVREPHIXZoUUwp6JLxlXO6ZLokUAG07w1PGUB2/ltA4kOYl2K7rbCV4DaJ5TaDvpt1CgRte72tVJGb2dLmEjb0SrFZ0D444sWBQmf8Yo2qYlzOJFLpX2LcVm5j61rM2qntPqRfIieA==
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Volodymyr Babchuk" <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
- Delivery-date: Wed, 15 May 2024 14:34:41 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 06/05/2024 12:15, Oleksii Kurochko wrote:
>
>
> The mentioned macros exist only because of Linux compatible purpose.
>
> The patch defines __ffs() in terms of Xen bitops and it is safe
> to define in this way ( as __ffs() - 1 ) as considering that __ffs()
> was defined as __builtin_ctzl(x), which has undefined behavior when x=0,
> so it is assumed that such cases are not encountered in the current code.
>
> To not include <xen/linux-compat.h> to Xen library files __ffs() and __ffz()
> were defined locally in find-next-bit.c.
>
> Except __ffs() usage in find-next-bit.c only one usage of __ffs() leave
> in smmu-v3.c. It seems that it __ffs can be changed to ffsl(x)-1 in
> this file, but to keep smmu-v3.c looks close to linux it was deciced just
> to define __ffs() in xen/linux-compat.h and include it in smmu-v3.c
>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
> Acked-by: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Michal Orzel <michal.orzel@xxxxxxx>
~Michal
|