From nobody Thu Feb 12 21:23:32 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D16EA192B95 for ; Wed, 5 Feb 2025 16:00:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771207; cv=none; b=pH50tTl6xEwAf/o3zPvC9XikO1uv3rI5im2TcXZLpITCNuaGGd3Ez0DDoOQkCQjtjMHKmqgFd0ltFnGIevMKsIUtQZtGaEDxxl1e1ewa/tKlIwfq9sKlXg44LN0SceHjFvdi6xonCTrxw0xBjv7N1NXOYolBabdQLmlTmmXmdJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771207; c=relaxed/simple; bh=gGGEYK7VGgFWWdh/qLZbuuJY+xZwb2aTgVHnwmrr23c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g0ejduOIFraWWXEER54EkgNPWiTwo61VGWFL85UkvjNBWFJwmUNZIc+IwmaQqDv37VjbXLcjOWEB7SEvfSaq3LHq2f5Wv6+gvMyyvPOZcm1rTpj+DFKzH3JAojbZ0w5AaTHb1TKA9ZGKtRtfwD/UOehAMPNOAVLYCirg/BDBxj8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=TR8ztHwv; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="TR8ztHwv" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21f16af1f71so16752655ad.3 for ; Wed, 05 Feb 2025 08:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771205; x=1739376005; darn=vger.kernel.org; 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=DvFsqgBHoepkWBjGC1yP+KOn/8qryanxa+3zb4U83Ao=; b=TR8ztHwvjBWTRUqu4GzOPO5qI+kZBnJodvGx514ndAAKm3pXvU0ca5ZdbvMNWfY41t qFVr5DDGT+c9ko7+NxLxgd61dAQw/Md2X0R6hFlTxyCNk8d9fPL/z6ICsU1/uou/1fHo umd3hoElgiAD38vNx15hpNla14Ax6YuI5JrDVIkWRuKBEbNTITocinVFrq0XKRRpCNxD a1xnOXswQsu2F0ZGdW0RGrr9Xjc91g4ZH9smOEEENiwfo8b0C3TEp5xME323BZ1T6PTk r1RAm30fJgFaBHoXghgZsP8+qXNYhGbaIOOAxxLeXmVUUik0q0o3/tw2koP0PyuVYcJu y+lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771205; x=1739376005; 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=DvFsqgBHoepkWBjGC1yP+KOn/8qryanxa+3zb4U83Ao=; b=IsiBh0filIP+yNhbpQPQfpa+dGqjKoRdlbRMwT3t7Y2/7oHRRFBU1nUKN9sNsqO3cL N9pbI2ITHc5fZx0g6pORS7lM3hj4tmCybgZrcHtTnIaP7nxCLduAlEfgwajqgvuMKk7x Bqp3ZVH0v/Cncd0UGcOmmz0M1zHQh9zy2Bin/Puk9nC/HQD8uumj0m4bFRSuWgd9KPlM Fbg+foouvsmoJy7WqdZMffnLqrDugmhNwp5MT5ZpVI+VgV51AptDwoy1ip3IH82ZajAM GJfpbcx69yvHXEkUEnXuTLJoltqDYybcD0RsAk5W5Y5+i7YXqamTF21pCOrVFdIn6ugY s4TQ== X-Forwarded-Encrypted: i=1; AJvYcCVZ5ZgRd2LldutDUCcsobSWUojKe1swnT+fo0CPyq6E2ouo0E1PuB1JPsq2c+HfSujS1MrHDm7m2RULMMQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9OQyRxkrjWh2n5lu9BWi+Tz1QbWRqNhTfl4A0NoBXOjWBovoS +2HPPWHSabrwZHM49hSSsD6R1roaVkdKI0ufaTbap3WjFffA79KiNrcTEizufRE= X-Gm-Gg: ASbGncv+ncXCD9yyg+xGdOllINVcCj8BsMOAN21JD/B8HAgfoPQX1ehCJDehc6Iw/3Q wMj3xNw6kyp64EquDzPv3rgBDdMrCZRtkmbGpBb8mNghfiAJisvBv7/DP5GyH9juE+IAeXFtJAK Dv9Hm9DrpSaulfE7n247cZ9Yhb6ENV/UjSWIAnegf1eLpa4I5EqQXkeoMpxwsEfQ/pE5bXNZH2Q CyKLPwJgFdY3y/2kpLG2yr2ATDmAHjoz0vl7zZVPZydvcfa013CFXRE8xg3hcObAx23RHToZkb6 MaB/qc65JcnVn5lZC0V3DM1mugasW92fyccTlDqMvoJdKBXPbXYuFX0= X-Google-Smtp-Source: AGHT+IFxrHkC5lry9v73hirVrwz0VwaueSl7vlCr1NVutMq+Q53roymPHtPchmK1sMCpMcVptQ1tdg== X-Received: by 2002:a17:902:d28b:b0:216:410d:4c53 with SMTP id d9443c01a7336-21f17ebba71mr44908125ad.41.1738771204969; Wed, 05 Feb 2025 08:00:04 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.07.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:04 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 01/11] irqchip/riscv-imsic: Set irq_set_affinity for IMSIC base Date: Wed, 5 Feb 2025 21:29:37 +0530 Message-ID: <20250205155948.81385-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Andrew Jones Instead of using imsic_irq_set_affinity() for leaf MSI domains, use imsic_irq_set_affinity() for the non-leaf IMSIC base domain and use irq_chip_set_affinity_parent() for leaf MSI domains. Signed-off-by: Andrew Jones Signed-off-by: Anup Patel --- drivers/irqchip/irq-riscv-imsic-platform.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/i= rq-riscv-imsic-platform.c index c708780e8760..5d7c30ad8855 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -96,9 +96,8 @@ static int imsic_irq_set_affinity(struct irq_data *d, con= st struct cpumask *mask bool force) { struct imsic_vector *old_vec, *new_vec; - struct irq_data *pd =3D d->parent_data; =20 - old_vec =3D irq_data_get_irq_chip_data(pd); + old_vec =3D irq_data_get_irq_chip_data(d); if (WARN_ON(!old_vec)) return -ENOENT; =20 @@ -116,13 +115,13 @@ static int imsic_irq_set_affinity(struct irq_data *d,= const struct cpumask *mask return -ENOSPC; =20 /* Point device to the new vector */ - imsic_msi_update_msg(d, new_vec); + imsic_msi_update_msg(irq_get_irq_data(d->irq), new_vec); =20 /* Update irq descriptors with the new vector */ - pd->chip_data =3D new_vec; + d->chip_data =3D new_vec; =20 - /* Update effective affinity of parent irq data */ - irq_data_update_effective_affinity(pd, cpumask_of(new_vec->cpu)); + /* Update effective affinity */ + irq_data_update_effective_affinity(d, cpumask_of(new_vec->cpu)); =20 /* Move state of the old vector to the new vector */ imsic_vector_move(old_vec, new_vec); @@ -135,6 +134,9 @@ static struct irq_chip imsic_irq_base_chip =3D { .name =3D "IMSIC", .irq_mask =3D imsic_irq_mask, .irq_unmask =3D imsic_irq_unmask, +#ifdef CONFIG_SMP + .irq_set_affinity =3D imsic_irq_set_affinity, +#endif .irq_retrigger =3D imsic_irq_retrigger, .irq_compose_msi_msg =3D imsic_irq_compose_msg, .flags =3D IRQCHIP_SKIP_SET_WAKE | @@ -245,7 +247,7 @@ static bool imsic_init_dev_msi_info(struct device *dev, if (WARN_ON_ONCE(domain !=3D real_parent)) return false; #ifdef CONFIG_SMP - info->chip->irq_set_affinity =3D imsic_irq_set_affinity; + info->chip->irq_set_affinity =3D irq_chip_set_affinity_parent; #endif break; default: --=20 2.43.0 From nobody Thu Feb 12 21:23:32 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 885F21D89F8 for ; Wed, 5 Feb 2025 16:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771217; cv=none; b=KlnoE9dfl1Rj9uhG7PxvO3iY5ST/LNRoIMLfJwuTqhqkMYtZT+giQIJwnSBWnov81b+/1c1oF8UcM0TV6xIF0B3yM5klCzI2svUZPbCS0AUI3w/jwotDz0EdOXOwWYRQtGsS6Jli7JYXrSnssM8za2VwE7raBSGQa1AWiKGLRA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771217; c=relaxed/simple; bh=GQ6h6qnifBeRvwI5lbrzx5DePz9FG/7AwYjLLcTRLyo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZyNxRWIMP8xuqrfRUkJ2UeuU329SRajpSxZnSnLIPKd3nYAPUSUjn22EDuAAKUlPJpAs17K/IAAfCzo/mJnRIP6FgNXNgJZRWpktHaiqnKfedY5Gx0xeADWBhV49+tOpOo5DMU8P8PwYT2M5b54g+bbPDZt6f1GbKLD0D8AEwkI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=YH4SUADp; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="YH4SUADp" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-21619108a6bso117140305ad.3 for ; Wed, 05 Feb 2025 08:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771214; x=1739376014; darn=vger.kernel.org; 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=dDa5uVtGTmKoF+EGxYZ14lQBrXBy+Zgm46G016g9yok=; b=YH4SUADp43pkmXErnrboFYnx2zCLkumQE09nxh0UFflSQhsIWJ1gXxXzlXVdGDkYRy A5l3cOHTVAGXGloT3lYxrQPQem6LBsT6+FJ58CfUl7k9FCC3pfqVTBONm4VvYZH7Ae9T AKL4+owQuIi5Jlul24HPom/5v/6qT1Yv+TFa49Ad1vIHjIVHbzuL2LRFa9ONIdhwZE0d tXkkQ7S6L4zISFaem2JcacQBoicAdcz6xgcFpsvQHluD1cSxvdebxW0txVXiL3MHY9lC 4UGjEmlTO8iXVU1MA6U0elfdlXLsXyqAtRdfBs5E9RWM2S3+nn7HskuEiCV7nLvwXg8c NL9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771214; x=1739376014; 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=dDa5uVtGTmKoF+EGxYZ14lQBrXBy+Zgm46G016g9yok=; b=c0DqCsRuvu/bMSWnviRqAx39GPKomY0NGSnxgVaQdvVtzkK4PJu9cgEnW4MkVhoKTh xAsD9+UWlparvC+MH/dMajy/o2ap64NdMPk8ywLVbkEtnqfVEws8EvdeD0c4V0H2JdKc GNfk+YJu+uBPYdlhSELLcU6N/kLqrzdiQWJCrrKKAvFdKXkNPUiD5zNZ1EPhjtcjM0Bs NZVzYdY0PG0Fdr3DeoFI0hOwnwvpkPoV4UTuLiVj8uAhK0mX3OCUeahzVJg1KFytukiw VdjTCcMXVICj/G3LLdORYu6EL0ZEeblXX6n3m5yAm6kwSypBvOXCae0C3KWbvuaFR+yE 0WCg== X-Forwarded-Encrypted: i=1; AJvYcCX/z+UAC5Ppq5AQ2svCZzrcitgMiVr14JOEBEeJBlkmi7p0iT14f5z0NpYwJHijb+hxo4Iy4NIkcOGAwE0=@vger.kernel.org X-Gm-Message-State: AOJu0YyU/gkswywa/XXS+LMhgLoy4K1M4VIPhpVMQ258Okzfwf+hsxJK 6OSunoJEqLC2MM5fV5j9Itf1PH2NurGwN8WLALWQn+lnRh5OPtD8OM3olSu7/ds= X-Gm-Gg: ASbGncsDPWrvCMG0yw0qZgaPJKm4bIAl/3MpPriOH9LKIWQjlN4NNZD/coIW20m2Xs8 Ljx6EXGBLK4SMWl35hBSPhRApPkXLYeB8GC5a0OPfSGJ8tyM4uc55ki0qe1voWgiw2Y6XNQYyeP XB4iKov78PU9EM5bK/vuwFLDoJGugdKV3p/BCHNTcZGANU03x+Bdk0jGxEyEPfvk9zrH9KMHd0B 30fYwpUIIjZTqKNGtFP3PiGAaJFvDDpTHVkSKAQfxT+Hw87N1MSaiYkmaOIyoAMRoiTtoMS8Lx1 g01CSpB4XwgC3G+A7ska/mwiWbigKxvJdQoVFUTKmmh5B2CoIlSiRzQ= X-Google-Smtp-Source: AGHT+IEwSqSk0Kn6tNM2Qd+4lhHoUFawjz0vSYYqNHq2adsR6hxf2+kmSVPrfORkTmMSBvoi8q34cw== X-Received: by 2002:a17:903:2282:b0:21f:45d:21fb with SMTP id d9443c01a7336-21f17df5c2fmr55285685ad.3.1738771211403; Wed, 05 Feb 2025 08:00:11 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:10 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 02/11] irqchip/irq-msi-lib: Optionally set default irq_eoi/irq_ack Date: Wed, 5 Feb 2025 21:29:38 +0530 Message-ID: <20250205155948.81385-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner Introduce chip_flags in struct msi_parent_ops. This allows msi_lib_init_dev_msi_info() set default irq_eoi/irq_ack callbacks only when the corresponding flags are set in the chip_flags. Signed-off-by: Thomas Gleixner Signed-off-by: Anup Patel --- drivers/irqchip/irq-gic-v2m.c | 1 + drivers/irqchip/irq-imx-mu-msi.c | 1 + drivers/irqchip/irq-msi-lib.c | 11 ++++++----- drivers/irqchip/irq-mvebu-gicp.c | 1 + drivers/irqchip/irq-mvebu-odmi.c | 1 + drivers/irqchip/irq-mvebu-sei.c | 1 + include/linux/msi.h | 11 +++++++++++ 7 files changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index be35c5349986..1e3476c335ca 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -255,6 +255,7 @@ static void __init gicv2m_teardown(void) static struct msi_parent_ops gicv2m_msi_parent_ops =3D { .supported_flags =3D GICV2M_MSI_FLAGS_SUPPORTED, .required_flags =3D GICV2M_MSI_FLAGS_REQUIRED, + .chip_flags =3D MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token =3D DOMAIN_BUS_NEXUS, .bus_select_mask =3D MATCH_PCI_MSI | MATCH_PLATFORM_MSI, .prefix =3D "GICv2m-", diff --git a/drivers/irqchip/irq-imx-mu-msi.c b/drivers/irqchip/irq-imx-mu-= msi.c index 4342a21de1eb..69aacdfc8bef 100644 --- a/drivers/irqchip/irq-imx-mu-msi.c +++ b/drivers/irqchip/irq-imx-mu-msi.c @@ -214,6 +214,7 @@ static void imx_mu_msi_irq_handler(struct irq_desc *des= c) static const struct msi_parent_ops imx_mu_msi_parent_ops =3D { .supported_flags =3D IMX_MU_MSI_FLAGS_SUPPORTED, .required_flags =3D IMX_MU_MSI_FLAGS_REQUIRED, + .chip_flags =3D MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token =3D DOMAIN_BUS_NEXUS, .bus_select_mask =3D MATCH_PLATFORM_MSI, .prefix =3D "MU-MSI-", diff --git a/drivers/irqchip/irq-msi-lib.c b/drivers/irqchip/irq-msi-lib.c index d8e29fc0d406..51464c6257f3 100644 --- a/drivers/irqchip/irq-msi-lib.c +++ b/drivers/irqchip/irq-msi-lib.c @@ -28,6 +28,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct= irq_domain *domain, struct msi_domain_info *info) { const struct msi_parent_ops *pops =3D real_parent->msi_parent_ops; + struct irq_chip *chip =3D info->chip; u32 required_flags; =20 /* Parent ops available? */ @@ -92,10 +93,10 @@ bool msi_lib_init_dev_msi_info(struct device *dev, stru= ct irq_domain *domain, info->flags |=3D required_flags; =20 /* Chip updates for all child bus types */ - if (!info->chip->irq_eoi) - info->chip->irq_eoi =3D irq_chip_eoi_parent; - if (!info->chip->irq_ack) - info->chip->irq_ack =3D irq_chip_ack_parent; + if (!chip->irq_eoi && (pops->chip_flags & MSI_CHIP_FLAG_SET_EOI)) + chip->irq_eoi =3D irq_chip_eoi_parent; + if (!chip->irq_ack && (pops->chip_flags & MSI_CHIP_FLAG_SET_ACK)) + chip->irq_ack =3D irq_chip_ack_parent; =20 /* * The device MSI domain can never have a set affinity callback. It @@ -105,7 +106,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, stru= ct irq_domain *domain, * device MSI domain aside of mask/unmask which is provided e.g. by * PCI/MSI device domains. */ - info->chip->irq_set_affinity =3D msi_domain_set_affinity; + chip->irq_set_affinity =3D msi_domain_set_affinity; return true; } EXPORT_SYMBOL_GPL(msi_lib_init_dev_msi_info); diff --git a/drivers/irqchip/irq-mvebu-gicp.c b/drivers/irqchip/irq-mvebu-g= icp.c index 2b6183919ea4..d67f93f6d750 100644 --- a/drivers/irqchip/irq-mvebu-gicp.c +++ b/drivers/irqchip/irq-mvebu-gicp.c @@ -161,6 +161,7 @@ static const struct irq_domain_ops gicp_domain_ops =3D { static const struct msi_parent_ops gicp_msi_parent_ops =3D { .supported_flags =3D GICP_MSI_FLAGS_SUPPORTED, .required_flags =3D GICP_MSI_FLAGS_REQUIRED, + .chip_flags =3D MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token =3D DOMAIN_BUS_GENERIC_MSI, .bus_select_mask =3D MATCH_PLATFORM_MSI, .prefix =3D "GICP-", diff --git a/drivers/irqchip/irq-mvebu-odmi.c b/drivers/irqchip/irq-mvebu-o= dmi.c index ff19bfd258dc..28f7e81df94f 100644 --- a/drivers/irqchip/irq-mvebu-odmi.c +++ b/drivers/irqchip/irq-mvebu-odmi.c @@ -157,6 +157,7 @@ static const struct irq_domain_ops odmi_domain_ops =3D { static const struct msi_parent_ops odmi_msi_parent_ops =3D { .supported_flags =3D ODMI_MSI_FLAGS_SUPPORTED, .required_flags =3D ODMI_MSI_FLAGS_REQUIRED, + .chip_flags =3D MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token =3D DOMAIN_BUS_GENERIC_MSI, .bus_select_mask =3D MATCH_PLATFORM_MSI, .prefix =3D "ODMI-", diff --git a/drivers/irqchip/irq-mvebu-sei.c b/drivers/irqchip/irq-mvebu-se= i.c index 065166ab5dbc..ebd4a9014e8d 100644 --- a/drivers/irqchip/irq-mvebu-sei.c +++ b/drivers/irqchip/irq-mvebu-sei.c @@ -356,6 +356,7 @@ static void mvebu_sei_reset(struct mvebu_sei *sei) static const struct msi_parent_ops sei_msi_parent_ops =3D { .supported_flags =3D SEI_MSI_FLAGS_SUPPORTED, .required_flags =3D SEI_MSI_FLAGS_REQUIRED, + .chip_flags =3D MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_mask =3D MATCH_PLATFORM_MSI, .bus_select_token =3D DOMAIN_BUS_GENERIC_MSI, .prefix =3D "SEI-", diff --git a/include/linux/msi.h b/include/linux/msi.h index b10093c4d00e..9abef442c146 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -558,11 +558,21 @@ enum { MSI_FLAG_NO_AFFINITY =3D (1 << 21), }; =20 +/* + * Flags for msi_parent_ops::chip_flags + */ +enum { + MSI_CHIP_FLAG_SET_EOI =3D (1 << 0), + MSI_CHIP_FLAG_SET_ACK =3D (1 << 1), +}; + /** * struct msi_parent_ops - MSI parent domain callbacks and configuration i= nfo * * @supported_flags: Required: The supported MSI flags of the parent domain * @required_flags: Optional: The required MSI flags of the parent MSI dom= ain + * @chip_flags: Optional: Select MSI chip callbacks to update with defaul= ts + * in msi_lib_init_dev_msi_info(). * @bus_select_token: Optional: The bus token of the real parent domain for * irq_domain::select() * @bus_select_mask: Optional: A mask of supported BUS_DOMAINs for @@ -575,6 +585,7 @@ enum { struct msi_parent_ops { u32 supported_flags; u32 required_flags; + u32 chip_flags; u32 bus_select_token; u32 bus_select_mask; const char *prefix; --=20 2.43.0 From nobody Thu Feb 12 21:23:32 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7105B1990BA for ; Wed, 5 Feb 2025 16:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771223; cv=none; b=OVvxmHdvpbXtYUqPyBDpfBZ+4DeWWzCk6dnTopPOLBBLvOoEWIauQEFKawaqup80swd3+Wc4n0/+DIwUA2beeLqs+6PFXcxXGC6wrPg03inmCqVvaUC1qW3Qah6qkucQMFIKlAtlA0ZMnSvY3xqFmjMZdf2NQme1rfxE+fKT41A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771223; c=relaxed/simple; bh=tqqED4GgT6fv8GxxWX7wObYflu49BH84mKUSrCVBeKU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W+uhqC6q3f8ToRH/qAqDcYGgCy9tnMq21tcYsdc8JH8AE71KeDKqaTaYoO8KjgJt7+7U5OoVbAvo9vXw2N/DSxkdX+n4fy4UppXVYJ/7fKhg+kBIMrgsDb4ufGGXBL91nINUn8iap46gp4UC8t76XER3UdS/0K4KMMllJWJmWFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=gRORlZdn; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="gRORlZdn" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-21f20666e72so11158905ad.1 for ; Wed, 05 Feb 2025 08:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771221; x=1739376021; darn=vger.kernel.org; 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=byPW6bNJR29pmHM6qNzPiiUHTFPpVNBWTNf2HlLXfG4=; b=gRORlZdnLYcpxt9rdNiB7xNkAFpOlmgumdSeaOHZ3aWFUSSLkBF58RgitxZkgmF14S wLMzozQAxN+9yCsmeVHfT9te7ZRp63a/Lyb8i1PP8iG6pY/aFZZq95conYL3crHZSTY/ KfzInc1KUxawt7gR9OGi+MDC3BfW4IGdIbIctl8J1r0KlivJERRblbmFDgJBShbK2/C8 pa7L0x5cQr9lUiFLr4n1Ep275eJtDP2scoIUWo801jSwGsBkLOeBYXPbh8i8AX8+cqBp 0eEWbDmly7HK9TpRyUtqB4mRq4VwMS9GtoC0r84wMgaV2c9530w9PwErx/NMNuKPzf51 riKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771221; x=1739376021; 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=byPW6bNJR29pmHM6qNzPiiUHTFPpVNBWTNf2HlLXfG4=; b=Lr2skFNRoSeNpIIrXw3ULymuENWnggwcLA8bIn1tFVJQ9lLITg/c4UdwDdxUd/Df6N xKWIYuWX2BzWLahZt6zLe5ltZvhg+C1vCsmZZtOb/Ejg8ENULogGEFt/6dOLruCbN1Yo 39kgdGP/Aw2esda1z7A13OxZuGxos0mLukIaiiaH/LmOdGBtNsKuSpjV0XCkII+kbqSJ yVkzH0S2pJUoB3+umOArdi8YqKEh3ZbH7fF9JxrD2NzyO79zc4rsnEnJhto2xVxLXIdF rPOG8l8cFsS666NOH4++LeJiDIgZzdfSe98vYdq3k0QKOzmZPosX5KuWoDfeg2198yIn tweQ== X-Forwarded-Encrypted: i=1; AJvYcCVkrZjN65RPMPWX3EFX1skuttrigDqQqXk3xhLOl1hvAC9Irk6KMCtLYlCroenhZjylSAoktl3k2Ycy6Ks=@vger.kernel.org X-Gm-Message-State: AOJu0YyWbCXbD4FjGPkQk7StXGZ237PCO+NaQvI6wOLgoENhePFo+MOc 82P2f2intyBQLnfbT0zfeGRRaVWAreuY9xKjLSfnSeUEtSAxMrphAgA3k4lZjmI= X-Gm-Gg: ASbGncu6ZTewZHm94syn9HX57hSLZTwzq+ydJsQKIUT7kcKKFi74UCdX33RDoaa23B6 iAzgEqAHVSNxSr5n5j8LddPFVvsHkwAXqHrzSq18Z2vPlyJLwp+W83PVZA5Fu5TkRaJ/k7Z2VKG JZhg3gChwK1Thlt90sqC67MWINPJKnedOWU3HGb6ON3bplLTzf9oTUX7jxGqe/Desniy54W7Q/h cuUpcZ6ShnwLWOdPjWBfAadLp2HLKQLnvNCxyC4AHWXkDN0QjUGLt6gz/wGtUlbvMrucl5T4s9n JI2peSOhzz+bdt684Pgw0IazaMPjtSEL/XHeIQZyFu1SVWdz7/hoEpw= X-Google-Smtp-Source: AGHT+IE61901PT4EUuxStQafEIq8FwJCGiiY6kWb9NQ321aRytwKILvXZvBacg0xie4XwDelkjOESA== X-Received: by 2002:a17:902:f68c:b0:21b:d105:26b9 with SMTP id d9443c01a7336-21f17e45b7emr53598095ad.16.1738771219978; Wed, 05 Feb 2025 08:00:19 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:19 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 03/11] irqchip/riscv-imsic: Move to common MSI lib Date: Wed, 5 Feb 2025 21:29:39 +0530 Message-ID: <20250205155948.81385-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner Simplify the leaf MSI domain handling in the RISC-V IMSIC driver by using msi_lib_init_dev_msi_info() and msi_lib_irq_domain_select() provided by common MSI lib. Signed-off-by: Thomas Gleixner Signed-off-by: Andrew Jones Signed-off-by: Anup Patel --- drivers/irqchip/Kconfig | 8 +- drivers/irqchip/irq-riscv-imsic-platform.c | 114 +-------------------- 2 files changed, 6 insertions(+), 116 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index be063bfb50c4..bc3f12af2dc7 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -589,13 +589,7 @@ config RISCV_IMSIC select IRQ_DOMAIN_HIERARCHY select GENERIC_IRQ_MATRIX_ALLOCATOR select GENERIC_MSI_IRQ - -config RISCV_IMSIC_PCI - bool - depends on RISCV_IMSIC - depends on PCI - depends on PCI_MSI - default RISCV_IMSIC + select IRQ_MSI_LIB =20 config SIFIVE_PLIC bool diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/i= rq-riscv-imsic-platform.c index 5d7c30ad8855..9a5e7b4541f6 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -20,6 +20,7 @@ #include #include =20 +#include "irq-msi-lib.h" #include "irq-riscv-imsic-state.h" =20 static bool imsic_cpu_page_phys(unsigned int cpu, unsigned int guest_index, @@ -174,22 +175,6 @@ static void imsic_irq_domain_free(struct irq_domain *d= omain, unsigned int virq, irq_domain_free_irqs_parent(domain, virq, nr_irqs); } =20 -static int imsic_irq_domain_select(struct irq_domain *domain, struct irq_f= wspec *fwspec, - enum irq_domain_bus_token bus_token) -{ - const struct msi_parent_ops *ops =3D domain->msi_parent_ops; - u32 busmask =3D BIT(bus_token); - - if (fwspec->fwnode !=3D domain->fwnode || fwspec->param_count !=3D 0) - return 0; - - /* Handle pure domain searches */ - if (bus_token =3D=3D ops->bus_select_token) - return 1; - - return !!(ops->bus_select_mask & busmask); -} - #ifdef CONFIG_GENERIC_IRQ_DEBUGFS static void imsic_irq_debug_show(struct seq_file *m, struct irq_domain *d, struct irq_data *irqd, int ind) @@ -206,110 +191,21 @@ static void imsic_irq_debug_show(struct seq_file *m,= struct irq_domain *d, static const struct irq_domain_ops imsic_base_domain_ops =3D { .alloc =3D imsic_irq_domain_alloc, .free =3D imsic_irq_domain_free, - .select =3D imsic_irq_domain_select, + .select =3D msi_lib_irq_domain_select, #ifdef CONFIG_GENERIC_IRQ_DEBUGFS .debug_show =3D imsic_irq_debug_show, #endif }; =20 -#ifdef CONFIG_RISCV_IMSIC_PCI - -static void imsic_pci_mask_irq(struct irq_data *d) -{ - pci_msi_mask_irq(d); - irq_chip_mask_parent(d); -} - -static void imsic_pci_unmask_irq(struct irq_data *d) -{ - irq_chip_unmask_parent(d); - pci_msi_unmask_irq(d); -} - -#define MATCH_PCI_MSI BIT(DOMAIN_BUS_PCI_MSI) - -#else - -#define MATCH_PCI_MSI 0 - -#endif - -static bool imsic_init_dev_msi_info(struct device *dev, - struct irq_domain *domain, - struct irq_domain *real_parent, - struct msi_domain_info *info) -{ - const struct msi_parent_ops *pops =3D real_parent->msi_parent_ops; - - /* MSI parent domain specific settings */ - switch (real_parent->bus_token) { - case DOMAIN_BUS_NEXUS: - if (WARN_ON_ONCE(domain !=3D real_parent)) - return false; -#ifdef CONFIG_SMP - info->chip->irq_set_affinity =3D irq_chip_set_affinity_parent; -#endif - break; - default: - WARN_ON_ONCE(1); - return false; - } - - /* Is the target supported? */ - switch (info->bus_token) { -#ifdef CONFIG_RISCV_IMSIC_PCI - case DOMAIN_BUS_PCI_DEVICE_MSI: - case DOMAIN_BUS_PCI_DEVICE_MSIX: - info->chip->irq_mask =3D imsic_pci_mask_irq; - info->chip->irq_unmask =3D imsic_pci_unmask_irq; - break; -#endif - case DOMAIN_BUS_DEVICE_MSI: - /* - * Per-device MSI should never have any MSI feature bits - * set. It's sole purpose is to create a dumb interrupt - * chip which has a device specific irq_write_msi_msg() - * callback. - */ - if (WARN_ON_ONCE(info->flags)) - return false; - - /* Core managed MSI descriptors */ - info->flags |=3D MSI_FLAG_ALLOC_SIMPLE_MSI_DESCS | - MSI_FLAG_FREE_MSI_DESCS; - break; - case DOMAIN_BUS_WIRED_TO_MSI: - break; - default: - WARN_ON_ONCE(1); - return false; - } - - /* Use hierarchial chip operations re-trigger */ - info->chip->irq_retrigger =3D irq_chip_retrigger_hierarchy; - - /* - * Mask out the domain specific MSI feature flags which are not - * supported by the real parent. - */ - info->flags &=3D pops->supported_flags; - - /* Enforce the required flags */ - info->flags |=3D pops->required_flags; - - return true; -} - -#define MATCH_PLATFORM_MSI BIT(DOMAIN_BUS_PLATFORM_MSI) - static const struct msi_parent_ops imsic_msi_parent_ops =3D { .supported_flags =3D MSI_GENERIC_FLAGS_MASK | MSI_FLAG_PCI_MSIX, .required_flags =3D MSI_FLAG_USE_DEF_DOM_OPS | - MSI_FLAG_USE_DEF_CHIP_OPS, + MSI_FLAG_USE_DEF_CHIP_OPS | + MSI_FLAG_PCI_MSI_MASK_PARENT, .bus_select_token =3D DOMAIN_BUS_NEXUS, .bus_select_mask =3D MATCH_PCI_MSI | MATCH_PLATFORM_MSI, - .init_dev_msi_info =3D imsic_init_dev_msi_info, + .init_dev_msi_info =3D msi_lib_init_dev_msi_info, }; =20 int imsic_irqdomain_init(void) --=20 2.43.0 From nobody Thu Feb 12 21:23:32 2026 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 718811DA61D for ; Wed, 5 Feb 2025 16:00:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771228; cv=none; b=useNU08Tt3lRHDGxqzB+veqp1ur363RndKuSXaco9VISSVPfdrKIorFlHqeauvjnikuUfA0HaaxANoo/+Zhrkm3TTL235rwzkTk7nEPyfsXz5Ao3+KEyT6Q0dF+4zpfGb7HSqeX5j/Mj+lKINP+++zHtfDrX78qz+u/b8JNaUhg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771228; c=relaxed/simple; bh=3zBJABDp2VjAHeAkIM6CLZBnc4fskYwTWZG6ia7OHWI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UD3OlQmI6slEbxE2PsiWbA7vwmXnzVVDN3WtBCMK57KH8GZobnF4s7sgYPCRoc7ZEk46KUcJgWlUXxKb3+YkFnpWJsv/nksvhH4bCGGZ6XFPmgE3+6TUOZG+vABFjTbuTY9b4OVrirA79fUyyH7FVTYWg+8SB1W+yHp6JJrGgdI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=mew13Adf; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="mew13Adf" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2163dc5155fso124417925ad.0 for ; Wed, 05 Feb 2025 08:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771227; x=1739376027; darn=vger.kernel.org; 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=zXz6fvQA0XjFVpb2cpM8OodOs5mmbZEn6PcelI8ZWow=; b=mew13Adf7VzrECcvNOUxS/MprQv5vhV2LktHre+nhnx5UHxnORaqQJwAj4IFIFo1L0 gOhkLnp1jYi2dqKnBoeo4sTxKjF/nAOy4ag3KLhF4ogtCP4vxXlrbCrKJt9htdVMnICy M4hw84SKcW+FvTnB/6jYxdRUG7Pb6WBkDWkCN58jku33Ls3HMZCVODquzLpDhTgFNlh6 pj6Qxp289P2LRPlep6fscRKagLvd5yBaJbtYRKTdDxp9cNjENd4gi1bGOhyILrZ6ZRJ4 pzqRNGE7ZYrwBhNh3oJTEbPLc0tckuaC/ZcekH40Qi47PZ1gtXyeZyfRcm7eS+6d+jTZ khtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771227; x=1739376027; 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=zXz6fvQA0XjFVpb2cpM8OodOs5mmbZEn6PcelI8ZWow=; b=NFQkatRrkQ8Xx9cRqkElNByIhzopuNIsY3/KaWRctCt7Yq7X8c6EwXbJr57XQJgZ+v 2aeX5DM1+iGEgVRu6P39ItY6JUthCtK4xrt755FPRXwTqHh6P53tyUOqYkVW/3Yn6REH 4KRnJ/hr+2h+IwFKPXDvKc5iF1XLajL2jbo8Sz+X3HI40WNcXL5GhtYq0+Z2nDf6IR7x Kcp0oI6mqM+3TkOW4qJUGY6vJ54PoCXylKmgIVB1AX1cq/xC2aerRF1/xtFMqIoGcbbp S76bPyOFr/yQm/Wnia11HQick50fyDLsWRfvuLuP4V8+0A0yAVfQYh1l1zO9KrEI/gJi Dsrg== X-Forwarded-Encrypted: i=1; AJvYcCUwOcYonWo+/U4AP+jxm40vwymoCbTW1z3NBk76VAPooI1QkvdRdZlNSqLeg1jzahTOwGtKlpXv56SQeow=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/awQvknRRsU7UNlr1Qd0YGxQ23IyMmXWZCfuXuJLyFuyxzlQA kxFLsntw5CykyEb3GF/fvb3WBhYyyH7Dv/mIm9uWBPcVV8vV1DCdMnrr82eolZc= X-Gm-Gg: ASbGncuRHn850vcYLWKpaLHIhnSYS9NzcKNoqP5BaltmkEMslU0NxKYxp+vZEHxqGfK Vd8TmfzNBVMilr6tMAuHhUyhyFj8bcoYeJdGOa8/+6pZsSqg10tZN2s4GnWhSN2jMjih6tbo5OL LByKQ/zisknn5qD4Q8SK2x210dzoZrtAz0X7DWUs6Btia65jDFkHsYd0X19swBiVYT9EMFo5VXB 99hF52Pq2WaIOlvDAHUiX+5DaEYK8udowC4jSmFJqnVlpQ1Sn/GbGHslywjxKsY90DP3FfbIblt QcOv8lnSNTvgjAJdW+asaCxXh37G4EsSFxU3HmOSo/b+l8vK43gQ2fg= X-Google-Smtp-Source: AGHT+IF8jFyxyV/f5JzHUJJ21FDiQHGu6kpLDQlz+2/R29XsqdFXb5Fuvhx/j03+dIK/P/pfOWQ0WA== X-Received: by 2002:a17:902:ccca:b0:216:2bd7:1c27 with SMTP id d9443c01a7336-21f17ebb95cmr57042015ad.33.1738771226541; Wed, 05 Feb 2025 08:00:26 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:26 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 04/11] genirq: Introduce common irq_force_complete_move() implementation Date: Wed, 5 Feb 2025 21:29:40 +0530 Message-ID: <20250205155948.81385-5-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The GENERIC_PENDING_IRQ requires an arch specific implementation of irq_force_complete_move(). At the moment, only x86 implements this but for RISC-V the irq_force_complete_move() is only needed when RISC-V IMSIC driver is in use and not needed otherwise. To address the above, introduce common weak implementation of the irq_force_complete_move() which lets irqchip do the actual irq_force_complete_move(). Signed-off-by: Anup Patel --- include/linux/irq.h | 5 +++++ kernel/irq/migration.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/irq.h b/include/linux/irq.h index 8daa17f0107a..1884fa4ec9b5 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -486,6 +486,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_= data *d) * @ipi_send_mask: send an IPI to destination cpus in cpumask * @irq_nmi_setup: function called from core code before enabling an NMI * @irq_nmi_teardown: function called from core code after disabling an NMI + * @irq_force_complete_move: optional function to force complete pending i= rq move * @flags: chip specific flags */ struct irq_chip { @@ -537,6 +538,10 @@ struct irq_chip { int (*irq_nmi_setup)(struct irq_data *data); void (*irq_nmi_teardown)(struct irq_data *data); =20 +#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) + void (*irq_force_complete_move)(struct irq_data *data); +#endif + unsigned long flags; }; =20 diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index eb150afd671f..2920024475a3 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c @@ -5,6 +5,15 @@ =20 #include "internals.h" =20 +void __weak irq_force_complete_move(struct irq_desc *desc) +{ + struct irq_data *d =3D irq_desc_get_irq_data(desc); + struct irq_chip *chip =3D irq_data_get_irq_chip(d); + + if (chip && chip->irq_force_complete_move) + chip->irq_force_complete_move(d); +} + /** * irq_fixup_move_pending - Cleanup irq move pending from a dying CPU * @desc: Interrupt descriptor to clean up --=20 2.43.0 From nobody Thu Feb 12 21:23:32 2026 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE1C618A6C5 for ; Wed, 5 Feb 2025 16:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771235; cv=none; b=Nu8BfUlNBbNjJjs8aIv1Ebm7IBPqDXrVwpcMsWC71rYoj2yDdyrwGvajw6zK1+bwdPpA0ijFvEweNma6HlRHLxSjuuR/6d/8fhHdODQ78W1IUq+GuJ81P6TXq2rc0ETuZUrunjTGszuiC7afZyI6y+8yenScr2YG4AYJheYiI7I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771235; c=relaxed/simple; bh=zAamzhUEpJ0Ntfo7PXDoXhLHzC064WJshCcKxat5Ftc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TQ4WoUGBoXAnzCUww8pyVA19ozNKysg3szzCw8pGpw/v5uqTHsZI0hOEqi+LvfiTdL0d1M35hEaIZ8uYeGnfOCvKy4Fobg/PBKGbUzGx/wcKvL81Db7cUX7+uqzpGRPuK7DAFXfMOW72DNw5dEcW6QY8lLoAYUnuqXozfc/82zk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=ikajuO12; arc=none smtp.client-ip=209.85.214.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="ikajuO12" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2165448243fso45300335ad.1 for ; Wed, 05 Feb 2025 08:00:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771233; x=1739376033; darn=vger.kernel.org; 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=2MMc9mwT9NVQ5mz2h0GYOBXRUS44hVyd7ty+rMv4eE4=; b=ikajuO12P5Q5rdcnACWaLfsmHUeZpNBkaiC8FBGZGYvn7ugLxgdRk0CdbATfY3uk8O AnavxPXXgGcCJNMk6b4oxDaPoJ5PKYJFiTG2UgFyK62Oe+B+9LU0shlzLqOxi+45XMfO rKHog/fafvVIXVTW1qwL5HF8Z10ACk3gExyzv1bYuD+kxTqo68BX11wgA0+m9kiF95AL qUynu/HvD3DLzDEjPnVqVvU8nrUzlZm4tMoUqYiom17lmahxIF2GYpK0UB/URURLylSg UKWqJ+7NtmaDTchxIoJSfzUO/53m5nwmPoGAw1ykgXKMH8bSyLp3nVtsGpAzk7ZiSXK/ 3TlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771233; x=1739376033; 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=2MMc9mwT9NVQ5mz2h0GYOBXRUS44hVyd7ty+rMv4eE4=; b=Wtg/lsbqaAkkI13jwtjp0FBgmTzxlVSo60SVQgJss0TYJaM0946FFA9oeNQYmW1IIh bNkxogy3ExJ+s9X6qorvynptgVBAp4hBb2RAZxn9klW2diMhZGSYK4XzvA3h9+mAPh8K GkGVCidpwHA/1VZlJjl5j/DJQSTbhLgMFsdKUioQVSGdK7GKDSsqdFgpypNBIHUD0LWJ kQmyEiaKLTcxEprZobukaGtOwBBoEKRKudfT2OKWsyn6P+sHvvBUJqye8eQ4VZ4+0M5i q/hskRCxEuyUWcMkpiKdWWq4xSlDzesWkRCG+XvAoUKyt14sLF+3RKyq0qfUccEEH+/U 8w5w== X-Forwarded-Encrypted: i=1; AJvYcCXblmfb81Af4xHZSUcQEwypTVeg4aLu7aE9PoqCAadsGkpDQZwlMHDgmuqam5PdTIHuC7VoVF8b4TdYAYQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxFmeKTcou4mx+9ucrTVRYXET8vpIeV3ARwjZlb8bcTBvrg+DLm VbjxlF2WfQF7TGq6ko4ePw6dvO7bCloN7Wrf0e08tbzpXfaRSp9B7xjfpW2LZ2I= X-Gm-Gg: ASbGncurgLTNbNHb6OR3sgVdMsIqTCgYJWveJVcUyrSOQbV9XMohGEges1uLoH9FZ7A ND6tYzzkLHadBEJ4yq2Cap25DlS2fza3HwX8oXniglLmjDqKwsS1/15KkMtDTugtOy7hRKnqe// 0hSYKB7CYOzvWkfkRYwF5qJeXF/lnN4Zfs7Uxxnbbx33T2zx5Vlji4wN3bPErfPZkmszBskncrw 19GLKPGZ+ApzAAbhC+pu8rEpryd2wYCKTbr81pucZAkBCNoNBWYo2cP/RyuaDlvTxnvN5f6Xbxs 0vvPlWOYjDNeLbN4FhD/H/CnEVSxVSW/gw0dkkyxjFsGZ1FtodZF9qY= X-Google-Smtp-Source: AGHT+IFVUygBqhzTxplgfR5D4ALHtsI55bhay/IfP7Si4rFXdhEgGg1YfTQqUROzXYR+kUtbmKwJEQ== X-Received: by 2002:a17:903:8c7:b0:21f:16b2:9339 with SMTP id d9443c01a7336-21f17e2a39amr53896345ad.27.1738771233066; Wed, 05 Feb 2025 08:00:33 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:32 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 05/11] genirq: Introduce irq_can_move_in_process_context() Date: Wed, 5 Feb 2025 21:29:41 +0530 Message-ID: <20250205155948.81385-6-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The interrupt controller drivers which use GENERIC_PENDING_IRQ can move interrupts in process context for downstrean devices which support atomic MSI configuration. Introduce irq_can_move_in_process_context() which allows interrupt controller drivers to test whether a particular interrupt can be moved process context. Signed-off-by: Anup Patel --- include/linux/irq.h | 2 ++ kernel/irq/migration.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/linux/irq.h b/include/linux/irq.h index 1884fa4ec9b5..5b67a47da144 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -617,6 +617,7 @@ extern int irq_affinity_online_cpu(unsigned int cpu); #endif =20 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) +bool irq_can_move_in_process_context(struct irq_data *data); void __irq_move_irq(struct irq_data *data); static inline void irq_move_irq(struct irq_data *data) { @@ -626,6 +627,7 @@ static inline void irq_move_irq(struct irq_data *data) void irq_move_masked_irq(struct irq_data *data); void irq_force_complete_move(struct irq_desc *desc); #else +static inline bool irq_can_move_in_process_context(struct irq_data *data) = { return true; } static inline void irq_move_irq(struct irq_data *data) { } static inline void irq_move_masked_irq(struct irq_data *data) { } static inline void irq_force_complete_move(struct irq_desc *desc) { } diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index 2920024475a3..428e42d3bc91 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c @@ -126,3 +126,14 @@ void __irq_move_irq(struct irq_data *idata) if (!masked) idata->chip->irq_unmask(idata); } + +bool irq_can_move_in_process_context(struct irq_data *data) +{ + /* + * Get top level irq_data when CONFIG_IRQ_DOMAIN_HIERARCHY is enabled, + * and it should be optimized away when CONFIG_IRQ_DOMAIN_HIERARCHY is + * disabled. So we avoid an "#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY" here. + */ + data =3D irq_desc_get_irq_data(irq_data_to_desc(data)); + return irq_can_move_pcntxt(data); +} --=20 2.43.0 From nobody Thu Feb 12 21:23:32 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0359C19539F for ; Wed, 5 Feb 2025 16:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771242; cv=none; b=mqoXNLukqCXxNdUVr76P9oUjQSvN+YrotZYvV5LJg49+eJlrEf0QPyjjfU4127xeTUmovcS/kPqQRsI5fGShc/Ydyskb7nsQG5Ty4zyENhOdq12lZeueicvNhscTkjCf56PsVWR1uN+qCqH6l2kXLz4IVKGUnbwbq8R6YXuUriw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771242; c=relaxed/simple; bh=rPuSUodznHcDcnkXovmaVlnFXIC34eH0em4djJco3jU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PkHqUr+B77IrPpgtytvtXd8QNRLzGVEHxjJY3yKASBtf3LQu/LA+C7Bn6gS2EunuX5X2p1qEL4PusuWqqyFqpFuDdm3epX6+D1a70n+lCpHVChPkU3Fi8pKCvutexz/Ijn5S4msvZgqkazxSJDoRo18L05EVdCgvM1l09Sn7HY0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=fIAp238L; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="fIAp238L" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2163dc5155fso124422425ad.0 for ; Wed, 05 Feb 2025 08:00:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771239; x=1739376039; darn=vger.kernel.org; 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=+su7Pdf8Wu86Zcml4faTN2UwZ+oipeVYumq+PsYwErw=; b=fIAp238Liy4FZOUsDTIlQF2moOHWLHjpuC0cU9AzRkvCHHL8EIaEY4nZ8up6468Jgv ET7RD7tOhDMTyjYeyFxM0PSDE6kstg54G0LMCGJzGjJaq4kvuEPRFAcF91cI7pVoqs50 MtDy1bvRfjcrcnOZvpPdeg4c/cr6RiozSRjwFTfm5iHzAe8Lx9ccmZjs+OhCnjSBl9C8 5UyOrjEjVsxVyTIzeVCh4Zf/cVY04r8IsY13R8CAfDswRZAlKLoM8w5GWiomx8KB6SEl bJ+ARp5Yskaos6tEDBhQDUKYccA9jbzACvqnRbCUZx9IVKBqN14QxXo5jPzqnYag30u+ bK9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771239; x=1739376039; 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=+su7Pdf8Wu86Zcml4faTN2UwZ+oipeVYumq+PsYwErw=; b=rGNsWJkFfUe9/PEUkD55yomxE1MadiUuYMme+jX5/0LiVxi3zj81h/nhC1aRcG1jsa w3gK6L9w5WXZXNAb99/lkVQqwNEEmHX1OfbZs5saZusQTzi4PeW3qhapTQ6Jgr8W1sTF MuBTTsQXsoJiglollL2i/TBNJ/mcTQVale3/6iygwHpGuPGDmat2jlMkkTZsZBtCuU4Y DnHavC/xS/qlHOT1KVGnHInfdUAaBLDUA4qMGz+35IZ2aTOl9PUu5jCHHxtX1YTBDuXk tKBMAc0JggEZ5wJzxL/0oFqJC1AuUeAEbRwOg5gRmpWLa2mNhdhgmlnpkvErY+ghE3QY lx8Q== X-Forwarded-Encrypted: i=1; AJvYcCUR7Gy0wH+LA0dgyrN7PUvq1q35Ngh6o+/NBJEfxT5vD/mOQmhryF9fDs++ADUjHIe9z3zze94Rk8Ug15Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yw45DY5F9/YH76lSln4leYt3EBmdLb1dmuolGhaTZINRyztvrh+ fCF8/AKU2hmn9rTU5wUffziiGRc2TNX1D5NBfACJoPjLO3CfI2iGAdgKYOigBn8= X-Gm-Gg: ASbGnctMtbZGoYhOPbLbKMlLM2jRTXmEh3RNh6mQAwGd7x/5niA+1XDteK3OgvBplSo pru7Yba6r3miFgzUbxtu1Kx2tXCDaJM1SSmQcpcu+no/rXlQaTYs1yLYPp45YDUdvfyJGFHaHcX 3lTudyfjtcDBsRkT7ebN+C9qX3mws/JsTHUjG/HqY+BD5wcv/w7YMyF8nfN405hdLccwXF0Ailb lQevI8isxLgFwW+ZXcGYhEfZhbMurG9ANDh7DHdMkeO5t+xONY11D92cyXe6DTgrzDK0xIPFemC nWei0AnO+gcbjrZDk3CmTHIXUvxpZ11t+rGeRdqTEK5Az5gVYZMh+EQ= X-Google-Smtp-Source: AGHT+IEJIosY/OKbXQSnforNF3833piSl8A3TJUvYoiwSYBBjf98+ctLM/SnWJ1Zo9+v0gmQgw/WRw== X-Received: by 2002:a17:902:cf12:b0:215:8847:435c with SMTP id d9443c01a7336-21f17df09demr64343705ad.12.1738771239274; Wed, 05 Feb 2025 08:00:39 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:38 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 06/11] genirq: Remove unused GENERIC_PENDING_IRQ_CHIPFLAGS kconfig option Date: Wed, 5 Feb 2025 21:29:42 +0530 Message-ID: <20250205155948.81385-7-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The GENERIC_PENDING_IRQ_CHIPFLAGS kconfig option is no used anywhere hence remove it. Fixes: f94a18249b7f ("genirq: Remove IRQ_MOVE_PCNTXT and related code") Signed-off-by: Anup Patel --- kernel/irq/Kconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index 5432418c0fea..875f25ed6f71 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig @@ -31,10 +31,6 @@ config GENERIC_IRQ_EFFECTIVE_AFF_MASK config GENERIC_PENDING_IRQ bool =20 -# Deduce delayed migration from top-level interrupt chip flags -config GENERIC_PENDING_IRQ_CHIPFLAGS - bool - # Support for generic irq migrating off cpu before the cpu is offline. config GENERIC_IRQ_MIGRATION bool --=20 2.43.0 From nobody Thu Feb 12 21:23:33 2026 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8174E1D89FA for ; Wed, 5 Feb 2025 16:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771247; cv=none; b=NBJsbsSLLbXIKy8FTq9Zh13criLEE0UxEJKtrdWIFPTrAS8IF46YqWWYH+N+DxtjK/07CO8fsBb8K50zfw21rgMWX1517Q8C7E3BjzIqFa7BGRogQopoLvDRmFRQplay19d/XU9e5GhROHZBFA+0kRCzkQlCmuXwh3WrrTDmPlQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771247; c=relaxed/simple; bh=n4slH+wgDA6MSJsnkDzYIOL0zzUU8vlxw6wGI5nPdQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J4qDy3mBPHE+n7YT6GIJccowGDF/murejSs/ciexaMPVQSK5ANMbnCP4BK1zKF+A/tS/isH25T/vJZuYLncXCIARRtRdozUeAO4Q6WfDBltTpF4qbF3IEjT/fcOtWXfHBYVqiAStjplT5wwpoXthuQlZfCv+44xOVrlsD/95Nic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=ocFTyz97; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="ocFTyz97" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2161eb95317so124803695ad.1 for ; Wed, 05 Feb 2025 08:00:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771246; x=1739376046; darn=vger.kernel.org; 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=JBZXTbuS/jzxIISJXLRWUHAJ1oANsva3E4CzlwWomJY=; b=ocFTyz972UdYAJNmYUXuszlfBQkZ9tqYKq+v9kG3O113oYEHBYfvdvq2ZvwpeWGG5C u7bimYklT3LuiXxnazwgVvQr/NnfJjgtvXPOqPljIwqAc8vDVc/RWxDWQ7+Sttg6IQ7u BtLjOYhCkhlCDOc1rECxfKNofkK8teLlOSSWs9cAX1cRwZbvtOR50tivMtNiK/joGQpq eLyL3v8aW0sGHXigwSoIsuPha2XIhTHXPHkRksInNv8AlHIXNA4mJKzULkgBmsJhEgfI iupN3ndMQhTXmYubeeZrBIKAOhtswRDRmW9EnLUcqtm4HvJVrpAPWOTQpT7ldtZUCbzt PppA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771246; x=1739376046; 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=JBZXTbuS/jzxIISJXLRWUHAJ1oANsva3E4CzlwWomJY=; b=JfiIEeQeuyPXlYIJV3xywMDBhZSc4Vhu/bcHSQSyrsqw07nc2MGpVtwSFqpjW25AGi 44VJoAGo7WP/Ssl51DwiH6PIOTjuhmmVOUcbnN90jtUsFBDgCFbmqOM9kDq4qUmr/iwI 18WSm95Yz1m+7sVfAmAnMmFXQs8QEt5IDe7BE2x3kYJEvCOLS1xwsrELUhAEJJoRU75F mkiAwJplOFAJeZzAQpEYMbn1anJEwXzX2auE5YfRJcbIlgx/+EkFoPCDXRY9lZzVm7F4 My2NUW8pMQ0QglCOUipN7QNfk24Wtp/JYoMZomNPRET1Uu3fUsmqCoPwPJNr2sILpX9N Kt6Q== X-Forwarded-Encrypted: i=1; AJvYcCVYhnFrqPlUXwZafUaT5NA4/YTzNbpkZW2CofuA7vYU/G2eM4zp7SlgP9wSFYA+yPMBPO1hM59/CRjImtU=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv9fowqpgA0CHB+rfEN8VcGieJ67P4CyL9Ox1JfEN5uCqwGgqY xMiY3qHRbj3/QGt99Pq0p3j32pkJ1kp4KDzdaAaxJPDvfC5WsrRm0bQUFebFWbI= X-Gm-Gg: ASbGncs5k/y16vTDoM0bvF9UjKDzGDlACAikiGDLWFrKiE3UmwheH3wdU0fQRYNbCBG SL0+hZsu26ypljR3XhQgXuka9Pjdv6pvUNeLHUIC9078T43PI3ineIkHb6zJp4OxLx3sJ2X+Qb4 4jKKNTHaAac3N/JEOfCWCUClA9gswH4wplpJX73i5WtTBB+5d8Jl36k6NYJHkHQr2m0+gawozxl WhVt2nCMkyENuNWOuuBD7dJgXo6+dI+wVQMIbFA/BTHNXO4R8Dt3RR23EPUQmrRkCYNCTfz0hLs G9+Q6IcEOF2z3ZV6mjG6iKfC0QXo22E8HQ9eWvk0q8ing7o+BbDA5lA= X-Google-Smtp-Source: AGHT+IG20/n0MlzHXXlDX+eid7Zzs/iscNjRXbzQaZokFNcd/sGA49bK8WlZsq67OCE4wBBbq10xxQ== X-Received: by 2002:a17:902:d2d1:b0:21d:3bd7:afe8 with SMTP id d9443c01a7336-21f17ed0ee5mr59541815ad.49.1738771245657; Wed, 05 Feb 2025 08:00:45 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:45 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 07/11] RISC-V: Select GENERIC_PENDING_IRQ Date: Wed, 5 Feb 2025 21:29:43 +0530 Message-ID: <20250205155948.81385-8-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable GENERIC_PENDING_IRQ for RISC-V so that RISC-V irqchips can support delayed irq mirgration in the interrupt context. Signed-off-by: Anup Patel --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 7612c52e9b1e..a32f39748775 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -111,6 +111,7 @@ config RISCV select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW_LEVEL select GENERIC_LIB_DEVMEM_IS_ALLOWED + select GENERIC_PENDING_IRQ if SMP select GENERIC_PCI_IOMAP select GENERIC_PTDUMP if MMU select GENERIC_SCHED_CLOCK --=20 2.43.0 From nobody Thu Feb 12 21:23:33 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A21F19B586 for ; Wed, 5 Feb 2025 16:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771254; cv=none; b=tOynNHZ9s63IqpzDH64jCpbOa/B2F0+r9kjL+FSYACLARIe9QZ3IBEia/mvwlItESN0o9x7j6VfWrZkz2wHotQqCqhe29RzE4XVGDa0bMlD+As3GVxCJ7dbf3zu4mXkH9LnOE+XwPLMz/VF3Fls/9V6Z3vrLFP9v6lWkMUt5uEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771254; c=relaxed/simple; bh=/aguk4ZYg6WQI6RlClB+Z+ge32iMkXIXY6eYPLNpAn0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ltTgwSlQ06eQujH04M3T2NGZSA40BgI8P45vxP3YA5GsC9QqPxmRyWjBJi0hkDUKtXoSdoWQza5Zrz/84Zx82x6q1a+AeznTnrk/j0yBX3UW1lngKR5YUCMPzo/zhMK3JvA1dRr11hpuZzLqVBSbY1MhcAcMSssUPmIj/sCCkZg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=GdKuwU1n; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="GdKuwU1n" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-21661be2c2dso118835385ad.1 for ; Wed, 05 Feb 2025 08:00:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771252; x=1739376052; darn=vger.kernel.org; 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=li309BKFytEFNs0s+UiLLaDTQ3aEtuOmqKESJ/Lkwhg=; b=GdKuwU1nhf2AnIxmTqI+MHGinur03GjWdhkXjoDZcJ8FTo9290mwjm2U8+9xS9JihP Vp7/m65EuqBHio08z0O75VDuPGrpZ8VwsXQPAHU8kaSyXdJhV+RKcCuv7Df4hQIqk0Ho +UNUKxWIU52ZEI21MYPRpA1iB1a78gDoFmpNibb+MVSnG//QJUodcBD/YFqPYrHlckl5 vyjRRMuU58SkIxzIJ25BMS2RsT7qeUFbbf8Om/ksltAphyNyHU4fbQy9mUB7PXuu8pbY lQ+FRwspLU76ikkK20P0xGCWkvl1FURlL81ec1LC5uzjg7vaJ8VJ52aaVZIjXau6pHrn hYQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771252; x=1739376052; 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=li309BKFytEFNs0s+UiLLaDTQ3aEtuOmqKESJ/Lkwhg=; b=llH8u4dsvIDjSocicpbVf8+KQOGn5DwGqX/MgEzhDwRYsCqzryO1mk1mj41fehdsj3 R8lOSGkyKSmwxayEG7HUdyuXw+rRzwEmliTCbGwBHDy6cfgUD0hBCuKedo2k6n8GNfam 7qnHSs3O3lfsZVKIEqbiwDfv2BWdPot2meneWL/kJdp2WxPLTN+RiZQB3SFr0gWg1QgV 3nyDUIUPRLpCC51ZlkCtmVT8yHUg/Rm6vAGG+VjqiKyXzwJKpsOrLSXILbfjWpPS17d9 +ytOuX9HVxreR1KOg5Rw4gZ5jWe2gFdB87Gk2s18nDbhPJRUCbOmpMeX4vyKcVWayA01 TCtQ== X-Forwarded-Encrypted: i=1; AJvYcCXncjLxQEGyrZ4JcBf7B6Qma/LOf5+7TGChL2bCkVaOPVX/9CF3QNmYbl1b5cqvT/yUu4gSc01MdQKSj3s=@vger.kernel.org X-Gm-Message-State: AOJu0YxOjZaf1U+odHN3s+GQJhdBfjyn7kBXLqXsBrSCfmxXI6JN1l20 C7hbEBLeYi1DJpie4meGXaEGM5pHr0aFZbAheJKK2RzzVLxB9Na66Wii+s+41wc= X-Gm-Gg: ASbGnctLagi/eWq0jtZLKtoH+bSidHVD3fvMa89xBEfcQhbbgx+7yE0AUczc1zUnYQ5 XU+glYYDLh5Xvs0pS0Z6CIz6Lliv7/pbk3xFZ3aRpABleIpninurHvkN+orPgPWMxclqcoso0Vx 2q6xALQHuCYnAK8sAAguhzXM1nhyDj+lUmAruv1j9dH4MvtpwqG4/tR/JPvO+rFXqLyuJt86xWd gcIOIEWGBHCwmsR/Oee/vryoULqB/0gfORIejBpzFhUQ+mW1968EzGvW6kI2HacrO8zOCVkbBSy FsHQComKr6cCAFeh8KU/TdvPBg2zdALurFErQ6MxLO1+LSvYhO7Mrs8= X-Google-Smtp-Source: AGHT+IGZXw5A6C5TRMXaRISdtNy30QCVwikmm8khroyenXQMwT2LAT21ro2VOMEOj9OPHLAZZZItVw== X-Received: by 2002:a17:902:f54b:b0:21f:f02:4176 with SMTP id d9443c01a7336-21f17ecbcfamr60758095ad.33.1738771252165; Wed, 05 Feb 2025 08:00:52 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:51 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 08/11] irqchip/riscv-imsic: Separate next and previous pointers in IMSIC vector Date: Wed, 5 Feb 2025 21:29:44 +0530 Message-ID: <20250205155948.81385-9-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, there is only one "move" pointer in the struct imsic_vector so during vector movement the old vector points to the new vector and new vector points to itself. To support force cleanup of old vector, add separate "move_next" and "move_prev" pointers in the struct imsic_vector where during vector movement the "move_next" pointer of the old vector points to the new vector and the "move_prev" pointer of the new vector points to the old vector. Both "move_next" and "move_prev" pointers are cleared separately by __imsic_local_sync() with a restriction that "move_prev" on the new CPU is cleared only after old CPU has cleared "move_next". Signed-off-by: Anup Patel --- drivers/irqchip/irq-riscv-imsic-early.c | 8 ++- drivers/irqchip/irq-riscv-imsic-state.c | 96 +++++++++++++++++-------- drivers/irqchip/irq-riscv-imsic-state.h | 7 +- 3 files changed, 78 insertions(+), 33 deletions(-) diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-= riscv-imsic-early.c index c5c2e6929a2f..b5def6268936 100644 --- a/drivers/irqchip/irq-riscv-imsic-early.c +++ b/drivers/irqchip/irq-riscv-imsic-early.c @@ -77,6 +77,12 @@ static void imsic_handle_irq(struct irq_desc *desc) struct imsic_vector *vec; unsigned long local_id; =20 + /* + * Process pending local synchronization instead of waiting + * for per-CPU local timer to expire. + */ + imsic_local_sync_all(false); + chained_irq_enter(chip, desc); =20 while ((local_id =3D csr_swap(CSR_TOPEI, 0))) { @@ -120,7 +126,7 @@ static int imsic_starting_cpu(unsigned int cpu) * Interrupts identities might have been enabled/disabled while * this CPU was not running so sync-up local enable/disable state. */ - imsic_local_sync_all(); + imsic_local_sync_all(true); =20 /* Enable local interrupt delivery */ imsic_local_delivery(true); diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-= riscv-imsic-state.c index b97e6cd89ed7..96e994443fc7 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.c +++ b/drivers/irqchip/irq-riscv-imsic-state.c @@ -124,10 +124,11 @@ void __imsic_eix_update(unsigned long base_id, unsign= ed long num_id, bool pend, } } =20 -static void __imsic_local_sync(struct imsic_local_priv *lpriv) +static bool __imsic_local_sync(struct imsic_local_priv *lpriv) { struct imsic_local_config *mlocal; struct imsic_vector *vec, *mvec; + bool ret =3D true; int i; =20 lockdep_assert_held(&lpriv->lock); @@ -143,35 +144,75 @@ static void __imsic_local_sync(struct imsic_local_pri= v *lpriv) __imsic_id_clear_enable(i); =20 /* - * If the ID was being moved to a new ID on some other CPU - * then we can get a MSI during the movement so check the - * ID pending bit and re-trigger the new ID on other CPU - * using MMIO write. + * Clear the pervious vector pointer of the new vector only + * after the movement is complete on the old CPU. */ - mvec =3D READ_ONCE(vec->move); - WRITE_ONCE(vec->move, NULL); - if (mvec && mvec !=3D vec) { + mvec =3D READ_ONCE(vec->move_prev); + if (mvec) { + /* + * If the old vector has not been updated then + * try again in the next sync-up call. + */ + if (READ_ONCE(mvec->move_next)) { + ret =3D false; + continue; + } + + WRITE_ONCE(vec->move_prev, NULL); + } + + /* + * If a vector was being moved to a new vector on some other + * CPU then we can get a MSI during the movement so check the + * ID pending bit and re-trigger the new ID on other CPU using + * MMIO write. + */ + mvec =3D READ_ONCE(vec->move_next); + if (mvec) { if (__imsic_id_read_clear_pending(i)) { mlocal =3D per_cpu_ptr(imsic->global.local, mvec->cpu); writel_relaxed(mvec->local_id, mlocal->msi_va); } =20 + WRITE_ONCE(vec->move_next, NULL); imsic_vector_free(&lpriv->vectors[i]); } =20 skip: bitmap_clear(lpriv->dirty_bitmap, i, 1); } + + return ret; } =20 -void imsic_local_sync_all(void) +#ifdef CONFIG_SMP +static void __imsic_local_timer_start(struct imsic_local_priv *lpriv) +{ + lockdep_assert_held(&lpriv->lock); + + if (!timer_pending(&lpriv->timer)) { + lpriv->timer.expires =3D jiffies + 1; + add_timer_on(&lpriv->timer, smp_processor_id()); + } +} +#else +static inline void __imsic_local_timer_start(struct imsic_local_priv *lpri= v) +{ +} +#endif + +void imsic_local_sync_all(bool force_all) { struct imsic_local_priv *lpriv =3D this_cpu_ptr(imsic->lpriv); unsigned long flags; =20 raw_spin_lock_irqsave(&lpriv->lock, flags); - bitmap_fill(lpriv->dirty_bitmap, imsic->global.nr_ids + 1); - __imsic_local_sync(lpriv); + + if (force_all) + bitmap_fill(lpriv->dirty_bitmap, imsic->global.nr_ids + 1); + if (!__imsic_local_sync(lpriv)) + __imsic_local_timer_start(lpriv); + raw_spin_unlock_irqrestore(&lpriv->lock, flags); } =20 @@ -190,12 +231,7 @@ void imsic_local_delivery(bool enable) #ifdef CONFIG_SMP static void imsic_local_timer_callback(struct timer_list *timer) { - struct imsic_local_priv *lpriv =3D this_cpu_ptr(imsic->lpriv); - unsigned long flags; - - raw_spin_lock_irqsave(&lpriv->lock, flags); - __imsic_local_sync(lpriv); - raw_spin_unlock_irqrestore(&lpriv->lock, flags); + imsic_local_sync_all(false); } =20 static void __imsic_remote_sync(struct imsic_local_priv *lpriv, unsigned i= nt cpu) @@ -216,14 +252,11 @@ static void __imsic_remote_sync(struct imsic_local_pr= iv *lpriv, unsigned int cpu */ if (cpu_online(cpu)) { if (cpu =3D=3D smp_processor_id()) { - __imsic_local_sync(lpriv); - return; + if (__imsic_local_sync(lpriv)) + return; } =20 - if (!timer_pending(&lpriv->timer)) { - lpriv->timer.expires =3D jiffies + 1; - add_timer_on(&lpriv->timer, cpu); - } + __imsic_local_timer_start(lpriv); } } #else @@ -278,8 +311,9 @@ void imsic_vector_unmask(struct imsic_vector *vec) raw_spin_unlock(&lpriv->lock); } =20 -static bool imsic_vector_move_update(struct imsic_local_priv *lpriv, struc= t imsic_vector *vec, - bool new_enable, struct imsic_vector *new_move) +static bool imsic_vector_move_update(struct imsic_local_priv *lpriv, + struct imsic_vector *vec, bool is_old_vec, + bool new_enable, struct imsic_vector *move_vec) { unsigned long flags; bool enabled; @@ -289,7 +323,10 @@ static bool imsic_vector_move_update(struct imsic_loca= l_priv *lpriv, struct imsi /* Update enable and move details */ enabled =3D READ_ONCE(vec->enable); WRITE_ONCE(vec->enable, new_enable); - WRITE_ONCE(vec->move, new_move); + if (is_old_vec) + WRITE_ONCE(vec->move_next, move_vec); + else + WRITE_ONCE(vec->move_prev, move_vec); =20 /* Mark the vector as dirty and synchronize */ bitmap_set(lpriv->dirty_bitmap, vec->local_id, 1); @@ -322,8 +359,8 @@ void imsic_vector_move(struct imsic_vector *old_vec, st= ruct imsic_vector *new_ve * interrupt on the old vector while device was being moved * to the new vector. */ - enabled =3D imsic_vector_move_update(old_lpriv, old_vec, false, new_vec); - imsic_vector_move_update(new_lpriv, new_vec, enabled, new_vec); + enabled =3D imsic_vector_move_update(old_lpriv, old_vec, true, false, new= _vec); + imsic_vector_move_update(new_lpriv, new_vec, false, enabled, old_vec); } =20 #ifdef CONFIG_GENERIC_IRQ_DEBUGFS @@ -386,7 +423,8 @@ struct imsic_vector *imsic_vector_alloc(unsigned int hw= irq, const struct cpumask vec =3D &lpriv->vectors[local_id]; vec->hwirq =3D hwirq; vec->enable =3D false; - vec->move =3D NULL; + vec->move_next =3D NULL; + vec->move_prev =3D NULL; =20 return vec; } diff --git a/drivers/irqchip/irq-riscv-imsic-state.h b/drivers/irqchip/irq-= riscv-imsic-state.h index 391e44280827..f02842b84ed5 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.h +++ b/drivers/irqchip/irq-riscv-imsic-state.h @@ -23,7 +23,8 @@ struct imsic_vector { unsigned int hwirq; /* Details accessed using local lock held */ bool enable; - struct imsic_vector *move; + struct imsic_vector *move_next; + struct imsic_vector *move_prev; }; =20 struct imsic_local_priv { @@ -74,7 +75,7 @@ static inline void __imsic_id_clear_enable(unsigned long = id) __imsic_eix_update(id, 1, false, false); } =20 -void imsic_local_sync_all(void); +void imsic_local_sync_all(bool force_all); void imsic_local_delivery(bool enable); =20 void imsic_vector_mask(struct imsic_vector *vec); @@ -87,7 +88,7 @@ static inline bool imsic_vector_isenabled(struct imsic_ve= ctor *vec) =20 static inline struct imsic_vector *imsic_vector_get_move(struct imsic_vect= or *vec) { - return READ_ONCE(vec->move); + return READ_ONCE(vec->move_prev); } =20 void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *= new_vec); --=20 2.43.0 From nobody Thu Feb 12 21:23:33 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29A34192B90 for ; Wed, 5 Feb 2025 16:01:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771264; cv=none; b=eqfGM5ncg+tYPsG30GMnOQ6vmeilwz5QhEUxSZzvwR12IPdAlviHcE2lnrJ2LsM3Pf8KUo9y+WQf9fu2c71rzrbpNnVcRLpK3Fe+Pk/j5yf7L/E/8DXZR/wvSoq/YUVJWIoXrCQ4jyQoa0D4a0wwYkAXdVnrIlFXIBmQTRItp7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771264; c=relaxed/simple; bh=mFFEh8+hZeEVXl9Ut+Oj3ibjoUtqS7w8eehuqLHhRt0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UKM0+hNXKlrDAWDvpxcBaIVk9RrOukT3sjZtvL0D/xw7VtFMKmcdnLuvmcHqKlYgQZk1P/JRH51n/9OxU4w6ykorqSmWBt0ZFKSXYtOq6O607wInSHrBvqQwKLrvwotrMporH7PL2H4XzKXtFHB561RHVyQqMe0lcz2s/S096Jo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=YnqfgO4F; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="YnqfgO4F" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-216728b1836so122755575ad.0 for ; Wed, 05 Feb 2025 08:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771262; x=1739376062; darn=vger.kernel.org; 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=RoqQmmMLZnhmH7e8y5iCPOfAA2UjM+1/YD5gOA06f3E=; b=YnqfgO4FhuLi/86UawPv18Z5+jeAjZEq1hzeJpP35sEwCjW/OI38Meq/b7vZU4xF1O n3c3+jaPuJ7k7HdhWunp3fTOHp2AJEZyDF0e0U8sBnFTvY6e6XV5D4VXBJOSJSTmdfd8 aCbBFmX8BybEpi7MIaDyl9hPpJTJMXmeRqsAW9U7bqCb5cJmOxNqjLMevsd2T6f/ZiyI C1SSMu1RAUS63MpQGTTEUKfs7+dNbFbarJATG0IhAdaJ0ntFuqVikTdBeBRwEJGUOdSZ 5rdFgMD/L++9M49YL9x4sMMF/cNPeMVea97xc5TTW3IUZzIZ3z2zOeLsIbk64Fy85zc5 N8BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771262; x=1739376062; 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=RoqQmmMLZnhmH7e8y5iCPOfAA2UjM+1/YD5gOA06f3E=; b=gigJZ0PgyFc0qegALZcaX4Cd6Xh3AGIcH13dPtLmieUhLlefsNhKjiKdTFpOMzkceQ rYEFHeZ7ktU/3m0E6KVWevCrotCjZvAgfllGDQpSiJh76IbQwXyP+krvbJejMbTRzMoc DOehuMMgyIWeWECnpEAwcfQPzhp8uTdFq53N0dZAYj0+Ss2edfu11Wk0CySMTYtrbKFj kLdIGvFoNRWiehh3VvcPOXSP8L4EeaclNtPDete+wdRkxHamjCiZoAE8UEOfToa3630B hTJMGyD3wHddy6xVfgfgSXCvMll3/anRHrP3DLh23Yj39evjyyjVaxNOmA69/aBP4MkD XXuQ== X-Forwarded-Encrypted: i=1; AJvYcCWLcvWx/rPdvgKJ1cvgT8cBwm7r30L7FUEmKaVk0Aqk4f6uYP9nfDGMOhHuZcK7mQI3Rfz6rWOkMSR7Zmk=@vger.kernel.org X-Gm-Message-State: AOJu0YwIQgCr/+eDOFPultZdLfH4CPGs1BYnaXLoN2K+PaqpnvXtJxFS X1z34266+WzYrfWuhQiCqhGuap7sYKhsY+CmdjcKMNv7s2yo6iDbXinR9uTprKU= X-Gm-Gg: ASbGnctt/yV+JlrJ2ih0IOTVxEaLJB2aSOWvZbM+3fFXcakZrIsvCYUe/Tnyv+T0HZf pSynckL1kpS6AQlAemvGtELMol969UiPNeOVPs6BZWS8WG9eShmBhq1zl9Ph/rPmb7kx78xop9X tC+g8u+jDLTuO1ghQT1CFxTUVweqVmQ1k/TiB20uJdi7Hp3mD7kIMTETaMyy45+m1FwLKpAohwr pSNZfFeoUDd9U8N5KSutlm7OOdGTFci9Ke1+c6h2Xp2VO5qe0V5Tbg5h2N2lCbM2sz/qgVZpSjt uVriidnQycR5g/aRhYMEs9h6Zf2gzPYkMdHb6fRss32/o6fhaFV1TRQ= X-Google-Smtp-Source: AGHT+IGA6bIArcQBSZQINkR2ug10cWLWOtAjnqU2/HK+jfs8kC57mwS6eJ+lRGDZ5WGk1pjMRxBEnA== X-Received: by 2002:a17:902:ced1:b0:215:65f3:27f2 with SMTP id d9443c01a7336-21f17e2719dmr55903235ad.8.1738771262008; Wed, 05 Feb 2025 08:01:02 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:00:58 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 09/11] irqchip/riscv-imsic: Implement irq_force_complete_move() for IMSIC Date: Wed, 5 Feb 2025 21:29:45 +0530 Message-ID: <20250205155948.81385-10-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Implement irq_force_complete_move() for IMSIC driver so that in-flight vector movements on a CPU can be cleaned-up when the CPU goes down. Signed-off-by: Anup Patel --- drivers/irqchip/irq-riscv-imsic-platform.c | 32 ++++++++++++++++++++++ drivers/irqchip/irq-riscv-imsic-state.c | 17 ++++++++++++ drivers/irqchip/irq-riscv-imsic-state.h | 1 + 3 files changed, 50 insertions(+) diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/i= rq-riscv-imsic-platform.c index 9a5e7b4541f6..b9e3f9030bdf 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -129,6 +129,37 @@ static int imsic_irq_set_affinity(struct irq_data *d, = const struct cpumask *mask =20 return IRQ_SET_MASK_OK_DONE; } + +static void imsic_irq_force_complete_move(struct irq_data *d) +{ + struct imsic_vector *mvec, *vec =3D irq_data_get_irq_chip_data(d); + unsigned int cpu =3D smp_processor_id(); + + if (WARN_ON(!vec)) + return; + + /* Do nothing if there is no in-flight move */ + mvec =3D imsic_vector_get_move(vec); + if (!mvec) + return; + + /* Do nothing if the old IMSIC vector does not belong to current CPU */ + if (mvec->cpu !=3D cpu) + return; + + /* + * The best we can do is force cleanup the old IMSIC vector. + * + * The challenges over here are same as x86 vector domain so + * refer to the comments in irq_force_complete_move() function + * implemented at arch/x86/kernel/apic/vector.c. + */ + + /* Force cleanup in-flight move */ + pr_info("IRQ fixup: irq %d move in progress, old vector cpu %d local_id %= d\n", + d->irq, mvec->cpu, mvec->local_id); + imsic_vector_force_move_cleanup(vec); +} #endif =20 static struct irq_chip imsic_irq_base_chip =3D { @@ -137,6 +168,7 @@ static struct irq_chip imsic_irq_base_chip =3D { .irq_unmask =3D imsic_irq_unmask, #ifdef CONFIG_SMP .irq_set_affinity =3D imsic_irq_set_affinity, + .irq_force_complete_move =3D imsic_irq_force_complete_move, #endif .irq_retrigger =3D imsic_irq_retrigger, .irq_compose_msi_msg =3D imsic_irq_compose_msg, diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-= riscv-imsic-state.c index 96e994443fc7..5ec2b6bdffb2 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.c +++ b/drivers/irqchip/irq-riscv-imsic-state.c @@ -311,6 +311,23 @@ void imsic_vector_unmask(struct imsic_vector *vec) raw_spin_unlock(&lpriv->lock); } =20 +void imsic_vector_force_move_cleanup(struct imsic_vector *vec) +{ + struct imsic_local_priv *lpriv; + struct imsic_vector *mvec; + unsigned long flags; + + lpriv =3D per_cpu_ptr(imsic->lpriv, vec->cpu); + raw_spin_lock_irqsave(&lpriv->lock, flags); + + mvec =3D READ_ONCE(vec->move_prev); + WRITE_ONCE(vec->move_prev, NULL); + if (mvec) + imsic_vector_free(mvec); + + raw_spin_unlock_irqrestore(&lpriv->lock, flags); +} + static bool imsic_vector_move_update(struct imsic_local_priv *lpriv, struct imsic_vector *vec, bool is_old_vec, bool new_enable, struct imsic_vector *move_vec) diff --git a/drivers/irqchip/irq-riscv-imsic-state.h b/drivers/irqchip/irq-= riscv-imsic-state.h index f02842b84ed5..19dea0c77738 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.h +++ b/drivers/irqchip/irq-riscv-imsic-state.h @@ -91,6 +91,7 @@ static inline struct imsic_vector *imsic_vector_get_move(= struct imsic_vector *ve return READ_ONCE(vec->move_prev); } =20 +void imsic_vector_force_move_cleanup(struct imsic_vector *vec); void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *= new_vec); =20 struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned= int local_id); --=20 2.43.0 From nobody Thu Feb 12 21:23:33 2026 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A51321991CF for ; Wed, 5 Feb 2025 16:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771272; cv=none; b=pmh9ouO6oCPrg49eR7Mi1j0rDWZ0JeUfGuObMut0psvoF0DbnrHgCpE6a1Vso4nP7S1wc4PLZc1cLQJTLc1ECFz37Kp+AseL7XgIwMhJ68Lrm275uvXCC1TYnL0HV13JIu2mY1yu+5th60AHkrpATyQNh49x2CpEogfgTSwkM7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771272; c=relaxed/simple; bh=lcMa5p2pZjzeghLKvVY9ny71KeZ3wMkdol/DU/InCzE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qXoDTwF2O1c1oxOq9Qag5y1nS/q5m2AhY3rrAgYjYcvFvasVCVn6vtGIWrEiRvLlm08Xt+/DWEVmbPr/OFZQXiOc+ygSwwb5NdvibuYjjNw3W8YtEn3ocvk5orwILcYN+J6kAn+9wlcD2qNlOKNm7LLhG4nQGaNgCQ5k6kbE8Eo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=CQ0AfwQW; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="CQ0AfwQW" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-2f9da2a7004so2062156a91.0 for ; Wed, 05 Feb 2025 08:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771269; x=1739376069; darn=vger.kernel.org; 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=2uqH0LlhZdZ1/ZJgerOy14gnMEDsVqG8t0Fz3f/FUy8=; b=CQ0AfwQWi0KNP9OlLNt8pAooVeyyN7NUr0W8A8vtHvbkG5BxCzobqINgdlUx/lbIeb LfrvlkZgbnMwKgETjHXP4hyaZT/DpDWR2uhIiNvLq06Yk0BRFCpgGiXypLrEwSYINpdf 8OBRNKsjoJLl7vbZW31aJ1EHjsSpPPW2ZRc1FQcnGhgxfLueDxKGrA46k6drMRFURWP1 BygPqdoAiuBmA8GPGqlKDzt6nW3+mL2dXFqsmaDbgSPH0RizqQos7BoYgfCA0m9O3w58 nPZa9tiulF9uoKQQOoINIdgzL8eCikiGJqJcBEGo3tgtOp+/N3+5DO5WBqLLbecOtkdv faqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771269; x=1739376069; 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=2uqH0LlhZdZ1/ZJgerOy14gnMEDsVqG8t0Fz3f/FUy8=; b=iaTWH/cuWzeHK+8VxWhPFA+dfnbrfkCUN8DEnaBMsC/IqhpFY2al9FeRgno+rCQEoc n00Yfza4EfBMZJcuKQYSBC5HgwUfuHb29gGqCjUyBHDzWShD8AZMZrwxEoIiL1QZuPC9 KNzyqsU3yXL59wpXnZecNRkaN/mBuruFw88iIoTKEu9onFhVwcIxX/OkD9a4pLyfheOJ 8ntM1x30BHUyoDF61KzUKIOell2L+N+0zGL9szNFI3cnVLyLzPDiXdHiqUFrUvsESmom 9kKwZWJc6kNsMfq/yOK3P4DlFH+Uv5FpQJXqtQnZWcbc2+H15QRZjYpmyOV4xay19UDS D/Jw== X-Forwarded-Encrypted: i=1; AJvYcCV7iUKBdyN6/D5lYDitT22+S6v14gQQvEYH3afW/DbUO6AVKYqUqMQqRtsBQLZV3vXneKyItK1OHzzBOUY=@vger.kernel.org X-Gm-Message-State: AOJu0YxXKbOxQWG9SUBvAgzms5QMZVOvf9GB7E8nc4R1fRMmZnwJfPoa ErDptv6SK9ETBqsrp+BRlCNJuokJidAaOoHlA2kWDPE2ktXp95Eu3kk8w/cMw7k= X-Gm-Gg: ASbGncvrpoFzogtHx0gUIQhlHXUBdkJm0XmucjR9zrMkrI6B1aNGheeKHAWeYe8litR YUXGfgPUbqSG4pHW48jAttY967GMWbP7kEKO+4Y+lhGJPcUUHkJxzmfCFu6foWWuXzvE0n0cxUt XuFAxt1JvikP8coEBVb44elq75WLaPPDjKwFWCi267IIdFROVfHX+xK3z+T+OdZB9hhLjQ0C5ah VBgWMUTk/zHxG7sJB6ZPWYvkGFdkm0PAo8bAgECFFaGRLCOTereHoCbp24mRFIa9bUuSDeelc8q +Y1H68f63omELYh5YqNwzQYLNDd5ZMdCe4s/J9WNylFpjzgGdmqNxXA= X-Google-Smtp-Source: AGHT+IFnLvRLZKvgJpx8dmK1OqS269EnZ/fW86sG/bu7Q2nxZbfcOX7ctDxWBsYaZVjqDvgkXox9sw== X-Received: by 2002:a17:90b:4a8a:b0:2ef:67c2:4030 with SMTP id 98e67ed59e1d1-2f9e08003demr5011059a91.27.1738771268829; Wed, 05 Feb 2025 08:01:08 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:01:08 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 10/11] irqchip/riscv-imsic: Replace hwirq with irq in the IMSIC vector Date: Wed, 5 Feb 2025 21:29:46 +0530 Message-ID: <20250205155948.81385-11-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, the imsic_handle_irq() uses generic_handle_domain_irq() to handle the irq which internally has an extra step of resolving hwirq using domain. This extra step can be avoided by replacing hwirq with irq in the IMSIC vector and directly calling generic_handle_irq(). Signed-off-by: Anup Patel --- drivers/irqchip/irq-riscv-imsic-early.c | 6 ++---- drivers/irqchip/irq-riscv-imsic-platform.c | 2 +- drivers/irqchip/irq-riscv-imsic-state.c | 8 ++++---- drivers/irqchip/irq-riscv-imsic-state.h | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-= riscv-imsic-early.c index b5def6268936..d2e8ed70d396 100644 --- a/drivers/irqchip/irq-riscv-imsic-early.c +++ b/drivers/irqchip/irq-riscv-imsic-early.c @@ -73,7 +73,7 @@ static int __init imsic_ipi_domain_init(void) { return 0;= } static void imsic_handle_irq(struct irq_desc *desc) { struct irq_chip *chip =3D irq_desc_get_chip(desc); - int err, cpu =3D smp_processor_id(); + int cpu =3D smp_processor_id(); struct imsic_vector *vec; unsigned long local_id; =20 @@ -103,9 +103,7 @@ static void imsic_handle_irq(struct irq_desc *desc) continue; } =20 - err =3D generic_handle_domain_irq(imsic->base_domain, vec->hwirq); - if (unlikely(err)) - pr_warn_ratelimited("hwirq 0x%x mapping not found\n", vec->hwirq); + generic_handle_irq(vec->irq); } =20 chained_irq_exit(chip, desc); diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/i= rq-riscv-imsic-platform.c index b9e3f9030bdf..6bf5d63f614e 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -111,7 +111,7 @@ static int imsic_irq_set_affinity(struct irq_data *d, c= onst struct cpumask *mask return -EBUSY; =20 /* Get a new vector on the desired set of CPUs */ - new_vec =3D imsic_vector_alloc(old_vec->hwirq, mask_val); + new_vec =3D imsic_vector_alloc(old_vec->irq, mask_val); if (!new_vec) return -ENOSPC; =20 diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-= riscv-imsic-state.c index 5ec2b6bdffb2..d0148e48ab05 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.c +++ b/drivers/irqchip/irq-riscv-imsic-state.c @@ -422,7 +422,7 @@ struct imsic_vector *imsic_vector_from_local_id(unsigne= d int cpu, unsigned int l return &lpriv->vectors[local_id]; } =20 -struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct c= pumask *mask) +struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpu= mask *mask) { struct imsic_vector *vec =3D NULL; struct imsic_local_priv *lpriv; @@ -438,7 +438,7 @@ struct imsic_vector *imsic_vector_alloc(unsigned int hw= irq, const struct cpumask =20 lpriv =3D per_cpu_ptr(imsic->lpriv, cpu); vec =3D &lpriv->vectors[local_id]; - vec->hwirq =3D hwirq; + vec->irq =3D irq; vec->enable =3D false; vec->move_next =3D NULL; vec->move_prev =3D NULL; @@ -451,7 +451,7 @@ void imsic_vector_free(struct imsic_vector *vec) unsigned long flags; =20 raw_spin_lock_irqsave(&imsic->matrix_lock, flags); - vec->hwirq =3D UINT_MAX; + vec->irq =3D 0; irq_matrix_free(imsic->matrix, vec->cpu, vec->local_id, false); raw_spin_unlock_irqrestore(&imsic->matrix_lock, flags); } @@ -510,7 +510,7 @@ static int __init imsic_local_init(void) vec =3D &lpriv->vectors[i]; vec->cpu =3D cpu; vec->local_id =3D i; - vec->hwirq =3D UINT_MAX; + vec->irq =3D 0; } } =20 diff --git a/drivers/irqchip/irq-riscv-imsic-state.h b/drivers/irqchip/irq-= riscv-imsic-state.h index 19dea0c77738..3202ffa4e849 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.h +++ b/drivers/irqchip/irq-riscv-imsic-state.h @@ -20,7 +20,7 @@ struct imsic_vector { unsigned int cpu; unsigned int local_id; /* Details saved by driver in the vector */ - unsigned int hwirq; + unsigned int irq; /* Details accessed using local lock held */ bool enable; struct imsic_vector *move_next; @@ -96,7 +96,7 @@ void imsic_vector_move(struct imsic_vector *old_vec, stru= ct imsic_vector *new_ve =20 struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned= int local_id); =20 -struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct c= pumask *mask); +struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpu= mask *mask); void imsic_vector_free(struct imsic_vector *vector); =20 void imsic_vector_debug_show(struct seq_file *m, struct imsic_vector *vec,= int ind); --=20 2.43.0 From nobody Thu Feb 12 21:23:33 2026 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CEF01DC198 for ; Wed, 5 Feb 2025 16:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771279; cv=none; b=P+1I/49G6/jVwFyhm3RImKcq3n5XH7y+pVFM6RjIYZHqP3WNb35pLhLzMyXhwbxplPSmqQV2nsUlUgyaLV3fCiwtNJygkkYEWnGlD8g8cOLd/+v+nyG9t4ehZm5AdmF5S4MWCpETQ3KYkOcL5O6bmbMq9IFKBzGKW3PysYyiXxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738771279; c=relaxed/simple; bh=tNahCfxLRgNIbiBla43nJrTI1GFGdO1edGYaRhyK8s8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F7IjrQvA29N6MlBEksapeOK4aT/cyTqEmtmnquw9hyfB30ScEmOZFsh4KVKe03dF+3OsxpJE5zG29v1lvI++948z+uSVOt1RmVveuJCMt2QOa92ctHfR1VFUsc03lcd/QSbu+p63JRAAXdhrFQyWNXYksL74AbWVKSJyqHGxtpc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=BdXhlMYZ; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="BdXhlMYZ" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-21670dce0a7so9323825ad.1 for ; Wed, 05 Feb 2025 08:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771277; x=1739376077; darn=vger.kernel.org; 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=KEjndyBD35lV6nr6NSLWRRyly4db2axy7koFOHZTKsQ=; b=BdXhlMYZoneg4XjFolZY4NOxBbTXtBUuRlqe9sGih0KPAOjEy0ItrsDIL6ft7Fyacu ylQa9zvIJLziUbZBk5JPc2KaxX3W75AFoFg1Hr3uJpTLlDvtV+Y/ArCA6gCw2sjCCbNq Ce+skkP9c7XVk1DHs1+BNZrNtfvQcHQ95VXBzEt2f2qZxxeWiic0RQogeIGAmS17CPJz ohch+eo0BqkPETjqyrPaonE3LA/YeyaMsxT17LS8pYZq+GwT2xC/aB8H0xPUPfIjRODN X/mZDtIkyVjXkML+3YJcP3JhDaTfBjrbDbixeHcvTSmuvDmjEA+7vblHb/scJhEiyuXV Xxzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738771277; x=1739376077; 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=KEjndyBD35lV6nr6NSLWRRyly4db2axy7koFOHZTKsQ=; b=Crwf2R+2AK/rRSGUkZAhB9qE4wLbgXd0cMGXBnd9vmirrtpKBDPkZcryrkxC5ALp9o s59owuHQ3xEAOEFoKe02Dehbi1k7IDyonour6fzGSEtJZedMFq72RPKG/PaRhwT09bRB gBOBRSxImKE4FQqGPmkqnSMQYYsVHylO8buOg+73vFtqS9/qNBtY6gSahXi1X3uEkf0Q S4uOUWwZ0s0qWesatZB33oAxzL0ffPqh1+/cM3ToRQoyS/jOkIdkMz6+DtFrHr/kcWX0 9/VRoe1jcecuOgQJOp6ga4w9xLMdsGXnZH8mL+/BVC6rGMLE67KQnPFcquA4G9qQsGRR Zl0g== X-Forwarded-Encrypted: i=1; AJvYcCWl1DveZhuGcp9DW5rnSbNtnO7XUnueFTOeloMJlVUoTlaQ7hjFW8M+ipccdgMl89HmzkCX8mjVhcHW/tg=@vger.kernel.org X-Gm-Message-State: AOJu0YzH3xY+9crGbPhJGOsPa1H1nz4jDrr/QpE3INiMPBYO2vvKgPLi TTvZFX7KsjhCFQA/EYi1RKOrfdYhDO5Wo9o5HXrJ97MxfQr4Yu3BziqGDM1WifM= X-Gm-Gg: ASbGncsr4UILB9MLXks6RxZPZEeRQLCimpGzvR1Yty/rgBmroKkaNGwL+/TimHv0NhB UBXSlSms6Qo55uF7+kmuMJGcY4Rx/7/ySPibmXi82M9COA8eo46rTSGbXGLDX60o3wZ2jr2SxXq j+hUody4Hm3p/l3bZavcN9VH3npsZaY74Z5v/i5wsZlH7Suvod8Clt/Gqwuj5gW/PQsML2dlovT TGh4xSgkRJ6a6xVYpYoh14aXTsBWtnPJv06QqOdAIIFtce0y4k62mSpypDqIl8IAkhmk9rEptnM ai8bzKL0nytnEV5gdqPZ/NKX9AUwP4u+xXcrldQvGnw7ndKFHpVyzsU= X-Google-Smtp-Source: AGHT+IFTclDON/r36LodehwMg78zlP6BqfcqB9QXn3ksA4PSt60KgNQ9lMw/GuAJ5JZoMSZ1KuB8Cw== X-Received: by 2002:a17:903:18f:b0:21f:75c:f7d3 with SMTP id d9443c01a7336-21f17ec7bd9mr56546085ad.38.1738771275532; Wed, 05 Feb 2025 08:01:15 -0800 (PST) Received: from anup-ubuntu-vm.localdomain ([103.97.166.196]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21edddf883fsm99369015ad.4.2025.02.05.08.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2025 08:01:14 -0800 (PST) From: Anup Patel To: Thomas Gleixner Cc: Marc Zyngier , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Palmer Dabbelt , Paul Walmsley , Atish Patra , Andrew Jones , Sunil V L , Anup Patel , linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, Anup Patel Subject: [PATCH v4 11/11] irqchip/riscv-imsic: Special handling for non-atomic device MSI update Date: Wed, 5 Feb 2025 21:29:47 +0530 Message-ID: <20250205155948.81385-12-apatel@ventanamicro.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205155948.81385-1-apatel@ventanamicro.com> References: <20250205155948.81385-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Device having non-atomic MSI update might see an intermediate state when changing target IMSIC vector from one CPU to another. To avoid losing interrupt to such intermediate state, do the following (just like x86 APIC): 1) First write a temporary IMSIC vector to the device which has MSI address same as the old IMSIC vector but with MSI data matches the new IMSIC vector. 2) Next write the new IMSIC vector to the device. Based on the above, the __imsic_local_sync() must check pending status of both old MSI data and new MSI data on the old CPU. In addition, the movement of IMSIC vector for non-atomic device MSI update must be done in interrupt context using IRQCHIP_MOVE_DEFERRED. Signed-off-by: Anup Patel --- drivers/irqchip/irq-riscv-imsic-platform.c | 73 +++++++++++++++++++++- drivers/irqchip/irq-riscv-imsic-state.c | 31 +++++++-- 2 files changed, 98 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/i= rq-riscv-imsic-platform.c index 6bf5d63f614e..828102c46f51 100644 --- a/drivers/irqchip/irq-riscv-imsic-platform.c +++ b/drivers/irqchip/irq-riscv-imsic-platform.c @@ -64,6 +64,11 @@ static int imsic_irq_retrigger(struct irq_data *d) return 0; } =20 +static void imsic_irq_ack(struct irq_data *d) +{ + irq_move_irq(d); +} + static void imsic_irq_compose_vector_msg(struct imsic_vector *vec, struct = msi_msg *msg) { phys_addr_t msi_addr; @@ -97,6 +102,21 @@ static int imsic_irq_set_affinity(struct irq_data *d, c= onst struct cpumask *mask bool force) { struct imsic_vector *old_vec, *new_vec; + struct imsic_vector tmp_vec; + + /* + * Requirements for the downstream irqdomains (or devices): + * + * 1) Downstream irqdomains (or devices) with atomic MSI update can + * happily do imsic_irq_set_affinity() in the process-context on + * any CPU so the irqchip of such irqdomains must not set the + * IRQCHIP_MOVE_DEFERRED flag. + * + * 2) Downstream irqdomains (or devices) with non-atomic MSI update + * must do imsic_irq_set_affinity() in the interrupt-context upon + * next interrupt so the irqchip of such irqdomains must set the + * IRQCHIP_MOVE_DEFERRED flag. + */ =20 old_vec =3D irq_data_get_irq_chip_data(d); if (WARN_ON(!old_vec)) @@ -115,6 +135,33 @@ static int imsic_irq_set_affinity(struct irq_data *d, = const struct cpumask *mask if (!new_vec) return -ENOSPC; =20 + /* + * Device having non-atomic MSI update might see an intermediate + * state when changing target IMSIC vector from one CPU to another. + * + * To avoid losing interrupt to such intermediate state, do the + * following (just like x86 APIC): + * + * 1) First write a temporary IMSIC vector to the device which + * has MSI address same as the old IMSIC vector but MSI data + * matches the new IMSIC vector. + * + * 2) Next write the new IMSIC vector to the device. + * + * Based on the above, the __imsic_local_sync() must check pending + * status of both old MSI data and new MSI data on the old CPU. + */ + + if (!irq_can_move_in_process_context(d) && + new_vec->local_id !=3D old_vec->local_id) { + /* Setup temporary vector */ + tmp_vec.cpu =3D old_vec->cpu; + tmp_vec.local_id =3D new_vec->local_id; + + /* Point device to the temporary vector */ + imsic_msi_update_msg(irq_get_irq_data(d->irq), &tmp_vec); + } + /* Point device to the new vector */ imsic_msi_update_msg(irq_get_irq_data(d->irq), new_vec); =20 @@ -171,6 +218,7 @@ static struct irq_chip imsic_irq_base_chip =3D { .irq_force_complete_move =3D imsic_irq_force_complete_move, #endif .irq_retrigger =3D imsic_irq_retrigger, + .irq_ack =3D imsic_irq_ack, .irq_compose_msi_msg =3D imsic_irq_compose_msg, .flags =3D IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, @@ -190,7 +238,7 @@ static int imsic_irq_domain_alloc(struct irq_domain *do= main, unsigned int virq, return -ENOSPC; =20 irq_domain_set_info(domain, virq, virq, &imsic_irq_base_chip, vec, - handle_simple_irq, NULL, NULL); + handle_edge_irq, NULL, NULL); irq_set_noprobe(virq); irq_set_affinity(virq, cpu_online_mask); irq_data_update_effective_affinity(irq_get_irq_data(virq), cpumask_of(vec= ->cpu)); @@ -229,15 +277,36 @@ static const struct irq_domain_ops imsic_base_domain_= ops =3D { #endif }; =20 +static bool imsic_init_dev_msi_info(struct device *dev, + struct irq_domain *domain, + struct irq_domain *real_parent, + struct msi_domain_info *info) +{ + if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info)) + return false; + + switch (info->bus_token) { + case DOMAIN_BUS_PCI_DEVICE_MSI: + case DOMAIN_BUS_PCI_DEVICE_MSIX: + info->chip->flags |=3D IRQCHIP_MOVE_DEFERRED; + break; + default: + break; + } + + return true; +} + static const struct msi_parent_ops imsic_msi_parent_ops =3D { .supported_flags =3D MSI_GENERIC_FLAGS_MASK | MSI_FLAG_PCI_MSIX, .required_flags =3D MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | MSI_FLAG_PCI_MSI_MASK_PARENT, + .chip_flags =3D MSI_CHIP_FLAG_SET_ACK, .bus_select_token =3D DOMAIN_BUS_NEXUS, .bus_select_mask =3D MATCH_PCI_MSI | MATCH_PLATFORM_MSI, - .init_dev_msi_info =3D msi_lib_init_dev_msi_info, + .init_dev_msi_info =3D imsic_init_dev_msi_info, }; =20 int imsic_irqdomain_init(void) diff --git a/drivers/irqchip/irq-riscv-imsic-state.c b/drivers/irqchip/irq-= riscv-imsic-state.c index d0148e48ab05..3a2a381e4fa1 100644 --- a/drivers/irqchip/irq-riscv-imsic-state.c +++ b/drivers/irqchip/irq-riscv-imsic-state.c @@ -126,8 +126,8 @@ void __imsic_eix_update(unsigned long base_id, unsigned= long num_id, bool pend, =20 static bool __imsic_local_sync(struct imsic_local_priv *lpriv) { - struct imsic_local_config *mlocal; - struct imsic_vector *vec, *mvec; + struct imsic_local_config *tlocal, *mlocal; + struct imsic_vector *vec, *tvec, *mvec; bool ret =3D true; int i; =20 @@ -169,13 +169,36 @@ static bool __imsic_local_sync(struct imsic_local_pri= v *lpriv) */ mvec =3D READ_ONCE(vec->move_next); if (mvec) { - if (__imsic_id_read_clear_pending(i)) { + /* + * Device having non-atomic MSI update might see an + * intermediate state so check both old ID and new ID + * for pending interrupts. + * + * For details, refer imsic_irq_set_affinity(). + */ + + tvec =3D vec->local_id =3D=3D mvec->local_id ? + NULL : &lpriv->vectors[mvec->local_id]; + if (tvec && + !irq_can_move_in_process_context(irq_get_irq_data(vec->irq)) && + __imsic_id_read_clear_pending(tvec->local_id)) { + /* Retrigger temporary vector if it was already in-use */ + if (READ_ONCE(tvec->enable)) { + tlocal =3D per_cpu_ptr(imsic->global.local, tvec->cpu); + writel_relaxed(tvec->local_id, tlocal->msi_va); + } + + mlocal =3D per_cpu_ptr(imsic->global.local, mvec->cpu); + writel_relaxed(mvec->local_id, mlocal->msi_va); + } + + if (__imsic_id_read_clear_pending(vec->local_id)) { mlocal =3D per_cpu_ptr(imsic->global.local, mvec->cpu); writel_relaxed(mvec->local_id, mlocal->msi_va); } =20 WRITE_ONCE(vec->move_next, NULL); - imsic_vector_free(&lpriv->vectors[i]); + imsic_vector_free(vec); } =20 skip: --=20 2.43.0