From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 A2365299A80 for ; Fri, 23 May 2025 18:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748025394; cv=none; b=Dp7GpnEdqngCeWH2sheuUBLc7VlNCTeGJ4QKo6mQuATQyvSpLh27E4aZWFZgCGhwHb8EGXAZbx4Tl6SP6sRc/nDgtW6598EyTkLHVEX51bUsvOZNhzkja5BaFZqu62RXqYhSUTLvmY5lTwjOmiQ8Gr8HdcJQlP8GlFOXv9CxzRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748025394; c=relaxed/simple; bh=QOHDK0F2LEI21yWReKMJ2qBW2Ku8NNmNWGVoqKGiruA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qsxKwTSDBS4V+02tYtq97ysEWifRXTad4mq4GJwXZqara/5L/fp6TEAWeVB8CZOTa34wvT/r9V80GGd4RETt5ac2HCVXbtSL7nvk1U8Tuyvgf/hYF5ic5qIFUPRovKHZUbF8spasqj1Vfvsz3XIIF+g6sumjXp1ZhJaAluE6DLs= 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=brVdetyL; arc=none smtp.client-ip=209.85.214.176 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="brVdetyL" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2321c38a948so1991735ad.2 for ; Fri, 23 May 2025 11:36:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1748025391; x=1748630191; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=XnO8ioDanheZvAb9A+PQvS64cAnXAyms8SMalyfchF4=; b=brVdetyLQ40C6IaOjMmbqJ7m9i5p4e4vwEd5WantWmRRyGkknwUd9iG1jew9mgrh5B 7lFczKCieAehO5x97nz0zaH3Dg31V1eqcSz/0avP/D/N3HGZ6nYcqjXvUuQf+shV+QvF u5kaugL1a+Ul5iI0OKJnkIet0vXRhv5SEco43yEm213Yo9uxGnq+t8RNY7Hds3JATeyU V79lCPn+iNhI8e6eBF7KUyW9TRflxTNGyIk7Ed0icV/VXlou0XU5fyr53o8OkNMSKRTI S8itP1c9SEuMbj62XOIpPYZrdjmKvNTARvK01iqT2RrHHd28Cndxvm0k2CBDckAfFzXH 4eug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748025391; x=1748630191; h=in-reply-to:content-transfer-encoding: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=XnO8ioDanheZvAb9A+PQvS64cAnXAyms8SMalyfchF4=; b=XZGUf2Z0z7s+QA+b/CERyo8ToPXX4kEvy1UYgfXLzpCGvvCTzAELc/zAT58Dzh9Lv1 gmAPslkEglYSi42gyDQelzpSSymlVXiHx68/Z9iSwMTydvPNmbvGpyPfKAr+7b+jKM0P 4wOKa49M5rhqVmkz77ux7Tw69ZCo/TTs7UoGcID2MJ6ZIDUpCxEji57n+rCuORTO9dhb cRA5fXhJi4k87u2KtmveOJsiaq5css3r2IMK9jHqfDCacdRshiOKv+tT+aiCUDt5O3T1 sUycBqVVpZl7H01s4xhecTBpUQbRhQDf2aFxFjxcgUjCmnCEFU4iW44CHQt0ZcUOKXSi qF4Q== X-Forwarded-Encrypted: i=1; AJvYcCVtgpDwPjt24GoIYWiy2GWa3VkpNXTHXRlDFsUYZRBCw/HJprasbSNv3fQznBCb+wGdORI3ziJM8Dw=@vger.kernel.org X-Gm-Message-State: AOJu0YymwOGf6pMUPruZUlSYpfYR8VDHzdfJYZbj2y36Hlg5ca4NhkUR jOdjMFpaXE9FdMfcvXQU5YLPwFyQi/TLK+PGJKQO1I2OGfnxeqp0aUQP2JvfUvrDumw= X-Gm-Gg: ASbGncsA2akPlTVLYDH4kx9dY0VXWhuEUk3W22VJ6nG6teyfTcIlJ5Pla3UQo3+UIwU NGXHmRE+xSihxsAhK2aP0qX+7OazIjMeVeSkv1i3vofxAsZAdA3Sffe9EzvkR4MuNU1GuTPt2Gt X/QFlecvZaHkEx1MAXWvrlBrKKNqCVsIps2yl7ZQHI0BjsCW3np+2QYEY7g5g9uVC7KHcqKxbdd NpWwRuROpYw+57h37VbztFrAxEEVHG7yjcIRAht/Y1jAVXU9XA/mAa3xoRjvqP/W1Nm0vG0AAjC u30zHk0fMkCc8DrsQbILZVY4/N2ITPJ6D+XWkskNQNVv8CYU/SmlTydbqQ== X-Google-Smtp-Source: AGHT+IEwnYCpZ451OQ3B+iw4XNmTax9n7nwuUqC+o2uJAltQvhC5r0FNuL4BvGINCHYUs7gwuPUCJg== X-Received: by 2002:a17:902:da8b:b0:224:c46:d166 with SMTP id d9443c01a7336-23414fafe1emr6331075ad.40.1748025390826; Fri, 23 May 2025 11:36:30 -0700 (PDT) Received: from ghost ([2601:647:6700:64d0:bb2c:c7d9:9014:13ab]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-231d4ed897asm127271765ad.250.2025.05.23.11.36.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 May 2025 11:36:30 -0700 (PDT) Date: Fri, 23 May 2025 11:36:28 -0700 From: Charlie Jenkins To: =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= Cc: 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, Samuel Holland , Andrew Jones , Deepak Gupta Subject: Re: [PATCH v8 08/14] riscv: misaligned: declare misaligned_access_speed under CONFIG_RISCV_MISALIGNED Message-ID: References: <20250523101932.1594077-1-cleger@rivosinc.com> <20250523101932.1594077-9-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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250523101932.1594077-9-cleger@rivosinc.com> On Fri, May 23, 2025 at 12:19:25PM +0200, Clément Léger wrote: > 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 Reviewed-by: Charlie Jenkins Tested-by: Charlie Jenkins > --- > 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 >