From nobody Fri Dec 01 23:59:15 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Shqm36KTmz52b4q; Fri, 1 Dec 2023 23:59:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Shqm35qlRz4WP4; Fri, 1 Dec 2023 23:59:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701475155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k5nT5hUKCR72+p/AZJU9UEkFDbefW9UlAz9rtUJ5Rqc=; b=N9evP+sYIFiaBnEoJ0zP+igPGNTbXuVKuHR1mgdwklFk5ChUzYju/BPZ2If+cx9OH0AGn7 nrNgYwoRwBD+dd82d1o67zaaHl4ENIZDSvhMpMFxNUucS8eP/6dV/cNsxF35buHgM6phDM u14naf3H9VMEVG50PxWnYAF6H67o9zm25XMxmGuX6lmRkqNKFb8Hhna4MaNOFwgTC3DG0T JILgMG/ShIyX+ul5mtHC0pIKeozf+URM9OgKePhqx/zkDzCZVZOqLYeIVIc+8rLQFD4xh/ lw3PHUn4lreNFlBhZmBqrISH8/3OgjnRUENZG7/W3esa3OtXOVgj8ePSfLFGKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701475155; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=k5nT5hUKCR72+p/AZJU9UEkFDbefW9UlAz9rtUJ5Rqc=; b=g4bt0l9rkDQnPD0pHp/HqQb+YNt9d57MWqddmOx0Zes8Qb8NTxabUlNLM3nVamfHI4mKKl NvUY5ssHFlvCcte42BXiNBm2sELlaxhotKa0PxdtDu1u7nZEtN/9jLMkTrpFtplAaIGcwT 07TKow42u9DhBvP4PeS4zzYJqfAF1rBLcJa928kLgqYWOZDUIUeHDNRQwQV8rjQKbnsEXf BUAMZa21jAZEGi1kLFbAS9Hk0woIRULScoTBjSIlakCw5ZM0iLZIGEMeerg2dZQauP+hV6 Hk/LTkH5CIsR9JjdGsHE9bKQglRFhgtiAVmlFmcFCeCilqz0lGSoH0HRU7Q37Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701475155; a=rsa-sha256; cv=none; b=OrK7byVdCTpk5xFgWRZRLPY7Zboq5Ohbe7qnx1YAhtFM8SyFIHEtjiXE+nkznD6ek8bS9L +o9wgGHix4a1Y4xMpFbLxcOLDW2oRt+65sdKtBE7Z3rUrouFK2ftZfHxdhSSqAU+esD36y 8SL5geUU9G47q4m4ex899rk/+AE7bc5CWlzdJXX9Yum9RMtiR8GLHF/oGIWU1cikxcHux+ 0tsVqLaNqbXl9VehpZbySdE7LDmMWNE/svrN0Wam+uwW556x0yfFn/vamvEm15GWD6HWnJ p+SgdqUw567G5Ronps6nVkczi6C/VY9nWuAf0BSiWp5mtfWy1I5J4Mxz1uxIxw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Shqm34tWYztxF; Fri, 1 Dec 2023 23:59:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B1NxFOp024795; Fri, 1 Dec 2023 23:59:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B1NxFWp024792; Fri, 1 Dec 2023 23:59:15 GMT (envelope-from git) Date: Fri, 1 Dec 2023 23:59:15 GMT Message-Id: <202312012359.3B1NxFWp024792@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 9560ac4b638e - main - armv8rng: Don't require toolchain to support FEAT_RNG List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9560ac4b638edf688566f576adc65d3654f2240c Auto-Submitted: auto-generated The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=9560ac4b638edf688566f576adc65d3654f2240c commit 9560ac4b638edf688566f576adc65d3654f2240c Author: Jessica Clarke AuthorDate: 2023-12-01 23:59:07 +0000 Commit: Jessica Clarke CommitDate: 2023-12-01 23:59:07 +0000 armv8rng: Don't require toolchain to support FEAT_RNG We have the mechanism in place to support encoding system registers explicitly, so use that rather than requiring LLVM 13+, which breaks our current set of GitHub CI builds. Fixes: 9eecef052155 ("Add an Armv8 rndr random number provider") --- sys/arm64/include/armreg.h | 9 +++++++++ sys/dev/random/armv8rng.c | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h index 953c9af220b9..c43ec1f5b97c 100644 --- a/sys/arm64/include/armreg.h +++ b/sys/arm64/include/armreg.h @@ -1981,6 +1981,15 @@ #define PMXEVTYPER_EL0_CRm 13 #define PMXEVTYPER_EL0_op2 1 +/* RNDRRS */ +#define RNDRRS MRS_REG(RNDRRS) +#define RNDRRS_REG MRS_REG_ALT_NAME(RNDRRS) +#define RNDRRS_op0 3 +#define RNDRRS_op1 3 +#define RNDRRS_CRn 2 +#define RNDRRS_CRm 4 +#define RNDRRS_op2 1 + /* SCTLR_EL1 - System Control Register */ #define SCTLR_RES1 0x30d00800 /* Reserved ARMv8.0, write 1 */ #define SCTLR_M (UL(0x1) << 0) diff --git a/sys/dev/random/armv8rng.c b/sys/dev/random/armv8rng.c index 3cca42a5bbf3..61698bfff820 100644 --- a/sys/dev/random/armv8rng.c +++ b/sys/dev/random/armv8rng.c @@ -59,10 +59,10 @@ random_rndr_read_one(u_long *buf) loop = 10; do { __asm __volatile( - ".arch_extension rng \n" - "mrs %0, rndrrs \n" /* Read the random number */ - "cset %w1, ne \n" /* 1 on success, 0 on failure */ - ".arch_extension norng \n" + /* Read the random number */ + "mrs %0, " __XSTRING(RNDRRS_REG) "\n" + /* 1 on success, 0 on failure */ + "cset %w1, ne\n" : "=&r" (val), "=&r"(ret) :: "cc"); } while (ret != 0 && --loop > 0);