From nobody Mon Oct 21 12:24:15 2024 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 4XXDy85TNZz5Ywnn; Mon, 21 Oct 2024 12:24:16 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XXDy80MWkz4DZf; Mon, 21 Oct 2024 12:24:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729513456; 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=gpv4XKHwXQ24a3GqXmpATkbGkYc/bgIEEj/Q3PBPM80=; b=kLR7HxtFrnGSXw7pol73KNOGwIlGikH7wbJMzdF5B7X7yenGChqVp09SQawx0KdF04SKva n+DQgZ7BOKuvtSyow28yDKew4xmyvYJVuRlKpd93XgA5026gTxKTxEFHF0UMcfAuv54HOq QDWkmkA1iwZLiEY+hzvQbA6MT1SXTEhTiGPmEqm4G4m2HnsW38IZZt3oC3CgyfDdqCP/2u wF6WmFWcWqVrfhd3R0Jffa3wBggHvtFusUEOeoDooeudaDwKULvDGjcyK4j4f8dSK+DykH vF5b1kQPX/zyeVnEiIkrCI2EFEdQKekMBbd+dWXDBDGR7E215cjcHd/9A280og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729513456; 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=gpv4XKHwXQ24a3GqXmpATkbGkYc/bgIEEj/Q3PBPM80=; b=FzhvJNpiivAJsadDRRaH0DcTjT41mgnCvZKlfPTOD0qjEB6JxhKOWYtcsf8S6vUNi96Lnp y/+MLSpJvOcsXjEjCQZGEdJ2+r2PZzno5mv/E5hbQu41TIe0HAgScehvC1oN1NU5YEvqoI gRdrn5n9hau67S2Sh5AkMt3buM7Of0HsCsvANA9s6Wy+qfpq5pRQKkMtqi0PbsKof6tHFE uqrvhrx8mm9rLA9mkcyl8xs4e8an9wd94YJiEYT+H2NF7IZ8LTjp0ilerL8wdVSvrawppi Kq7dfy5jSUWikN5RJNyGT/4APZ/EMksfQ9mO0mOjMhvHXWfQhB99lEV1gDovXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729513456; a=rsa-sha256; cv=none; b=EZNh/yXkD99745tqRR4cVgvW4uarmx3ZNKSTGP6j2w3x9jUf2DrkVhvED7w9A02B7c3Wkl Lj7+YKfBQpwi1X7QnMwGExXFld4S81HfZdpFJ4PLQDc1hN1sWwJ9RMt1UUEjSHEm7coY5L IWaD7U1D/ZYo7b1k7vcTCXDr2lG1L+CDc4maKUNDXOHyR6MUQAWG4WelrX9A4MBhR5VYBg iyPjQ6bnaYDEamnb7T69BAT/J8KcJzH9zq8FICUcnuD0FwhAqYoMKa0M/kt2nEwD8wICN3 qxkuI5ow71PMa4UWJGCq6+m/wVoNpnA7rBJIJEnM2PbUrwP5Jf96dIyKaD653g== 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 4XXDy772WZzVr4; Mon, 21 Oct 2024 12:24:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49LCOFJf048889; Mon, 21 Oct 2024 12:24:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LCOFqk048886; Mon, 21 Oct 2024 12:24:15 GMT (envelope-from git) Date: Mon, 21 Oct 2024 12:24:15 GMT Message-Id: <202410211224.49LCOFqk048886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: aa760039c6eb - main - arm64: Support non-4 bit ID reg fields 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: aa760039c6ebdfe86171e3afb89e00f3f9ec45f9 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=aa760039c6ebdfe86171e3afb89e00f3f9ec45f9 commit aa760039c6ebdfe86171e3afb89e00f3f9ec45f9 Author: Andrew Turner AuthorDate: 2024-10-18 09:16:10 +0000 Commit: Andrew Turner CommitDate: 2024-10-21 12:23:15 +0000 arm64: Support non-4 bit ID reg fields In preparation for using the ID register decode with the cache type register support a non-4 bit field width. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D47119 --- sys/arm64/arm64/identcpu.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/arm64/arm64/identcpu.c b/sys/arm64/arm64/identcpu.c index 0f2104419aad..1627515361f7 100644 --- a/sys/arm64/arm64/identcpu.c +++ b/sys/arm64/arm64/identcpu.c @@ -355,6 +355,7 @@ struct mrs_field { uint64_t mask; bool sign; u_int type; + u_int width; u_int shift; }; @@ -365,6 +366,7 @@ struct mrs_field { .sign = (_sign), \ .type = ((_fbsd_type) << MRS_TYPE_FBSD_SHIFT) | \ ((_lnx_type) << MRS_TYPE_LNX_SHIFT), \ + .width = _register ## _ ## _name ## _WIDTH, \ .shift = _register ## _ ## _name ## _SHIFT, \ .mask = _register ## _ ## _name ## _MASK, \ .values = (_values), \ @@ -2138,7 +2140,8 @@ get_kernel_reg_masked(u_int reg, uint64_t *valp, uint64_t mask) fields = user_regs[i].fields; for (int j = 0; fields[j].type != 0; j++) { mask = update_lower_register(mask, val, - fields[j].shift, 4, fields[j].sign); + fields[j].shift, fields[j].width, + fields[j].sign); } *valp = mask; return (true); @@ -2150,7 +2153,7 @@ get_kernel_reg_masked(u_int reg, uint64_t *valp, uint64_t mask) static uint64_t update_special_reg_field(uint64_t user_reg, u_int type, uint64_t value, - u_int shift, bool sign) + u_int width, u_int shift, bool sign) { switch (type & MRS_TYPE_MASK) { case MRS_EXACT: @@ -2158,7 +2161,7 @@ update_special_reg_field(uint64_t user_reg, u_int type, uint64_t value, user_reg |= (uint64_t)MRS_EXACT_FIELD(type) << shift; break; case MRS_LOWER: - user_reg = update_lower_register(user_reg, value, shift, 4, + user_reg = update_lower_register(user_reg, value, shift, width, sign); break; default: @@ -2206,16 +2209,16 @@ update_special_regs(u_int cpu) /* Update the FreeBSD userspace ID register view */ user_reg = update_special_reg_field(user_reg, fields[j].type >> MRS_TYPE_FBSD_SHIFT, value, - fields[j].shift, fields[j].sign); + fields[j].width, fields[j].shift, fields[j].sign); /* Update the Linux userspace ID register view */ l_user_reg = update_special_reg_field(l_user_reg, fields[j].type >> MRS_TYPE_LNX_SHIFT, value, - fields[j].shift, fields[j].sign); + fields[j].width, fields[j].shift, fields[j].sign); /* Update the kernel ID register view */ kern_reg = update_lower_register(kern_reg, value, - fields[j].shift, 4, fields[j].sign); + fields[j].shift, fields[j].width, fields[j].sign); } CPU_DESC_FIELD(kern_cpu_desc, i) = kern_reg; @@ -2510,7 +2513,7 @@ print_id_fields(struct sbuf *sb, uint64_t reg, const void *arg) sbuf_printf(sb, "%sUnknown %s(%x)", SEP_STR, fields[i].name, field); - reg &= ~(0xful << fields[i].shift); + reg &= ~(((1ul << fields[i].width) - 1) << fields[i].shift); } if (reg != 0)