From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 B7F2E191F92 for ; Tue, 20 Aug 2024 15:24:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724167472; cv=none; b=AqClmvbdpleMmaagAjdNkdYoeVcHHYnZjYtoCIC2WbokKsi19HgH+CNCEbFl3CWDL93AvGpZ1xWhnDRoT9Jq+/9nOHG6fH+ckCqwDKXSq3mqo32e8cEOPUA/0pPXaj5e0Df8z9ATYKfUjTIcLeT5UvnI6lwPxW+yu1iWcty1hMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724167472; c=relaxed/simple; bh=lHCuR+6j1zERFHSs+KvLhuwolO3WP77swGPzBPMSIJM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=S9RVbS9qEIYi7yfXyDSBh32oK/Jy2qcDD/jo5jw0vB1S+KGacbMSlyONJ7pBF/WRhe0JzTLVXQGNfaNKIuymVdT0/0x42CHb8VqhR5FdUPBrGKPtcLwhZjbW47mchPp6yqf8T/gjlrUxiXm6VRqlRfwx1UT5dI7yYZgWdlZEuKM= 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=OhR17+Gx; arc=none smtp.client-ip=209.85.216.42 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="OhR17+Gx" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-2d3c05ec278so3927884a91.0 for ; Tue, 20 Aug 2024 08:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1724167470; x=1724772270; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/9HfCveIGD6wgO07CWK+R0yFcUzfSO61CbRgrTad0T8=; b=OhR17+GxmiQ+7WtH/9f14NpHEInGdO4rRM8XIprEZlboX6eUBf/rlCfydBnd37Kyxm DEx/UZZ9AHKGasCXohCF19xs06sFP8TwDC27uDIsxshhzffBdXJRB6KmeTTCUK8u4Wwi 4yPc8Gsa8cAIpO/xHa/RDLWUORY4e+sdaltV1UzWTDokZHS7hMwDAvbBcGtEa8t5gcnE T8kxZjpMOcsIl/cEu6eT5LVdMZwNTFukIr/JxyCGU0W1/WQ/KGPD2sDtgZG1QFfx4sOJ pyOzxX3XnqeKR3M9ETbysKynmBUT792evxgNpSnMm5DG5EIuToHvDXzUhQgFso+wPa60 fteQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724167470; x=1724772270; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/9HfCveIGD6wgO07CWK+R0yFcUzfSO61CbRgrTad0T8=; b=m1oGwFAx8qjs9uZuSlNofV4ilZUZnzPiN8utdTizrnWFZnmHKCki9qvtf7saWlodSr qbs4vu7ly+UBE8s8F9IANmxrxKwMM4Ful/S1EsIdc1MUmyoLQi1U/oXnsuHMXkIx4m/r yhld2dm4bny4sWDhlQz2+eQrzw4xu3Q5YdW7Z+kXH0TbuoWW3LTiytLoXfnoZ6FtQTmT AW6ju8rbLHEK03m5HWLB9Y5XuUk3GEWhHBG2KO79jihg/3JdiLbNYo2uYQSG7edxS+Ne Wo+FSWwErn6Gxqi7zeVgdpDwecJiSn+FGx+F1qtyu9gclQIUF09yJjAStDVBJJnBJ3x7 k29g== X-Forwarded-Encrypted: i=1; AJvYcCVZoetNqwKnoWp4k8Zm5tMWjmExJi9zp9b2Gic1EEpJTKa5JnGj/YRQcb3RHFBSVf4WBYYRH2bs+CDMpXb0TtQc58wlLzahLdl4pg== X-Gm-Message-State: AOJu0Yx1kKRs3XJZYp2DFsweYhbkxATiDPckIZKYCg+RdWrQQBC4pUOi W+8DTbDtn0tjYW9HXlDDxgusIm5l6HkQ6zj8x7k7P/+TcCd81y0pUxVeUlqabg0= X-Google-Smtp-Source: AGHT+IEFp8nNWtAhX07M+oXg7b8ZrLAlbIoqjPUVrUowEtxL+yOzQda+T9qdfMXpVJlBtO5ij749KQ== X-Received: by 2002:a17:90a:d803:b0:2d3:bd32:fc7d with SMTP id 98e67ed59e1d1-2d3e0409749mr14730820a91.39.1724167469966; Tue, 20 Aug 2024 08:24:29 -0700 (PDT) Received: from jesse-desktop.ba.rivosinc.com (pool-108-26-179-17.bstnma.fios.verizon.net. [108.26.179.17]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d40bea7cb3sm7258157a91.25.2024.08.20.08.24.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 08:24:29 -0700 (PDT) From: Jesse Taube To: linux-riscv@lists.infradead.org Cc: Jonathan Corbet , Paul Walmsley , Palmer Dabbelt , Albert Ou , Conor Dooley , Rob Herring , Krzysztof Kozlowski , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Evan Green , Andrew Jones , Jesse Taube , Charlie Jenkins , Xiao Wang , Andy Chiu , Eric Biggers , Greentime Hu , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Heiko Stuebner , Costa Shulyupin , Andrew Morton , Baoquan He , Anup Patel , Zong Li , Sami Tolvanen , Ben Dooks , Alexandre Ghiti , "Gustavo A. R. Silva" , Erick Archer , Joel Granados , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v9 0/6] RISC-V: Detect and report speed of unaligned vector accesses Date: Tue, 20 Aug 2024 11:24:18 -0400 Message-ID: <20240820152424.1973078-1-jesse@rivosinc.com> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Adds support for detecting and reporting the speed of unaligned vector accesses on RISC-V CPUs. Adds vec_misaligned_speed key to the hwprobe adds Zicclsm to cpufeature and fixes the check for scalar unaligned emulated all CPUs. The vec_misaligned_speed key keeps the same format as the scalar unaligned access speed key. This set does not emulate unaligned vector accesses on CPUs that do not support them. Only reports if userspace can run them and speed of unaligned vector accesses if supported. The Zicclsm is patches are no longer related to this set. Changes in v6: Added ("RISC-V: Scalar unaligned access emulated on hotplug CPUs") Changes in V8: Dropped Zicclsm s/RISCV_HWPROBE_VECTOR_MISALIGNED/RISCV_HWPROBE_MISALIGNED_VECTOR/g to match RISCV_HWPROBE_MISALIGNED_SCALAR_* Rebased onto palmer/fixes (32d5f7add080a936e28ab4142bfeea6b06999789) Changes in V9: Missed a RISCV_HWPROBE_VECTOR_MISALIGNED... Jesse Taube (6): RISC-V: Check scalar unaligned access on all CPUs RISC-V: Scalar unaligned access emulated on hotplug CPUs RISC-V: Replace RISCV_MISALIGNED with RISCV_SCALAR_MISALIGNED RISC-V: Detect unaligned vector accesses supported RISC-V: Report vector unaligned access speed hwprobe RISC-V: hwprobe: Document unaligned vector perf key Documentation/arch/riscv/hwprobe.rst | 16 +++ arch/riscv/Kconfig | 57 +++++++- arch/riscv/include/asm/cpufeature.h | 10 +- arch/riscv/include/asm/entry-common.h | 11 -- arch/riscv/include/asm/hwprobe.h | 2 +- arch/riscv/include/asm/vector.h | 2 + arch/riscv/include/uapi/asm/hwprobe.h | 5 + arch/riscv/kernel/Makefile | 3 +- arch/riscv/kernel/copy-unaligned.h | 5 + arch/riscv/kernel/fpu.S | 4 +- arch/riscv/kernel/sys_hwprobe.c | 41 ++++++ arch/riscv/kernel/traps_misaligned.c | 131 +++++++++++++++-- arch/riscv/kernel/unaligned_access_speed.c | 156 +++++++++++++++++++-- arch/riscv/kernel/vec-copy-unaligned.S | 58 ++++++++ arch/riscv/kernel/vector.c | 2 +- 15 files changed, 465 insertions(+), 38 deletions(-) create mode 100644 arch/riscv/kernel/vec-copy-unaligned.S base-commit: 32d5f7add080a936e28ab4142bfeea6b06999789 -- 2.45.2