From patchwork Sun Feb 20 05:08:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 12752550 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F343C433FE for ; Sun, 20 Feb 2022 05:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tatxdkk+WJrhQXterg9bFbjpzORvzeKfo6rSEREDoVA=; b=W1fjLZu53tRT7C biLbHBUZygQxqEW7XR3vxKma8Yp7IDaH38DOoj0G715/RyD2QVFo9XOiSVuc7rB92uT4s8SQDm0c+ X9E2qW0suBV5W0enNqpSgib2UMS5yhXKXf4vxC3/gBrilY/0O4YJb1dcbO5F9Bbay6vQ4pGE23xSk WT37NwL6LR2R6c5MPJJMhwLMUpBrDm8ParIQUXhqMHTA+nMDT5AejO6N9IcNKMf4dkTTKxns5+/JM 8T3F0icxUoO+PampNmINIoVTuAiBWZfPKlFU8m+lNBssMrNIWLlXopLodvkS/Yf5YDEoh4fbdIGfk fqpl/KglqzJF5A2IH1AQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLeTz-000bxb-JS; Sun, 20 Feb 2022 05:10:03 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nLeTw-000bwM-Ek for linux-riscv@lists.infradead.org; Sun, 20 Feb 2022 05:10:02 +0000 Received: by mail-pf1-x42c.google.com with SMTP id z16so5821038pfh.3 for ; Sat, 19 Feb 2022 21:10:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0e9yogaMLiWmOvC9vxOUuPR1xHD22ef7smp5tanFg+4=; b=iUiAv4bXiYHpbD8Iy22OVVQzO/lShGPSsHELrw40Cev5/d0169c2Kzh9M/D3b1GmrY gU5sNkUYtlvk4sIXy5/vAzD/FPg2Fb7oong+2RNqn3QYqD+WcQ3KlpXAwYyvz6zbmqwa wHpem/shCx4LD0JpcduBvqgtlrZDbA5Jm2LhXzrUhksDyV2U6WGjXtzN0keSRiNZcy4P MPOlh++kLYkoyagnFbCZ2s750bSth4PB3yAwR38fYZ2ANKHIrmMLr+KpvbmqAz2hr5hE W8Z028CQ++CrFI8RtfWASxK+hgkm0XRWyI5RH82Shz6kDkp+OdIAKrVaoTtf+B/CEtJZ PGuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0e9yogaMLiWmOvC9vxOUuPR1xHD22ef7smp5tanFg+4=; b=cpoxPkfHQb1uRj95LOL85x/eONuAmMaVbgJRaPXCFsJvIL7EEBj85i1Wp/eAvnA7Bc UWLlqwXm49QbPsJWY1W3TzddFIF5fbQMhDlWicXYRrnPzfbANJIrG+sNfpNXYpVpijKa NSPwWTmnFWGS//3W1oRusDv0aDtBQYapkXuh0fJ6y0TM+IRbpTnvXyNf5D3GHwXOTXpM 19e0/1e889iZ+bumJFgBuJd5isrU+O8b/+bHsZKTP12zn9AIw+2bT4TSK3O5jkpfhyJs zYPpQPYEwpbTK0rf4RC91SDn637hylBQ7h/zVHoCwZYZMw+38fct8OblxhOVdm5uKCe7 b07g== X-Gm-Message-State: AOAM533oPBzBytH6gb7hWiTtYx2YMbx3+1QPVdbzzT72Vck2/4/UmerS wPw2FRGAveJ0kUa7elqsQPMgZg== X-Google-Smtp-Source: ABdhPJwLfIY4gUQEEHqxuCTuVUUam/mxgVLs5JFIHSajj1op+Lwp6ydPyR3Zl76lIhTmnExi6v7CHQ== X-Received: by 2002:a65:6794:0:b0:36c:460e:858d with SMTP id e20-20020a656794000000b0036c460e858dmr11800885pgr.418.1645333799658; Sat, 19 Feb 2022 21:09:59 -0800 (PST) Received: from localhost.localdomain ([122.162.118.38]) by smtp.gmail.com with ESMTPSA id 84sm7602730pfx.181.2022.02.19.21.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Feb 2022 21:09:59 -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 Subject: [PATCH v3 1/6] RISC-V: Clear SIP bit only when using SBI IPI operations Date: Sun, 20 Feb 2022 10:38:49 +0530 Message-Id: <20220220050854.743420-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220220050854.743420-1-apatel@ventanamicro.com> References: <20220220050854.743420-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220219_211000_518901_86403030 X-CRM114-Status: GOOD ( 11.23 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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 --- 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 f72527fcb347..9786fc641436 100644 --- a/arch/riscv/kernel/sbi.c +++ b/arch/riscv/kernel/sbi.c @@ -621,8 +621,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 b5d30ea92292..6fd8b3cbec1b 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c @@ -89,8 +89,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);