From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 138E2130AC8 for ; Thu, 13 Jun 2024 19:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306198; cv=none; b=q75LaoUvmJAS/jLA23Zc0+Z8SionqDjeqMDzUAFbxPvjwsx1bBaFd/grB+AA9JX4a1KcBiRyHBRY/KaOlUtEiPVNPD702i72zu17ihXtDi3FXJyxsmg2f1UkV2tbJ8VNbrN53Y2+P9Ym30F+anM1a1G29Q7VeU0VxvYAqlm/X4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718306198; c=relaxed/simple; bh=xwz2gGVasPLG4WICRlhAaUV6zxKEkVvjxfn+L/yOsK8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=L6eerDq6v0hiI+iqmuXG9jkmBG8cs1Z+BM7Ea950SNtZbrPXziR80uC0LMtFesc7HfK2a6ONPLS6bVtClNgQ9TO64M5BoIKnlscjP+scJjtbqCth0VkUnL+uzVMbyju+Vd51pctOXjavp2wxDkOYG50aIFuWP90DBv+/FS9SMO8= 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=NCFslb8p; arc=none smtp.client-ip=209.85.214.180 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="NCFslb8p" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1f64ecb1766so11601885ad.1 for ; Thu, 13 Jun 2024 12:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1718306195; x=1718910995; 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=hpOwinj0W1yetvQNtkELpr5Kiud2ruzeFCMoj01VdbY=; b=NCFslb8pBIwyyil2TGL5uUyQi3bwW3CfWqDmgEpcXozuF5NHnSAZLFDm7gOSY3yGhR VZeyg5FgRmFzK36fWdCinVqVftCeaDx3sPxSp0qMZrfCd+IIKdLZjpP6ig6igmNimKIG SzZ13IxlTAKAfTvspd/xAfe0GGedWsRNcG8W5DTH1VJ2TztylOTfVOp8hCFC/w8o112a PHKjQUzOVH5YranCPXjRcuv9MKTzSxXU3OhPlfNsgSXBh1Clei2uLnDgFwBhrds9bKTW T3TMOotDrNHH7Q1SqSfCzufuZ6lJb+EiLnawL/VMi3v6alVUwwM2z7hgNIOruqAOIOLK 01sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718306195; x=1718910995; 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=hpOwinj0W1yetvQNtkELpr5Kiud2ruzeFCMoj01VdbY=; b=sRyUGfLvrxff2d3mq03sRuwENm77dsNrc07S/5DE/mp1AKb6tyj/kHLOU3UZMGUT1I KMCPy2lUNYRMNn3QpcyT+QglPnm2ykfw0CFCO45isU6CLBXNRr3xQK8C9iQ1cPvDhvJq /HSrTV6CXaKcP0HdIFasWyUqbkDW1XYpNOM2XRXAoFuJVat2lTqI90eShPpv4Wh2f1jb FOavK/nnYg/MoAg3i4H8zuMNz9sDdY3Z5Cx0rWaY06ppdV9G2Eyg++4rYp6y89w+ciYr qS7Ws8rFjKzaK/C+go7EhEMRfgn9iThADw25DDu7KHwb7APosB/dRxBDAdR+8BsR89MT LpDw== X-Forwarded-Encrypted: i=1; AJvYcCVlHhAhNjJyZDnEV4V14Wq6Ra/jphrJfB9WBQNMvseTx6nDH0cY8Ul9I3peWuMp+howt8HV2/7/9Hg09SIus90P3oFb9fh1x5GQWQ== X-Gm-Message-State: AOJu0YwxunM2r9oY//wKC7Cz8dLK9dmQmpcgeJIzbUVvn3Yq9d6U9IDL kPGDhfjzYIDBZDMD3FLrWwSI+nje8eubbmdcJhCGR7Y7R55PQuaQM0slHzmNrsY= X-Google-Smtp-Source: AGHT+IHHy8Y/gbuqVUoKIBAHl3Kik8dEPGS63zG9zTuBzI8FXFYH9pTlmfj7DD0pHAJEd7bxMGtqFw== X-Received: by 2002:a17:903:1249:b0:1f7:393c:fcdf with SMTP id d9443c01a7336-1f8625c0537mr7044225ad.6.1718306195179; Thu, 13 Jun 2024 12:16:35 -0700 (PDT) Received: from jesse-desktop.. (pool-108-26-179-17.bstnma.fios.verizon.net. [108.26.179.17]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855e7ca78sm17471015ad.106.2024.06.13.12.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 12:16:34 -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 v2 0/6] RISC-V: Detect and report speed of unaligned vector accesses Date: Thu, 13 Jun 2024 15:16:09 -0400 Message-ID: <20240613191616.2101821-1-jesse@rivosinc.com> X-Mailer: git-send-email 2.43.0 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. If Zicclsm is present, the kernel will set both scalar and vector unaligned access speed to FAST. This patch requires the following patche to be applied first: RISC-V: fix vector insn load/store width mask https://lore.kernel.org/all/20240606182800.415831-1-jesse@rivosinc.com/ Jesse Taube (6): RISC-V: Add Zicclsm to cpufeature and hwprobe dt-bindings: riscv: Add Zicclsm ISA extension description. RISC-V: Check scalar unaligned access on all CPUs 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 | 19 +++ .../devicetree/bindings/riscv/extensions.yaml | 7 + arch/riscv/Kconfig | 59 +++++++ arch/riscv/include/asm/cpufeature.h | 7 +- arch/riscv/include/asm/entry-common.h | 11 -- arch/riscv/include/asm/hwcap.h | 1 + arch/riscv/include/asm/hwprobe.h | 2 +- arch/riscv/include/asm/vector.h | 1 + arch/riscv/include/uapi/asm/hwprobe.h | 6 + arch/riscv/kernel/Makefile | 7 +- arch/riscv/kernel/copy-unaligned.h | 5 + arch/riscv/kernel/cpufeature.c | 1 + arch/riscv/kernel/sys_hwprobe.c | 48 ++++++ arch/riscv/kernel/traps_misaligned.c | 142 +++++++++++++--- arch/riscv/kernel/unaligned_access_speed.c | 154 +++++++++++++++++- arch/riscv/kernel/vec-copy-unaligned.S | 58 +++++++ arch/riscv/kernel/vector.c | 2 +- 17 files changed, 484 insertions(+), 46 deletions(-) create mode 100644 arch/riscv/kernel/vec-copy-unaligned.S -- 2.43.0