From patchwork Fri Jun 21 09:38:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13707171 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 4CF41C2BA1A for ; Fri, 21 Jun 2024 09:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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=aEnWK+0acw/WG1fcmrFaO0S/Kpr6hx9ikccJYvNHjek=; b=ke2dZfPVl5EeHa//6NMjEZaKKv vR79LqecZgzjBn20LoFxkGFSGs0rCt/hKcFbG5L2AX0Sa/1laQEhI2J/mkYVlfYdN9IeAoJMutwo1 7ky9cKh1LUsQ5NvKGkxTwbv2GbCf3dAHcI6TsI2cTI5TnScwydXdy4uzXRBDBvWqRmD2ga3YvS1/2 lrYzR8Z9crgH+SAmnl7fQ8OzoXusEE2Oa6j0nG3R7DzcQScMJO1mVmv/hTOyvS1iB0tN+R9JMH+Dz G/ArGCWqOg9TOV6JB1k/NG6fi+H1n1WxB0GAbbROJgohnvbKUf3mqgy3gkpY20cDPrUVDp+sTYr2K nUOpTEng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKajf-00000008alz-0JKP; Fri, 21 Jun 2024 09:39:11 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKajO-00000008aeN-2eEc for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2024 09:38:56 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E8E9F624E0; Fri, 21 Jun 2024 09:38:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E53EC2BBFC; Fri, 21 Jun 2024 09:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718962733; bh=ebsxRfG7w+7jqsb7KNkQhLDZDTRew3CMFRyjawbrcIU=; h=From:List-Id:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzw4NvpH5VYO0Arp61CObhIZ6F1k0b/RYgwPvWh4MfI6ZwfvoE98zutQMX1k3mbFb 9i+HDwtrPdc5IaWJhfFGx+COdVC41mZevXz+ZO3IMLxkRYYZyVqiCRiJfMqL9w5U48 +FL7g0gBmkJuxeRDtjStmfQtCGR6y9e5iB3frm3GdgCH8+zNUhYaPtAokck7dQB8iA 4uzBqQrUUTpdNbA6VQh/VKCs5IzlG0K/Drd9nEms2v1NmxSzeKJKhbfphSaSRWO3TC zBh+vLO3BN1ZtCG2eWlJg3Q6t6rmXcOQ7nFAFKW9bTY3mhLY7XDuZL0kpjGRTPrQLW afOSd9GlXLg2w== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , Arnd Bergmann , soc@kernel.org, linux-arm-kernel@lists.infradead.org, arm@kernel.org, Andy Shevchenko , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Cc: =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH v3 5/5] irqchip/armada-370-xp: Use atomic_io_modify() instead of another spinlock Date: Fri, 21 Jun 2024 11:38:32 +0200 Message-ID: <20240621093832.23319-6-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240621093832.23319-1-kabel@kernel.org> References: <20240621093832.23319-1-kabel@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240621_023854_833797_42916270 X-CRM114-Status: GOOD ( 10.25 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the dedicated atomic_io_modify() instead of hardcoded spin_lock() + readl() + writel() + spin_unlock() sequence. This allows us to drop the irq_controller_lock spinlock from the driver. Signed-off-by: Marek BehĂșn Reviewed-by: Andrew Lunn --- drivers/irqchip/irq-armada-370-xp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index ada257aeba78..dce2b80bf439 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c @@ -512,24 +512,18 @@ static __init void armada_xp_ipi_init(struct device_node *node) set_smp_ipi_range(base_ipi, IPI_DOORBELL_END); } -static DEFINE_RAW_SPINLOCK(irq_controller_lock); - static int armada_xp_set_affinity(struct irq_data *d, const struct cpumask *mask_val, bool force) { irq_hw_number_t hwirq = irqd_to_hwirq(d); - unsigned long reg, mask; int cpu; /* Select a single core from the affinity mask which is online */ cpu = cpumask_any_and(mask_val, cpu_online_mask); - mask = 1UL << cpu_logical_map(cpu); - raw_spin_lock(&irq_controller_lock); - reg = readl(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); - reg = (reg & (~ARMADA_370_XP_INT_SOURCE_CPU_MASK)) | mask; - writel(reg, main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); - raw_spin_unlock(&irq_controller_lock); + atomic_io_modify(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq), + ARMADA_370_XP_INT_SOURCE_CPU_MASK, + BIT(cpu_logical_map(cpu))); irq_data_update_effective_affinity(d, cpumask_of(cpu));