[{"id":3675390,"web_url":"http://patchwork.ozlabs.org/comment/3675390/","msgid":"<CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>","list_archive_url":null,"date":"2026-04-09T16:17:07","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On Wed, 8 Apr 2026 at 19:43, James Hilliard <james.hilliard1@gmail.com> wrote:\n>\n> MIPS glibc startup expects the thread pointer to be live in both\n> CP0_UserLocal and k0. linux-user already updates CP0_UserLocal for\n> cpu_set_tls() and TARGET_NR_set_thread_area, but it leaves gpr[26]\n> unchanged.\n>\n> A guest can therefore successfully execute set_thread_area() and still\n> reach __pthread_initialize_minimal() with k0 == 0, faulting on the\n> first TLS-relative store.\n>\n> Make cpu_set_tls() synchronize k0 with CP0_UserLocal, and route the\n> MIPS set_thread_area syscall through cpu_set_tls() so all guest TLS\n> updates follow the same path.\n\nWhere does the kernel do this? Looking at the mips set_thread_area()\nhttps://elixir.bootlin.com/linux/v6.19.11/source/arch/mips/kernel/syscall.c#L87\nit looks like it sets CP0_UserLocal plus the tp_value field in the\nthread_info struct; and I can't immediately see anywhere where it\nwould read either CP0_UserLocal or tp_value and put it into k0.\n\nI also couldn't find the MIPS glibc code that uses k0, but I\ndidn't look very hard there as I don't know my way around the\nglibc sources -- do you have a pointer to it on that end?\n\nthanks\n-- PMM","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=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=bhoGODst;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fs4q74CJsz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 02:18:09 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAs4P-0000La-IL; Thu, 09 Apr 2026 12:17:29 -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 <peter.maydell@linaro.org>)\n id 1wAs4M-0000LN-SG\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 12:17:28 -0400","from mail-yx1-xb131.google.com ([2607:f8b0:4864:20::b131])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1wAs4I-0003J4-5d\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 12:17:23 -0400","by mail-yx1-xb131.google.com with SMTP id\n 956f58d0204a3-6507a7d2eccso1144587d50.0\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 09:17:21 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775751441; cv=none;\n d=google.com; s=arc-20240605;\n b=OHjHJTN+jhqsmLVcWy8l364U4lUL4iF0oSGd7jGF4Cer28haeb8chmfyAvcNI5/+6R\n RH+P6Hh2hP78+EGS7i3sJRCqLxQcj6m+TXipw28EYxlYedr3oUK2GUrG8LhlP/yxgMMp\n us3YLVpvQqEujfBmduUK3b5pt3At7tcFGl9el8jBzokH5MdKzLA5mCoE3isegp3oSjwu\n R42a6exWKHjCNN3IXuadP0fW0vagqr9AmsPDBMu0j5jMYGcdF1B0Dj0OSrJKbBzA8cA6\n A3IzbW/pRYpO9qMzqSuVabuyfusutiDpmKEXof2EWOH03SAme4/iIkplExBcQ2dIrfwM\n RvMw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:dkim-signature;\n bh=P/ZnN0f0wUnGZgYsNB0YAHdKqMgxio/+kVecTuolZnw=;\n fh=VQTX0KcHLYp0W1xh5qMyMVzUksc/bNzicpit96Uxm2w=;\n b=U5UjchHWKB0+HYOI4xAvVLhriBZj8EEQKUfStiIZQaRF/INVk6PGCvwiA7MIYHt76U\n BvnLANu3EFzUBjCjC08h8zAFPsMp4Ac1FGQDs5OSoZD+eMmkfrl9YwFkE68ekrP5I/Sq\n dTKTL8Jaqj3ejqu3ky8IutkO4msWWiXW3PTbdherldPkT+w4n5TEVAOIDc40e2dA+i+V\n 9y3g6mOVXiJjFvpp5WP5k0/AJKZxo6wMLcoHKP9zp+0rAOcyyBkYazUr+4sjFWLrAtx1\n cUod3BPrgJUpdacNbwPlRiPA4zpAcELL/nm6o9CzbusbocW/7tX+znt5cVP9+p3Pvn9Y\n RIww==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775751441; x=1776356241; darn=nongnu.org;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:from:to:cc:subject:date:message-id:reply-to;\n bh=P/ZnN0f0wUnGZgYsNB0YAHdKqMgxio/+kVecTuolZnw=;\n b=bhoGODsteXohxl4OfRFVK4+QyrJhg1Kax9XvlGE7rMC9+mhrChOwYjFFXrrq8nUp0i\n 5O3OAhd2AFLhqrWOG6D/4NdVdb8BcMruIxSj2bQ9jraU2u+e0Ul17UvaSi7TgeF1ykfs\n g0+7vQiaWPG2DRtb462y+Xe52LFcJGYV5YL8QROozUQTPM9KBiklDk9Nd0pYhsbPmy5W\n fpam746kCkStrXcC1yk4TT30RgknB1DAwQ5UQ5+QIHEQz6H7JaMY84i3BZR9i0iL6k8m\n 00WZftgb8iMrAgCuCG1UoMVQxvsIRJDbZW8GIm/upAJX0BDo6rbtga7ZCVR/UvdLQ6oG\n aXgg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775751441; x=1776356241;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=P/ZnN0f0wUnGZgYsNB0YAHdKqMgxio/+kVecTuolZnw=;\n b=oTOInHMHif0HEiTJS6sTVHVjaepqhpd5uRO/KsWnlM4aEJgVheTK4fGHGrWnWEAAQ1\n 1Wo+TVRlhbXlSp4HEEEbLPkcMa/tTxjL9y+zDAmVeymEQ4DfuA6AWTNeYZ2msSupL+p6\n LRd54THPbq75bM/VwKc58kTtWN/UkoFqnxMVYjEyyUdLLu0ubWGVmrVWy/3t1bR1RzQ0\n xsVjRydA6tjHDBv9ZcuIE5AeLrEN4hr0u4TX9a/BV6BVMHbOpjs8SZpd3jc0T2eauJEB\n JWX094sZBhAepPzeJgORN/0dkAXCNzo7q8BphvIGyhQPp3Evy3C4tFDVb0+fB1k6qafs\n Y7Pw==","X-Gm-Message-State":"AOJu0Yy8MePamNTnvwGEZjxFzzLlkTir4xbRBrmDTvyrdFG2U4fCfp/C\n sjnI1Ur8VTIKMeuViefR+Iy8UbOmy+/rtWIGwZ0DLyjOSkpwoqsis+P3J/t7oPQ5nUR7AcQmUwa\n GIVnRwZwp9AtaBXkj6pat3otGh2tj2TAAdaTVnGyjsw==","X-Gm-Gg":"AeBDieuG/fZs9/0wpISJxZw0DtLV2XYawFmpvFlJROmUodD6FLJP4rVhh0/tsIsw4eV\n +hcdXTTTJKyA8RsrJKLjx8BJa7e56NfF0g9Ni6PhLRwx09Z+pJfde7s+VFj0jRbAfnq2W1iCTw9\n HuzGabGhwiToqVUvDqp27TXOMGtcLnWDXDuhohFKABk/RsHKt4b02zYZNfKeiCUtAgLTPJN1kj8\n vML/R3d/l+KL//13HmzFbB97+WazVqWGeQzq3UyaiSxFzghj8Pzv05KLvCvSS8pOLptjeZdvxhS\n 40SKCRHLbRgKh5NYHWCvWC7TCdeuf1ZyEVysz80N8dIpZtzAzZCAEV+1mYu+J1TTAh0=","X-Received":"by 2002:a05:690e:1914:b0:64e:e82e:8413 with SMTP id\n 956f58d0204a3-650598d9194mr19720821d50.1.1775751440575; Thu, 09 Apr 2026\n 09:17:20 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>","In-Reply-To":"<20260408184228.44242-1-james.hilliard1@gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 9 Apr 2026 17:17:07 +0100","X-Gm-Features":"AQROBzBD4M1uxmn4nmj9JyvoskAY4hwwSca4IJTYjvIIgQCJw84Y9VE6vqwNQtM","Message-ID":"\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"James Hilliard <james.hilliard1@gmail.com>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n  Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu?=\n\t=?utf-8?q?-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Received-SPF":"pass client-ip=2607:f8b0:4864:20::b131;\n envelope-from=peter.maydell@linaro.org; helo=mail-yx1-xb131.google.com","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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675486,"web_url":"http://patchwork.ozlabs.org/comment/3675486/","msgid":"<CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>","list_archive_url":null,"date":"2026-04-09T19:47:08","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":66301,"url":"http://patchwork.ozlabs.org/api/people/66301/","name":"James Hilliard","email":"james.hilliard1@gmail.com"},"content":"On Thu, Apr 9, 2026 at 10:17 AM Peter Maydell <peter.maydell@linaro.org> wrote:\n>\n> On Wed, 8 Apr 2026 at 19:43, James Hilliard <james.hilliard1@gmail.com> wrote:\n> >\n> > MIPS glibc startup expects the thread pointer to be live in both\n> > CP0_UserLocal and k0. linux-user already updates CP0_UserLocal for\n> > cpu_set_tls() and TARGET_NR_set_thread_area, but it leaves gpr[26]\n> > unchanged.\n> >\n> > A guest can therefore successfully execute set_thread_area() and still\n> > reach __pthread_initialize_minimal() with k0 == 0, faulting on the\n> > first TLS-relative store.\n> >\n> > Make cpu_set_tls() synchronize k0 with CP0_UserLocal, and route the\n> > MIPS set_thread_area syscall through cpu_set_tls() so all guest TLS\n> > updates follow the same path.\n>\n> Where does the kernel do this? Looking at the mips set_thread_area()\n> https://elixir.bootlin.com/linux/v6.19.11/source/arch/mips/kernel/syscall.c#L87\n> it looks like it sets CP0_UserLocal plus the tp_value field in the\n> thread_info struct; and I can't immediately see anywhere where it\n> would read either CP0_UserLocal or tp_value and put it into k0.\n\nSo this seems to be something used by the vendor SDK for Octeon1\nbut not Octeon2 and Octeon3 targets, kinda strange/annoying.\n\nI also found this:\nhttps://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n\nIt's in the Octeon vendor kernel here looks like:\nhttps://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n\n> I also couldn't find the MIPS glibc code that uses k0, but I\n> didn't look very hard there as I don't know my way around the\n> glibc sources -- do you have a pointer to it on that end?\n\nFrom Octeon SDK glibc/ports/sysdeps/mips/nptl/tls.h:\n/* Note: rd must be $v1 to be ABI-conformant.  */\n# if !_MIPS_ARCH_OCTEON\n# define READ_THREAD_POINTER() \\\n    ({ void *__result;                                  \\\n       asm volatile (\".set\\tpush\\n\\t.set\\tmips32r2\\n\\t\"                  \\\n             \"rdhwr\\t%0, $29\\n\\t.set\\tpop\" : \"=v\" (__result));          \\\n       __result; })\n# else /* OCTEON */\n/* The Kernel stores the value of \"rdhwr v1,$29\" in k0 ($26) register. And\n   it is the Kernel's responsibility to always have the correct value in\n   k0.  Replacing rdhwr instruction with k0, as this instruction needs to\n   be emulated by the Kernel.  */\n# define READ_THREAD_POINTER() ( { register void *__result asm\n(\"$26\"); __result; } )\n# endif /* OCTEON */\n\nFrom Octeon SDK glibc/ports/sysdeps/mips/tls-macros.h:\n# if !_MIPS_ARCH_OCTEON\n# define TLS_IE(x)                                      \\\n  ({ void *__result, *__tmp;                            \\\n     asm (\".set push\\n\\t.set mips32r2\\n\\t\"              \\\n          \"rdhwr\\t%0,$29\\n\\t.set pop\"                   \\\n          : \"=v\" (__result));                           \\\n     asm (LOAD_GP LW \" $3,%%gottprel(\" #x \")($28)\\n\\t\"  \\\n          ADDU \" %0,%0,$3\"                              \\\n          UNLOAD_GP                                     \\\n          : \"+r\" (__result), [tmp] \"=&r\" (__tmp)        \\\n          : : \"$3\");                                    \\\n     __result; })\n# define TLS_LE(x)                                      \\\n  ({ void *__result;                                    \\\n     asm (\".set push\\n\\t.set mips32r2\\n\\t\"              \\\n          \"rdhwr\\t%0,$29\\n\\t.set pop\"                   \\\n          : \"=v\" (__result));                           \\\n     asm (\"lui $3,%%tprel_hi(\" #x \")\\n\\t\"               \\\n          \"addiu $3,$3,%%tprel_lo(\" #x \")\\n\\t\"          \\\n          ADDU \" %0,%0,$3\"                              \\\n          : \"+r\" (__result) : : \"$3\");                  \\\n     __result; })\n\n# else /* OCTEON */\n/* On Octeon the kernel stores the value of the thread pointer in the k0 ($26)\n   register.  */\n# define TLS_IE(x)                                      \\\n  ({ void *__result, *__tmp;                            \\\n     asm (LOAD_GP LW \" $3,%%gottprel(\" #x \")($28)\\n\\t\"  \\\n          ADDU \" %0,$26,$3\"                             \\\n          UNLOAD_GP                                     \\\n          : \"+r\" (__result), [tmp] \"=&r\" (__tmp)        \\\n          : : \"$3\");                                    \\\n     __result; })\n# define TLS_LE(x)                                      \\\n  ({ void *__result;                                    \\\n     asm (\"lui $3,%%tprel_hi(\" #x \")\\n\\t\"               \\\n          \"addiu $3,$3,%%tprel_lo(\" #x \")\\n\\t\"          \\\n          ADDU \" %0,$26,$3\"                             \\\n          : \"+r\" (__result) : : \"$3\");                  \\\n     __result; })\n# endif /* OCTEON */\n\n>\n> thanks\n> -- PMM","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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=f30kPg8F;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fs9St4V7bz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 05:47:42 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAvLb-0002m9-LL; Thu, 09 Apr 2026 15:47:27 -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 <james.hilliard1@gmail.com>)\n id 1wAvLZ-0002l3-Vj\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 15:47:25 -0400","from mail-vk1-xa2a.google.com ([2607:f8b0:4864:20::a2a])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <james.hilliard1@gmail.com>)\n id 1wAvLY-00089x-8P\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 15:47:25 -0400","by mail-vk1-xa2a.google.com with SMTP id\n 71dfb90a1353d-56adf76631cso582746e0c.1\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 12:47:21 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775764041; cv=none;\n d=google.com; s=arc-20240605;\n b=ZJX2Kn3wN8CWHHIfq/YlnH21PwkyptR5lfjLCob6Fsygf57oTkJyyRs44JravioEbu\n YmJKo0f0+DvG0MEvn9jDH1f2cu2uYP6KSm6dgYLhu57XUz2siE2Y4WpKr7cRPjwuKqhz\n zm4QRe6hKcVPl02OZ4vt2QccxWlvxoM7ililF0/8RsIvW32n4Q4KPQQGpRZ7J2u4yh5h\n Rb0aoqZNv345GnvinV04pN3vaT7nJqItyQlzRdiAVJW+gRtr+oHL0m04fHyEpgBIce8e\n te9QEj1XfiMeT2HJkbTzgv1/nXJZKyc2DkepAlXAaUeYnQO3POmo+IcqyYCddGotDTGR\n cnKw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=ivK1ujKgo5AEue5SL9zh2aD9+EPBEhfFsm44MC3WiWI=;\n fh=6WPaczp89kVEvyqQhTtoSourPaOeS62pIBkgOKSIhVk=;\n b=fujKhwXL8GQB9uWByn9JrdE83usEYLrNJxGbc2I+tOzOVqmBQWnTXOMNCCgyTnQhbj\n 16kPgiQuQeJN9cxDyVpEJQaIIZQdnaLQCJEjo4u62xM8GAO6cTNjejtnuIl2/jrUYda1\n wGbm/mcpaXskdFpHKbRmK1hpy6jZ+6+0MeenVHRg4C0PaOPbcKo4hcybqEMjQAVttY9D\n HpRhCbXw+byWSk3u/j51rJbz488Cw60apNrGBvSiTQ3lDA3xge9kFAFMZYYS1GjYcWMt\n SCA5KGyVrHvcxTQOnCkn4BdzC/jK+3hahmxdcuJ5iPD2QEO3xLMNVvCszm0ilQ+Q3WBQ\n u9nw==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775764041; x=1776368841; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=ivK1ujKgo5AEue5SL9zh2aD9+EPBEhfFsm44MC3WiWI=;\n b=f30kPg8Fyv4Yj8L5JJ2e/7KoWCiDuFxXu96YPdDfjFtlE2aQ2QdiyAGDBasGxvWEsd\n 6YIDDkY9xjTJ2WIRiNxfmvDdTRpEhUv3/26LUH0Q0zYeZ74vgJZHHG6zrbCAw7KX+FTO\n uakOUlNPdAkd4n3FWaetasV47E0kve+l0vALiEVYRQ/6UbpkQkRHoAyB19LA7CIx8NKT\n ZPnlzQPj1nvDLC0z6oPPMQ6cdmjXKbaXSPZjRFVart/xTyxe9lCypn6T5KM0u5JuIKPF\n C6Qkp4ep37TZbDCFDSy88NLpqALv+qbWwQlOJyA0HFeqT5LmFxUsML3yhXvhdCtNkzHW\n t/4A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775764041; x=1776368841;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=ivK1ujKgo5AEue5SL9zh2aD9+EPBEhfFsm44MC3WiWI=;\n b=OfuvHSSPsq5XVcHKTYa0qR7mQPFJ2QUniuw2H9A3qM0v6lRpzPeXH8pYizM87zam/T\n sNmdMCb9zAcP1Rl4wP+abqRbVoUOuhFBfnr8rbC5msiDsLBe5LLK2M7LaFNdoYAeVvVp\n cGS2HJ9dUW3NnSj1ab9XnwbQi38FV1oFN2VWv21/MQX/0p7Z1WiLD6ndB42CpaedAQVW\n W/5YJCHog5yAQ9nDfTKNhy3FYkzoAqwaFWG0yGEl3swFR7Z/K9mWuxmbmLABpynfb2Z4\n qctAj+mBXiNwSUSNBCTju6bL8sSJUUNgx81VX1lLwKxLDjqu+Zs8wLdSjIIu4yc9iQhV\n VXiw==","X-Gm-Message-State":"AOJu0YwBb8xYfBOJ0XbTG+0fJz4fmav3hopPOAIl8wtM8DaK7OcXXZpz\n 2iZjSuZJANWTT639oMvcAkUvDK1UyUvheTExc2ellbGvXRebLOwljGsC1glGCDJLgKh/Jy0ouWI\n fopEL5TLpY05HgmnxhKP3uyQKxHVi/es=","X-Gm-Gg":"AeBDietAtl2oLSrKDlSw0DbeRL71GayZk3OlTVHPTHRJ2T8o701OR3BjIetUr/hO3fC\n 9WVi8aIyRomI+Wof0kx8HJE8m5vgJMBwmrcTIbOZ3GJS3FeF1SfNRwtJYHX6aqeh/HhBAxKJ7WM\n FXRLe8VeOArfCI8u86ujrOsheSDRYfhPru6ZFWYBFWz1MR2DJ8JMCu1ycpHZTr1bqbOyt4FMquk\n 0a6eKT4TyS0h3EIUO907TEcjdtpiQ4jWPfcabc+z1Hc2whXH+gOXDyNIm7xl40raUmRc7FOlZR4\n w0Ibz9v0+InBs6wK6ouUDjSsnO6qXIwCT86J90lbAbkWUgnvy0mI+SaPHlcNfYLQCnu7TA==","X-Received":"by 2002:a05:6102:f8d:b0:609:4182:f135 with SMTP id\n ada2fe7eead31-609ff2d5780mr142444137.11.1775764040657; Thu, 09 Apr 2026\n 12:47:20 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>","In-Reply-To":"\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>","From":"James Hilliard <james.hilliard1@gmail.com>","Date":"Thu, 9 Apr 2026 13:47:08 -0600","X-Gm-Features":"AQROBzAveNF3jHCkKmrLcl8en688esMJcyx_6L0bcXM1S2ry44_fjm-xrIwTM8c","Message-ID":"\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"Peter Maydell <peter.maydell@linaro.org>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n  Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu?=\n\t=?utf-8?q?-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::a2a;\n envelope-from=james.hilliard1@gmail.com; helo=mail-vk1-xa2a.google.com","X-Spam_score_int":"-17","X-Spam_score":"-1.8","X-Spam_bar":"-","X-Spam_report":"(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675493,"web_url":"http://patchwork.ozlabs.org/comment/3675493/","msgid":"<CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>","list_archive_url":null,"date":"2026-04-09T20:16:54","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On Thu, 9 Apr 2026 at 20:47, James Hilliard <james.hilliard1@gmail.com> wrote:\n>\n> On Thu, Apr 9, 2026 at 10:17 AM Peter Maydell <peter.maydell@linaro.org> wrote:\n> >\n> > On Wed, 8 Apr 2026 at 19:43, James Hilliard <james.hilliard1@gmail.com> wrote:\n> > >\n> > > MIPS glibc startup expects the thread pointer to be live in both\n> > > CP0_UserLocal and k0. linux-user already updates CP0_UserLocal for\n> > > cpu_set_tls() and TARGET_NR_set_thread_area, but it leaves gpr[26]\n> > > unchanged.\n> > >\n> > > A guest can therefore successfully execute set_thread_area() and still\n> > > reach __pthread_initialize_minimal() with k0 == 0, faulting on the\n> > > first TLS-relative store.\n> > >\n> > > Make cpu_set_tls() synchronize k0 with CP0_UserLocal, and route the\n> > > MIPS set_thread_area syscall through cpu_set_tls() so all guest TLS\n> > > updates follow the same path.\n> >\n> > Where does the kernel do this? Looking at the mips set_thread_area()\n> > https://elixir.bootlin.com/linux/v6.19.11/source/arch/mips/kernel/syscall.c#L87\n> > it looks like it sets CP0_UserLocal plus the tp_value field in the\n> > thread_info struct; and I can't immediately see anywhere where it\n> > would read either CP0_UserLocal or tp_value and put it into k0.\n>\n> So this seems to be something used by the vendor SDK for Octeon1\n> but not Octeon2 and Octeon3 targets, kinda strange/annoying.\n>\n> I also found this:\n> https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n\nAh, nice find.\n\n> It's in the Octeon vendor kernel here looks like:\n> https://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n\nMmm. We emulate the upstream kernel, not vendor forks, so\nwe wouldn't want to set k0 here I think.\n\n-- PMM","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=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=Po4Zh2Wx;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fsB7y2BXmz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 06:18:04 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAvoP-0000QC-7F; Thu, 09 Apr 2026 16:17:13 -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 <peter.maydell@linaro.org>)\n id 1wAvoM-0000Pb-7v\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 16:17:10 -0400","from mail-yx1-xb12e.google.com ([2607:f8b0:4864:20::b12e])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1wAvoK-0007CV-9I\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 16:17:09 -0400","by mail-yx1-xb12e.google.com with SMTP id\n 956f58d0204a3-65032e9cf01so1249587d50.3\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 13:17:07 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775765827; cv=none;\n d=google.com; s=arc-20240605;\n b=eyKING0HUta9zOIy+ITSNBl7Td19t/on50McCAwbLjRe9ZUUjBq0FqR7Mc6Avq6Jpo\n BN0hVmJd5tPBh0KiizZNkEK3yvh9ovaO1TPnctniqjgMAld/jLPCpIHPmIBHlWLZkmT4\n zu7WcrDqnYSIkznuAzAlVaorNKXsEn+5p5k8z0nTeSkKRWmVWq/dBP24FMFs+7ga7GjD\n G1FSgiLVaVINEcvOXDolw4XYXw1Ad0hOxp8dUxvCVeNmbF+2mo9sTgPP4z07L1urrnUV\n OU2qeZt0ytaLOph3ZOTx+2j3DvfptPCFIM4aZWBFBfTXa3N4PYwzVQ4lomsGkAry3M3y\n LCsw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=DZxLqrufXceS85n/R/AvvuBjIY8xZUEjqhJGvgNdNuo=;\n fh=VQTX0KcHLYp0W1xh5qMyMVzUksc/bNzicpit96Uxm2w=;\n b=AyyulJEPemYzuj6unovvrv8t71yIo+h/SkcaM/DAJuCc4RlueHqiyZSwqficzaF2Nx\n iT8kl1Z0KgSgpTmCwRG7BWijxEn5RGcvJv6MYUuku2gaBZVjB6WGC6wqqSV3lShwcf4n\n iRSBsNnEfWudgki+d07MzlakhtokvWUcvP38AzCOTIZIFeacV+DOFxUHNyrcC3QLW6v1\n 1UjxzvlFqHohxQ52qVhPT3E23+5FnE6C/lFgATxHg3PJmObSSIiY65ubGG/Y7nBX3z1Q\n hWJKCjcqEOkm0k8l7kUFgBUObmybdaaO613oe4Cv+s2HheVuPvOvtlza8jTaewj64sTV\n 2Z2Q==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775765827; x=1776370627; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=DZxLqrufXceS85n/R/AvvuBjIY8xZUEjqhJGvgNdNuo=;\n b=Po4Zh2WxTJqr6Kn7sjFskTz85G1XGOcKQemShLwmA0NLf5t/mZcr9QLZbtTG11a0EX\n TF5lAA97pttGbWSAM+XHVCVmNn5pxivCWmEi0Hh+QI6Fl+sI/ATMPAgME0pimc6yBesW\n mWiYb7Daflnq3RuQ1mnJFnuxU0WUoiCCyHiPSsMvTuYKqoO3I41rGYID+dtBeKyshyjM\n fIvEVjCEn3OtRNDQPD3ct6GwtcpgK94gLHZcKCU1zytvoEvz0hukvcF08Oj2yB7l+HYz\n FYf1z4gL9STUVgYqpyV87ffYRGOccTPfMRUbhrfYpZRIENUqvrPQNnnW+HXLKX/pl0ux\n n7vA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775765827; x=1776370627;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=DZxLqrufXceS85n/R/AvvuBjIY8xZUEjqhJGvgNdNuo=;\n b=Malh2zhxvTX0eaoPpb1SEEmlhQaf7vGcqeS/HgkBZ1YsaNvhBNsj8uwfTblYg31N4Z\n C1A4/LbESMI/2GG+JXLxNp5n63ZG42P4pLHDrJFMRe38bQSRLkE3R3tuBwtP1fdthQk2\n cvtGuv50To2t2prXutbi0k3E36f5v6wkLcFOgL87vkiteodP3A4cr+r3vyzjV3DFF/W4\n +UUE0tnQInTIKLRGB0nE1uNjDt6F/6nXnOZWyd5xkGwYdO/O/Zluo29L23F33Gf8jVKI\n fKdo4ID2hz8fQqSMuVzUoVTQMXIzrrQHaq9AKw1zl//7rpacs1AiAI7lAy3yZaWlAI+3\n IO7g==","X-Gm-Message-State":"AOJu0Yxjk7ectLFOgKFQAKazoTYeDnJH0bW+ewTrW/ui8A0rTp5005I/\n TllXDoNrMOz57yi1sQWr1dgYQOiJFT7GGAfaLCrF7wlUp9ZtzZ+w8itowUZCrdlObcXxdmMsbF4\n pi1U2BK/71p3kGHvEEDjGSEziEa9F1fj3y0eJs38Xag==","X-Gm-Gg":"AeBDiesQGSifxK3yu0t6f4uujJhzn7eFr+ZJquedD8iGhvDpCXYvBSUAdzCFKF4OkE1\n YiO27JkSO2Aan2Kly6easKSihMxWbLkO310sjv6Q2iZ+iysxreT/Lb6aq6KzoMwbnwuOv3cSka0\n BqH/Tdpqlo5fixtsXWkRCCQpeVufYERE50sKycxnsqK2LDk7sf9MPDG6bxblEmUEyY3UgH+ExEv\n Tph/36n/7mULIDgRTNWfwPO/230uclE34fPCRFrYNDw5cXm1QO24KWqz8HEipYHJK4LvpNmqAjE\n nPPErGceJI9ZlxJutkbexlVAwiWQgIBzKTo9/2w2untoJcs6zBtbiP9U2TKRuuqIZD9iHH+CtSz\n v3w==","X-Received":"by 2002:a05:690e:400b:b0:64c:9ec3:d710 with SMTP id\n 956f58d0204a3-65198b78e0emr398785d50.41.1775765826673; Thu, 09 Apr 2026\n 13:17:06 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>","In-Reply-To":"\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Thu, 9 Apr 2026 21:16:54 +0100","X-Gm-Features":"AQROBzAzdBHRTtfHqI6u6UuWaLqQ2yP-vsiuAXeynE3nlMMQAkYfUJew2bTmmx8","Message-ID":"\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"James Hilliard <james.hilliard1@gmail.com>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n  Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu?=\n\t=?utf-8?q?-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::b12e;\n envelope-from=peter.maydell@linaro.org; helo=mail-yx1-xb12e.google.com","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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675512,"web_url":"http://patchwork.ozlabs.org/comment/3675512/","msgid":"<CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>","list_archive_url":null,"date":"2026-04-09T21:00:09","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":66301,"url":"http://patchwork.ozlabs.org/api/people/66301/","name":"James Hilliard","email":"james.hilliard1@gmail.com"},"content":"On Thu, Apr 9, 2026 at 2:17 PM Peter Maydell <peter.maydell@linaro.org> wrote:\n>\n> On Thu, 9 Apr 2026 at 20:47, James Hilliard <james.hilliard1@gmail.com> wrote:\n> >\n> > On Thu, Apr 9, 2026 at 10:17 AM Peter Maydell <peter.maydell@linaro.org> wrote:\n> > >\n> > > On Wed, 8 Apr 2026 at 19:43, James Hilliard <james.hilliard1@gmail.com> wrote:\n> > > >\n> > > > MIPS glibc startup expects the thread pointer to be live in both\n> > > > CP0_UserLocal and k0. linux-user already updates CP0_UserLocal for\n> > > > cpu_set_tls() and TARGET_NR_set_thread_area, but it leaves gpr[26]\n> > > > unchanged.\n> > > >\n> > > > A guest can therefore successfully execute set_thread_area() and still\n> > > > reach __pthread_initialize_minimal() with k0 == 0, faulting on the\n> > > > first TLS-relative store.\n> > > >\n> > > > Make cpu_set_tls() synchronize k0 with CP0_UserLocal, and route the\n> > > > MIPS set_thread_area syscall through cpu_set_tls() so all guest TLS\n> > > > updates follow the same path.\n> > >\n> > > Where does the kernel do this? Looking at the mips set_thread_area()\n> > > https://elixir.bootlin.com/linux/v6.19.11/source/arch/mips/kernel/syscall.c#L87\n> > > it looks like it sets CP0_UserLocal plus the tp_value field in the\n> > > thread_info struct; and I can't immediately see anywhere where it\n> > > would read either CP0_UserLocal or tp_value and put it into k0.\n> >\n> > So this seems to be something used by the vendor SDK for Octeon1\n> > but not Octeon2 and Octeon3 targets, kinda strange/annoying.\n> >\n> > I also found this:\n> > https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n>\n> Ah, nice find.\n>\n> > It's in the Octeon vendor kernel here looks like:\n> > https://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n>\n> Mmm. We emulate the upstream kernel, not vendor forks, so\n> we wouldn't want to set k0 here I think.\n\nYeah, I was trying to see if there was some sort of way to trivially\nidentify binaries that require this k0 support and autoenable a quirk\nbut I didn't find anything, maybe it would make sense to have a\nseparate runtime target for enabling this k0 quirk since it seems a\nlot of octeon binaries require it?\n\n>\n> -- PMM","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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=q1pqz+Fb;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fsC5f38yvz1y05\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 07:01:08 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAwUH-0003dk-HI; Thu, 09 Apr 2026 17:00:29 -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 <james.hilliard1@gmail.com>)\n id 1wAwUD-0003cz-Cl\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 17:00:27 -0400","from mail-ua1-x92d.google.com ([2607:f8b0:4864:20::92d])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <james.hilliard1@gmail.com>)\n id 1wAwUB-0003kG-5z\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 17:00:25 -0400","by mail-ua1-x92d.google.com with SMTP id\n a1e0cc1a2514c-951a4e8d1b5so379497241.1\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 14:00:22 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775768421; cv=none;\n d=google.com; s=arc-20240605;\n b=joc2bzhsYfobYCJ65NMJcmoayOltSOYmOBYVZqDifmuS/AWmZVlxzKBF/qON3J36by\n 7btZ6Duz6RlRpi9H3V8QjTi50sly1tSbdcp4uma1wa3YIXG9fZusHE8TjkE3f8Xo85wS\n MxzuVsGUg2cx3Gymb02dnkPYoHuBPiVnypVYa0oIz/KzDBbb5/N4Cn9nQpge9pavBvuG\n 5FDLo/CM7t6oinnFHZzuReuaSE0U1bZYMc1iRAshLH4y7U0B0JYjgmZU0dFgIZ32UzAn\n FQzsZd5zIwaV0AHPq9rSxZ3hdc5aHaA+IVQjTcZOKimTCCHZ2kvLBVafmnxMMRCiJ00w\n rDNg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=uBcqEMShb2pCBQGj/7zGpFmCDx6PjKYsootyagL8btc=;\n fh=6WPaczp89kVEvyqQhTtoSourPaOeS62pIBkgOKSIhVk=;\n b=cq9GbBYzXtuHNHUbanKHPD0muUIHBXcJXDlZ72pTEbZiRATlw4IVuGHY6udGR+kGaQ\n ykEuoLhw5zs4r6hTeLg2TZYCnKXsXO/iKmHpU9SzhnMMqARF7FJMcxueWngxq4gOb4zP\n bOCdcCVWr7fm6v6oUY3vOPkAEUwyvJbgic1XwHPg9mwQf9PPhymHDcN7A08oAyRDAc7J\n rp4hxbAHa3G2SpqEYYtuZgP8hz9heGt2kNP7QTSYuDOPNMUckXvMMHb7+YDG23vXMpkM\n OMJlhO5FG5hpBWhfkfIa4FT9UuHgvyg+S+C6sPQ3vDnYYNxc0T8VssHEF3vAvglCFKgw\n 6kIg==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775768421; x=1776373221; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=uBcqEMShb2pCBQGj/7zGpFmCDx6PjKYsootyagL8btc=;\n b=q1pqz+Fb0i573BUNagLxu3Ka2U1DksuUTGNIrWStuSrn99Bz9eavbxhjbJ4fYgPHkP\n zuyBf0oCGTqT5dYRyySzeysBPocb88TebYbPIkHWjDPVWH8bYewm3FfBn0uLpjmaHg9j\n 9rBn3Nop/mkVNiQq6nag8Z94RDB6MMfPCl6l2VakQ+B0HC7viC0oCdSLGzoGV5mdhHWW\n +BVnflw0+90wMD8yFgEaJICENGDW+sJX09+AOIukM1mg4V5JvoyBBL8PxM0LPZKgSvli\n SmzW87HQ66C+B6Hit4LlcP7h/fZEkb5n6zl6pJCUg/6ECpTS+DpSm3D75Ncy2lD0nbPF\n C+RA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775768421; x=1776373221;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=uBcqEMShb2pCBQGj/7zGpFmCDx6PjKYsootyagL8btc=;\n b=qz6qDqs8IW9+mBhjOjZkr5q+RxwgbeMwGb6krHVWWqTAWQkJi/yA0CCgGi04I1gx1P\n HP1IHqkkz8In15vOeea2QhZTV7fZkIilSFDLaLG/cSVib6m3JqdekWV/XMP51+wFLDXA\n dlFK+zjR9wmNYwRaCqcFDgUW1/DUW6mpnHWpoBpJ197m5XcC4XtaNUS7HMuh25xZwrtW\n tVVvSa9yZ4a4EhuHJqp0iKKRk7KjMZ85i3sVTh542uNbG2YbrXMK2630A2vGxYq4uozs\n Xk5sk/yL5kLJn51Ehszn2yyybi8SdS2402qw5+ce5YayjdY7vZ4sioyzciWtKUluwEfa\n 2jWQ==","X-Gm-Message-State":"AOJu0YzENBaKajusG0pl96ezy3u7meClpFW2sI2T/sw9dEPpRWbyfakZ\n E1BZibuA2VSwwxl7aZ/gQgDTFEnmMCXqh45Q07NQtjEfEDCN6adKP+C+mOkagoV+Kt/wg3rPyqL\n jMiBxpewK/jEkqVRQ9X14Z1udbYJQCSw=","X-Gm-Gg":"AeBDieuRmgFSsiH1usRNU8j1V30zyMiudlVUZrhQXplHpez/OKTy+03d6JLoe1hzQQO\n 8lb8VE/e/8c/yVvPho7s3L9e9JLImnoK6xrIIOxq6qOAUFg62hONGyFt0AiHBGzs2PizKvM/WoR\n NBS6nikv1/WPzlgvs9OewqPU46vfa+4rSYp/SxprpHHF/it3lkw+fwjkk/tfGicDSezkjItTSjJ\n 1diqOEshjGL9QP5ErM79Dbu8wSN7ND8C28EDaNMmx3mYNcYJMawthdD8dVA8Z6OUJFkI95eTRUW\n Jl89Ra3KQnztNXLMK2aR+EkAOXE6nDxqJM2Ue0xOM0ay7M0kPkIro3A2is+FS4awIJ35Og==","X-Received":"by 2002:a05:6102:c46:b0:5f5:4055:4556 with SMTP id\n ada2fe7eead31-609fe7a6cc1mr282046137.4.1775768420833; Thu, 09 Apr 2026\n 14:00:20 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>","In-Reply-To":"\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>","From":"James Hilliard <james.hilliard1@gmail.com>","Date":"Thu, 9 Apr 2026 15:00:09 -0600","X-Gm-Features":"AQROBzBLf2oPNiezj7TWcx30qCbRg-QJLt-c-PeaFo2ZCkhZav4PwOz43PNFsiM","Message-ID":"\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"Peter Maydell <peter.maydell@linaro.org>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n  Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu?=\n\t=?utf-8?q?-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::92d;\n envelope-from=james.hilliard1@gmail.com; helo=mail-ua1-x92d.google.com","X-Spam_score_int":"-17","X-Spam_score":"-1.8","X-Spam_bar":"-","X-Spam_report":"(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675516,"web_url":"http://patchwork.ozlabs.org/comment/3675516/","msgid":"<46b5a434-10de-4ff2-aaca-636fc7a85180@linaro.org>","list_archive_url":null,"date":"2026-04-09T21:07:44","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":85046,"url":"http://patchwork.ozlabs.org/api/people/85046/","name":"Philippe Mathieu-Daudé","email":"philmd@linaro.org"},"content":"On 9/4/26 23:00, James Hilliard wrote:\n> On Thu, Apr 9, 2026 at 2:17 PM Peter Maydell <peter.maydell@linaro.org> wrote:\n>>\n>> On Thu, 9 Apr 2026 at 20:47, James Hilliard <james.hilliard1@gmail.com> wrote:\n>>>\n>>> On Thu, Apr 9, 2026 at 10:17 AM Peter Maydell <peter.maydell@linaro.org> wrote:\n>>>>\n>>>> On Wed, 8 Apr 2026 at 19:43, James Hilliard <james.hilliard1@gmail.com> wrote:\n>>>>>\n>>>>> MIPS glibc startup expects the thread pointer to be live in both\n>>>>> CP0_UserLocal and k0. linux-user already updates CP0_UserLocal for\n>>>>> cpu_set_tls() and TARGET_NR_set_thread_area, but it leaves gpr[26]\n>>>>> unchanged.\n>>>>>\n>>>>> A guest can therefore successfully execute set_thread_area() and still\n>>>>> reach __pthread_initialize_minimal() with k0 == 0, faulting on the\n>>>>> first TLS-relative store.\n>>>>>\n>>>>> Make cpu_set_tls() synchronize k0 with CP0_UserLocal, and route the\n>>>>> MIPS set_thread_area syscall through cpu_set_tls() so all guest TLS\n>>>>> updates follow the same path.\n>>>>\n>>>> Where does the kernel do this? Looking at the mips set_thread_area()\n>>>> https://elixir.bootlin.com/linux/v6.19.11/source/arch/mips/kernel/syscall.c#L87\n>>>> it looks like it sets CP0_UserLocal plus the tp_value field in the\n>>>> thread_info struct; and I can't immediately see anywhere where it\n>>>> would read either CP0_UserLocal or tp_value and put it into k0.\n>>>\n>>> So this seems to be something used by the vendor SDK for Octeon1\n>>> but not Octeon2 and Octeon3 targets, kinda strange/annoying.\n>>>\n>>> I also found this:\n>>> https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n>>\n>> Ah, nice find.\n>>\n>>> It's in the Octeon vendor kernel here looks like:\n>>> https://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n>>\n>> Mmm. We emulate the upstream kernel, not vendor forks, so\n>> we wouldn't want to set k0 here I think.\n> \n> Yeah, I was trying to see if there was some sort of way to trivially\n> identify binaries that require this k0 support and autoenable a quirk\n> but I didn't find anything, maybe it would make sense to have a\n> separate runtime target for enabling this k0 quirk since it seems a\n> lot of octeon binaries require it?\n\nWhat about (untested):\n\n-- >8 --\ndiff --git a/linux-user/mips/target_cpu.h b/linux-user/mips/target_cpu.h\nindex 0a000ac8f35..c4aa08df4a3 100644\n--- a/linux-user/mips/target_cpu.h\n+++ b/linux-user/mips/target_cpu.h\n@@ -36,7 +36,9 @@ static inline void cpu_clone_regs_parent(CPUMIPSState \n*env, unsigned flags)\n  static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls)\n  {\n      env->active_tc.CP0_UserLocal = newtls;\n-    env->active_tc.gpr[26] = newtls;\n+    if (env->insn_flags & INSN_OCTEON) { /* Octeon1 */\n+        env->active_tc.gpr[26] = newtls;\n+    }\n  }\n---","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=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=q8RKrw+F;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fsCGC4LQKz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 07:08:33 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wAwbS-00060h-TS; Thu, 09 Apr 2026 17:07:55 -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 <philmd@linaro.org>) id 1wAwbP-00060J-VI\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 17:07:51 -0400","from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1wAwbN-00064X-64\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 17:07:50 -0400","by mail-wr1-x42c.google.com with SMTP id\n ffacd0b85a97d-43d02a71526so806749f8f.3\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 14:07:48 -0700 (PDT)","from [192.168.69.228] (88-187-86-199.subs.proxad.net.\n [88.187.86.199]) by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43d63dec28asm1686886f8f.15.2026.04.09.14.07.45\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Thu, 09 Apr 2026 14:07:46 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775768867; x=1776373667; darn=nongnu.org;\n h=content-transfer-encoding:in-reply-to:from:references:cc:to\n :content-language:subject:user-agent:mime-version:date:message-id\n :from:to:cc:subject:date:message-id:reply-to;\n bh=mEDrAYWL+WIvBTZfhs7OCeci3sI70D3lFJQa5oMQunM=;\n b=q8RKrw+F/uSa1XGS/8Ji1KahusOKoevbgmDEIBq7NnH4GhR0Y2He+WxodSfpYoCRu3\n tQau+DDarabROdtsO1wi0HxmsMRBzHCEVn5yAQ39zQ3fuo3O0b0ccWf9cGhIGkTNda+G\n 3odWKujT+36YoA/zTnGHD7+9czFuz1EkB9EuaTIlVtUmvWkLd9E9ad0rWss7KwHGQKix\n 9XYa9Dh2aM3X9opbp3YKqtsfa3E1pj4MN6Mn2r2Pi6/mjepgfrCjHiF/c2RlUUeSQMdv\n iYIOFo7L4Q2K+3I0R0l0ZdNJz1gWA+Hf3dGLHC3UmHjtCUcyrXAWt+kfwa8uLR/UyQ57\n OAJA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775768867; x=1776373667;\n h=content-transfer-encoding:in-reply-to:from:references:cc:to\n :content-language:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=mEDrAYWL+WIvBTZfhs7OCeci3sI70D3lFJQa5oMQunM=;\n b=q9GuET56S9xybOsWaMAubwPMJcrNWaJS2cHVHv4I4L4eZsLpNjXfCxfQnCO6Vp+PWt\n 63hDKj8dXfls2KXQ64LWyWQW2+TxN+veseuc5fB6ilXwzL6tI4gLGsCkGY3oHnLAZKVo\n bmUxQhS8hrQpS1j7a4J7fcGrMEVDqmOkXm/LTVNr7ARPUFlNXc7Qlgv1cb+jUSDdddER\n 33tOJ1d62MdX6xMh5vNuX4vdrWXRqASOYdJWm8bfG0Nse6CddJD1seX1BPTpbrkVUAq3\n iuqfCrl27BJColrCArsR29W3cSjLW3c1VdarwJ5Pt6tE59qJzDWESQcXcIub0XeAT6Jl\n FiDg==","X-Gm-Message-State":"AOJu0YyAEOs962s/YwgOkA6vp32YTUb5jMdogMASYGdMeasoA/3QJZM4\n 5wJifVD7ENIXmNdl653Ew2Gct6iMUi1Pg2ZMSu/8HVPie7LIRgw+SI6pBHiCeHk5nv0=","X-Gm-Gg":"AeBDieupv9EavBsCD9H0Prscv/9t7cEQy8RTeNyaC1vWwRVygSl9jy57oDhH9yS8mIy\n 4Sk8ChXXTPL8TAPeqU0z2jF0zt9rY7qqwxxXJxohsj8jYKH7HZbyeIKngxiZxU3Rk6m0DiMqUP4\n w3GQCzDXxoHwhJgjfUMk3WhklAxXFesYxVFpkbHBsCPR9ei7+XQkqIE0+tZ7A4mlq7pTr3P8Ffa\n AuDgoCnEw59RmZ3BBQuJFXS438dvQuuIZXUmMJXBE93aOb98bZV/mU3tCYO/MwE8cIKR2bCTGWx\n ZYcMvWxH202N4jJBL/dZefzl6ELI0Cqu/JAiDuzJeAy1Cr6YGYTuOVAnoyK3vEIi7BkGdJ2IKE4\n +0Weut3IfiMCz9hDDq4k1UApBtdTV+yTOuim3YREbXKLn+mheuU1cB3Vl4O+gPfC/z9UvApJYYb\n XA/ZcxTqhOREIdkBVM4WbZE9BUJ5Wq6Fv2otg8k1M4KGLQo3YHD5X33km3E7COk8184A==","X-Received":"by 2002:a05:6000:4014:b0:43b:4981:1ba3 with SMTP id\n ffacd0b85a97d-43d6423d08emr822214f8f.2.1775768866558;\n Thu, 09 Apr 2026 14:07:46 -0700 (PDT)","Message-ID":"<46b5a434-10de-4ff2-aaca-636fc7a85180@linaro.org>","Date":"Thu, 9 Apr 2026 23:07:44 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","Content-Language":"en-US","To":"James Hilliard <james.hilliard1@gmail.com>,\n Peter Maydell <peter.maydell@linaro.org>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Jiaxun Yang <jiaxun.yang@flygoat.com>","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>","From":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","In-Reply-To":"\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=2a00:1450:4864:20::42c;\n envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.google.com","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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675608,"web_url":"http://patchwork.ozlabs.org/comment/3675608/","msgid":"<CADvTj4pQXVt=mTidKeaJRfP8mzSgnDyOWgNzA0J8Y-Qi8X2d6Q@mail.gmail.com>","list_archive_url":null,"date":"2026-04-10T02:09:30","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":66301,"url":"http://patchwork.ozlabs.org/api/people/66301/","name":"James Hilliard","email":"james.hilliard1@gmail.com"},"content":"On Thu, Apr 9, 2026 at 3:07 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote:\n>\n> On 9/4/26 23:00, James Hilliard wrote:\n> > On Thu, Apr 9, 2026 at 2:17 PM Peter Maydell <peter.maydell@linaro.org> wrote:\n> >>\n> >> On Thu, 9 Apr 2026 at 20:47, James Hilliard <james.hilliard1@gmail.com> wrote:\n> >>>\n> >>> On Thu, Apr 9, 2026 at 10:17 AM Peter Maydell <peter.maydell@linaro.org> wrote:\n> >>>>\n> >>>> On Wed, 8 Apr 2026 at 19:43, James Hilliard <james.hilliard1@gmail.com> wrote:\n> >>>>>\n> >>>>> MIPS glibc startup expects the thread pointer to be live in both\n> >>>>> CP0_UserLocal and k0. linux-user already updates CP0_UserLocal for\n> >>>>> cpu_set_tls() and TARGET_NR_set_thread_area, but it leaves gpr[26]\n> >>>>> unchanged.\n> >>>>>\n> >>>>> A guest can therefore successfully execute set_thread_area() and still\n> >>>>> reach __pthread_initialize_minimal() with k0 == 0, faulting on the\n> >>>>> first TLS-relative store.\n> >>>>>\n> >>>>> Make cpu_set_tls() synchronize k0 with CP0_UserLocal, and route the\n> >>>>> MIPS set_thread_area syscall through cpu_set_tls() so all guest TLS\n> >>>>> updates follow the same path.\n> >>>>\n> >>>> Where does the kernel do this? Looking at the mips set_thread_area()\n> >>>> https://elixir.bootlin.com/linux/v6.19.11/source/arch/mips/kernel/syscall.c#L87\n> >>>> it looks like it sets CP0_UserLocal plus the tp_value field in the\n> >>>> thread_info struct; and I can't immediately see anywhere where it\n> >>>> would read either CP0_UserLocal or tp_value and put it into k0.\n> >>>\n> >>> So this seems to be something used by the vendor SDK for Octeon1\n> >>> but not Octeon2 and Octeon3 targets, kinda strange/annoying.\n> >>>\n> >>> I also found this:\n> >>> https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n> >>\n> >> Ah, nice find.\n> >>\n> >>> It's in the Octeon vendor kernel here looks like:\n> >>> https://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n> >>\n> >> Mmm. We emulate the upstream kernel, not vendor forks, so\n> >> we wouldn't want to set k0 here I think.\n> >\n> > Yeah, I was trying to see if there was some sort of way to trivially\n> > identify binaries that require this k0 support and autoenable a quirk\n> > but I didn't find anything, maybe it would make sense to have a\n> > separate runtime target for enabling this k0 quirk since it seems a\n> > lot of octeon binaries require it?\n>\n> What about (untested):\n>\n> -- >8 --\n> diff --git a/linux-user/mips/target_cpu.h b/linux-user/mips/target_cpu.h\n> index 0a000ac8f35..c4aa08df4a3 100644\n> --- a/linux-user/mips/target_cpu.h\n> +++ b/linux-user/mips/target_cpu.h\n> @@ -36,7 +36,9 @@ static inline void cpu_clone_regs_parent(CPUMIPSState\n> *env, unsigned flags)\n>   static inline void cpu_set_tls(CPUMIPSState *env, target_ulong newtls)\n>   {\n>       env->active_tc.CP0_UserLocal = newtls;\n> -    env->active_tc.gpr[26] = newtls;\n> +    if (env->insn_flags & INSN_OCTEON) { /* Octeon1 */\n\nINST_OCTEON isn't OCTEON1 specific, but we could do something like this:\nhttps://lore.kernel.org/qemu-devel/20260410020012.98778-1-james.hilliard1@gmail.com/\n\n> +        env->active_tc.gpr[26] = newtls;\n> +    }\n>   }\n> ---","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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=JqSCl5CZ;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fsKyf3RySz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 12:10:32 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wB1Ja-00017d-IX; Thu, 09 Apr 2026 22:09:46 -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 <james.hilliard1@gmail.com>)\n id 1wB1JY-00017P-Oj\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 22:09:44 -0400","from mail-ua1-x932.google.com ([2607:f8b0:4864:20::932])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <james.hilliard1@gmail.com>)\n id 1wB1JX-0006Nt-3f\n for qemu-devel@nongnu.org; Thu, 09 Apr 2026 22:09:44 -0400","by mail-ua1-x932.google.com with SMTP id\n a1e0cc1a2514c-9549a6448e6so339150241.2\n for <qemu-devel@nongnu.org>; Thu, 09 Apr 2026 19:09:42 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775786982; cv=none;\n d=google.com; s=arc-20240605;\n b=C0k97bBHFLBumM5nRVei3+C/EqO4yzH+b199xHqraF5CcOsasIfUmiqXo+z0KwPC1y\n WOVYXUJoMSPh8Dbi+Z8jmNZpS3MNTV6eghqRExtsne+7VXMT9edxBaWfii0NC82gXehf\n SPA21GBt0qheSGaY0KoOfNXOV/ejd3HZ+8/jhM2GfeQYopp4p8j0RkxCJwUPNs5Nwnpn\n mZE1vNYVCl93fJT9RcSKma/JX84txEtL6bE4xN2KwvayvMxY3hos4TrHlNRknbf468S8\n 3aIqIlRcg7dEqU1ThgKvB83WOEAer33Vxvpva8zHRlw9I8mequf+KvsUj8IIBgr+4XVi\n w7qA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=fu9VAJi4oofOw449zoo1nqP2TsOt/Fusn6qpq5HBG4Q=;\n fh=mCZyUOZNBC0wi5TF8haytF29amPSn9tvfwStsFR2vvw=;\n b=FYVNzyr0rtN3x67aui1z5BKpg6UP1SVycW1nlGdXRzzaAadzlwJslZZs5/XBsU+us0\n ceoo6sm7qFyioxMTfKLqzFXwPOmSOcfJmBjVKVcDeMHVVKW3C9vuooa2pxF5CsheKzqT\n sDM5HZBzPWljY5g8UO4KGDGBtLUtKtRJZvia8PTUFj7Czw8Lx/SOHMWB9WZToski9a0l\n XtnYlYRmYdXjEJU3HmEXbK7/Pz/9aZX1tYx5W9ANxNu8Rrat3OVJJb727l9UGPJ4ZpIq\n zHZY8oNvgsbCfVqQKcEBxkBVXm43WieaNK1gCOTZFK/dLZDvTOCRxZMnvQYnoCCNuDFz\n 7FxA==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775786982; x=1776391782; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=fu9VAJi4oofOw449zoo1nqP2TsOt/Fusn6qpq5HBG4Q=;\n b=JqSCl5CZsS7NxV02Yem2VT6J+um8YJPJviPjbYvKROM7/BNeRLRsuN1N4+rVcaQMIg\n lSh7MlSy36O2DKEAr9N+8vtxUKs62wylbptcvjhArtLkFb0VcoeK1K5awV2jdEKDDviB\n YGwOG7a6LOI/G4/hkVhqD976tsnl7/RsUNE1VeklEedIg6er13HXQf4C+gwyU46YQpwr\n 3lI6tNFe7oYmSD56DV35ATB36zseGD3CoBKEHxs4DH+PTtxDTw6eOxaIXyOKpCqfO2Iq\n QdSE45IktHWcBubPyQxOXfijBzOyYlpYgBky3Bd4pwN/QqTNwuxgqR/eqidWmUtFmH69\n ed8g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775786982; x=1776391782;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=fu9VAJi4oofOw449zoo1nqP2TsOt/Fusn6qpq5HBG4Q=;\n b=d0mbHebbc+64Z9TEMmAydcrbDU8Cz83yg25nxiomP/CaKWsUHD+87ce/ORpTGldizM\n NBXwjPDiCDu9GSd0EcJjc/Fz2bR19rG6ZwRmI4qtZESZ6KzPPSjlZpLXmfedP/DY58gZ\n OBz2kP57UeGkREVzHoEuBtOwEohUK6+1mP77/OJ8VyQ1T88lQMOyu2wyOlHtcqwEpIUf\n 5Dli4SSp8VhT+txHJk1gJ29xnhyoxxw0FqlaCH+bD/0K/pgmSTPYdbJGnm7c8y3nomVB\n 8cERPKpGnnpzu2Rf+wkAChogJOzecDYusSJSw2v2MLpc66G+3mc84xueGbasaKPO5wKg\n sv6A==","X-Forwarded-Encrypted":"i=1;\n AJvYcCVSjBX+ibI+sXsFpk9l1BJD5Vj3Kl/X8+zsVzxfZyM7zvKlSk2KRKUKsITuQ7dVIiUD/VXCxaO2MJye@nongnu.org","X-Gm-Message-State":"AOJu0YzRXYit5NRA1dvYcRvuVfoa5d1cPph+cU3ptDVfrYQ2AqRVbvPM\n tvPX2+0gaBAvFM/xaU2rISSeQNcM5gE5tuKZKdrBAATTnbn100zWdWnwB1lz1OVLnW8fjTLHCna\n 4noDDqpTq8CbcylYkBWv4CtEXLw3+jGc=","X-Gm-Gg":"AeBDiev5x+Rg6864cYxf7YCJIa5AxQbDwPOS1Z1+HpUMFvbfgT3gCQ2XBIQhDzIfE37\n 38qrLNHnslLvAMNHwoVaLLan8jn7HsK/LulLhqNsVbbX9ap3gJRnV/ZAszO42uCRxND2+seZTl/\n jDm/Xl0oISKHpq6YfMb9x2eLQrX/hyvnT0EAnNsxM8NhStlmWIxSm/LK0KAQMZsmwkM/x4jpxoI\n e1KqY99o+hVpuQLLxCppKAY3THF1fus2Mdz6R/tExNesyEwTzrDty46R2C2PjQRnsueOZLkLGir\n Hr338lap/ss7m9MvOXzWkBOhoitv2iiWfEzfQ7fruT69k92n8l3HcC5ABr0cC3HU7fCGlHvJ0cW\n HtiwO","X-Received":"by 2002:a05:6102:3e23:b0:609:af4a:371 with SMTP id\n ada2fe7eead31-60a00e44326mr562833137.23.1775786981269; Thu, 09 Apr 2026\n 19:09:41 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>\n <46b5a434-10de-4ff2-aaca-636fc7a85180@linaro.org>","In-Reply-To":"<46b5a434-10de-4ff2-aaca-636fc7a85180@linaro.org>","From":"James Hilliard <james.hilliard1@gmail.com>","Date":"Thu, 9 Apr 2026 20:09:30 -0600","X-Gm-Features":"AQROBzCGo3_-1AGKUe4rgZzfUZpYoxaFQfw5QjjwbrElF0cxNC7ChXStET0rDHM","Message-ID":"\n <CADvTj4pQXVt=mTidKeaJRfP8mzSgnDyOWgNzA0J8Y-Qi8X2d6Q@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>","Cc":"Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org,\n Laurent Vivier <laurent@vivier.eu>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>,\n Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::932;\n envelope-from=james.hilliard1@gmail.com; helo=mail-ua1-x932.google.com","X-Spam_score_int":"-17","X-Spam_score":"-1.8","X-Spam_bar":"-","X-Spam_report":"(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675719,"web_url":"http://patchwork.ozlabs.org/comment/3675719/","msgid":"<CAFEAcA9CT9KeO1qmNg6YaCnjmvDG3-jeSwTjP4EnUqg4Hh8fSg@mail.gmail.com>","list_archive_url":null,"date":"2026-04-10T08:13:44","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On Thu, 9 Apr 2026 at 22:00, James Hilliard <james.hilliard1@gmail.com> wrote:\n>\n> On Thu, Apr 9, 2026 at 2:17 PM Peter Maydell <peter.maydell@linaro.org> wrote:\n> >\n> > On Thu, 9 Apr 2026 at 20:47, James Hilliard <james.hilliard1@gmail.com> wrote:\n> > > So this seems to be something used by the vendor SDK for Octeon1\n> > > but not Octeon2 and Octeon3 targets, kinda strange/annoying.\n> > >\n> > > I also found this:\n> > > https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n> >\n> > Ah, nice find.\n> >\n> > > It's in the Octeon vendor kernel here looks like:\n> > > https://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n> >\n> > Mmm. We emulate the upstream kernel, not vendor forks, so\n> > we wouldn't want to set k0 here I think.\n>\n> Yeah, I was trying to see if there was some sort of way to trivially\n> identify binaries that require this k0 support and autoenable a quirk\n> but I didn't find anything, maybe it would make sense to have a\n> separate runtime target for enabling this k0 quirk since it seems a\n> lot of octeon binaries require it?\n\nWe didn't add this 15 years ago, and my feeling is we still don't\nwant to, because we track the mainline kernel. If an actual host\nkernel doesn't have a quirk to let these binaries run, we don't\nneed one either.\n\n-- PMM","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=linaro.org header.i=@linaro.org header.a=rsa-sha256\n header.s=google header.b=lMf39ox0;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fsV2v49sZz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 18:14:45 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wB705-00088c-4j; Fri, 10 Apr 2026 04:14:01 -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 <peter.maydell@linaro.org>)\n id 1wB703-00088N-MX\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 04:13:59 -0400","from mail-yx1-xb133.google.com ([2607:f8b0:4864:20::b133])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)\n id 1wB701-00005w-Vs\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 04:13:59 -0400","by mail-yx1-xb133.google.com with SMTP id\n 956f58d0204a3-6505ef94043so1795203d50.2\n for <qemu-devel@nongnu.org>; Fri, 10 Apr 2026 01:13:57 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775808836; cv=none;\n d=google.com; s=arc-20240605;\n b=ZCaj4yvCQM6FDuTwsIek1yRB4x0QsogbdV+diINavON49G3WDhl4Ndk23yeQmfQCaF\n Ii9JQZr7QVFO0KQaSK/pTmA7OEWY74gGNEf/LLqcx8bp1DDFT2eenFgiombIFkT6h1aL\n /x29BCO/J3f4GOZDlyMW72FqLEFnTExZFsal9qe3UqX9+57/mSmcMoGUJAymG2elj30o\n R6W1t3cZjIub8hgmf2lXmY0uGvNAJeykcyWedpyL+jhVx346SVNuL8xOF3cX0pbku9AH\n EIUUzI2V/tte34mwJfLp/pYW/VPDQcSNtR+z+ri2TOuZXtQeQXnB84v55P30EAxm7mpQ\n LfEg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=RvFO6UByEpB5iQ8gep8vaTkLyi+ZU0xgSFREu2ZZbP8=;\n fh=VQTX0KcHLYp0W1xh5qMyMVzUksc/bNzicpit96Uxm2w=;\n b=dx3fiOPXkFsofOrUv+1mqYAhOelxP0QXuzZoE5kMQTNVKhRjHqh98VU1a4v11bA4UZ\n 4QwikexhtNCCgZIunONu2ad9nmPM9Tdnq15WZGJ4GxvwBAuW1pfTCwDVJcjY+mIyIy+o\n OoroUzQFs5E/u3fzgCXNvL5vHPjwvfdTylSH+4KbbpolnqAFP/+A4YX0Yj3wrMI6rN1i\n E3aoA23V62FE/QQ9tukZ9Zj9Irm6TBzrLNtkc6eG+jaGjaPBX4eqlS9mY5EASr+vIJiw\n MPnZyZxOBNpvwrQiN9YNfySnNoxadhD+NczLFE77zze8qumnolLoEh/O/JCsQFV6gmqZ\n I30g==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=linaro.org; s=google; t=1775808836; x=1776413636; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=RvFO6UByEpB5iQ8gep8vaTkLyi+ZU0xgSFREu2ZZbP8=;\n b=lMf39ox0ba33dlLSzpFlhV8t+7T1oIjHkQZY5RrggR1i68uO9QbHAIS6mptGJCIfXw\n dy4y2+Ie+5TmnyYKcLUGiDNRBJV0lgvhcsMuOZn541KTs8vvQc+QeG26dRbYrmHzCa4W\n lWKpetZNUcrmNZ5hTPZhIQsqm3u4FL+IHsrsrheX3z6k7qIFDw9uSODcXG22I4oOJNDF\n xjcNxyW3NHuoo229eI0RM7dQ3YFhruqTWhgICL9KCFUhV1q5UhHqK/49KbJDk389BIgG\n BtqFOtcq9MK92fkgDzVtrgrDXp318tkVtLGhJBtqdkF6g6ywGuE2+NztnfEryTMaB0VO\n mzYQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775808836; x=1776413636;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=RvFO6UByEpB5iQ8gep8vaTkLyi+ZU0xgSFREu2ZZbP8=;\n b=kM2tT9nHfiLU/t+qXjVGIZtV5wDj384NdKp/HHbkrh00Fj5iFYHIZgJMgYf3st0Eds\n Ofl4WKVUhrASdUae2d5WIERP/uxhvcREIIqYcNliyb5C9yghsDoEbCnf5SdIBYKwnSYV\n vXQJ2Zcn6VgrlMj0Ob4tUlBFJxK5M73UjfWWx+FJ7joTEayMMZtwpFcbmnbDWxCwZFSo\n gdQZA6ITPWIqM24ANfRPIR4H7rpQBJOH5hrR1EKzQe1bpBkcptIlfXMQ8ZVUwTu3R0yy\n aM8W1aLk/CoJDnFenWF50ONTIP8J7xC0EvgtCpBsH65GmNMvRPtsLbGBUaTkcxPG7DCP\n /Ljg==","X-Gm-Message-State":"AOJu0Yzn4c6pdKHhmfqNWAJNbhzWqS4P/uYSg1qR8+aAFG+J0DWNy9+5\n cQqX9j/V4AeAV5T3PCyDAVAZA45yio9aPufqMH1eI0Ich/vRuVbq24mAi5qpD4YyUSEeVBxKEcE\n jpRwxpQtpKJAJmQuNT70le1k/JNJ0jUEMcxK4wI4JLw==","X-Gm-Gg":"AeBDieu4uYQiAq69C3oF88WZSR/3fmLMVmp/TNeJe0W4VJzujMojwBwRflENtT7u4uq\n vy0TLUK4d5zS6uX+tN0cAQ3KwJYnmqaawtvB0dDZXefgWs1sU5P1ChGNKw30NdRBHorrc1BnByF\n MA/2P+epEMorYF+AmVKBcNFBIyj+K85XafSurYRTCzGYNKZ+ehiCEXU3ZVgWA4ZNmfjYMkHNKoC\n aQX9jtXaECnCIMdkpo/1PEkA+wx/1OZ8bl3R/Kqx9ikQ5ItUB1askGerT4fjHOp+xTyIVIzOIL/\n uit4SylVVCiaaxENyWBCID6VPf5U0BAG4EUnvOh4111+txXduUOu5s6aQNHcfvH0C/A=","X-Received":"by 2002:a05:690e:484e:b0:651:8ba3:8787 with SMTP id\n 956f58d0204a3-65198bdd966mr1306929d50.61.1775808836506; Fri, 10 Apr 2026\n 01:13:56 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>","In-Reply-To":"\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Fri, 10 Apr 2026 09:13:44 +0100","X-Gm-Features":"AQROBzBJ4JUIqcoLxp4Lg9Hta65TMVJrK5xyLcFa0sD8gDrLAisSgXDqLhkHStU","Message-ID":"\n <CAFEAcA9CT9KeO1qmNg6YaCnjmvDG3-jeSwTjP4EnUqg4Hh8fSg@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"James Hilliard <james.hilliard1@gmail.com>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n  Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu?=\n\t=?utf-8?q?-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::b133;\n envelope-from=peter.maydell@linaro.org; helo=mail-yx1-xb133.google.com","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, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}},{"id":3675969,"web_url":"http://patchwork.ozlabs.org/comment/3675969/","msgid":"<CADvTj4rZUm1opV8viEHB-BEuCoyj_+_Fr2UN6SEj=Dpkcg_xBw@mail.gmail.com>","list_archive_url":null,"date":"2026-04-10T16:17:48","subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","submitter":{"id":66301,"url":"http://patchwork.ozlabs.org/api/people/66301/","name":"James Hilliard","email":"james.hilliard1@gmail.com"},"content":"On Fri, Apr 10, 2026 at 2:13 AM Peter Maydell <peter.maydell@linaro.org> wrote:\n>\n> On Thu, 9 Apr 2026 at 22:00, James Hilliard <james.hilliard1@gmail.com> wrote:\n> >\n> > On Thu, Apr 9, 2026 at 2:17 PM Peter Maydell <peter.maydell@linaro.org> wrote:\n> > >\n> > > On Thu, 9 Apr 2026 at 20:47, James Hilliard <james.hilliard1@gmail.com> wrote:\n> > > > So this seems to be something used by the vendor SDK for Octeon1\n> > > > but not Octeon2 and Octeon3 targets, kinda strange/annoying.\n> > > >\n> > > > I also found this:\n> > > > https://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02026.html\n> > >\n> > > Ah, nice find.\n> > >\n> > > > It's in the Octeon vendor kernel here looks like:\n> > > > https://github.com/MarvellEmbeddedProcessors/Octeon-Linux-kernel-4.14/blob/5c48e5031fbd86361e8185f6c530ffcfa5c9a60d/arch/mips/kernel/syscall.c#L94-L96\n> > >\n> > > Mmm. We emulate the upstream kernel, not vendor forks, so\n> > > we wouldn't want to set k0 here I think.\n> >\n> > Yeah, I was trying to see if there was some sort of way to trivially\n> > identify binaries that require this k0 support and autoenable a quirk\n> > but I didn't find anything, maybe it would make sense to have a\n> > separate runtime target for enabling this k0 quirk since it seems a\n> > lot of octeon binaries require it?\n>\n> We didn't add this 15 years ago, and my feeling is we still don't\n> want to, because we track the mainline kernel. If an actual host\n> kernel doesn't have a quirk to let these binaries run, we don't\n> need one either.\n\nI'm wondering, is there any actual downside to enabling this quirk for\nOcteon 1 binaries? It wouldn't actually interfere with binaries that\ndon't require the quirk right?\n\n>\n> -- PMM","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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=d4xnjBtx;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.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 4fshn33QGzz1yGS\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 02:18:31 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBEYW-000669-CL; Fri, 10 Apr 2026 12:18:04 -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 <james.hilliard1@gmail.com>)\n id 1wBEYV-00061s-7A\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 12:18:03 -0400","from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <james.hilliard1@gmail.com>)\n id 1wBEYT-0002jN-IK\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 12:18:02 -0400","by mail-vs1-xe29.google.com with SMTP id\n ada2fe7eead31-607f1fac33cso757736137.3\n for <qemu-devel@nongnu.org>; Fri, 10 Apr 2026 09:18:01 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775837880; cv=none;\n d=google.com; s=arc-20240605;\n b=cbILQ8VTr17EQQOycRQEavkqqpRDKPAPfrth/qQY2oITVrrX+t/kDc9h6opTO8+FTy\n MNJTxpy0ENAVOGjags+5w36aNGuc9j9KPMG3xT0883utTpmCMYrCSuClUntVj0v7z2e1\n b0e2aCc7jH4imcYWNQGSqcuSa35TLGHfmCF750z+QunPPCaIVXQrtjttXxl2qGJDTRzm\n rkxUTIGq0fePHkn1X3BvofJKZEw2gXtTvPjx4PmPUxgBmKSKPCkIR9v8afpjsJtNBUtL\n Vf/oQ+oXWZuotUuUIRz/9ZKSefXpDBr8BnFQ0xbR+w7duez8NzSwNDhzpTqWlM6v9HCV\n aMbA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:dkim-signature;\n bh=Zb7LYTqGtSCK+gsuBQZ2Dvcd6c15n5rlD6NcR35ZKlE=;\n fh=6WPaczp89kVEvyqQhTtoSourPaOeS62pIBkgOKSIhVk=;\n b=doiJw9zj0B7pjkBRgHF/51KzKMmIAxQKFpsCe12PdhTx7i+26Ry5w1a76RDH+rR/Rg\n b4vMePngxrH5jFMksFh/+02A7S8reU0QwbEExmxLR2QuM4Fm6jmIWeUnthQNo2cNGPHt\n sqP3vFfgKIp/aZRm4rCW7KD6PhvU8+f3i4oBKGly5szlWhSFh5mh6xVp9wG5jVTDoVpg\n y4GkgLF185HIK+Yj+GJFHtGdH5K9NDHrfHZtmFJDK5XBeht62DXivEV282UE3FJw1ki/\n hDJ+S5dYHOFUD7D3fqIjLrWZ+nTQ1RZJ9Bv7juXhpPhq5IoqU7uXpJMJfXWaUJ2Fhz2S\n k4nw==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1775837880; x=1776442680; darn=nongnu.org;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:from:to:cc:subject:date\n :message-id:reply-to;\n bh=Zb7LYTqGtSCK+gsuBQZ2Dvcd6c15n5rlD6NcR35ZKlE=;\n b=d4xnjBtx7rutJ07mW2BGovqc76Mq/ZQO1JNTG9tmyIKIGaIJelsYYMdgb2aeGcQAXp\n RqhvW8zmadYrpE1+5cIk2Py45xG6ze2IMsfu2ClLWYq9vx2U7u3GMqt9AT9OxX2uXwVP\n Gl3Dft9CVNeNR8/mKklQAA3tIyZwIXxdHNLTBKxAFG2rrrqRArvge4URNpzZTHq+zJ12\n e6gnQtA22Ci5ckJsvIhxF3o6HUYJnY9NhCoOZQEOaKANqwZRqpzOFb79hSoyUYZt1EMX\n KPtX7hLwZCnqxNd7bPsrpswTvxnQHYVPqq05cWYLaOBNm6iki9B3lw5I0vvvljDY8rtH\n fH3Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775837880; x=1776442680;\n h=content-transfer-encoding:cc:to:subject:message-id:date:from\n :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=Zb7LYTqGtSCK+gsuBQZ2Dvcd6c15n5rlD6NcR35ZKlE=;\n b=QSlwKHehOxwsbVuV4sTQWhMgcj6/EW9CUFJc743nweVRnvRGPOzywilXNebhVUNyd/\n OCBan+qchmyQUkMDodtK+Wo2MKUZzVJGjaOnq9tEsGKNLt0424Me0NkbPkTAYEMhKSaQ\n /VP8Xox12xDAXSqGykkI9IKbiqhjzUVwi6EaN5QHY2a8GGvo8BbGOCg1VYI/z+vZ0+2r\n /7u3RxMkjxsrI/fF4sR3plNCoCERkuuy1TF4KXUyZ74D34gNNUGtj/bZaqARx+prybiy\n vTM1wq9S+VGPwqXtPBEycCwx5KraVrzQEvI8QWML4+yd9UeRDmqQyBqFo3kF7ZBx1kle\n 3OYQ==","X-Gm-Message-State":"AOJu0YxD8mNjOgxUAbxXPIJPi5Qqy5qm2s3txZu8KKtPsc9SK15aS15k\n ulp5jpdIfMeZNxGmlY/SUI+5HpqrMIK9dSivnY0/iAHfer527l2WpBjy1t54i+kzBTmZXAlAbFU\n taM9HvC3BQ0dTLi2zInestg0Zd9dP8/Y=","X-Gm-Gg":"AeBDieuh1Fvv0zgQnQ2GJOINhuIhfH0tr7oIBOmbrBoS0MJG0D6GcV/tsfJx5lkH8Uj\n og1gfy3MNDCDWDMIJoj8J2vlEhzsNNU3ETjBMAei7vqBPvDqzDb9SLNGtOmlvTKAYC9SJ9+Opgo\n L9gkrnUIGZGN/cIhXKNMp07pVcLJHJIZOGtLtfik50w7kfejhlgmuyFNm5i5j/mqkmE/rkqMNae\n IWVi7yC5OgtfkFA6knsxbxwhffG9Vml+c7TyPOke6Hkx2UM02Z/5ov4esWiqz1avCIV9YWNVrBF\n zw562Duzg+M4+WF5httuXjxE34NDOil6ebSAi1TPYwxRLQf0YgZzpyXeTCONyL7FmWo=","X-Received":"by 2002:a05:6102:304b:b0:5ff:fbe4:8a4 with SMTP id\n ada2fe7eead31-60a00629e26mr1639943137.21.1775837880256; Fri, 10 Apr 2026\n 09:18:00 -0700 (PDT)","MIME-Version":"1.0","References":"<20260408184228.44242-1-james.hilliard1@gmail.com>\n <CAFEAcA_Jt3SmuTiLWxuVQuktAG=M5C-Ux7OYKcGwPUBSETegew@mail.gmail.com>\n <CADvTj4rMoQi-ic=q=TJ5Dz6_GhHhR=JNhMoRhfKCFAuZzhUpzw@mail.gmail.com>\n <CAFEAcA_JPnWh22zhb+ajr76oKtFRoCZSZpsVW51m08eWrMZS5w@mail.gmail.com>\n <CADvTj4qUY6=b56LeHb+fZBEdvFPPR9dMFkYEjNhtN=BipOaEog@mail.gmail.com>\n <CAFEAcA9CT9KeO1qmNg6YaCnjmvDG3-jeSwTjP4EnUqg4Hh8fSg@mail.gmail.com>","In-Reply-To":"\n <CAFEAcA9CT9KeO1qmNg6YaCnjmvDG3-jeSwTjP4EnUqg4Hh8fSg@mail.gmail.com>","From":"James Hilliard <james.hilliard1@gmail.com>","Date":"Fri, 10 Apr 2026 10:17:48 -0600","X-Gm-Features":"AQROBzCs8DBFvf3_uEY4GH3sVICM0ANwOMt20BhpJ9HRiLgR_8Rf0TVFmxX1a4w","Message-ID":"\n <CADvTj4rZUm1opV8viEHB-BEuCoyj_+_Fr2UN6SEj=Dpkcg_xBw@mail.gmail.com>","Subject":"Re: [PATCH] linux-user/mips: keep k0 in sync with CP0_UserLocal","To":"Peter Maydell <peter.maydell@linaro.org>","Cc":"qemu-devel@nongnu.org, Laurent Vivier <laurent@vivier.eu>,\n  Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu?=\n\t=?utf-8?q?-Daud=C3=A9?= <philmd@linaro.org>,\n  Jiaxun Yang <jiaxun.yang@flygoat.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","Received-SPF":"pass client-ip=2607:f8b0:4864:20::e29;\n envelope-from=james.hilliard1@gmail.com; helo=mail-vs1-xe29.google.com","X-Spam_score_int":"-17","X-Spam_score":"-1.8","X-Spam_bar":"-","X-Spam_report":"(-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n 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"}}]