From nobody Wed Aug 21 16:36:09 2024 X-Original-To: dev-commits-src-main@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 4WpsQx4dt4z5V8SR; Wed, 21 Aug 2024 16:36:09 +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 4WpsQx46w0z4YR1; Wed, 21 Aug 2024 16:36:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724258169; 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=XrWy/3csl3LZvB6BMdxpc9X2aoS8ADYmSFeaL9cotyE=; b=SYbKct8T+shcTd04p/fmACoPm3oZvNonzESUEM5nD1OV7O/gBxSxfiSDv7M7KMO+jCHqRS k+hR++FGveUo9IJ512GF6X3erZICaVMRz4rqSM+8hvVjn6hPehJHWVJ9lRQcV8y3KZ4RcK BpJcdPyV3o/nZlNKdVGe+/8V+KLXMsxXuj6h3mD0F8EB7PSrbsf+dqvSnZl5qK+7WNxdq7 PAFAl1zBvGcuObkUh+MvfLY8SjZQazDQyT8N16uPt3pbv2f2hQh/Gr7Tn/sEsIOvvhL53P PqT50uQW4oIeMw9B+gwis+by7iksWqqXpE7WjQpLK+VRPMPj05i+6ytKywmnWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724258169; a=rsa-sha256; cv=none; b=SbuYvw/icKP0MiUe5ibPa4A1jjmwSiJaIF7tNvwgiXieRYxA01qPcfWfqtUlEj5pKYlWax OQBARtr/U5zaMp1DRdcK5sBb9aaOR+u882kbuQ97ooT5qZprw3q4dL+OfRI3uFloGRF6b4 poyBIDIzfRQcpf9vQlSfmTCzFa4bd/sYniPdOyY6JUXgohI6WDEE0fHr/qgUF65SOSzd6r GPFS8vUIxzlrCsZ1BGtVRaf2EmFQE0VksHGNzOozOLdgsCcvzbMRDJguFGqyPwEyTMM9g5 sqox7CtJirkTqpSUwaNecm7TEftKXa7QiB39ZhlpJyoYOLmCWYh+lhsGN/gvrQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724258169; 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=XrWy/3csl3LZvB6BMdxpc9X2aoS8ADYmSFeaL9cotyE=; b=ZhYz/om/G2OBmda7F0wGsjUNW7EEOlJiP73WCBCCSu2s1inSJJeepAYOs8k6BUp3auzr+B wrGZrIhm3cSliMeN65720HAstkUWLlV5D2xebsyRxHucxweaEKeedsbBWqnSKPc5ree3Xe xyYkm64BZV+hUybbVwhqka3ZIqWhET8TtOobfYIyuDjqJsa03/NEz7G9n5fsI7M1r2DHis DlPX76lYTLBRM6hrBTw8SA5gaLPLxt+rSIBvRvw/fzY/vJb5I9Z9zMVJhNlktxC7hlIsjn DvsM5JSJlFGSvm1SItuEywGvzPRr47HFi3uMpme624jOFG8854kSBFvYOMyo7A== 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 4WpsQx3jpjzqs3; Wed, 21 Aug 2024 16:36:09 +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 47LGa9i6089001; Wed, 21 Aug 2024 16:36:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47LGa9rJ088998; Wed, 21 Aug 2024 16:36:09 GMT (envelope-from git) Date: Wed, 21 Aug 2024 16:36:09 GMT Message-Id: <202408211636.47LGa9rJ088998@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 111c7fc2fe21 - main - amd64: add convenience wrappers for INVLPGB and TBLSYNC List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 111c7fc2fe21356a637f89fa58c407958f05ad93 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=111c7fc2fe21356a637f89fa58c407958f05ad93 commit 111c7fc2fe21356a637f89fa58c407958f05ad93 Author: Konstantin Belousov AuthorDate: 2024-05-13 22:40:07 +0000 Commit: Konstantin Belousov CommitDate: 2024-08-21 16:34:59 +0000 amd64: add convenience wrappers for INVLPGB and TBLSYNC Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D45191 --- sys/amd64/include/cpufunc.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 62e782304fca..ca53d73b0186 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -525,6 +525,29 @@ invpcid(struct invpcid_descr *d, int type) : : "r" (d), "r" ((u_long)type) : "memory"); } +#define INVLPGB_VA 0x0001 +#define INVLPGB_PCID 0x0002 +#define INVLPGB_ASID 0x0004 +#define INVLPGB_GLOB 0x0008 +#define INVLPGB_FIN 0x0010 +#define INVLPGB_NEST 0x0020 + +#define INVLPGB_DESCR(asid, pcid) (((pcid) << 16) | (asid)) + +#define INVLPGB_2M_CNT (1u << 31) + +static __inline void +invlpgb(uint64_t rax, uint32_t edx, uint32_t ecx) +{ + __asm __volatile("invlpgb" : : "a" (rax), "d" (edx), "c" (ecx)); +} + +static __inline void +tlbsync(void) +{ + __asm __volatile("tlbsync"); +} + static __inline u_short rfs(void) {