From nobody Tue Nov 17 08:40:42 2026 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 4jTJ8p2shhz70xQt for ; Tue, 17 Nov 2026 08:40:42 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jTJ8p1MHgz4t6K for ; Tue, 17 Nov 2026 08:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794904842; 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=rYa5qRiUFzNxLg2EvGeBnThD604g67fIznn47wOu5lo=; b=Wpg/jIYjnZBL+gwKSBbT65HKVYSMDFOBd9EZyg50GyodpFf18HyKevoG/dxNVFLBhiqG9C 9DqDzAkZaCo3tYMGS4aRLrEG6pTebUAfCcXYHLXN2I7KdmZ4oUamtKKiALla7naI5qdalu bWiVgKexGgW5daLqPbKqMd9z9/jS9IR0lw6JI325BXsq58YQO3OpWLPUOH1qmYP65I0P6m rKEe/GdkoWSyc7bHlIgKKqCdk1FEeZ1hFtirpZpJADS5+H6bdtWrEqL0s/dHlzMFSaq9fd jFOSSRhj1R4EMxA2Ps3DSwwVF+DyqhbK7UBlJrMdLfgx4cX6gHM7Cfj5apNf+g== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794904842; b=TWv8CspUBDcglJk/SoecL5Kj5e7fHaQ7TGRYK8CM9G+snN+wDjmChkHoGPZgkikrO+u6qR M9czWIqJdvYT9CXiZXzNlfqMqVOA+IF7GC1SNKyy0d4JEfVH7Pf8rf9wLwdB+Vr344m+0a xA7cr83/n5E90n4MuvjW8zhtn4BTpQreiBkEtbW/x+AhTLBKxCzUWsF09hmUJ9DuDS660b gv/VBd47WwysHdikTdt3G+/dSZQo60QhSIsOW//FGzA1/zd7YMxeAXuaWj+WG5L2hjgnh0 kr2umSJQY77USDXFbwDPl1udjRSjUdkqDa8VV4WxARgSArCLbzmuwn5L4stz6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794904842; 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=rYa5qRiUFzNxLg2EvGeBnThD604g67fIznn47wOu5lo=; b=g+sV042JDFPhnmr/Zx8VEQWyIbA/ZMJkZznFGQ7QNv4pm0IPFXN+hFaiNQJaxoEmv5Ye5c um+SLkqaWb4f/JMkeN0eAoJdeXXczpPmmTZp4TS6BtDi3Irvkxds9hT/y2dy5ASyief2rf N8iubdkhKYAccxfwv5VSeJy1757QuFCJqsQMGOZxDVAdNc0wIOKSlqCfYjY1sqZvz07u7t xhtNWKK2sfonGfV6zezxWoca0c1nzAb246+RhzDNqoaD/hUcqeLmQVCC22Iv6al9eTUfzG l7hOhiFPrX1yUFnIcgJeMANtyulGUNPBFKCSweFWzmZaY+oSlOwNzA9yFs48Pw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jTJ8p11bdzb16 for ; Tue, 17 Nov 2026 08:40:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id b0fc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 08:40:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: 26b47fd4b63c - main - powerpc: save and restore VRSAVE with the vector state List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26b47fd4b63c4e67a952f9a4f0ceb89bcb6a24ac Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 08:40:42 +0000 Message-Id: <6afc130a.b0fc.cda53c5@gitrepo.freebsd.org> The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=26b47fd4b63c4e67a952f9a4f0ceb89bcb6a24ac commit 26b47fd4b63c4e67a952f9a4f0ceb89bcb6a24ac Author: Piotr Kubaj AuthorDate: 2026-10-18 10:41:40 +0000 Commit: Piotr Kubaj CommitDate: 2026-11-17 08:40:35 +0000 powerpc: save and restore VRSAVE with the vector state VRSAVE was never saved or restored, although user code can write it and the mcontext carries it, so every process saw the value the previous process on that CPU had left there. Two processes pinned to the same CPU and writing different values to VRSAVE each read back the other's; each reads back its own now. Reviewed by: jhibbits MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D61544 --- sys/powerpc/powerpc/altivec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/powerpc/powerpc/altivec.c b/sys/powerpc/powerpc/altivec.c index 928e5cf2f0eb..b847a2e5f12e 100644 --- a/sys/powerpc/powerpc/altivec.c +++ b/sys/powerpc/powerpc/altivec.c @@ -39,8 +39,10 @@ #include #include +#include #include #include +#include static void save_vec_int(struct thread *td) @@ -80,6 +82,7 @@ save_vec_int(struct thread *td) */ __asm __volatile("mfvscr 0; vspltw 0,0,3; stvewx 0,0,%0" :: "b"(&pcb->pcb_vec.vscr)); + pcb->pcb_vec.vrsave = mfspr(SPR_VRSAVE); /* * Disable vector unit again @@ -126,6 +129,8 @@ enable_vec(struct thread *td) msr = mfmsr(); mtmsr(msr | PSL_VEC); + mtspr(SPR_VRSAVE, pcb->pcb_vec.vrsave); + /* * Restore VSCR by first loading it into a vector and then into VSCR. * (this needs to done before loading the user's vector registers