Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp3680066pjo; Wed, 26 Feb 2020 14:58:32 -0800 (PST) X-Google-Smtp-Source: APXvYqy+1xQpNKM9BgzAgTVOYVkttGcwns1uQtWtD0B+QuwdqYtjgFK7BGVGtP1n5ndyqnf3YGqZ X-Received: by 2002:aca:af49:: with SMTP id y70mr1124426oie.162.1582757912234; Wed, 26 Feb 2020 14:58:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582757912; cv=none; d=google.com; s=arc-20160816; b=R5FCS/1SArAEll688Y/QLOHofqsFyT+K0nrmdLZjwhzpz30UNu7cBBB9XVrkKsNRGV lT7rTJ1NDcIEwx2P+zurk6hPvDWhUvMnrmpOr7elx2zpv8mSNvkkuHrCavkuiNrZBIfE 55QsQgNYMDuyDb2jiUiam1Owuf+QMQ8wOeysY+/d0rZUfnZZ5fEIdM24+M/mIq2g2iPt 1V5t/2HEOU2QGFIutfN0dsXkEReWHOGAwQXIEAoSHMpkIVJEu8de0kUYHnxnX6zswg/z IZeAyRfMz+Qgq+ZEQyedQuhYpjCAi+AchEnM5B16hLK+Lv5WmasaTRyUPm7f0oyx3soU CCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5ohmIu4XqdwwoGOhxHZxWRSxu96xnb4vm9jRlxB7Rk4=; b=j0lpc4AsnT8Q//bn1xLfb1Db/iVk51WvRFTBL/e17fW0AmszwH2MyyK4tSUXWkXr5k mbd7knGLVNKqwgXcCQ4F3BiKDJExB5HmbgGlxe9PUMmOWxc4wKEDvysI1Euzq6AOYJzg aauYUyCXnKSqYnBNbZcEsK0V02/VCaB8cbAc8mSuPhpPdSvpAjfBLqK4fipoOPIqp4Ql K4aEsl4y5lxxre5mQtYej6Tq8J/9hRFgXQXAxE3UDXY/MJVvlRA8otlrDd44SP57202e a8tUv1ZTCtE1Sna84lA4NJOVc7Sxujx321Ldl9jQO23n6AQhB+nx5PlszPsFJHT5AScm 7yOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=o2oR2jPe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f187si328092oia.218.2020.02.26.14.58.20; Wed, 26 Feb 2020 14:58:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=o2oR2jPe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728000AbgBZW4w (ORCPT + 99 others); Wed, 26 Feb 2020 17:56:52 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34422 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgBZW4w (ORCPT ); Wed, 26 Feb 2020 17:56:52 -0500 Received: by mail-pl1-f193.google.com with SMTP id j7so304441plt.1 for ; Wed, 26 Feb 2020 14:56:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5ohmIu4XqdwwoGOhxHZxWRSxu96xnb4vm9jRlxB7Rk4=; b=o2oR2jPevA8x/8UCrV1EgrGE3AdJ+mc/EDnisAEwLf1+dC0nr+f6eotTgRm7T+Z7oc mkrFlGEqZobJMMQXcKPlFRL8Thl9nqWAo/KaId7bkyLJv+hcxpjxTkE9y09g2taDz3DO Y3sJ+9SMdjgEldumApxzkxT8DXFcnq7M6wEiRJK7xpPUANBKP42OMFDYYo3R3RghOT/j x0KyWy3ZIqxMqhwGh9MnFYCRPpvkc5wCkmfF5ibJEKDcJnAmbgsodQgo4sTOdpHEGlaT ywxGjgh7s8CBSYwBndo8//PKsIDrv0J+hCaTJNrB8QQoJhMOPp5Ye5HCuqwv/xGeJr4n +eQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5ohmIu4XqdwwoGOhxHZxWRSxu96xnb4vm9jRlxB7Rk4=; b=A9sbWWsSbapM0Rb0MwYNdmF3sHx2gnDTY+PDOZka9oG1fv0DmzyrhACFl3Hc5f7FUI YfIuGMjnGOAoOAo4Wmit8h3F3kP9cbfeKa7U0WHuPuEJQxBOKcxKcGcg0nK8kTvKlAu/ Q6lFRRgHL79O4qEE1ujC3/FR3agpMvsaGGbUvDBKK7yKffMzrP/Y8MAFXubGTCiqfu0f JHCTO0Fq60ayQy2yNshI1u9ot4ZINs82Po3bAYjqSEihq0NlpoFt6xLasjG2w9xVbuZT ic1StQsC0+Z/J573CfUF/aQZ4KvIo1SD0ejX8SIFhcELqVz4hZfmZbSu7FZRzVxrdLWl 0hbw== X-Gm-Message-State: APjAAAXZA8/SWWDvo8E1MTG4RiuzQD5FuGhRbf3sX+D4r+QUeEcnuiWf DoSSIMKKgOoG1RxlBXHoNWOH1przgG0= X-Received: by 2002:a17:90a:c78b:: with SMTP id gn11mr1471893pjb.97.1582757809594; Wed, 26 Feb 2020 14:56:49 -0800 (PST) Received: from localhost (g183.222-224-185.ppp.wakwak.ne.jp. [222.224.185.183]) by smtp.gmail.com with ESMTPSA id x190sm4277665pfb.96.2020.02.26.14.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 14:56:49 -0800 (PST) From: Stafford Horne To: LKML , Openrisc Cc: Stafford Horne , Jonas Bonn , Stefan Kristiansson , Christian Brauner , Greg Kroah-Hartman , Thomas Gleixner , Allison Randal Subject: [PATCH 1/3] openrisc: Convert copy_thread to copy_thread_tls Date: Thu, 27 Feb 2020 07:56:23 +0900 Message-Id: <20200226225625.28935-2-shorne@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200226225625.28935-1-shorne@gmail.com> References: <20200226225625.28935-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is required for clone3 which passes the TLS value through a struct rather than a register. Signed-off-by: Stafford Horne --- arch/openrisc/Kconfig | 1 + arch/openrisc/kernel/process.c | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 1928e061ff96..5debdbe6fc35 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -14,6 +14,7 @@ config OPENRISC select HANDLE_DOMAIN_IRQ select GPIOLIB select HAVE_ARCH_TRACEHOOK + select HAVE_COPY_THREAD_TLS select SPARSE_IRQ select GENERIC_IRQ_CHIP select GENERIC_IRQ_PROBE diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c index b06f84f6676f..6695f167e126 100644 --- a/arch/openrisc/kernel/process.c +++ b/arch/openrisc/kernel/process.c @@ -117,12 +117,13 @@ void release_thread(struct task_struct *dead_task) extern asmlinkage void ret_from_fork(void); /* - * copy_thread + * copy_thread_tls * @clone_flags: flags * @usp: user stack pointer or fn for kernel thread * @arg: arg to fn for kernel thread; always NULL for userspace thread * @p: the newly created task * @regs: CPU context to copy for userspace thread; always NULL for kthread + * @tls: the Thread Local Storate pointer for the new process * * At the top of a newly initialized kernel stack are two stacked pt_reg * structures. The first (topmost) is the userspace context of the thread. @@ -148,8 +149,8 @@ extern asmlinkage void ret_from_fork(void); */ int -copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) +copy_thread_tls(unsigned long clone_flags, unsigned long usp, + unsigned long arg, struct task_struct *p, unsigned long tls) { struct pt_regs *userregs; struct pt_regs *kregs; @@ -180,15 +181,9 @@ copy_thread(unsigned long clone_flags, unsigned long usp, /* * For CLONE_SETTLS set "tp" (r10) to the TLS pointer passed to sys_clone. - * - * The kernel entry is: - * int clone (long flags, void *child_stack, int *parent_tid, - * int *child_tid, struct void *tls) - * - * This makes the source r7 in the kernel registers. */ if (clone_flags & CLONE_SETTLS) - userregs->gpr[10] = userregs->gpr[7]; + userregs->gpr[10] = tls; userregs->gpr[11] = 0; /* Result from fork() */ -- 2.21.0