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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00B6EC4167B for ; Mon, 27 Nov 2023 16:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234339AbjK0QJa (ORCPT ); Mon, 27 Nov 2023 11:09:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234322AbjK0QJ3 (ORCPT ); Mon, 27 Nov 2023 11:09:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 303EFA7 for ; Mon, 27 Nov 2023 08:09:35 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A07CBC433C8; Mon, 27 Nov 2023 16:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701101374; bh=u6iWdo/8a2a6pHkq5FkOccFiPiQNgIqfuW+dZLSH+jU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hCr5YsqSSE1eyQWuoDx7kB+6p0HXj51KWg3lgJj2xjaEa31UJr7oPSVFdfEGtUPFN LTh3RJQtSQdFIjByszyBFNUsCWycw8qIENRxJZ3BLpWWQocz3iMx1o/LjKJsa7Ygjm MgW38x9qRQqZepTeKXjYV66/LbzBTzUmW3jpdROIQ626dpnLNGaHXXu+JGdTz098WF Pcl95/5JfKYfHrF48s2CUXdxJpa+uqiyHBN8apQbWW2brUWNdEkmtL6sA921iCFfvb +a6hFgjOMy1b28yBX+7ccOLEh0ZN0K+GF+Y/wCzJHUp6m4K8/vuDaJFa9aUkw6XAIF 5o/qdFqBREZ4w== Date: Mon, 27 Nov 2023 23:57:09 +0800 From: Jisheng Zhang To: Conor Dooley Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: Use asm-generic for {read,write}{bwlq} and their relaxed variant Message-ID: References: <20231123142003.1759-1-jszhang@kernel.org> <20231127-swell-garnish-3f2104647aa0@wendy> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231127-swell-garnish-3f2104647aa0@wendy> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2023 at 10:39:16AM +0000, Conor Dooley wrote: > On Thu, Nov 23, 2023 at 10:20:03PM +0800, Jisheng Zhang wrote: > > The asm-generic implementation is functionally identical to the riscv > > version. > > > > Signed-off-by: Jisheng Zhang > > This fails to build for nommu: > /tmp/tmp.ojumpiEgOt/arch/riscv/include/asm/timex.h:20:16: error: implicit declaration of function 'readq_relaxed' [-Werror=implicit-function-declaration] > /tmp/tmp.ojumpiEgOt/include/asm-generic/io.h:342:23: error: conflicting types for 'readq_relaxed'; have 'u64(const volatile void *)' {aka 'long long unsigned int(const volatile void *)'} > > Cheers, > Conor. Hi, Thanks for the report. I can reproduce the build error locally. The problem is readl_relaxed usage in timex.h. If include in timex.h, then we will meet issues which is fixed by commit 0c3ac289. If not include , then the readl_relaxed readq_relaxed are not explictly declared as reported here. I have two solutions: solA: use __raw_readl and __raw_readq in timex, since I found other architectures use the raw asm instructions for get_cycles() solB: remove clint_time_val and export a function in timer-clint.c as below: get_clint_cycles() { readl_relaxed(clint_time_val); } then #define get_cycles get_clint_cycles Both solutions can solve the issues. which one is better? Thanks in advance