Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp749141lqc; Fri, 8 Mar 2024 10:26:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZYARy2B4ZcP3+L7sp+lxD6O58QhHYcEIrXsRN6tn513r7tCVUZK/NOr/8h5sm7AmAC4bJtbPdQlC8ZB6yLeCo3OOuATm9yq4O1HdlYg== X-Google-Smtp-Source: AGHT+IFs26FV4V/8mmzNvRqm1Kf+UZO3W719zRsZYdAZSMYWkA9q6prxS3Qzi9/IYNvvGIRqDSxD X-Received: by 2002:a05:622a:448:b0:42f:2047:92dc with SMTP id o8-20020a05622a044800b0042f204792dcmr144qtx.10.1709922369130; Fri, 08 Mar 2024 10:26:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709922369; cv=pass; d=google.com; s=arc-20160816; b=YSoXObLzAu6NSza1l5pzIaRjdrfCYstZ65jZjL9BCGy7y5lvXyNXYnJxRJuijQg9t/ OQIa8SmLNsNFqmP43sfEjsMG+RcvJQI0kzHSxyviltq3ZyxQFjt2y4m8Gmx4zc/BjOnV j2DYG3mhrz3KeH0mxM6Y1ym9DBjzJj2Ub3gtpvPRKS3113N4esNZsYHNd+g7jj7fws1O KRXqqy+OEQ68K5Heuwfbxhk23uSX7JKZHnO9v9r8nAqtkGTqGLjfwm1eYs3zwYzLXw4k rWyLj+Yr9NIIUTtWQHNxSlVfpK7OyGZAr+2zmFG05hr6UvHvgVJ5h5+b3acVyLDE2tuH 87Hw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=hoSjgbEckKxxEroEjUzvoD7N56Z9lulxyyOlHDmHt9o=; fh=jcnAHhtZtfp71P7CLV12L2JaOUBaOZ/biOFGFM9FQYg=; b=OKOleaSbMQI/yC6YtyNvN3T4VnBNfNBxLgRd+he+Az6cpt2UzVIJmSTtSTCA0EdNVU zef52d5HIhHcrskiEWobgkHpS71hcI898qI+jm8faG5Pv08kbmgBtRnP/IkFb38Txsnx YF57WenEkHFpwSX3f+nH50Pc7fEPcSL7cPxqVVaxIQIr97UsXRKkGW5rItM3h5TSiQqo X7m2P1zDJ/IcvOdnWfwNvG/snG8Rbicnrp/s+wp4b98QkrA/SNJWzgGZu5zlZdXbdP6P Rrid1So/BEgrQE4E78OoBMHAnczF+VeWjprheMSnP5YTfKKM/Rl1rTZ0P10/GRzg2UUB DGJg==; 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=CC1P8bWP; 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-97451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97451-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r3-20020a05622a034300b0042ef6607fd4si56214qtw.95.2024.03.08.10.26.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 10:26:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CC1P8bWP; 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-97451-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97451-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C7EBF1C216D5 for ; Fri, 8 Mar 2024 18:26:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5400A56478; Fri, 8 Mar 2024 18:26: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="CC1P8bWP" Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 C88A3381D4 for ; Fri, 8 Mar 2024 18:26:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709922362; cv=none; b=KfPCVhpcrcr+al24UR06JBwg/2V1ThcfVXOlvFNPOvkRVMu573bXPKqrGb7DngwN9zq1GxV3tVrf7/9n/87gmOx8Z8YccsMrhVS9hmm/4dNgKR301qLwnoA99KNeYrTI2eHMOhNTl0qVgT3/Lv93q5lHfi2omoEXOy6+OYgToWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709922362; c=relaxed/simple; bh=mhSJPSDAQcTli1q8D3Nd6CYHlA7Z7/7MIiS4fHVZ1pM=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=CQJ92O2l6fYbDljh7cPNAZTjt/q4B9I/GRfUhAXd75dodXL24+VhHsCj9k/BSSEgR1TaEaQTngn0cTcZt3MlsTMO+aU1kHRlm+GjbOBKbt6+eOzy0f2M2aqVp+eF2MOWigSHhlrHyCi/PJgIyxtedmVtrV3mp8yENCn9lJSgmpw= 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=CC1P8bWP; arc=none smtp.client-ip=209.85.216.49 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-pj1-f49.google.com with SMTP id 98e67ed59e1d1-29b7dbe39ccso1708450a91.1 for ; Fri, 08 Mar 2024 10:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1709922360; x=1710527160; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=hoSjgbEckKxxEroEjUzvoD7N56Z9lulxyyOlHDmHt9o=; b=CC1P8bWPncOBEdB4UBaWosJz0ML9l+5gP6ZsFBhfuo4QKbOABpfP1c7E087GpQcnO9 /AbT964FTVg1hFSs5KZXTNiPDNNrVTJ+BJvqM350zQxvoi9wGsTm2XOXI026DzX5R83l NjIYkrpH++1vfxRgUPx1Wcfi4TliRGJHPEwoJ4KNJyS0wQew3apITjnHdCLx3Wfe7oIo bl9GPDZEoHTwkgr5Pw9V0VdyOd/pWM4QGG+gyMFyesWpAHnq8bH/BrTb4z+kv3ySdA/o T7C91nfr2I3lKNIfTPh4PFRZK6ClMek+4fZDttWUdNCiaEhuNX9AA28jkjGCqza6R481 VPjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709922360; x=1710527160; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hoSjgbEckKxxEroEjUzvoD7N56Z9lulxyyOlHDmHt9o=; b=nAly+aiVep+CCW6RgtTMuHsDEVqFXVO9YfpX4oawoep624Rz8t8myW+LQIMOHXJ/mv azYmC9Q7otNGVmhgr4o44A9xN97Qfw8+/CdzZhWIuZFDgTZsoQGog6LNnL7NPi7OXaFW BE853tVJCGdGCGYklkzB+yjSCyz65EuH9EbinuiPGoJ6E6ANxSVlEoIQ4WRgvMnA6HxU 8Ej9biaM00eGbVDtql8EJBG8OETpj8KtBwAj9UiThzx1HN+YV1eG/lH6mxsOAs9or8AU kKqdyQn/VDigCJ5ZJ4CJ1OQDpBLP9S75BsHW7aKEbvAcn4LPSJrXbnOUxIhgmlvELMxd O/Qw== X-Forwarded-Encrypted: i=1; AJvYcCWmhckjdKpUnH+c/dLeMw5FYZl0zSCWAvARj31m9gywVPFDjkQZrK5MmLhqLdHRZMWGXgkpdrm7FioyPDwKbIxDGUoc0H+996tXS33X X-Gm-Message-State: AOJu0YznQuBjx4/WWBVeut5wzltFJU//UOuCrq+X1qGl4g4cAOBtGyIg D+t5o9YOIVK+ZW8atzaMaSU7SqsPl8pdVp+k6T2Pr0G1YyS3Rsnp82LB7Fr0LM8= X-Received: by 2002:a17:90a:df86:b0:29b:c432:c1bb with SMTP id p6-20020a17090adf8600b0029bc432c1bbmr257530pjv.24.1709922360133; Fri, 08 Mar 2024 10:26:00 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id e13-20020a17090ac20d00b0029bb1bb298dsm44821pjt.35.2024.03.08.10.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 10:25:59 -0800 (PST) From: Charlie Jenkins Subject: [PATCH v9 0/4] riscv: Use Kconfig to set unaligned access speed Date: Fri, 08 Mar 2024 10:25:54 -0800 Message-Id: <20240308-disable_misaligned_probe_config-v9-0-a388770ba0ce@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIADJY62UC/43QyWrDMBAG4FcJOtdF+5JT36MUo2XsCBIrSMW0B L975VxiisA+Df8cvlkeqECOUND59EAZ5lhimmowbyfkL3YaoYuhZkQx5Zgw0oVYrLtCf6v1Gsc JQn/PyUHv0zTEscOcWbBMicEwVJV7hiH+PCd8ftV8ieU75d/nwJms3eP2TDrcGR2IEGB8sPojx zmVOPl3n25o5Wf6Iik+QNJKKuWZ1A6CcrRBsi1J90lWSc/5YMiAmXOyQfINSeQ+ySsZPCYgNPH Y+gYpNiRV+6SopJNaMM0lUGUbpHyR7MgvZSUloeCCNANnuEGqLXngcLWS3mBODChrWr/UW/LA4 bqSQtQVpXfMaPePXJblD0PDG6kWAwAA To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Jisheng Zhang , Evan Green , =?utf-8?q?Cl=C3=A9ment_L=C3=A9ger?= , Eric Biggers , Elliot Berman , Charles Lohr , Conor Dooley Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Charlie Jenkins X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1709922358; l=3401; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=mhSJPSDAQcTli1q8D3Nd6CYHlA7Z7/7MIiS4fHVZ1pM=; b=9nd3CN2A2kFLFI1Z1TTqF/VXEKKQTjlAt9ZnI6vd03L2nOq15g+9nnrrcshi6CpFEerdBVIEC 8i49edyJt3XBKpYQyftb+jc88oWQZWh3zRpgB731qopvdzKlje8w8xT X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= If the hardware unaligned access speed is known at compile time, it is possible to avoid running the unaligned access speed probe to speedup boot-time. Signed-off-by: Charlie Jenkins --- Changes in v9: - Clarify wording for RISCV_MISALIGNED Kconfig option - Link to v8: https://lore.kernel.org/r/20240307-disable_misaligned_probe_config-v8-0-55d696cb398b@rivosinc.com Changes in v8: - Minor commit message changes (Conor) - Clean up hwprobe_misaligned() (Conor) - Link to v7: https://lore.kernel.org/r/20240306-disable_misaligned_probe_config-v7-0-6c90419e7a96@rivosinc.com Changes in v7: - Fix check_unaligned_access_emulated_all_cpus to return false when any cpu has emulated accesses - Fix wording in Kconfig (Conor) - Link to v6: https://lore.kernel.org/r/20240301-disable_misaligned_probe_config-v6-0-612ebd69f430@rivosinc.com Changes in v6: - Consolidate Kconfig into 4 options (probe, emulated, slow, efficient) - Change the behavior of "emulated" to allow hwprobe to return "slow" if unaligned accesses are not emulated by the kernel - With this consolidation, check_unaligned_access_emulated is able to be moved back into the original file (traps_misaligned.c) - Link to v5: https://lore.kernel.org/r/20240227-disable_misaligned_probe_config-v5-0-b6853846e27a@rivosinc.com Changes in v5: - Clarify Kconfig options from Conor's feedback - Use "unaligned" instead of "misaligned" in introduced file/function. This is a bit hard to standardize because the riscv manual says "misaligned" but the existing Linux configs say "unaligned". - Link to v4: https://lore.kernel.org/r/20240216-disable_misaligned_probe_config-v4-0-dc01e581c0ac@rivosinc.com Changes in v4: - Add additional Kconfig options for the other unaligned access speeds - Link to v3: https://lore.kernel.org/r/20240202-disable_misaligned_probe_config-v3-0-c44f91f03bb6@rivosinc.com Changes in v3: - Revert change to csum (Eric) - Change ifndefs for ifdefs (Eric) - Change config in Makefile (Elliot/Eric) - Link to v2: https://lore.kernel.org/r/20240201-disable_misaligned_probe_config-v2-0-77c368bed7b2@rivosinc.com Changes in v2: - Move around definitions to reduce ifdefs (Clément) - Make RISCV_MISALIGNED depend on !HAVE_EFFICIENT_UNALIGNED_ACCESS (Clément) - Link to v1: https://lore.kernel.org/r/20240131-disable_misaligned_probe_config-v1-0-98d155e9cda8@rivosinc.com --- Charlie Jenkins (4): riscv: lib: Introduce has_fast_unaligned_access() riscv: Only check online cpus for emulated accesses riscv: Decouple emulated unaligned accesses from access speed riscv: Set unaligned access speed at compile time arch/riscv/Kconfig | 58 ++++-- arch/riscv/include/asm/cpufeature.h | 31 ++-- arch/riscv/kernel/Makefile | 4 +- arch/riscv/kernel/cpufeature.c | 255 -------------------------- arch/riscv/kernel/sys_hwprobe.c | 13 ++ arch/riscv/kernel/traps_misaligned.c | 17 +- arch/riscv/kernel/unaligned_access_speed.c | 282 +++++++++++++++++++++++++++++ arch/riscv/lib/csum.c | 7 +- 8 files changed, 374 insertions(+), 293 deletions(-) --- base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d change-id: 20240131-disable_misaligned_probe_config-043aea375f93 -- - Charlie