From patchwork Fri Apr 14 09:32:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 8176 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp247913vqo; Fri, 14 Apr 2023 02:34:11 -0700 (PDT) X-Google-Smtp-Source: AKy350av5HePsiwcVaDNoqnGSDNfYmA/YKwitge3v4fma6H9e4hkec2aPb3/iJUrZyY9JJ89ySwx X-Received: by 2002:a17:902:820f:b0:1a1:bfe8:4fae with SMTP id x15-20020a170902820f00b001a1bfe84faemr1971925pln.43.1681464851377; Fri, 14 Apr 2023 02:34:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681464851; cv=none; d=google.com; s=arc-20160816; b=kvTezV4loTC7zeIc23SHRSHLVGRvbGyS4wd/nfW270RVcgwSASdkY5xJtc212hLWPS sCY3z3fxSeSIuiDsERBUuXq6YzElvNz2T72+VimLcTWE/ByHa2dRNUrO4H+VBbzT9Sgb uIEAnyJGBoOXkRYe5CFb9Qqx8h2Y0iyYgB8XECF05o8eN9J3EHXoL4dbxxaF4apUS+5M EJLqS2yydiab1LtmmtvLAHyHv0fq1Y3yDu17Q0pE6gvYSeXRly1ruHaCGunWWTh6IL/6 Cn1c/5hyth2xuLvojdm9D7f0967oLZry8RoeWXl9XQt/ZUKbTzm/pHQxKvvKu8aA+wnq cmqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=9n8iWmQoLo1pP9qD5jtqgBQlgFnXcmIT9eYLs40mi4I=; b=0MJHABUc8lEBj2YYXH2K8u+DUQDyPhACrxnHaCAw8EXu+qdRIUwFYFHZxVsutNiJ0a p+eDilyK5iH7SdmMPzDr0/GLlzMhJ25yQJzGeG53RAEIc15Ed39cuDktyvG1BNzr9wL6 5IkAFFIs34dv7Y9wLmnDgvPyn6dTl2RVNxGYfEn5PO/NpM267Uz++B4XDjjnAaYuXNz1 OsGSzN6PH0WdfuMh8yOb0mmt/+d1yWXNlh2BnE52/9NFdL8qESKvwXWQK/7gkTK0N1pk qhovnrm0tF+yYV/fmIggtonutd6SbbA8miC1XIzS+21toUmUD09Zpx9kUh5MY6EJvG2J 43GA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o7-20020a170902d4c700b001a0039e3597si4516820plg.316.2023.04.14.02.33.59; Fri, 14 Apr 2023 02:34:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229721AbjDNJdL (ORCPT + 99 others); Fri, 14 Apr 2023 05:33:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjDNJdK (ORCPT ); Fri, 14 Apr 2023 05:33:10 -0400 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9526D5244 for ; Fri, 14 Apr 2023 02:33:08 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8Axkk7THTlkkGIcAA--.43782S3; Fri, 14 Apr 2023 17:33:07 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dxjb7SHTlkpYkkAA--.885S2; Fri, 14 Apr 2023 17:33:06 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , WANG Xuerui Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v2 0/4] Add uprobes support for LoongArch Date: Fri, 14 Apr 2023 17:32:57 +0800 Message-Id: <1681464781-4428-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8Dxjb7SHTlkpYkkAA--.885S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7tF4kWFyxXr15ZFy3Zw1DJrb_yoW8GF1fpF nrursxGr4rG3s3Jr9xtas3ur1rtr4xGrZFqFnxt3yrAr4Iqr15Jr18KrZ8JF90y3y5KrW0 qF1rG3yYga1UA37anT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b7AYFVCjjxCrM7AC8VAFwI0_Jr0_Gr1l1xkIjI8I6I8E6xAIw20EY4v20xvaj40_Wr0E3s 1l1IIY67AEw4v_JrI_Jryl8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVW8JVW5JwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwA2z4 x0Y4vEx4A2jsIE14v26r4UJVWxJr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4UJVWxJr1l e2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27wAqx4xG64xvF2 IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE14v26r1j6r4U McvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2 IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v2 6r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67 AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IY s7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr 0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8r9N3UUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763143687877264564?= X-GMAIL-MSGID: =?utf-8?q?1763143687877264564?= v2: -- Move the functions to inst.c in patch #1 -- Pass around union for insns_not_supported(), insns_need_simulation() and arch_simulate_insn() v1: -- Split the RFC patch #2 into two patches -- Use larch_insn_gen_break() to generate break insns for kprobes and uprobes -- Pass around instruction word instead of union for insns_not_supported(), insns_need_simulation() and arch_simulate_insn() to avoid type conversion for callers -- Add a simple test case for uprobes in the commit message Tiezhu Yang (4): LoongArch: Move three functions from kprobes.c to inst.c LoongArch: Add larch_insn_gen_break() to generate break insns LoongArch: Use larch_insn_gen_break() for kprobes LoongArch: Add uprobes support arch/loongarch/Kconfig | 3 + arch/loongarch/include/asm/inst.h | 16 ++++ arch/loongarch/include/asm/kprobes.h | 2 +- arch/loongarch/include/asm/uprobes.h | 36 +++++++++ arch/loongarch/kernel/Makefile | 1 + arch/loongarch/kernel/inst.c | 48 ++++++++++++ arch/loongarch/kernel/kprobes.c | 75 ++++-------------- arch/loongarch/kernel/traps.c | 9 +-- arch/loongarch/kernel/uprobes.c | 142 +++++++++++++++++++++++++++++++++++ 9 files changed, 265 insertions(+), 67 deletions(-) create mode 100644 arch/loongarch/include/asm/uprobes.h create mode 100644 arch/loongarch/kernel/uprobes.c