From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2nam03on0126.outbound.protection.outlook.com ([104.47.42.126]:24363 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933438AbeDIAl2 (ORCPT ); Sun, 8 Apr 2018 20:41:28 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Suzuki K Poulose , Marc Zyngier , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 062/101] irqchip/gic-v3: Honor forced affinity setting Date: Mon, 9 Apr 2018 00:41:25 +0000 Message-ID: <20180409004042.164920-12-alexander.levin@microsoft.com> References: <20180409004042.164920-1-alexander.levin@microsoft.com> In-Reply-To: <20180409004042.164920-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Suzuki K Poulose [ Upstream commit 65a30f8b300107266f316d550f060ccc186201a3 ] Honor the 'force' flag for set_affinity, by selecting a CPU from the given mask (which may not be reported "online" by the cpu_online_mask). Some drivers, like ARM PMU, rely on it. Cc: Marc Zyngier Reported-by: Mark Rutland Signed-off-by: Suzuki K Poulose Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- drivers/irqchip/irq-gic-v3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 30b93dd1e612..ec8468829aef 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -526,11 +526,16 @@ static void gic_smp_init(void) static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask= _val, bool force) { - unsigned int cpu =3D cpumask_any_and(mask_val, cpu_online_mask); + unsigned int cpu; void __iomem *reg; int enabled; u64 val; =20 + if (force) + cpu =3D cpumask_first(mask_val); + else + cpu =3D cpumask_any_and(mask_val, cpu_online_mask); + if (cpu >=3D nr_cpu_ids) return -EINVAL; =20 --=20 2.15.1