From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (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 9B16B226CFD for ; Fri, 23 May 2025 10:22:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747995727; cv=none; b=p03d4ElYDmZnv6SDT0gmWo0XiZBv6SZlmyqlswrRE5YgiEhXYIUdmAW7rTLMn0j2mYOr21RqZcXBgvHUdT3yTA93JYW+itMhHIPfPDuCH9bHLYu5GoBTQ9PGmcsHTcDcaMWKgILgXIR/Md6u7JdyWbeoIfh4b81ir3bM5sGS/0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747995727; c=relaxed/simple; bh=WrnyhIasMq6stNyEMZaWBeMPZeLi0WsnQ5RqREJagnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TNmKisjry8m7S2ETw2E8BTc78mxEYLKaLfJM0qHPHKwhgDTmO1PoF9eQR/SaRRIpUM4NFd7UCAlP6udhDoHsSG0qirXS4+3CdG3N/Qw4Lu01ZemWu4aUHltfo4bmr4S9opwwMbe8z9O6nJGDXYVIsBgFPWa2eF6KfFyH6hEVrjU= 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=hWsPuST9; arc=none smtp.client-ip=209.85.210.169 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 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="hWsPuST9" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-742c5eb7d1cso7685732b3a.3 for ; Fri, 23 May 2025 03:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1747995725; x=1748600525; 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=r+BbSDDHoenIJ3oteuCEH5EGHycpOZc3PIlMBGmoJPY=; b=hWsPuST9ePr0oAag0BP3gnLxUGbrjBRqKnYZUHvKUIc3gD7bwyc8nYFZcYtPYvc9Ua zv8S1bJYNEgqbe8weP00C9y5RTtih0lPfJGO/i52rI8lHo6F2qHsddvRSsnSTYFuvrxZ ijk63m7ydyinwqSlmSmWr4BAl2Ur5b8udyVUoTknY4EvtjAxnySB7XjsLglnqK3fUejT 0lP0QWaVYKAFRwG6UlNihI8QnhBnKvk4mEfXkyCfVU9nKNNyHA7scQPypJTKdbvoHY/0 OlZBCK20wCIJxP8loOIfbj4oJmSWj/fYmfXKaoZkvA6yE5vOrm04U74Q14yc6F5+1e7Z twyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747995725; x=1748600525; 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=r+BbSDDHoenIJ3oteuCEH5EGHycpOZc3PIlMBGmoJPY=; b=YJNhFQornqKtVjOdoDKqdU/kNrqdTCLxjiYBlPtmJJDvU1qMxcaJjdvTRcRl2DUch0 qz9TipSvf7DC9dlf4MbPYKcAcfetFwAuD8iOEliB2+g4UiPijHAncOLCXGw9bL1rp4g6 3XANnMNWtIQ1uY9H/4bKDopv8FR6yXk0RbY9cx7tMXPUnv1ukC8MwHRc/aKaNShD4zzh G9fGIs2UVeieeYHiVL9QDGIqniGLSLkAbkT7cH6HMiP4d9ea0CkMviG/DxRpGHfdwj2G AJ9u22WAhPwj5fvYcXCzv67c5IcmbgPIbRN8/2Hu9eiPaC9wkxPB+gTm54yhW5Apb/w8 7DCw== X-Forwarded-Encrypted: i=1; AJvYcCU01zoF9a8HSP6ksqQbP3utccVA6kIPCD29/SpNJ4wtqrsCIy4lU8QwXrEPcDgnijTS7Ym6XP/A/Jg=@vger.kernel.org X-Gm-Message-State: AOJu0Yw42dl0wUlmqx3UydlsUhkRfuucUfWLR3PonmqI0hdkYNFhU/ux ECK/tgBW/U4p86j2DQN8OMzdJEIQlDAcTC1ORPVz1ZtLmtkXNqP0L4i4edoJgsuzNV0= X-Gm-Gg: ASbGncv3Q1vg+whTjNe4S5wCa7FKOdcUEAfPaDaYNtzzRIBSV4TL2UZnZiATVPaDc18 uC+RMRb9KluYi/CR7ONPF1GHFgUiqzAUjGZETEET/xYLbEjNWbAR3rQ52AFmvpiBDIuEwvIGGnX muMibh4fyYyxgmrrIed2uRD0rcxr6/RVMmwbx2Mk6CFgkRAlCI3NP5XzwxgOh/jpp4yOCmQbLt6 G8EMyfX2+99cTr1ndaLhj2OZ0REdeovPbPeTCc7iPM7Vpxk5A8pilxHS1JckPs3EM7xYADsjol2 eSuXUGQpjt/aAHk6yHzge7KNTdn/kDNd99rRMcz+1K5gi+FZzqF7 X-Google-Smtp-Source: AGHT+IGKTvrfjxP+cm7Qm4VGpAeva7NGxp+n2OLS1ggJxzcYA6qQkaI/iWC4Vzlh5iYGSGWB+//FSA== X-Received: by 2002:a05:6a00:4614:b0:736:5822:74b4 with SMTP id d2e1a72fcca58-742a98d4a75mr42390281b3a.21.1747995725139; Fri, 23 May 2025 03:22:05 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:e17:9700:16d2:7456:6634:9626]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-742a9829ce8sm12466688b3a.118.2025.05.23.03.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 May 2025 03:22:04 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Paul Walmsley , Palmer Dabbelt , Anup Patel , Atish Patra , Shuah Khan , Jonathan Corbet , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Samuel Holland , Andrew Jones , Deepak Gupta , Charlie Jenkins Subject: [PATCH v8 08/14] riscv: misaligned: declare misaligned_access_speed under CONFIG_RISCV_MISALIGNED Date: Fri, 23 May 2025 12:19:25 +0200 Message-ID: <20250523101932.1594077-9-cleger@rivosinc.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250523101932.1594077-1-cleger@rivosinc.com> References: <20250523101932.1594077-1-cleger@rivosinc.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While misaligned_access_speed was defined in a file compile with CONFIG_RISCV_MISALIGNED, its definition was under CONFIG_RISCV_SCALAR_MISALIGNED. This resulted in compilation problems when using it in a file compiled with CONFIG_RISCV_MISALIGNED. Move the declaration under CONFIG_RISCV_MISALIGNED so that it can be used unconditionnally when compiled with that config and remove the check for that variable in traps_misaligned.c. Signed-off-by: Clément Léger --- arch/riscv/include/asm/cpufeature.h | 5 ++++- arch/riscv/kernel/traps_misaligned.c | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index dbe5970d4fe6..2bfa4ef383ed 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -72,7 +72,6 @@ int cpu_online_unaligned_access_init(unsigned int cpu); #if defined(CONFIG_RISCV_SCALAR_MISALIGNED) void unaligned_emulation_finish(void); bool unaligned_ctl_available(void); -DECLARE_PER_CPU(long, misaligned_access_speed); #else static inline bool unaligned_ctl_available(void) { @@ -80,6 +79,10 @@ static inline bool unaligned_ctl_available(void) } #endif +#if defined(CONFIG_RISCV_MISALIGNED) +DECLARE_PER_CPU(long, misaligned_access_speed); +#endif + bool __init check_vector_unaligned_access_emulated_all_cpus(void); #if defined(CONFIG_RISCV_VECTOR_MISALIGNED) void check_vector_unaligned_access_emulated(struct work_struct *work __always_unused); diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c index 34b4a4e9dfca..f1b2af515592 100644 --- a/arch/riscv/kernel/traps_misaligned.c +++ b/arch/riscv/kernel/traps_misaligned.c @@ -369,9 +369,7 @@ static int handle_scalar_misaligned_load(struct pt_regs *regs) perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, regs, addr); -#ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS *this_cpu_ptr(&misaligned_access_speed) = RISCV_HWPROBE_MISALIGNED_SCALAR_EMULATED; -#endif if (!unaligned_enabled) return -1; -- 2.49.0