Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1785301lqe; Mon, 8 Apr 2024 23:12:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSVPQArUD95D5Ipoc+QY3RBAHvvY4NkAv4LbH+So5OfaoSm4iZ4kYHZfuPD6ZVPIj0RR550+OyY3bz2q08Ii7s/PGgjATIHmVTgwiM4g== X-Google-Smtp-Source: AGHT+IF1/mHn1ha5pqDtpM1dn1chnR11pSsX0rdt9gJqJPA3RITKjWpbM+9WTjhcEzX1YYcPwC/z X-Received: by 2002:a50:d49a:0:b0:568:9b13:77fe with SMTP id s26-20020a50d49a000000b005689b1377femr8077672edi.37.1712643151493; Mon, 08 Apr 2024 23:12:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712643151; cv=pass; d=google.com; s=arc-20160816; b=uUq1KJJS1frlvxIFOsLjxtY3ClIZhf6P1hFXT1j6bEqGjtsHIFl0rbXo/aocJkOisB jh8y8BpcBQ5WFMBl38c3fiHh+HgOkFcwI9eembCiO6i3kEpeRigMwXQt0TqTykJIlml3 zFMczdYkhgVxpRDl5uzZgCm4AINeG6KRgEGJSI0wkWCa5xMtoVsc+ktkimzfJ/Nwg73L AdoW1ER+g7uIfXQBRuhjS0+PAl24jsFJaFeJBFdFkZEnyRhgduDkZZB5VuZlmvSWLnBn OtaEf9lEm+tC64nZea6UPtJ3S9yEy57zYLbTtoIQsRi1RzqPMYA7FaKFAJsPE0OCeC3X mf6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=JiLAeIECyw84AGrUV1USEqteoHaPU8YvP/EXtLFxWio=; fh=M9jvxon0Epd8HdC9/BOeyXhYuQbHPUgrD1gghsRX3+g=; b=XFlJzFPcAo6fx6acgZdE2DFTIFSJxYIreaVSeGE6+XRenjdXZsYLzfwvJfoVdls3Tw ISF2qF5Y9cPP13fnVBQ7A5Fe/AYt1ulugAXFpxzsvK+VorJEWFRYZtl0DoNpje0YRhwI C7VlpgAnuj+ufW7eWyHpn/D3NiE9BK7h2zeg56oDYpvK7iNcDXxP3ATDlsxamBv6usie Bj2AMoPhEKwOH7VPaXo6hghXHKqnaJHujt2JO77snACf0lkvgQUWxQ7eotFd0X+1Bq51 bFEWGSGDQ1DcQWv4JL34l6er5Kr0H04mFoXA57ktJ83sjs3FxtS11gitvXfEmGQdqW8i 3bVA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="V2xX2L/D"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-136271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136271-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x72-20020a50bace000000b0056e0d134fdesi4448355ede.529.2024.04.08.23.12.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 23:12:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b="V2xX2L/D"; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-136271-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136271-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 12AB61F22D81 for ; Tue, 9 Apr 2024 06:12:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E935276F1D; Tue, 9 Apr 2024 06:12:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="V2xX2L/D" Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A7A97441A for ; Tue, 9 Apr 2024 06:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712643123; cv=none; b=l9/Z7h559xLlthuP06//feDePbhpg3TculONoiFIjtJW/p3WJyvIish7OWoc59je5kIs3jMcBV/nlNwHGDsohXxd4TEuKIX7l+RohqoYSGKZ3BvjiR9swLy2eRmB6UtTZpAJCCfyyQdxGoyGV/Kkd0giUFu2XUCMzjCSwYLyOSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712643123; c=relaxed/simple; bh=5sZFa9MwpAUEn0MLOkKBsH+G2UQd4bau7WQNBed8iyw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WWpH/vbGg6dj/rSYlKKY0NrRrme5z71s/FImzLvrXU6switx7eTZ0VHWI688YSvQCYIZkXOtwo7JGNr+wjvmi8QcnHcqBPbzEDtvw70Za//JEe9BR/KkE87cQjM1qm/CRKk20ctQNhu3lITkR54v9/vCIW5SqE0tYXAN8xiuS7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=V2xX2L/D; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1e3c3aa8938so24053675ad.1 for ; Mon, 08 Apr 2024 23:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1712643121; x=1713247921; darn=vger.kernel.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=JiLAeIECyw84AGrUV1USEqteoHaPU8YvP/EXtLFxWio=; b=V2xX2L/DvMMKWI6yS/MWSbs0ue4J43XBqp9OJJP8VwfUf8tYxT/Fi8lghIC5a0EidN fiYZhZSbUTCF/dJ+vGLx6bHZqgk7bMbjkoZMrefG/ZtEw6NJ5/m44oqbKNxm+WHKDyiw hk3uC1Z3VoYNSwzwd5ydleMo0NkA+XJ9+TYwgikW1PXqWRnyXlto4qUDl+5toh4ijPoI bQmRiq2IL10y0Bsrf0C4bENW0nB+m2Y+bmfN6upk5z6q+8Jg3DIlqE0irjfqa3RW8hWU FUmPc8GyOozmpaN7UZcXm1acgPCX5TcwSvZHEUGCXz3nm7uW9mp1EhrlCQrdILghLV/1 UW0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712643121; x=1713247921; 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=JiLAeIECyw84AGrUV1USEqteoHaPU8YvP/EXtLFxWio=; b=qtiF/NGv+RcsN+Yy2CzQU3ZsUmjNRRTd5nPhXJDWfV8tkTVRDMAnFhAh9JbboJ65ns rJ+r/wMBIVzNbQfJ9n7AmWVBuTcGfV6m8CKp12SG2CfWc3UqmGdP00M6F3IRleSyuF/+ Ze44GekDLx6X7HFa3vcz07o1PdJ1oOwtx/9qdAgpwwkeETL+gwNVVfGZJk0AOPMOXrNf bseTFAaaKFAgh7rc2aYIS4MJ8YrwcULwXcUFXZFBbHNhvt6UCRtNeMJBYasRCw9HCQCd CLEKXAyJuZNhSYnJcn1R6Um4PcYfH6BB+jSQXf8DWkPJjUUyBe5GTfWB49+V950rpWqq 9yCA== X-Forwarded-Encrypted: i=1; AJvYcCXTdxlyQH7152XjnBzgBzNmJQZAY6eDmY1pyBdY9BEla+TIchccMSfoicHQvb2wK0B6YAuRcDgxTAHADh9+hIj/SkMD49kO0au7xiBo X-Gm-Message-State: AOJu0YwxnkAFLLIJoI+MWXvshf8MbfNdem9qo2MsUgf9IOoBsEd3aPwt AB94t0qkOhAbjwwOkIWPsvxrXup9E0IUs/3s0TmARRqYSuGHQ7c8cZzrho6EKls= X-Received: by 2002:a17:902:ce06:b0:1e4:70d0:9337 with SMTP id k6-20020a170902ce0600b001e470d09337mr3182383plg.45.1712643121070; Mon, 08 Apr 2024 23:12:01 -0700 (PDT) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id n3-20020a170902e54300b001e3dd5972ccsm5775564plf.185.2024.04.08.23.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 23:12:00 -0700 (PDT) From: Deepak Gupta To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, nathan@kernel.org, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com, andy.chiu@sifive.com, debug@rivosinc.com, hankuan.chen@sifive.com, guoren@kernel.org, greentime.hu@sifive.com, samitolvanen@google.com, cleger@rivosinc.com, apatel@ventanamicro.com, ajones@ventanamicro.com, conor.dooley@microchip.com, mchitale@ventanamicro.com, dbarboza@ventanamicro.com, waylingii@gmail.com, sameo@rivosinc.com, alexghiti@rivosinc.com, akpm@linux-foundation.org, shikemeng@huaweicloud.com, rppt@kernel.org, charlie@rivosinc.com, xiao.w.wang@intel.com, willy@infradead.org, jszhang@kernel.org, leobras@redhat.com, songshuaishuai@tinylab.org, haxel@fzi.de, samuel.holland@sifive.com, namcaov@gmail.com, bjorn@rivosinc.com, cuiyunhui@bytedance.com, wangkefeng.wang@huawei.com, falcon@tinylab.org, viro@zeniv.linux.org.uk, bhe@redhat.com, chenjiahao16@huawei.com, hca@linux.ibm.com, arnd@arndb.de, kent.overstreet@linux.dev, boqun.feng@gmail.com, oleg@redhat.com, paulmck@kernel.org, broonie@kernel.org, rick.p.edgecombe@intel.com Subject: [RFC PATCH 02/12] riscv: add landing pad for asm routines. Date: Mon, 8 Apr 2024 23:10:33 -0700 Message-Id: <20240409061043.3269676-3-debug@rivosinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240409061043.3269676-1-debug@rivosinc.com> References: <20240409061043.3269676-1-debug@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit SYM_* macros are used to define assembly routines. In this patch series, re-define those macros in risc-v arch specific include file to include a landing pad instruction at the beginning. This is done only when the compiler flag for landing pad is enabled (i.e. __riscv_zicfilp). Signed-off-by: Deepak Gupta --- arch/riscv/include/asm/linkage.h | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/riscv/include/asm/linkage.h b/arch/riscv/include/asm/linkage.h index 9e88ba23cd2b..bb43ae7dadeb 100644 --- a/arch/riscv/include/asm/linkage.h +++ b/arch/riscv/include/asm/linkage.h @@ -6,7 +6,49 @@ #ifndef _ASM_RISCV_LINKAGE_H #define _ASM_RISCV_LINKAGE_H +#ifdef __ASSEMBLY__ +#include +#endif + #define __ALIGN .balign 4 #define __ALIGN_STR ".balign 4" +#ifdef __riscv_zicfilp +/* + * A landing pad instruction is needed at start of asm routines + * re-define macros for asm routines to have a landing pad at + * the beginning of function. Currently use label value of 0x1. + * Eventually, label should be calculated as a hash over function + * signature. + */ +#define SYM_FUNC_START(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \ + lpad 0x1; + +#define SYM_FUNC_START_NOALIGN(name) \ + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) \ + lpad 0x1; + +#define SYM_FUNC_START_LOCAL(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) \ + lpad 0x1; + +#define SYM_FUNC_START_LOCAL_NOALIGN(name) \ + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) \ + lpad 0x1; + +#define SYM_FUNC_START_WEAK(name) \ + SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) \ + lpad 0x1; + +#define SYM_FUNC_START_WEAK_NOALIGN(name) \ + SYM_START(name, SYM_L_WEAK, SYM_A_NONE) \ + lpad 0x1; + +#define SYM_TYPED_FUNC_START(name) \ + SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \ + lpad 0x1; + +#endif + #endif /* _ASM_RISCV_LINKAGE_H */ -- 2.43.2