Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229179/?format=api
{ "id": 2229179, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229179/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427210133.6016-9-deller@kernel.org/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260427210133.6016-9-deller@kernel.org>", "date": "2026-04-27T21:01:26", "name": "[PULL,v2,08/15] linux-user/mips: sync k0 TLS for EF_MIPS_MACH_OCTEON userlands", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e9f330539deda739bfafde3b574d406b6084057d", "submitter": { "id": 87076, "url": "http://patchwork.ozlabs.org/api/1.1/people/87076/?format=api", "name": "Helge Deller", "email": "deller@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260427210133.6016-9-deller@kernel.org/mbox/", "series": [ { "id": 501726, "url": "http://patchwork.ozlabs.org/api/1.1/series/501726/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501726", "date": "2026-04-27T21:01:22", "name": "[PULL,v2,01/15] MAINTAINERS: Add myself as maintainer for linux-user", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/501726/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229179/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229179/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=JIDwp7Hz;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4GJV3t5Dz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:03:54 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHT5b-0000Sw-IX; Mon, 27 Apr 2026 17:01:59 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <deller@kernel.org>) id 1wHT5X-0000J1-IG\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:55 -0400", "from tor.source.kernel.org ([172.105.4.254])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <deller@kernel.org>) id 1wHT5U-0003Wk-UF\n for qemu-devel@nongnu.org; Mon, 27 Apr 2026 17:01:54 -0400", "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n by tor.source.kernel.org (Postfix) with ESMTP id 1163260138;\n Mon, 27 Apr 2026 21:01:52 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 55866C2BCB5;\n Mon, 27 Apr 2026 21:01:50 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1777323711;\n bh=ZCgbefl3znT//LnX5C+F02YXGLn7Vtw2haVvLrZdTz0=;\n h=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n b=JIDwp7HzuIdSMdH+ZOsnuOmBgJ0H3sIhTFXdexpOSDOqmTQR6Z91Y0Su/36pPFMm3\n hlW81d+N3U7Jnnn+ePZ7wyYY3I0KfXsx1equgMMcd+37IsPE/acgq4m4SZVvGC6gwk\n 4ZyRLvvWZ8w98but5/aIcgsZ8yN8ZPq9jKQ/hA8BkOfPcbbMbcd3WDJoDKURksiIWJ\n tilNs21L3IY+Qf338O9JbxR/9VODfEIqdp7MCEE1ObdWAzQDdSjkHRcD0iO3et4PJX\n N2I97j0ULUMpLHkbDze3nq3a8OHtM1ZSw2eSd869fluJz51BznZnwZ6jMmYU/DZX0V\n EQoyXnl6REM+A==", "From": "Helge Deller <deller@kernel.org>", "To": "qemu-devel@nongnu.org", "Cc": "Laurent Vivier <laurent@vivier.eu>, =?utf-8?q?Philippe_Mathieu-Daud?=\n\t=?utf-8?q?=C3=A9?= <philmd@linaro.org>, Helge Deller <deller@gmx.de>,\n Jiaxun Yang <jiaxun.yang@flygoat.com>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>", "Subject": "[PULL v2 08/15] linux-user/mips: sync k0 TLS for EF_MIPS_MACH_OCTEON\n userlands", "Date": "Mon, 27 Apr 2026 23:01:26 +0200", "Message-ID": "<20260427210133.6016-9-deller@kernel.org>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260427210133.6016-1-deller@kernel.org>", "References": "<20260427210133.6016-1-deller@kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=172.105.4.254; envelope-from=deller@kernel.org;\n helo=tor.source.kernel.org", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: James Hilliard <james.hilliard1@gmail.com>\n\nCavium Octeon userspace is not following a generic MIPS Linux TLS\nABI rule here. Older Octeon glibc uses the k0 register as the fast\nthread pointer, while newer Octeon2 and Octeon3 glibc variants use\nthe normal rdhwr $29 path.\n\nlinux-user already updates CP0_UserLocal for cpu_set_tls() and\nTARGET_NR_set_thread_area, but it does not keep gpr[26]\nsynchronized. That leaves EF_MIPS_MACH_OCTEON userlands able to\ncomplete set_thread_area() and still reach pthread startup or\npthread_self() with a stale k0 value.\n\nUse the existing MIPS ELF machine flags from linux-user/elfload.c and\nmirror CP0_UserLocal into gpr[26] only for EF_MIPS_MACH_OCTEON.\n\nSigned-off-by: James Hilliard <james.hilliard1@gmail.com>\nReviewed-by: Richard Henderson <richard.henderson@linaro.org>\nSigned-off-by: Helge Deller <deller@gmx.de>\n---\n linux-user/elfload.c | 3 +++\n linux-user/mips/target_cpu.h | 5 +++++\n linux-user/qemu.h | 1 +\n linux-user/syscall.c | 2 +-\n 4 files changed, 10 insertions(+), 1 deletion(-)", "diff": "diff --git a/linux-user/elfload.c b/linux-user/elfload.c\nindex 59b543f740..0e757787d2 100644\n--- a/linux-user/elfload.c\n+++ b/linux-user/elfload.c\n@@ -1476,6 +1476,9 @@ static void load_elf_image(const char *image_name, const ImageSource *src,\n /* Usual start for brk is after all sections of the main executable. */\n info->brk = TARGET_PAGE_ALIGN(hiaddr + load_bias);\n info->elf_flags = ehdr->e_flags;\n+#ifdef TARGET_MIPS\n+ info->use_k0_tls = (ehdr->e_flags & EF_MIPS_MACH) == EF_MIPS_MACH_OCTEON;\n+#endif\n \n prot_exec = PROT_EXEC;\n #ifdef TARGET_AARCH64\ndiff --git a/linux-user/mips/target_cpu.h b/linux-user/mips/target_cpu.h\nindex c375616c55..2bbd0a81c5 100644\n--- a/linux-user/mips/target_cpu.h\n+++ b/linux-user/mips/target_cpu.h\n@@ -35,7 +35,12 @@ static inline void cpu_clone_regs_parent(CPUMIPSState *env, unsigned flags)\n \n static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls)\n {\n+ TaskState *ts = get_task_state(env_cpu(env));\n+\n env->active_tc.CP0_UserLocal = newtls;\n+ if (ts->info->use_k0_tls) {\n+ env->active_tc.gpr[26] = newtls;\n+ }\n }\n \n static inline abi_ulong get_sp_from_cpustate(CPUMIPSState *state)\ndiff --git a/linux-user/qemu.h b/linux-user/qemu.h\nindex cfe5f45fc4..7f98fb2607 100644\n--- a/linux-user/qemu.h\n+++ b/linux-user/qemu.h\n@@ -65,6 +65,7 @@ struct image_info {\n uint32_t note_flags;\n \n #ifdef TARGET_MIPS\n+ bool use_k0_tls;\n int fp_abi;\n int interp_fp_abi;\n #endif\ndiff --git a/linux-user/syscall.c b/linux-user/syscall.c\nindex f4b74ad350..8e96cc26db 100644\n--- a/linux-user/syscall.c\n+++ b/linux-user/syscall.c\n@@ -13216,7 +13216,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,\n #ifdef TARGET_NR_set_thread_area\n case TARGET_NR_set_thread_area:\n #if defined(TARGET_MIPS)\n- cpu_env->active_tc.CP0_UserLocal = arg1;\n+ cpu_set_tls(cpu_env, arg1);\n return 0;\n #elif defined(TARGET_I386) && defined(TARGET_ABI32)\n return do_set_thread_area(cpu_env, arg1);\n", "prefixes": [ "PULL", "v2", "08/15" ] }