From patchwork Sat Nov 26 17:34:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 26280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4749248wrr; Sat, 26 Nov 2022 09:37:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf7N3llwxx/KQKKzeE9sbqtb9MERQAPlM7Z8P648kvdHyq56zKjCvF/zLynXNqJw4ZhvlD7S X-Received: by 2002:a05:6402:114c:b0:457:35d4:ac66 with SMTP id g12-20020a056402114c00b0045735d4ac66mr40492611edw.415.1669484227428; Sat, 26 Nov 2022 09:37:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669484227; cv=none; d=google.com; s=arc-20160816; b=QIuD3nmzg10vBuCOQB0URVnjJFHQGkKKiRuJo7KH/lhSvmxGRExM8L78UkaVja7h8B OfDiTnBo9W4xzZ8G5fhgN1XZY8EcecZbDD99ISTT0pLGOqfHwJG1fIM0JMsvY7tdZOkp N4hyCTYBWd3XD1qLEPvWmJ9DSB1LK0QYSC1SaewQv0qhMZ21G+qP4swKjBwqN3x1sar4 yJyugRrocVjvKpzIHcggiBVUUJO4GiizN1V2IgxrHrlZ2EFx/SIiD1MlH55YJhLiMeuE iZyD8JwA4s48tTen2kdHO5o63ru2zZXYtlyVQUoA/QE1XJiIUFO9JeiseZaf/lfZxbdf kqyA== 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=j1N+6it4sw1s3UAjDFcrNQ1r48mFcw7kvB+ID/PrVk6gUztBTzYwsEPTMjZjqhinud Us/mY9nQnPDiV5qmPOxDNpMck0dmmNE96K8LmodGDDJ7kphDGSYGA3yyHCmFz2yn2UYX 8/aOYQV+SegWkJlA6LW2SUR8Ejdtr3Vi5kLvzai5+w4kLYQV1FMQnA5rTooDhOvu0K4x hq9ci5/BdQue3LsJ5E2MesyFj3Bq0XqiaN8comrN5AALytrhZkOSMixJ4eucQLib8Wmi wB17zhMvpMu39dqAMGsZv2l1Yi6dpTMmff/JL9zBT4cjPt2CMKLtETmI1vKyf5cKCWkS 2K7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=MwU705xJ; 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 t20-20020a056402525400b004696a0da4cfsi6999974edd.358.2022.11.26.09.36.43; Sat, 26 Nov 2022 09:37:07 -0800 (PST) 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=MwU705xJ; 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 S229634AbiKZRfP (ORCPT + 99 others); Sat, 26 Nov 2022 12:35:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbiKZRfK (ORCPT ); Sat, 26 Nov 2022 12:35:10 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 300BB1D67E for ; Sat, 26 Nov 2022 09:35:09 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id a16so6339809pfg.4 for ; Sat, 26 Nov 2022 09:35:09 -0800 (PST) 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=MwU705xJfUSSthvCC2sCblhJGza3LUZ6vZ+xE5SfJhDq1VVPVBRVRY4SjvFc1a6dpF DmqFF0Cnpi5WwEys551+bUiSJJgGozG0jq4ZTu7erwDTn8wYTbNjNqL7wBBcQhRN9boW bYX1cXyn7E9RHOMSexxdCwW0xMCfAEzJTvQbnuje58RHifyiTaz+z5166w4uZrueOiSH UihbKxtFRwE1qwShwdRekG2IQGpH9qP4gEyzOhxOvmT1fn6iXz2d0IzBPpoirXW944bX OlWsFpNHLjAW/qkDxFGJRry+R97zBwLfBpFUEPvrjyMOJRJs7pjtGZaHPx7fbIWGTNkG RM+A== 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=6O5dBBOCfOO56cvIc9PylsUUPS8sPZ9ERJvoov7o27iJBp8s83E8BxhOTgnFSMxq5c rV6QuORXxVPWERVcjpdu51nZCtYU6+Ht72Ox7oZJPJ75yr1FbOZISt0eN9H9EVDSAQiq Tl41kp/yPVZujW95Dy3wcJuC+/61VGYf3eLBxRfhpisEtyrNIRyGs+3ohWp11uBI05Xk TVkNKK4XweRorq+XePYZQ1Dh21Y2ZNjbqxmkzWD+3ngT8JCUBPawJ1JmKETEzuSfjwkR 6hN4aStwJ8MOk/fPh2cCcTsV4qCVO7JcGK+bIAh4OeKoeIpIvqRTOVRqWCuxyerGvRdH IMng== X-Gm-Message-State: ANoB5pkyBHTU/elyf5zdCeiWdCOFgr6wHGVQdYb6nHEXWwCMgBV0aYnV Zso48ap/c/LGtrDtqwILuIo0Dw== X-Received: by 2002:a63:5d63:0:b0:462:85d6:6276 with SMTP id o35-20020a635d63000000b0046285d66276mr21009901pgm.293.1669484108516; Sat, 26 Nov 2022 09:35:08 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id u11-20020a170902bf4b00b0017f7c4e260fsm5639813pls.150.2022.11.26.09.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 09:35:08 -0800 (PST) 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 v12 1/7] RISC-V: Clear SIP bit only when using SBI IPI operations Date: Sat, 26 Nov 2022 23:04:47 +0530 Message-Id: <20221126173453.306088-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221126173453.306088-1-apatel@ventanamicro.com> References: <20221126173453.306088-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?1750581093081200324?= X-GMAIL-MSGID: =?utf-8?q?1750581093081200324?= 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);