From patchwork Thu Jun 20 09:52:33 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: 13705069 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 DAE2AC27C79 for ; Thu, 20 Jun 2024 09:52:58 +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: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:In-Reply-To:References:List-Owner; bh=cRT9c6Jh4y2R/sppBUbc4Qxk5C/DSWk7G81/tPMAHbk=; b=f9JG9A/Sah+kBeiDa/EnWPeEQO WXIzfJijBJwU2Df57v1tFllZvYoxay9k7vHVWOetMSfOyJcF07Z2OfIUxZaZhXhMPSm7G+weNQ1wL vLCG/Wqt29ad2H4NwaoANWRW+8xfKERbTZ5NZSkcVZ5Q2obXuOEXR4FdOk+l5fRinAcTiRyfqaTk3 lpc3wHPGvHJf+pV2YPoh3eWbND0JhSs/AY20obh/w+L4j5EW6eY8ddwrqwXuVk84ySGyw5uf41uiK ra9v7j6hTpNx6A2xZuzXhaG7XCuHmr4NpcuMUygKBBfE9MqRuf1vvJtxTOtS7X3BiGC+Sybw+FEJ8 V8NUea7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKETH-00000004Sym-3Ef4; Thu, 20 Jun 2024 09:52:47 +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 1sKETC-00000004SxU-1w6Q for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2024 09:52:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 8228F61CCF; Thu, 20 Jun 2024 09:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C338C4AF09; Thu, 20 Jun 2024 09:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718877161; bh=Yn6MNvj1EMAgJjNs+Q+7Wd222vF8e2SyiBzKDs22eLQ=; h=From:To:Cc:Subject:Date:From; b=TUQSNjdFZoX+JOgCtUkYh0ux9U73e52/vDR4cVIqym9R9XhbCGFbOMiDrn3VnNtH7 eoqHjQQN10lCkwrtTTrK1Rnl2pYzYnApBeze2OV0v7W2P5pQz5tjK+monlaXajO6Ie N7vEs+gyOnY/kF3I8OjwX+QSjqoJnuNtIvNkH89c1f4/LwnPuBcb0nxJLFHaNKyRiY zxGmZtprT99MaI3S2XDYK7h3TbA9FyAhpWuBJRWTqyDYCGu1UI81He0kLoTlc/ls3x Ozw2OH+lDd8TDJQCrfBSCjKPcGtcU+I9RY3D6rl/myM0WQqNdHAO1x5JtG2e3+H4Wr C+tDgCjwsVqQw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Thomas Gleixner , 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] irqchip/armada-370-xp: Use atomic_io_modify() instead of another spinlock Date: Thu, 20 Jun 2024 11:52:33 +0200 Message-ID: <20240620095233.12185-1-kabel@kernel.org> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240620_025244_826121_8E208751 X-CRM114-Status: GOOD ( 11.80 ) 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 --- Note: the atomic_io_modify() function is defined only for arm platform, and it is currently used only in 3 drivers: drivers/clocksource/timer-armada-370-xp.c drivers/clocksource/timer-orion.c drivers/watchdog/orion_wdt.c Do we want to use this? Is there some other standardized alternative that can be used across all platforms? --- 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 924a574f28ea..8d76e70f8dfd 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));