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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 EA6E3C4332F for ; Wed, 13 Dec 2023 14:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n3D2LXjU70lzgXftHp9Zjpq696wapn8Cj/ruAZoztss=; b=B52hf55ooQCWmX WcxmI7EyQmo1rkEms2ecpYpiCdc9j8BIBQMDGRbntOPdPze1aTn0sf42YNqBgHvI6X0iZc0JyB16E sRBLMoIBpXW9gMhrWz2v11LKvkwMDv9zMgGWRLSAwM6HrpgeIen5yNtAL4KTdUQz7XdygTM1bI4XY 61dj+QeMra7NZTEnNDBqAHTbHQylROwKP5wL1RwED52Itj9bjXtObZipMw5ESJ2DyO0O/gzmMIACQ You1x3Q3WCag6kbsiFfU2EQsNrCMvxykIijWWN8rBMKSXzr6a1UAYjU6LcKg12K8l9ZL5UV3N8a15 rVOD1vof9dBREdvYRcuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDPpE-00EwWE-15; Wed, 13 Dec 2023 14:03:00 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDPpB-00EwTW-0z for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2023 14:02:58 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40c41df5577so38148545e9.0 for ; Wed, 13 Dec 2023 06:02:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1702476173; x=1703080973; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=W8CNgTMGbobolB1r9w8VNb165BlBAplPuvdaxYrWog0=; b=L/dZ/mW11NP+0umYFUe5ruHtlCvURyLOiMR69aQeqRfrFwsRM8+xeBUw8RYocxE6SU 23+LhyA4HpDBOPtY3IvShVmeAg/KI5sgi9vm8yM5y+tpx/gOhSbVqnxi1XaX5D7CZb1x KrukpNcpAsdwQfME/sqyA+CZST4+4t6RxppLhGFYHmCjGRGkeDpHxeMGDXBKCwoKTjEw n4Qz+PDFvPi4QBlMuOTpwGdkMVG45EeUcSsK+osfdWBc2QaRZ8tc1YnwrbVxR2q4z3FJ XZbPHVbvS75S/2woCBwG5hB2KFtiyiuK88splJEIHj0RNe5NZuAUbJklKddRdBcusDF9 WVtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702476173; x=1703080973; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=W8CNgTMGbobolB1r9w8VNb165BlBAplPuvdaxYrWog0=; b=PhtjGNAvY6k5RvCfaW1A2IcdvcmJu+WKtDOBdU44V3y+2M76OU9LCyheDo7eqHzHmX FMKu5UDSLAlh/SDMNcke2MduBGdlP4GyDuIPYheX17XZBnxO9Bbr+hou9KQ+5FlET56r 2+zyiQfx1WwYlipfgXOfUC7NdTIUwc0u9CiZN3rf2loRHE8bY8SYa1Fa/HyR98IvG9IQ 26Na12tWdR4VXFUPAvrOsqOeVkGZOPRvknl6OSrSAx1qBXt056qfIdDrGFzTYeuXpsyz YLt2IHCQv8cl4WX2xl2P9qeAq3CtxMMx13TBODDanmho60aSpW/jfUqGgyu0c4m2cE1C Frlg== X-Gm-Message-State: AOJu0YzwsqwuRpFcJNBmM5i4GsDnEgL+7f9opAz7cjz7tYa/xJdW9XWw st0CTsjalIQ9+gxYnrANht+lmw== X-Google-Smtp-Source: AGHT+IHHe1VYvYeZf/3ceduRCoWvVbIdH20JSg3fNMXtxhw7fHkTGIiZ2b27mL7MboW3CuD0I846lA== X-Received: by 2002:a05:600c:2483:b0:40c:3314:5be0 with SMTP id 3-20020a05600c248300b0040c33145be0mr1879277wms.295.1702476172702; Wed, 13 Dec 2023 06:02:52 -0800 (PST) Received: from localhost (2001-1ae9-1c2-4c00-20f-c6b4-1e57-7965.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:20f:c6b4:1e57:7965]) by smtp.gmail.com with ESMTPSA id fm14-20020a05600c0c0e00b00407b93d8085sm22968185wmb.27.2023.12.13.06.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 06:02:52 -0800 (PST) Date: Wed, 13 Dec 2023 15:02:51 +0100 From: Andrew Jones To: Haibo Xu Cc: xiaobo55x@gmail.com, Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Shuah Khan , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Anup Patel , Atish Patra , Guo Ren , Conor Dooley , Mayuresh Chitale , Daniel Henrique Barboza , Jisheng Zhang , Samuel Holland , Minda Chen , Sean Christopherson , Peter Xu , Like Xu , Vipin Sharma , Maciej Wieczor-Retman , Thomas Huth , Aaron Lewis , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org Subject: Re: [PATCH v4 05/11] tools: riscv: Add header file vdso/processor.h Message-ID: <20231213-9d5ad03bed3056007c6e714d@orel> References: <7b633cc441f5133608597463301fef122f5174d3.1702371136.git.haibo1.xu@intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7b633cc441f5133608597463301fef122f5174d3.1702371136.git.haibo1.xu@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_060257_345087_76D9573E X-CRM114-Status: GOOD ( 17.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 12, 2023 at 05:31:14PM +0800, Haibo Xu wrote: > Borrow the cpu_relax() definitions from kernel's > arch/riscv/include/asm/vdso/processor.h to tools/ for riscv. > > Signed-off-by: Haibo Xu > --- > tools/arch/riscv/include/asm/vdso/processor.h | 32 +++++++++++++++++++ > 1 file changed, 32 insertions(+) > create mode 100644 tools/arch/riscv/include/asm/vdso/processor.h > > diff --git a/tools/arch/riscv/include/asm/vdso/processor.h b/tools/arch/riscv/include/asm/vdso/processor.h > new file mode 100644 > index 000000000000..662aca039848 > --- /dev/null > +++ b/tools/arch/riscv/include/asm/vdso/processor.h > @@ -0,0 +1,32 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +#ifndef __ASM_VDSO_PROCESSOR_H > +#define __ASM_VDSO_PROCESSOR_H > + > +#ifndef __ASSEMBLY__ > + > +#include > + > +static inline void cpu_relax(void) > +{ > +#ifdef __riscv_muldiv > + int dummy; > + /* In lieu of a halt instruction, induce a long-latency stall. */ > + __asm__ __volatile__ ("div %0, %0, zero" : "=r" (dummy)); > +#endif > + > +#ifdef CONFIG_TOOLCHAIN_HAS_ZIHINTPAUSE > + /* > + * Reduce instruction retirement. > + * This assumes the PC changes. > + */ > + __asm__ __volatile__ ("pause"); > +#else > + /* Encoding of the pause instruction */ > + __asm__ __volatile__ (".4byte 0x100000F"); > +#endif > + barrier(); > +} > + > +#endif /* __ASSEMBLY__ */ > + > +#endif /* __ASM_VDSO_PROCESSOR_H */ > -- > 2.34.1 > Reviewed-by: Andrew Jones _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel