From patchwork Tue Nov 1 14:33:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3010210wru; Tue, 1 Nov 2022 07:37:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66rz/V8/DWUleAWOjqTSacgJbXb2VYYPUbYdcdmIEQebql0r+TstamrdFRhDcy3jvm89W5 X-Received: by 2002:a05:6a00:16c8:b0:53b:3b9f:7283 with SMTP id l8-20020a056a0016c800b0053b3b9f7283mr19885779pfc.46.1667313466391; Tue, 01 Nov 2022 07:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667313466; cv=none; d=google.com; s=arc-20160816; b=Y43IWcASiDd8+kwy831dW5MZ2H7zjlTWANVBUeMVqwoEA2/J8memqnczJds9cdTvdR Je+gGNMGzM2ES1UEj3dfMzbjCNInbc/uG/P1YfMnq+Ey5NC5EfrQ5D+BmUisvJlSRHbw 212Nj+n6jicshQ+G7I760pB5dZlpcCloPx+coNmPk7u4HYZfDDOAgiCvN1XlvUNXxMzv 3nXd+C1cKmFJqttEfqLx8dL14FWitJW3tpVeFUM4LIhdl7tSNfNrDIIyvi/ABzFXg/hL Ad7RgJ/yeh93/L38f5aJFClFea7/f8m+k6QZSNaD4GOafANvzyG3QLgtsinCYWQ+iN2i e2QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RwWFYCYJumXDNukDFpgq6aZHdE7ume2pA+aIBGQJqXE=; b=duYk/vNmpevyly7bQQ38L0AphKzGPs+17Hq4ql4ACOfqTgA9l89fNdVleQ+63QAOws 8C3ECpQdj07P4CqFBc130+ljEHxx4+U+r7A/QTx432irjjSFMdx+5h9pymghVUmthwE8 hDmKdGBt4zAIHjX+9uPKGPbOQJMHKuMlC6unjDxwQAIS065fi7hDh6Tl15xc0/NBJjOV l8vuqqPojIFYd+HVv1g7feqDKbvoJi+xzJ+VryMIhSKRxHfnm7PvldE/ppyoGmbrTuUH pezksWIwu6fdWaPU883sVfSqgVF4mKEyOXyWFIqqfst+XrJ0J+RI19Fz0AhdLwRL7dkc bXAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=GFcmRIes; 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 v10-20020a63f20a000000b004615836deeasi12504782pgh.860.2022.11.01.07.37.32; Tue, 01 Nov 2022 07:37:46 -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; dkim=pass header.i=@ventanamicro.com header.s=google header.b=GFcmRIes; 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 S230196AbiKAOel (ORCPT + 99 others); Tue, 1 Nov 2022 10:34:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbiKAOei (ORCPT ); Tue, 1 Nov 2022 10:34:38 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 331671B7A1 for ; Tue, 1 Nov 2022 07:34:38 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id r18so13549250pgr.12 for ; Tue, 01 Nov 2022 07:34:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RwWFYCYJumXDNukDFpgq6aZHdE7ume2pA+aIBGQJqXE=; b=GFcmRIesUWIz/XTK/DZOnuFn9hhDBdvIgSX+tNR4YNV02qbkLgAb0VRAQzpftjbynm i67Zt2PpSUy3ObjokrZCMzlwwwcRqRUz2/FZY0cprReKwAky0iyKfRQ2qPcRFVCebn4/ tcdO4dftOeCtLKTNKhgjtGlxbbZovxnenlGQdbc1bhh0XZbFj66iqJh79gQUpgINBLFa 1uy5vR2ZquzfPKjcwVnsoQzQEEiGgHu4uD5JtPfbzTrEx6nwnOre74V7wuRpy7JyIPEy UA3L2tSHdvrXvsh16MFn5OKFZvg4eK3o9g/Mh5LJ/sWbJkDCBVi4Bwg8wovl4YVBGNjt if3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RwWFYCYJumXDNukDFpgq6aZHdE7ume2pA+aIBGQJqXE=; b=cU9/KrkiDuRMMfZioVw2NsGRG1OhdkqEZeoJUF0DuGrMfjJv9N6FNKhFmOGx0T2uAH 6HJtOA4ZbNPKLDZNJM7+H/tOnVkNm2ocHBqxOweD+cyFf2+YlRkyFHSZljHWgMAdRguF LgO9doByIQb0MtmXgsfxd0RTWcWcE7+J+5exwvqVc+ihhKNWNndYxA5lG+pr5nadmz+I cdHVUWHiJSAQSh516p4khwhWn2PVIILilm3oA2NKpIxbTWEE9xFxMGpsumfvIqvui4xj NT2YgJJ/aAyczIbWWTAWzLsakZ6g74A6F4J/vmSPE1/LMzTzGQascP2gILK0zWcbjs9E Cazw== X-Gm-Message-State: ACrzQf2BTLelZMGiDSmMIBPf4koyswHWOQ8fX4Y02z0cZmJie/lVtGbn WSeSjuw2deK+c9omjYYzJ19s5w== X-Received: by 2002:a05:6a00:1f06:b0:56c:ee8a:29f7 with SMTP id be6-20020a056a001f0600b0056cee8a29f7mr20213771pfb.44.1667313277494; Tue, 01 Nov 2022 07:34:37 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([171.76.80.52]) by smtp.gmail.com with ESMTPSA id o20-20020a170903009400b0018685aaf41dsm6449055pld.18.2022.11.01.07.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Nov 2022 07:34:37 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Daniel Lezcano Cc: Atish Patra , Alistair Francis , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel , Bin Meng , Atish Patra Subject: [PATCH v10 1/7] RISC-V: Clear SIP bit only when using SBI IPI operations Date: Tue, 1 Nov 2022 20:03:54 +0530 Message-Id: <20221101143400.690000-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221101143400.690000-1-apatel@ventanamicro.com> References: <20221101143400.690000-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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?1748304885385842067?= X-GMAIL-MSGID: =?utf-8?q?1748304885385842067?= The software interrupt pending (i.e. [M|S]SIP) bit is writeable for S-mode but read-only for M-mode so we clear this bit only when using SBI IPI operations. Signed-off-by: Anup Patel Reviewed-by: Bin Meng Reviewed-by: Atish Patra --- arch/riscv/kernel/sbi.c | 8 +++++++- arch/riscv/kernel/smp.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/sbi.c b/arch/riscv/kernel/sbi.c index 775d3322b422..fc614650a2e3 100644 --- a/arch/riscv/kernel/sbi.c +++ b/arch/riscv/kernel/sbi.c @@ -643,8 +643,14 @@ static void sbi_send_cpumask_ipi(const struct cpumask *target) sbi_send_ipi(target); } +static void sbi_ipi_clear(void) +{ + csr_clear(CSR_IP, IE_SIE); +} + static const struct riscv_ipi_ops sbi_ipi_ops = { - .ipi_inject = sbi_send_cpumask_ipi + .ipi_inject = sbi_send_cpumask_ipi, + .ipi_clear = sbi_ipi_clear }; void __init sbi_init(void) diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 760a64518c58..c56d67f53ea9 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -83,8 +83,6 @@ void riscv_clear_ipi(void) { if (ipi_ops && ipi_ops->ipi_clear) ipi_ops->ipi_clear(); - - csr_clear(CSR_IP, IE_SIE); } EXPORT_SYMBOL_GPL(riscv_clear_ipi);