Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2450107rwi; Tue, 1 Nov 2022 07:52:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WpmKx+oHB9J75Jp6qi16GTvmrgBMvPEaYoEK3TNyNxHO4UGYHRkIK3l5zYWE0+iFxEpkS X-Received: by 2002:a17:90a:a88f:b0:214:25ce:fa67 with SMTP id h15-20020a17090aa88f00b0021425cefa67mr83571pjq.116.1667314326259; Tue, 01 Nov 2022 07:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667314326; cv=none; d=google.com; s=arc-20160816; b=gu4d4zvjdTzPa3WtWlhm404eW47ILqxKxHzTQdcY0PYQcdwQcvF1VYaG+JWkAjrgEG MItFrM90rjBFXNv9mHPRWpSZ3mLdRsiVrujuOMuSvVsAK4/JFDldLJzR22Sc+AIiakzS FLhnxLz7hw7+mxJBb7eKp4tHiK9cfQdLy4XeW2QY2OTTRj/y/Ge5oMsCKO2HqRZJjJDR Yw+VKX0MQmRpUyLhDr93znKZIqKRuZ0neVn4w7IPn87fWqByVSK7RdadsdlMoUDcY3Ci KDmFoivhq1JcvZciHiWTPt8fDviu03iBk3d9jkqVdXqD84zwAeBegRyYN9lSbis+YDz0 B4aw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j63-20020a638b42000000b00456222a202csi13226667pge.436.2022.11.01.07.51.53; Tue, 01 Nov 2022 07:52:06 -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 + 96 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 Content-Transfer-Encoding: 8bit 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 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); -- 2.34.1