Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3185420rdh; Mon, 27 Nov 2023 08:09:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDTw32e4SuxNIhuzU/jE0q7zD21DO07JN6YWPDFKqxJqlc8aylmsO84Xb9kG5dxAPKEyJG X-Received: by 2002:a05:6a20:7294:b0:18c:ad4d:3469 with SMTP id o20-20020a056a20729400b0018cad4d3469mr2477197pzk.53.1701101389669; Mon, 27 Nov 2023 08:09:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701101389; cv=none; d=google.com; s=arc-20160816; b=FevC6ceNIOA1B6jdS6e8q/OIu6JxdbLJKX0tGs1aKAIjD/upidcdQPFIhXeKbKwQk5 6T2MhZQq/hl2GRoH0baU3Uvkb2uFR8kMAXmNjUkBTGJdkGCzXjnPn80ULTrjTQ15+qL1 pvssfdZE4gZMANE882Am7yMGC1tVm4CIzLTk1JcbHWLvnANY+zR6TWXKeky7YzF57e2L 2bkvBhCAcuCzf9l8uRFPplmFn5r98W9BoZOEpCIcVPTMooahjNW7xNedx7HJvpi5hylV RsP2gjp7qe4wUW3HbE71iyyKe2rcXlkAEg7HcDH+JrRQv0Uh5FhbsUoZkzJ4bhGt1hQ+ ljtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dzYxUdtVtLIxD0DxO0Uq2Q0bxCJb8QV++mZvchuqteU=; fh=llKkVNcTrktmfS5JeQ5fUe47kzdbGYmQL27SgJpWq48=; b=TFt9pD2I7sj/5Q96tcuQFipKAYdJ6zjcXFkRMq8JO7bM52qQjTq2GFMtzsIGkaOR42 PYdDzDPDydw7ieieq+ROAmrz6vq2PsvNHOAbwSifkMOrgoUyjmXavQVDKm5J6aNkbw/Z +QIcBGkAUe5KBuIM3KMM6mEDiig2KkKEu16eEjsC+yAvtaKT4bB+PStBSBtlHL94awK+ DcM4J6R4fQXlQsw3QTJzWq/H1IPkyNAQWfQCLzRypDqEKvD+cEuACW1nW3oUilDlkDJz ui4xjFkFangULp7vV8cPifw+7j7+M1hMs+HQ0641bK56s8KdJota+3CuFAfeY7eam52w gtgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCr5YsqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id b14-20020a6567ce000000b005c1b2eff948si10225312pgs.494.2023.11.27.08.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 08:09:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hCr5YsqS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 362EF814557A; Mon, 27 Nov 2023 08:09:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234333AbjK0QJa (ORCPT + 99 others); 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> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 08:09:45 -0800 (PST) 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