Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2875973rwd; Mon, 29 May 2023 02:08:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Mt9Qz7eePOagCxax8UetSFL838fid390QlyUnMprpb40+3ZXRRnv9/Ewa+eBVdeYbP8/l X-Received: by 2002:a17:90a:564e:b0:24e:3452:5115 with SMTP id d14-20020a17090a564e00b0024e34525115mr9971153pji.37.1685351328524; Mon, 29 May 2023 02:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685351328; cv=none; d=google.com; s=arc-20160816; b=m4GfTHVkejuO5cdGshjuSC5SdXfU4XDxhK2nCPN3GAvLPqHWrmp6U2dDJiNh1ejEQi 0v3RVVH5azyiI2FcXziG7ufLx5jQfKBfqH/rSTjKoIoOw9/xnUjGlNe94H+xUqFV/7uH xdF9FWX1OTeANmkdgT3EI6quJa0UXzYRkAmrdOQR/4jUp6wPwT71AVdAeppxILXTYhiv ZkWa6LAUnmDkR7qZKpCedb0b2IQTgaV7kw+vE1f+JbajZUyYupL5GgF0ZNjzObv9CdTG NtyyCyDFOR8qkbVqBeYr6/YdkqcMWHKDdZYkJ1ItNkaxGoloNECON6bZvrqGgLJsIhex 8oxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=GclIXn8xpSmTzKetdkAKHRcWNUqXe7O7UqDlwq7UF0s=; b=KDRwpnGqdNVFHVbEjNjlye9O6uFuJwMHEYZhU6YUKcggRDuOfzV+aoj279y4/WDoEs SDH6nHkUmSXmCu0KQQCX7h6HgGD0n4qmVID8BSoZgn7pUuWUG1q2ZIItkaPKRC2E6Zmz BkfKx3m75DHsqxebtZT2Ww6z/QCGAPqqjPvm6A4pNnUuC1tqop9AwfyQPlSeTToePNtG UpMaRVacwb283mCOh1fng0SMBl/Lguuo9ed91BCBa7miYEF6+ndITqcb7kJRKVWHofAO bHn5NEWC2g59iZ7ruzIMjshRFwsr8JN9FAtNLmr/2LcDISBm1Qgp6aC3vm7aD4wmWUmn NCIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PGFjSRa2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a639353000000b00509461bbf1csi8739580pgm.79.2023.05.29.02.08.34; Mon, 29 May 2023 02:08:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PGFjSRa2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231702AbjE2IvW (ORCPT + 99 others); Mon, 29 May 2023 04:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231748AbjE2IvI (ORCPT ); Mon, 29 May 2023 04:51:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52B5010C; Mon, 29 May 2023 01:50:56 -0700 (PDT) Received: from [IPV6:2001:b07:2ed:14ed:a962:cd4d:a84:1eab] (unknown [IPv6:2001:b07:2ed:14ed:a962:cd4d:a84:1eab]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 5F52B6606E70; Mon, 29 May 2023 09:50:54 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1685350254; bh=vONTs6WMJV8KARE9JFHUrd9Ipnd933O8COixgUoyCrA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=PGFjSRa2U0lt4ZTtEAvOlhPCcKsseSMpeyLa28juvIhF2ElLWPq31iHpIbqz/qNg3 9hDOForVW20w3BkErYjIqsl4AveUVgBJNBJLVgTTpz91cpgfG07djMyaLBRl4zpcMG dJesnUN691UkBCBTpH9iFNWOzUE6qapqfRlh8ENhrDqvRWxb0OlqPI/FZTAzDS0uX4 1q8mLMwKyLXfMus6EXL0cF+2n+JZqDXCHijPuMtCoEouA+odUrGJ9m+SxTFgKwlKSE IRv9+qWnqJDSCYheWB6aY/SvXiwd3NTXQxxeTmw3ZYvIRdCCaIPf2sZSN5dx5tVb4K Bp4f4D/hd/yMA== Message-ID: <66d9eaa2-4eb5-e9d1-cc76-0e0b68be44ca@collabora.com> Date: Mon, 29 May 2023 10:50:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Subject: Re: [PATCH v2 2/2] clk: divider: Fix divisions Content-Language: en-US To: Sebastian Reichel , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christopher Obbard , David Laight , kernel@collabora.com References: <20230526171057.66876-1-sebastian.reichel@collabora.com> <20230526171057.66876-3-sebastian.reichel@collabora.com> From: AngeloGioacchino Del Regno In-Reply-To: <20230526171057.66876-3-sebastian.reichel@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 26/05/23 19:10, Sebastian Reichel ha scritto: > The clock framework handles clock rates as "unsigned long", so u32 on > 32-bit architectures and u64 on 64-bit architectures. > > The current code pointlessly casts the dividend to u64 on 32-bit > architectures and thus pointlessly reducing the performance. > > On the other hand on 64-bit architectures the divisor is masked and only > the lower 32-bit are used. Thus requesting a frequency >= 4.3GHz results > in incorrect values. For example requesting 4300000000 (4.3 GHz) will > effectively request ca. 5 MHz. Requesting clk_round_rate(clk, ULONG_MAX) > is a bit of a special case, since that still returns correct values as > long as the parent clock is below 8.5 GHz. > > Signed-off-by: Sebastian Reichel Reviewed-by: AngeloGioacchino Del Regno