From patchwork Fri Nov 10 16:30:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13452546 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 E1742C4167B for ; Fri, 10 Nov 2023 16:31:22 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.630619.983725 (Exim 4.92) (envelope-from ) id 1r1UPS-00089U-PK; Fri, 10 Nov 2023 16:31:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 630619.983725; Fri, 10 Nov 2023 16:31:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r1UPR-00087c-WC; Fri, 10 Nov 2023 16:31:06 +0000 Received: by outflank-mailman (input) for mailman id 630619; Fri, 10 Nov 2023 16:31:04 +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 1r1UPP-0005EV-QX for xen-devel@lists.xenproject.org; Fri, 10 Nov 2023 16:31:03 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8a337266-7fe6-11ee-98da-6d05b1d4d9a1; Fri, 10 Nov 2023 17:31:03 +0100 (CET) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9df8d0c2505so460863966b.0 for ; Fri, 10 Nov 2023 08:31:03 -0800 (PST) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id lv19-20020a170906bc9300b009a9fbeb15f5sm4128966ejb.46.2023.11.10.08.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 08:31:01 -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: 8a337266-7fe6-11ee-98da-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699633862; x=1700238662; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O9cK1yjpDKWQCw8xI+NWHuaVAE4NsCYRJpwmxLZ2MEU=; b=a7G9g0EULeOnzOzKD93sW5vhHxYzKrPIGtTp1bqeZ/THoLlykL5kD+AnX2QA1fEsl7 HT6n/LozvHrubdR49GQWQO98TwryUYsrMtBtubEoePbkemiIC3MuZtkPrBZPKpG5G8bw IRCn6NzTcdU9SO1m91Phx+TeswWDqEEmEKHwbB9PvjPW9gwm1urIMU/iW6OZxExLAp9Q AtAJHkyEAZcCTekYbABVhUSyjrEYvRsCYaFop7KIUw07OS9zh5iUlhpaUyVVwHCtcZxv i8FtYiOOwX2ENbxVxaMPeUEIVNr/VRTFW/XwYtwswJ2g0CppgTAcO33NeP2ME5tPpDhz c44w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699633862; x=1700238662; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O9cK1yjpDKWQCw8xI+NWHuaVAE4NsCYRJpwmxLZ2MEU=; b=OD3K6vVNacSJDrxrHbQZQrbuewedskxQcvpNxFup68nKTIGVdNDZb1GhHsSHpoBH06 AbMFe5vhqpJmD08nks9XYn+bkFODCA7adEfqBTVTVZLN4KVXhdFh6HOoHZopWaSrnvu9 R554Q339YFaLqhlgcUsRK6c0FVRhlAH2/jnZBOBsd8bFhxk13mkodEd0aose1QcJDncP N7qwJdJP7FUSa0PrNCK87z0KAj38cLnAWYz0F9c9UlrR1J0cl+LtZNWLGNiozdAZ+hgD EWGP+poXJz92XiPiHWz8nFKymIRp+XLsAMTS3mWVvHIOGbpKXHhP8ERK6URDp1LuVNn9 sRxg== X-Gm-Message-State: AOJu0YyzmQVg81i7FplSMzKpxvHso1fdcuCwnDbKG3retBpv5bO0JOoc j4D3CIzkFtE7ZZAb+MBsdjcX4TJMSuQ= X-Google-Smtp-Source: AGHT+IGdZf8lmwn9Nhc8WsjdLlVrjitW0A/updKdWdxjrI/StxCwh4MAjzORsIsFJpgwbCyJbTTdYA== X-Received: by 2002:a17:907:77d1:b0:9bd:81c3:2a85 with SMTP id kz17-20020a17090777d100b009bd81c32a85mr2614152ejc.32.1699633862171; Fri, 10 Nov 2023 08:31:02 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v2 11/15] xen/asm-generic: introduce generic div64.h header Date: Fri, 10 Nov 2023 18:30:37 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 All archs have the do_div implementation for BITS_PER_LONG == 64 so do_div64.h is moved to asm-generic. The patch introduces header stub necessry for full Xen build. Signed-off-by: Oleksii Kurochko --- Changes in V2: - rename base to divisor - add "#if BITS_PER_LONG == 64" - fix code style --- xen/include/asm-generic/div64.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 xen/include/asm-generic/div64.h diff --git a/xen/include/asm-generic/div64.h b/xen/include/asm-generic/div64.h new file mode 100644 index 0000000000..068d8a11ad --- /dev/null +++ b/xen/include/asm-generic/div64.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __ASM_GENERIC_DIV64 +#define __ASM_GENERIC_DIV64 + +#include + +#if BITS_PER_LONG == 64 + +#define do_div(n, divisor) ({ \ + uint32_t divisor_ = (divisor); \ + uint32_t rem_ = (uint64_t)(n) % divisor_; \ + (n) = (uint64_t)(n) / divisor_; \ + rem_; \ +}) + +#endif /* BITS_PER_LONG */ + +#endif + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */