Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3722345rdb; Sun, 10 Dec 2023 18:53:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcl/LkVl/yG4Mn60Fd7GUdZdWPx9/GUC8skoWw9UIZqKpZfjCX4xoNf0K6poZYTuvOhRrA X-Received: by 2002:a05:6870:a119:b0:1f0:3b19:db24 with SMTP id m25-20020a056870a11900b001f03b19db24mr1883837oae.56.1702263223232; Sun, 10 Dec 2023 18:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702263223; cv=none; d=google.com; s=arc-20160816; b=V740fRAfuVJZ9fRyWfPwoye5+HIqwX4+/whR6CptLGg1TuzL2j28tn63cRuphNzbdD 5xYnOrBYULYqw8D2c/i/5Q6lQTNrG4PhVUsmyGfIOWBCDThaLXG1biM3EqVPP00CP5Wr Q3gfiUiNWpmnAwCKRYew9VcyJPxvJy+FM6zXYJNB0fZVCVGORe44t2QcC/xN+8eXL/cR DO1OFq7RUYByUtG2pVmHzPW9PEllMyqd06TGZaV25yHmFaC6JuXgPEWLNUw+g/TqtSVy eURADVGtgqnIy/Q9Y3Xno4iRCqv+N84SmEAy1VYQs8gsTaLTsNZpnY0+CHLZjyyk6nbv 73Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=rdjPqWXoBECrPlDifczgnZc0bIsdggF4s0b8XjgXGds=; fh=lTS7hrIgkdr7XoLjwUPQmGCBlNWTlrOiT0JBQqruUD4=; b=OEmTLoTVGKj19Hy1DJ1N82X5Fsfi3tABRqZlpl5kDnZPhGlzGYZ5J9wbno0WPZ7yLs vVGcZBUupmUMXpGh0biDdhyjyb7cdOF2rJBAw6DbwEoCC1QsdAyawcMt6Fe2S27ww/al Mi3jir/DZ/0w40pS/xP8pEoQRuN4cx9h7xtbFbYLuX6wJm8GBZ2CMhumCUqnODq0x+3Y Hiq/tJlLKh9PhDiEmMyvbPpamGnQxIeFVLSYoAvq83PT2K8vTqwdciV4tepn9Pk+4raZ TxQ5CpnTv6iAsNBU69wWXr1NOqUzcGW21kI9OXEp8Ak7+/lled5MlLiYkqFVcwGTbF5c UnZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bq5-20020a056a02044500b005be00724141si5470773pgb.533.2023.12.10.18.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 18:53:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 06FCF80681DA; Sun, 10 Dec 2023 18:53:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233166AbjLKCww (ORCPT + 99 others); Sun, 10 Dec 2023 21:52:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233555AbjLKCwg (ORCPT ); Sun, 10 Dec 2023 21:52:36 -0500 Received: from smtpbguseast3.qq.com (smtpbguseast3.qq.com [54.243.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 367F5172A for ; Sun, 10 Dec 2023 18:51:44 -0800 (PST) X-QQ-mid: bizesmtp64t1702263093txwc5r18 Received: from HX09040029.powercore.com.cn ( [58.34.117.194]) by bizesmtp.qq.com (ESMTP) with id ; Mon, 11 Dec 2023 10:51:30 +0800 (CST) X-QQ-SSF: 01400000000000402000000A0000000 X-QQ-FEAT: l3A5VUsUnUlcsmarVtr1L2MyOzd1tHeCEh7Lba7DnyL7XM6lBjjwpWggANvlj 37vbA2o6jXMMSVExU4hOP923LNECzG2mlYCsrEbEER10kpMLd1ytTJRAIkQMo/DuMHtbIq4 y7fJQxL4aAsCJeZVhKdXRgPujuV96APRS6oMgV7j95XrdcP1Lt7xOBkczU19oMf2JlCRWUI 2i+ILVZ4gDfP7RyUPHDErBcMfhs59sqmk8UESE/ptvWETVMLOy3gUMLpsfja5FudKa+tMpM j30u0h0S/JI0R4dHOKGgVStzn6hC5bwesVf243JoatAujmU6Xn1YuJTs5CsPSNSx+AusESV Ns98AtgEeIccij1Lya9L3/jc15C/ZrmM9K8k7SpfwczAOSjEfCdLCpSjan8rfPvrkHQxBlY pHhEmqIBhuU= X-QQ-GoodBg: 2 X-BIZMAIL-ID: 9599634464750526515 From: Luming Yu To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu Cc: luming.yu@gmail.com, ke.zhao@shingroup.cn, dawei.li@shingroup.cn, shenghui.qu@shingroup.cn, Luming Yu Subject: [PATCH 1/1] powerpc/debug: implement HAVE_USER_RETURN_NOTIFIER Date: Mon, 11 Dec 2023 10:50:54 +0800 Message-ID: <475A60AEEAA99F6C+20231211025054.885-1-luming.yu@shingroup.cn> X-Mailer: git-send-email 2.42.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:shingroup.cn:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sun, 10 Dec 2023 18:53:05 -0800 (PST) The support for user return notifier infrastructure is hooked into powerpc architecture. --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/entry-common.h | 16 ++++++++++++++++ arch/powerpc/include/asm/thread_info.h | 2 ++ arch/powerpc/kernel/process.c | 2 ++ 4 files changed, 21 insertions(+) create mode 100644 arch/powerpc/include/asm/entry-common.h diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c10229c0243c..b968068cc04a 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -277,6 +277,7 @@ config PPC select HAVE_STACKPROTECTOR if PPC64 && $(cc-option,-mstack-protector-guard=tls -mstack-protector-guard-reg=r13) select HAVE_STATIC_CALL if PPC32 select HAVE_SYSCALL_TRACEPOINTS + select HAVE_USER_RETURN_NOTIFIER select HAVE_VIRT_CPU_ACCOUNTING select HAVE_VIRT_CPU_ACCOUNTING_GEN select HOTPLUG_SMT if HOTPLUG_CPU diff --git a/arch/powerpc/include/asm/entry-common.h b/arch/powerpc/include/asm/entry-common.h new file mode 100644 index 000000000000..51f1eb767696 --- /dev/null +++ b/arch/powerpc/include/asm/entry-common.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef ARCH_POWERPC_ENTRY_COMMON_H +#define ARCH_POWERPC_ENTRY_COMMON_H + +#include + +static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs, + unsigned long ti_work) +{ + if (ti_work & _TIF_USER_RETURN_NOTIFY) + fire_user_return_notifiers(); +} + +#define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare + +#endif diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index bf5dde1a4114..47e226032f9c 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h @@ -117,6 +117,7 @@ void arch_setup_new_exec(void); #endif #define TIF_POLLING_NRFLAG 19 /* true if poll_idle() is polling TIF_NEED_RESCHED */ #define TIF_32BIT 20 /* 32 bit binary */ +#define TIF_USER_RETURN_NOTIFY 21 /* notify kernel of userspace return */ /* as above, but as bit values */ #define _TIF_SYSCALL_TRACE (1< #include #include +#include #include #include @@ -1386,6 +1387,7 @@ struct task_struct *__switch_to(struct task_struct *prev, if (current->thread.regs) restore_math(current->thread.regs); #endif /* CONFIG_PPC_BOOK3S_64 */ + propagate_user_return_notify(prev, new); return last; } -- 2.42.0.windows.2