From patchwork Wed Feb 5 15:59:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A506FC02198 for ; Wed, 5 Feb 2025 17:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DvFsqgBHoepkWBjGC1yP+KOn/8qryanxa+3zb4U83Ao=; b=mjm+CmlhATM6Tp+FMz32W3wCTE eu7OINAms9Dz/FiJDi6QHE6OULOcoiniGyhcLMkDRAjj3uEgaxLMtt/OS7VHWSwuLmEdvDBV9WRRv 0UAEa9W/2gF8ddPQOFT4TeP9rzddz7Djlo0OTCnxOcdbKtlCkFIZvJtWA0DOqOIk4Qp/G55Al6zKX Z+oTufL7mSjjC+T9gkUGFvrvlXW3MQTCzz3h9mLDcaJN/K2U/NTU0EaVri24g6pac7ISX+QvY0iP9 vnwJOYajbg0/GXbIrbm3TDFVG3eSAaFwDsqbvqs/VH/uI7lbzrPSVR8HLxrEEOuYQKJb1Qgu2ET3b qH6iIttg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfj0V-000000043iW-3MhV; Wed, 05 Feb 2025 17:16:11 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhow-00000003sqH-2NYz for linux-arm-kernel@bombadil.infradead.org; Wed, 05 Feb 2025 16:00:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=DvFsqgBHoepkWBjGC1yP+KOn/8qryanxa+3zb4U83Ao=; b=GgEjLpY0OwT0bpWQJ+msw1DG6Y HXF+wSB/qJ9eMIrKKrs+GTDRRaAl2uWELIBWNHeIfGuqmQYe6B4XSgl2ZRl/tDATVnoux6NeQnyVW sHrhzFU+FhbISi9+TzD6S/NtiKT4Dwwed8h4kCBqjq4fA0YKTmvDSFQM/TURVAzpoEI+0gIjQ7n7l AHV/zZ1WRro0Me1X9XCEFv+vGkxbmTw3a7DYdQV7909atto44CkE8saR4T0kt7m/m1IQfCB15qr9A sUBIATpM01bzCqJGrCiQ2XYjIg6TVtye/VOtSwCivzgRmrBkk1LHQoZcgIwIZys1ixTye22Ws+SgD rolWuIBg==; Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhot-0000000GgKn-2JnX for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:09 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-21f200014f1so9654185ad.2 for ; Wed, 05 Feb 2025 08:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771205; x=1739376005; darn=lists.infradead.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=RHAUBPB2DvScUihMQzh6RFEtnszQm1n25B5Ts/O4zEC+bJIjw/PG1cbgHieFBGztkp GkDdhWL/4xu4sG/n4chiE6/c9i26pXY1UPNn1RgZ4c2DOxg0gfKUm9CmV70hBWXonmvA rV3KhGOmpHmYQZZesz+EFcl9EbkMBOLb1HonKP5nldiyVBpUvJfi2ik7dtTFu+8vwqnO Cp2kT1Y2WUUF1nSlpc9S6foGJb43BRU3eT4aBnI0FZkGNIHnEb52xN4QenQnlkymqBwh NqsmQuo06/ztNctcEJ52ETPBxXFEoF2xH9OW1/zcz46hw82L4laQdWLlJVvMF6XmvMmI xqHg== 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=gg+/aT7OjXaDmb/ZliKAsPRcm5DiUr6uJpKJ32Q27KKl7mBjfHWAyrMDuibIJ6ElQB F7N2a2PCLtIO6Wqt7ISEFmAChnSlD+LEOdNQs9HHtPzJdO5ADADvYB59cnQVgnqAHuLr dKB8fW8rOnE8XGC0S5PyppoF+spr1WtRfHxniqGCsb+YLYTF/0A7mi+srlZSHKhE+qOF m1DhnJkbWxuIleR6vSoUBDjIqm3qLS1WUZo2KCRTPXZnR2JFRhBodJBdO/4f9Xz7ZavH 9OfMO7AvFwkdhvdF4UOGUrXO8l53AXywrWMenjaqG8jeo4XdYXFRWMc8Cx+M4g0OHp2r 2GtQ== X-Forwarded-Encrypted: i=1; AJvYcCUwkYLPB0TzALgwMsT5OcOec7TmIOienqZ9mTXstQlwqgjmobVM8CEMELm9dqXU52txDBt07d9BcSUb62lqiIYo@lists.infradead.org X-Gm-Message-State: AOJu0Yyumx2mNNZcsY6OiwNGRQExfH9ACiaEjyX6np1mgXEYxP0RT2Gm 0jTid+Yawx4+DZkf8+MLYXjSff0lwYF4QpnBvQNE5f7hQfdjAgjy0MYhIjOhH7A= X-Gm-Gg: ASbGncuG4lvrjkAdhis1K/RqssUXtzn1QxxxJ4VmiRu7It55KWWAczgyWxYZlL8rG1v 92YdV4Zkvk1630ywNaVk3nlRObzFLIo4HjQoJlysLiY2rxgbvAqrk9phQaZbLtwaWkmmn1fNbKU 10xc7dH+y74Cq64yRGMZNYLmyufLobn10yz3Oott+uS5EtpyJiYbypm9JsUoCfWbVk9qRkNRqSr RQY5F3XM4aqLnmULGQPFMv1UVXUVNpNCSh92IqpBL2r7YbbhwKYHlpf7iJhjBnpWm+Qxdix0wUN BI8fYZrfPr0U9LZDl0ZoU7+vRCZ7sfgziUvpaPPrpYS0o/mQURR1wSM= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_160007_818868_CBC15DB2 X-CRM114-Status: GOOD ( 14.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/irq-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, const struct cpumask *mask bool force) { struct imsic_vector *old_vec, *new_vec; - struct irq_data *pd = d->parent_data; - old_vec = irq_data_get_irq_chip_data(pd); + old_vec = irq_data_get_irq_chip_data(d); if (WARN_ON(!old_vec)) return -ENOENT; @@ -116,13 +115,13 @@ static int imsic_irq_set_affinity(struct irq_data *d, const struct cpumask *mask return -ENOSPC; /* 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); /* Update irq descriptors with the new vector */ - pd->chip_data = new_vec; + d->chip_data = new_vec; - /* 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)); /* 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 = { .name = "IMSIC", .irq_mask = imsic_irq_mask, .irq_unmask = imsic_irq_unmask, +#ifdef CONFIG_SMP + .irq_set_affinity = imsic_irq_set_affinity, +#endif .irq_retrigger = imsic_irq_retrigger, .irq_compose_msi_msg = imsic_irq_compose_msg, .flags = IRQCHIP_SKIP_SET_WAKE | @@ -245,7 +247,7 @@ static bool imsic_init_dev_msi_info(struct device *dev, if (WARN_ON_ONCE(domain != real_parent)) return false; #ifdef CONFIG_SMP - info->chip->irq_set_affinity = imsic_irq_set_affinity; + info->chip->irq_set_affinity = irq_chip_set_affinity_parent; #endif break; default: From patchwork Wed Feb 5 15:59:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961478 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6EBAC02192 for ; Wed, 5 Feb 2025 16:05:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dDa5uVtGTmKoF+EGxYZ14lQBrXBy+Zgm46G016g9yok=; b=x0ILO6p121Ub10JbvSwYnfH5hI 0otnfW+eucfFphjOKCyy6MVV0Zw1IpT6WNu3570pGaD0N0Fmab4KmGHwG1ZiWhb4aAWocBkcli7qD c/arFIAUe/3SXj4+H4vENR93noKS/N0y32KW86Q4W/1U1JFFOq0qQxmfPoQgq4KSLEfDgUdHDa0zq G5+bjCHd7WzBAFRQZMDnTYXAMwSc2ejdPx6OTIgbkgzQixBxanALffLopebqG7uY17lCUDsEFZKOv BFgcmJ8Pm2oSdDYUBOxcW9rtU48NHCS8r/H9+ms7eJocJFBoo8wludulLz8nvI4cKNg/+5Xkxu9yn Sbns+5bQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhts-00000003tsy-2ZEx; Wed, 05 Feb 2025 16:05:16 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhp1-00000003srL-0SWR for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:16 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-21661be2c2dso118822905ad.1 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=lists.infradead.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=Dj6jyIIps8FKBwOCxyDfCjBTSMLRD33jape//MYtgZl4KSZBDIwyR/Sp6pARnVE0Zy ySBfJ48ZH/PZ931mH5b6Y/ZTGbtTE82MANL6i4Cq0astjXNlw46EA9E1cSGtap/zNRNS PjUJk0PTtBn+8q+0FwzHkxkRQVujrzQuvPs3pz1YngBH8MpBGPaLexneeSx5gFkt3Lwt SIOjs6E8q4hOVscxpPWYPse9JQJ9DHaXvyzKBwtLRUc0ENmDALobq0e4tnfveDuhl9tD EvLUniZZrPml8Rwi8AOmOVU7JwcKQtVLL4aq6GdPDMcepiAKMPmEg2A3g375Yh5gnYNM JPvg== 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=bad9jM9xJG5yx2xqGsXQHzgovBpCxb//NSdOdFd0RemWuvm8bW99ZWHmMgoKXk7lpE wtrX4tEPJaIq9gqiNIqawmyAkuP449D+re05tlktm8sieidoZhCSGo4v5luzkxBfGYQN QQjmc2wPWwBhmKQpsSd2evIHNuwwp010JYBJwxjMxNOmIXgfr5+tvrqxuXBkajy8QWld h6RIEq8r04HRRIkmlYJYEa8veb7sLwutAxpIEmoTgmUGOGtgvr+7dHItotkUSD+ywoQn UxJUgexpbr1o31Jkv7GHA1DAP52m3U76uvFXtu7K5xTeoMywxcC2HTPjSGAL1cWkd0jQ b/mw== X-Forwarded-Encrypted: i=1; AJvYcCXQz/IYn9gcSez4nrr++uXI80mq9lUMaLh15n1vcZe0sSEQZ161nnl4jxscLj3zdPXqwKhGyGrR4kILV/bpI4Az@lists.infradead.org X-Gm-Message-State: AOJu0YzS5BOJ5vz7JVobz0tAIQ99ET7+iB0qE5FJJpSW7ItERKdT/o3w Yr7EX+aPdUmr8FuIHG0kL9ObzWDshBzftcGQ7KtbjpdNaRk/101B8vDDcL+tFNg= X-Gm-Gg: ASbGncsOa3L2ayd4Ff+E5NO+iqoG4VqP09fzI3OG9kpv8NUfbLuQAhzGKqw1ULaUwGO TkCMsHWIrRRzcEgTU7h4rtrNHztIBz+W2F8J7RO11Y1Gv5AQL/rZZXFcsWBWcjs2EY1N3SlRSPW 37R+Wvh9tURqG+aMGBp29zKalTeaDyzKY0NSPQCncnUz/sCkya5p7IvsaJGZuASdzH0rL04dnoG 81IHuXMyXZGBdtlSIACQbLwVGST47EzxVg9e39ideoHZ6RKJzm90Q6t29QrmiKoEZavtGDS1chh Yl21csjeayEDkGYiUh+N+nrn6HS50KTTlCnyHc/yHNLrVX12bd6Aml0= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080015_142871_B2BA8C56 X-CRM114-Status: GOOD ( 18.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 = { .supported_flags = GICV2M_MSI_FLAGS_SUPPORTED, .required_flags = GICV2M_MSI_FLAGS_REQUIRED, + .chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token = DOMAIN_BUS_NEXUS, .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, .prefix = "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 *desc) static const struct msi_parent_ops imx_mu_msi_parent_ops = { .supported_flags = IMX_MU_MSI_FLAGS_SUPPORTED, .required_flags = IMX_MU_MSI_FLAGS_REQUIRED, + .chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token = DOMAIN_BUS_NEXUS, .bus_select_mask = MATCH_PLATFORM_MSI, .prefix = "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 = real_parent->msi_parent_ops; + struct irq_chip *chip = info->chip; u32 required_flags; /* Parent ops available? */ @@ -92,10 +93,10 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain, info->flags |= required_flags; /* Chip updates for all child bus types */ - if (!info->chip->irq_eoi) - info->chip->irq_eoi = irq_chip_eoi_parent; - if (!info->chip->irq_ack) - info->chip->irq_ack = irq_chip_ack_parent; + if (!chip->irq_eoi && (pops->chip_flags & MSI_CHIP_FLAG_SET_EOI)) + chip->irq_eoi = irq_chip_eoi_parent; + if (!chip->irq_ack && (pops->chip_flags & MSI_CHIP_FLAG_SET_ACK)) + chip->irq_ack = irq_chip_ack_parent; /* * 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, struct 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 = msi_domain_set_affinity; + chip->irq_set_affinity = 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-gicp.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 = { static const struct msi_parent_ops gicp_msi_parent_ops = { .supported_flags = GICP_MSI_FLAGS_SUPPORTED, .required_flags = GICP_MSI_FLAGS_REQUIRED, + .chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token = DOMAIN_BUS_GENERIC_MSI, .bus_select_mask = MATCH_PLATFORM_MSI, .prefix = "GICP-", diff --git a/drivers/irqchip/irq-mvebu-odmi.c b/drivers/irqchip/irq-mvebu-odmi.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 = { static const struct msi_parent_ops odmi_msi_parent_ops = { .supported_flags = ODMI_MSI_FLAGS_SUPPORTED, .required_flags = ODMI_MSI_FLAGS_REQUIRED, + .chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_token = DOMAIN_BUS_GENERIC_MSI, .bus_select_mask = MATCH_PLATFORM_MSI, .prefix = "ODMI-", diff --git a/drivers/irqchip/irq-mvebu-sei.c b/drivers/irqchip/irq-mvebu-sei.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 = { .supported_flags = SEI_MSI_FLAGS_SUPPORTED, .required_flags = SEI_MSI_FLAGS_REQUIRED, + .chip_flags = MSI_CHIP_FLAG_SET_EOI | MSI_CHIP_FLAG_SET_ACK, .bus_select_mask = MATCH_PLATFORM_MSI, .bus_select_token = DOMAIN_BUS_GENERIC_MSI, .prefix = "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 = (1 << 21), }; +/* + * Flags for msi_parent_ops::chip_flags + */ +enum { + MSI_CHIP_FLAG_SET_EOI = (1 << 0), + MSI_CHIP_FLAG_SET_ACK = (1 << 1), +}; + /** * struct msi_parent_ops - MSI parent domain callbacks and configuration info * * @supported_flags: Required: The supported MSI flags of the parent domain * @required_flags: Optional: The required MSI flags of the parent MSI domain + * @chip_flags: Optional: Select MSI chip callbacks to update with defaults + * 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; From patchwork Wed Feb 5 15:59:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08299C02192 for ; Wed, 5 Feb 2025 16:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=byPW6bNJR29pmHM6qNzPiiUHTFPpVNBWTNf2HlLXfG4=; b=r4eY7+ZOwOVm6CoDk62lU+SOGy +zcWO1ZD7//KmfzjwLWTrxujTlhWpsedA7ZT7tcU6jmEL3OWJcQOQaIj2PgNdkZN8ZHVW9CzhovfP w4/lI0Sghyt67eUUj5U1MeQIkOFhmGsokf8sVx8FppEOWE46T126pplY7TYMtQlRrmd3R76WZY/ng /B72uKzBmhYHXl17kykzNejCTUnXL7hZn2NkSE3C13a+Q8IjiXErHDiujAXmZyStog2MUfheN5UIo Amn0LVCWcVW119lBzoMOoJcKL1geT0P/MlWQ9OFe5QWefqZ3FML1F/tEQXjC7ZE6j8fG0tr243X5V D5J+AcaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhvE-00000003uFc-1iiy; Wed, 05 Feb 2025 16:06:40 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpA-00000003str-3pfS for linux-arm-kernel@bombadil.infradead.org; Wed, 05 Feb 2025 16:00:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=byPW6bNJR29pmHM6qNzPiiUHTFPpVNBWTNf2HlLXfG4=; b=YJX1f/P0wAykWmRvqmGiRoTyWH CI0Cq7Ny903Tpm+l1NuhN9Rr6ENuJA7YjpDIyUSy6aWYE2c4AtK3UbDOK2b6QHm+uW//GOS1bdNag fpnOELK2t6z2ASo4FB3OtQM9wPNkAN2hZuQDyanxmTWEI5tJj8iElNfGr+n2bkj3iSEuS0/F/Xzu4 YNL0wJArLVN8uHSY79Ph3PakHOvxGtcV4PXJ8yHlcVtADrZgKmI99gBcGXQUCvaJftDa2Yj5gkkln 3FIaCEQXHshC2NkrHXXOBIc5iqXkWfv/O6WqYX12zquIR6dbzjQ1qw3HfDDUFR6jLSw6GCy3/Acp8 eZDbdkwQ==; Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhp8-0000000GgMM-0dAN for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:23 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21f20666e72so11158895ad.1 for ; Wed, 05 Feb 2025 08:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771221; x=1739376021; darn=lists.infradead.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=nl/PUlBCLxVNC7tgb0QnnyslUK/An1ZWyTl30Y5iPsBEXzNiQcD5hWUPAbyCxD8wU9 y/+tWSZ/wuePd7Q5WYHfvGx0iNss+n2jnTn1ecV3Jppzp+B+ownT0bz8v3rIPKCeNrDD WBSzRcSGNfYGXbwPVfoU7H/Z+NKFU/Mz1Pk+Dhxpg4U327CxY35GCUNPHxVdDE90S0vC zE098/qI0GoW3OOtuTGqWEqMGoHVknMhgFAg3zJcA4+IFqyjE37KoABMvAfQNBodUwHa lkVTIQDx65HCJ/PdXkIFnbk9aLdJLiE77OtqDHxQcxCLqFDqudmTunlGr94WHmLDZSgk FD6Q== 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=wZ4E7ifKgju3CB1eYKGqMsZw1lQE1ODu1Y4lkVKsB/mu38GT67zHopRyKBEiEFAtYZ gw+B42d3jNOpKtwqub/z2EamxVZCXG2vW+pjy4/bOErvi4P28JTx72Tl58G5YNCSbX0Z tL8EP7dBz5y/Fk0aOVToOPUr5cFDRrYj2Ab2DL7n/kXC8jIMLTsrdEtsb2Rc5qcDE3qZ 7FGSkvomlCS3UPzEY1t9PNeW3LV2kfmf4fJ4572Q9P2TQsw5J3jqtqinr6JqAhxDw+DP emU6P/5Ju7OyJv5ATrabXvyYHDKXbrmTgtmR/SwHbAuENUNbTZNYNZuF96IDByG95bpR NUnw== X-Forwarded-Encrypted: i=1; AJvYcCXddPV7mx4zzPsDqlnGnYUgUJqccf5Fr+TD4SckApVsDU0yK7uEOwCJ5aD0amRAXHv9Sy/peF7alai6adN0sHAY@lists.infradead.org X-Gm-Message-State: AOJu0YwJ//UNM0LwvdBcUn090UYOE+CuiLUlXSyCuQ+drj7Q9b2ndTyQ +LmF5DoWT2HkCi6UKNNOTvroMkolTZWpUgewphl1zcnQdTLEJUQu16Ex7LBKrQw= X-Gm-Gg: ASbGncuSpabqSZkyL/QukGMJHqt/R+uxKwxy70SxlT5rO8n7F/WLNCX2z+6xtxffrpz J+ycywD1MlBddjzqAu0fq80Dkk0VoTXB5BQIEEDC+zjsnJJeraB8LqPbeUxnosfjBNXDVq9yl0S X014p5LQAB1EFjSn0zRDhmajowzsdRr4N38qL33nGhzCiKm+QbGu0TKyc4/zyH5SGX3VmUCUIVj APHCMT9VR0fiBzZ83LIsdgxsBVJjYSBBONASc3xrGy5n6jJpbrrDb/yzJ2/UOh2Y4tu/uZgm70y 5P8DEha9jUs6pwKrAvST8CsCZovLIx4GfyQ8M2YeDX3WSo+AcY3fPfg= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_160022_382979_D148B98B X-CRM114-Status: GOOD ( 17.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 config SIFIVE_PLIC bool diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/irq-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 +#include "irq-msi-lib.h" #include "irq-riscv-imsic-state.h" 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 *domain, unsigned int virq, irq_domain_free_irqs_parent(domain, virq, nr_irqs); } -static int imsic_irq_domain_select(struct irq_domain *domain, struct irq_fwspec *fwspec, - enum irq_domain_bus_token bus_token) -{ - const struct msi_parent_ops *ops = domain->msi_parent_ops; - u32 busmask = BIT(bus_token); - - if (fwspec->fwnode != domain->fwnode || fwspec->param_count != 0) - return 0; - - /* Handle pure domain searches */ - if (bus_token == 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 = { .alloc = imsic_irq_domain_alloc, .free = imsic_irq_domain_free, - .select = imsic_irq_domain_select, + .select = msi_lib_irq_domain_select, #ifdef CONFIG_GENERIC_IRQ_DEBUGFS .debug_show = imsic_irq_debug_show, #endif }; -#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 = real_parent->msi_parent_ops; - - /* MSI parent domain specific settings */ - switch (real_parent->bus_token) { - case DOMAIN_BUS_NEXUS: - if (WARN_ON_ONCE(domain != real_parent)) - return false; -#ifdef CONFIG_SMP - info->chip->irq_set_affinity = 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 = imsic_pci_mask_irq; - info->chip->irq_unmask = 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 |= 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 = irq_chip_retrigger_hierarchy; - - /* - * Mask out the domain specific MSI feature flags which are not - * supported by the real parent. - */ - info->flags &= pops->supported_flags; - - /* Enforce the required flags */ - info->flags |= pops->required_flags; - - return true; -} - -#define MATCH_PLATFORM_MSI BIT(DOMAIN_BUS_PLATFORM_MSI) - static const struct msi_parent_ops imsic_msi_parent_ops = { .supported_flags = MSI_GENERIC_FLAGS_MASK | MSI_FLAG_PCI_MSIX, .required_flags = 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 = DOMAIN_BUS_NEXUS, .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, - .init_dev_msi_info = imsic_init_dev_msi_info, + .init_dev_msi_info = msi_lib_init_dev_msi_info, }; int imsic_irqdomain_init(void) From patchwork Wed Feb 5 15:59:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26B2AC02197 for ; Wed, 5 Feb 2025 16:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zXz6fvQA0XjFVpb2cpM8OodOs5mmbZEn6PcelI8ZWow=; b=vOnuG1IKtwoCPr4QARzw8AjnL7 ilg+AgMncwDUO6uAsEe7ufu0quxEqXHfyv/gm4a+iXO9kLn1t2Kf7sNMJ89N7xwgmwIqeVJIdloSG 2z3ePQYHT3PEIFEH7R00I/DV1Oa6fxidv1nCNX6etz7n+WTSLoZ/POqwWik9xtHNMhP1r7+NmJuTq NHkpPN23qRcue9GARsvOplBi/Do+7xBlv5BL/gj6FR7aspdVSmmAClG0FWJdMjA0vrV/x1VNQouAL KIWg4ENq+qD9U9jyi4nQAHqTMEv4VSuBkdhMVwul49cb9dyQ0fFPNkhKy7PfljX8ZUz7ZzkgJCfOp Prso3YSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhwZ-00000003uYS-2tpS; Wed, 05 Feb 2025 16:08:03 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpD-00000003suJ-1S0F for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:28 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2164b662090so135455895ad.1 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=lists.infradead.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=GcGMj1B2FufUiEuKofbveyI/yKlRYdMCuQ5PWYd+zqu/C1qxBmBS2jAgc2kqt7oOke Z8m2h+UaJI4MNcsUDiP4Yf6eUUvjKDvmxURBwP4Bwq7DztEM3WXwYxkUFKBSSFPvgLeu pXmpwJEOJF10NzhHLN5KNfIxTsB4GtqbUW0AE+/+nO/p1v482XjECCtD6osoY5ui53yy EhA/ZsbnP+MJs9ctgKnjp+IHCWVBRyiok4duzZq5Zf9++upKh4I13rRemwOmIPMp+Ob/ 8dyKLv34T8Mr7gY32rh8JUt3TxQg/OxOrp7Elb064Oh3RHGJrPQiTVDKphks6gBlhdDb bdaQ== 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=nmR8yMjaM39n1uMFh1+oL3FDRYnmt9pBZLkM59islGtBOCBzOqzrBe7BsqlfPKDcr5 DwZxqwqC6HGIK84khbBS86/gyETvgDdgQMD02T0MWetbEI6FNNg5C/Ufc+KDHvor3gNd cb+mLOIsMTdlpQXXblJ3KIxwGab/Z/rnOe369TVliqEhY4yzm5wBz9iRm9al+82BVYKf Wu7P3q7S4nDHUKdymQAjqObUnLd3x3stoYZ5mckbBNGGXQ7tuCiT87UL8n9PU4mdlpjZ AGEyISzkuvCDaWHqmqLwpgd308aPNkt1HqCYZn3nJsG4VKoShO4cHEPSbCj/YmAHtR2S 94WA== X-Forwarded-Encrypted: i=1; AJvYcCX4GVMBynIhrd2o/rT4Z/HKN9N9xsCPm6550NMEIuG0d97w9kVWWVS4Y2e78kfvpVuGOFKqjE6lQgiIGQYe9fLL@lists.infradead.org X-Gm-Message-State: AOJu0YzYClloX4Mt4sVuvfnXofz2neQsPkhEhDOjTQTdVS/8Yp8xhoyM rrDoK8k700RI0PaEAed/so5HW/NbsoXJcp/nV/bFBec94V53ux33slA3/X+bhQs= X-Gm-Gg: ASbGncuB5AN6riE/3fK3oZZhHI1fdM9MKf5b8ogz1qJUU12MpqKpYxMx31dmHUu/PAH jgNodtglDGcPQmNml9w5PEwFCXQrem0NXyadeD4Md+0moMMRj6Kgl+bH+jHA0ngs9Xx1UcZOCvc bpwypAfzWOYaJSKMcGRQZtpD6vdFsvVTnbmpYFZAeSHTb8YEjzxf0hGEkrS9vBJnUx2fzqPGklT 4o2uWf4ud6FRmRc9gbTXq0EM+Y1FzP+x5zcPxGI/6Z/LcLX2SAzO1lQmebdsygdZz9PdH4kVVRn 25+iPjnDp4tvP/0mX8JdG0eGfVF4pkKuLZch5K/XHvvP8Y9C3FRCx/8= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080027_386195_221E1BC4 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 irq 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); +#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_PENDING_IRQ) + void (*irq_force_complete_move)(struct irq_data *data); +#endif + unsigned long flags; }; 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 @@ #include "internals.h" +void __weak irq_force_complete_move(struct irq_desc *desc) +{ + struct irq_data *d = irq_desc_get_irq_data(desc); + struct irq_chip *chip = 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 From patchwork Wed Feb 5 15:59:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3883BC02192 for ; Wed, 5 Feb 2025 16:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2MMc9mwT9NVQ5mz2h0GYOBXRUS44hVyd7ty+rMv4eE4=; b=UG+ltpIxV4wRYoy4sFNNZfLpPQ ANovgKve43hCAdbEXD5+8/3uXeeW78pK+br0Isz0xB7+yAXcT1zYIxcP93c1DiZLhggPfa3zaR3ra Det0DetD0KGDMiK5MZ2I+V3IaA4NXlrBpVU1HD+Fdu5gr5TGXR6q3HtoFseBzrwqhPtz56m+yD7EK zWbm0riZR/IaV8d18Yha4l5y7XffHmTiUR0BfM5nit7GZvDIkPjn+xOJ7SCmIqx42lhUO8iNVwp3s oFPoRbRMAjTtwX8ITd4S2/zx+J9n/pOGiUjUTdpClxf8u8AgE7jmA2njFj1dr5jasdHWvHNdmYpnQ 0HHUIGbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhxv-00000003uuK-0K7F; Wed, 05 Feb 2025 16:09:27 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpK-00000003svj-0DZG for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:35 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-218c8aca5f1so49719785ad.0 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=lists.infradead.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=ILo+grGQIs16tbSanD8v6mZwUHlllZhrcY6rySUQhlLj3NEJSezHps8pTuAeoK9+sL UIMNv+rHkXYW32pa+NVZTZMKFxYneMQyDKkHbO29nW+/4LW7QlHXKr/CGoIvNk+P77ly eERz6CbO/4pRXXWalRiw8CjEEpzXwWIXqFJkywdy16uzDf6bOzbEnzgvFRRK12QJSnAW YlxnOZQO4gQbqIQBZSQL+BhuT6+rGK/VcVcLxvbpHsEJ0Ke6aordW1+cya+o5+gspVnl ioAf2azMi+aRo6/9KgIeUbl7Qhm8beHCawR6UDhflwtWlNx+ul2xrb0J+DEr+O1bPE6Q H9GQ== 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=CdsqDfvDoV5fQQo5vzkWoQqJRPJrbOvdLiWRDMBP4TGWFfMszS6IaqJCZM321eBhVu dLeiwgDmmfT3uwvNf3QLHrtqz96p7EYEiKzEigr5K372ZfZzHRBF20zJ4aGVou8UOvdF rweSJufXfcDaEOSiFf+WmwC33Be03+AcHN6k4PSmcvzfP5trOCiKh7XxblzV8Xa+zxGe DQgoNBbAWbcpEpbNCV2wSqV0z08i1ZgSuRFHryyUYRQwLqQwksgrkO2cJ79voypZVBXe D6W26IIifVEyNwENpz9gPaGfrTG9txTXg1zX+hnuVMFXJC0tZWwEN5/s3tY51nL0BbhL 4gKw== X-Forwarded-Encrypted: i=1; AJvYcCV2cwxuRyyfToWEJ4dJ/UedvCJAV0ohfrFDfjkupV+rYWGWzjPpTsCh/GbUUhjgXmMLajwkGqUMO1PVpc+Pcj+P@lists.infradead.org X-Gm-Message-State: AOJu0YxyerKbqJ1ydXwsoTRJfcjTfDogSvk3RIfjKehNndkDQoE28Fud Zo3QjY5gZisxTOepYLxLCf/qW/fKmLMct5jdMFEkbafZo3TqR4v5DdWAqL9wGXg= X-Gm-Gg: ASbGncvc4MoNFO2p5JUEoiz/49GkJFxPTdL7CBowUW5UQYILNWDiS1aTGPFHDK+b5hb jgaZebzCaBrqRDnuOh2YgRVTsLCbcQBVoTfMGr2GoZ0mG9qp9f5MSqQnwp53rSNpqFdFI8QD16m EpTj4/uGb/mpj/5sohx34Nm8BlLeh6iqFS0bTp/GFSgIVIinZeojGVLK6sSisRI6wcbvIWsQv8c rcgrJ+YQsO8kqj4LQJWiqhL95WK+3ZLpreAcO7+wAuA82udntu1NFWrx1tIyy0hYuaaWbDWDvF7 YjUBOhwT3rlpkeN1n4v59eyzwC6J8k8hgnD1V3QbTOmJBcDSUCyVV2g= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080034_107163_4E191581 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 #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 = irq_desc_get_irq_data(irq_data_to_desc(data)); + return irq_can_move_pcntxt(data); +} From patchwork Wed Feb 5 15:59:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961570 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94725C02199 for ; Wed, 5 Feb 2025 17:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+su7Pdf8Wu86Zcml4faTN2UwZ+oipeVYumq+PsYwErw=; b=bJG3pS+a9sz565u61gk7IP/VxY BwMu0/5pa22gB0qNBnvo+Nm3AP64Dx9j1+++h8BRngsSJf2tU9fREkioJ/owQHKUsTPQwhOGfsQzJ 3EbOqBy/kZi65fgz0jzMUhOgU+6PEtVEqGni9HtRMx7MEszrChdSqU4nhvlK8VriObba9pW7LfYyi vLIrt+BUnslY/RnMm1CoOFZ3fJcgIDDqcZfXFphYkVdsKSMn5K55M4l16z7Lu5fdliGQPkHU8jBVf NvDiSLsNw6MOo8BcPy4eu3F1ZZCx3S7SQOB+NNilISGuLk/ePAE6ZKRvd63jRMtYju9hzzmxRtJ9Z Dg/ndEXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfj0W-000000043iw-1MfA; Wed, 05 Feb 2025 17:16:12 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpP-00000003sx7-3pUq for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:41 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2163dc5155fso124422445ad.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=lists.infradead.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=PopthXk4VsAXJfXDKGFYACxrpK0atlNg386cfypxV4QUhp/WLCgFiGiuXuSMViWK5n SR+8c+82WGZENM/aBDhIE2QqusuIgqdPHJH9el16gQyPdIxckP2BDAx+R1tHob5PGN7C d+dM0RcuzbwD2X7169332QV3AUSSZHoQaKuEDyc1LclWvLQRzvczcY95UHQ6fX9qjteK Qgh9lAfmhDuEq5sxyVoO81iXsCITD/xXjltWmADmwpwwuBOdbA3yDdXQE0eCTHy0dwzm /DKRPDHh7S/Mk36yoGLxmpDQrfxv18fnjEutxMeMUX5Y7fNvrtZjgEC665qhYsp8HCUT go/Q== 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=j6/WKdhypBNyObFtxY07+AYSkHPRm1RVPuFctfROlrpUwLjfK34Ljo23T9fOc8FPUl 5ZsgdKZKrfjhEdZscBqSHOCzZMeniumFnO6T54QbtKdGVEABoSU00n4aK8Tao9IIB9xc lchWTRN6iEOnackVWYTXw1+4BwfFBjO8fgwk32PqBm91rDquch1fVYSu/u0BumP34JZD huN/Y2QYp9yLQYzWbsOV7S+d+BrECj17W3yH1DwV7gUMRVJedAardcMOIXdCq/5IeF4v UHfrmpL1lYEeW/W6N2r1IvBGbx+s/wnEP40x2J3MuGKTVbYu40eBUzzu/DvXleX97UMl kuBQ== X-Forwarded-Encrypted: i=1; AJvYcCURt+nKV6SMX7PtlPIn93XC9G5u+LdOeERl0QS0OD9PcpG0V0XNNRx2zOTBVoWU27K/ZrAken+kQiAIlFwHj6KS@lists.infradead.org X-Gm-Message-State: AOJu0Yw9bmxzQp2K+clknq88FoqfzXV8pai2G+Ps23FVijCP+CsAKv8d TWwMDFDaklgZP455Ot9Z/lnVbl6+iCdImBVVU9tjHQUxbD9Tvsrvt9ho3ToOoCE= X-Gm-Gg: ASbGncsYmOMOIYgqH4sNB2Z+lD49X3DVOXLx0Ym8/0Sg8u4bCJxF3We/rZ5ijPRmw/D VfE/MO7NfLFZDwFFwhA1DWdaWPy0HFmx+rP9fdGrN73ynCKAlqvkYv4vm5tgrVLkxRwmnAR8qH8 T9IIImka3/5cxtcjoLdSBpUUyTYLm3nR78+AvCuS5VrUWrliIYx2A6LIj2UhdJYl72oxQCgWzX1 QJ6glgljbcc99GV7ttskPjsSGfqyaW+QrOjutDfAy2R61rVUIeOU62N1qRvnSQP5CZyecTB/jyl SNhRRyOTf3c264pXAsadWW3iqxVb0tnJmbqf0edSyTbBKBqzsI14nmU= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080039_961063_8C1A93A5 X-CRM114-Status: GOOD ( 10.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 -# 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 From patchwork Wed Feb 5 15:59:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81C51C02192 for ; Wed, 5 Feb 2025 16:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JBZXTbuS/jzxIISJXLRWUHAJ1oANsva3E4CzlwWomJY=; b=MvIrEB2G4T0hVr+aRiW4OB3gyV +n2Hs35lakKoKQz1y/TdMWCqmIt1EMi3baMIB36zWRllPkoArYzzdlMFLy8caInpGxOr8uGWDz9EO uZ38e8AlsHbCfWt3iFAN3uluu6yEGRRAW2FKE3+1aPKi3d+FJbz4x9Ypc0Y4SknplyVzKzVbU5USe PYEZIt4OKPoUPm3wvjZrpmpgOnJXK3z3+tKSaT4kyu1DHT3Mlpp7QR0AvCltSDKGnl23uMbNyPvc0 +5BH52y2Bq9TahdXzIOtTJ2iFxz/8sZwYOdtHFcJoq0XBcT6NkJD+b3Im896gPYnou7VNS1JvXS/5 Bl19K8Tg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi0c-00000003vR1-047j; Wed, 05 Feb 2025 16:12:14 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpa-00000003t07-2B6M for linux-arm-kernel@bombadil.infradead.org; Wed, 05 Feb 2025 16:00:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=JBZXTbuS/jzxIISJXLRWUHAJ1oANsva3E4CzlwWomJY=; b=SI1+gnOISvhxghplSkG6/OYRLw URSirxtdwHQEGS6KnTMEn6coU1qNcJ9nZ3OSEZQHFqU0eytWg4w18i8aPkvgTxycuE1lPJOJ0vUug eZ2iRvJMl2LW7FqhYBezZWyCDeEq1Iu/HIOmcPhUQV8wdxtRx8oxT1aSg45K2VHJuWzhgJbCzednV bmfpSn6FVGr9M1lVIcXA38taDotRGWrxBUUufnQyked2Jaw/orO+0dPN1nbEYGVp0Zi9qu2d5GBHv 0RoQfhxMgh0cq5B4qqS1bdk2VpQTpvh67LhwTFnege9aSecJ0/FQFRVkpgh3ZZm1oY7uFCZPA6JUD e++4Hzvg==; Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpX-0000000GgOR-17fr for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:49 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-21f1d4111d4so10179715ad.0 for ; Wed, 05 Feb 2025 08:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771246; x=1739376046; darn=lists.infradead.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=Yffj1+cm7XSs6dIq+ltL/1dg/LPVgHBTboLKIEe6NwnNoGz7IPLkwGCbF1dqfzWrs1 HP3wZELgn1RRDk1m4HNj3VAVwY9OnbtXHdvdcXUmrrwAIoZjfDMT1wynoNau92QL7t7w GxiIexbRDahF2gD/u89ghWbGkc5TQfPmmWkxggt25NQ5A47EmFlHc/5l5mhydPE36G0X sVNRTRBGqbgsGhatVGXEbmsDjepcGIHKBc+h5tcywYk5c91P77B4/cwllitctlzKTYMi 9sWhZlB4SkNQs8yXIBMkfo1EDYf1hkL5uffYNSWQTvOmOYkCSpbQwFR+CPrtdSPym73m /1TQ== 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=D5zwdM8Kb2jvKJwYpxYWr0HhXJtyPWGs9SPGpmVxpQKoUobss93901HmkiGXKhyIt3 5/hUcMtfLmpHgwjWUNI82W0gPa+l67u7C9xU02gKdAHx6H0z1CWdeRJBREcKOYF+qvNY 8evmRIi6Q4rnxWaqod6jT6cDssNIWtkD+E9Mj9oYxYPwTe4A0ekOJ9xAMF7Mzm8bKm5r 62AEUwnljKk+gw9hCX4Smjb/iciq0KGrlF33sNysQ58tRHut5uww9SD/l3SvUK1ptNtf H0HvLSFvTQD+H/+fnyxoWyPoXavuwZKKEjpKZrk2nNCwT3/x8vjg9ipSvK/wwlrNmQjF WSYg== X-Forwarded-Encrypted: i=1; AJvYcCWc/ksh0lKrk7kgxlWo1Zn00tZzwY6w5Uz85tr7pNv/Ba9ibdzK2fRRJlbTVu/2/bxWTKWjL2gBubYEvA70fck/@lists.infradead.org X-Gm-Message-State: AOJu0Yy89iqJsn73KD5AxWXDYmNZN5iaZ3MFzx6xWZSCnmyFJ/OPwArw wl26Llwk9HUlaBvKIis7pLDoZL5j80U1LoWiX+M7IBEITvElh6Cofq+odJBjpc0= X-Gm-Gg: ASbGncsGuzF+f2f0wTG1b7Nmw1rTLLgr0APW/Q0+0UuqFL/5bii6jBeWybJSWPjsdQP 4aX348VsxeFAmuMHKFYgqtvLboYjIt5PD9x2VC+BbWx+twr5H8ae0/K4WHIy5BcjPnHFVjJlUgF v1w8C806Q9FNS6jywIjAnjj1VrFd579MNEu3kXiYEFNbDA5pwHFAuQlUUpGS7qWCh02LciZQmyF HJve5ri1aJ8z60Tut962tbViobEc+uTmJc4aq805PKQOusiHPlHT12Li/E2ru4U1b2dkWSP6C8d w3YF4lioYblkAbnycmfBdPNTRUUGBxuXcmRLHM9YJiTzIaL6l9Wn5iI= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_160047_863015_9BEE9675 X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 From patchwork Wed Feb 5 15:59:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B126C02198 for ; Wed, 5 Feb 2025 16:13:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=li309BKFytEFNs0s+UiLLaDTQ3aEtuOmqKESJ/Lkwhg=; b=Z7HKhDZdL63yKXlrlAB9eShAoK +FXHWiLcL4dmUc4oOtg7Ll+fNZwE2n/f//HM4Viwznf4TE2scv/aQl2FvZ4tB/6Ip1NlGfmbQ9xS4 BG8AmCcIbNLHsxEAhH7mnPIc3gMACnE6FjnAapJ1iRzu5PiT5oC0ZJ4Spni2rJXL7eS4Od1ADOQPz ogXWmNQ05EJkg79BTDziELKLN5Y2bTOaNcXonqfZuscBg6JUa0OOB4AExLJh8E/COff5aL05kR4YW wMfDZM/v54Lehl5jUjfWS/qx+8E/52u1+wrpt9GtUruCtJns0pAffA29dQa0BJRHl0lCE/LRq/z0v trnP1NNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi1x-00000003vmi-2PsQ; Wed, 05 Feb 2025 16:13:37 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpc-00000003t0L-41Ie for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:00:54 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-21f21cc7af5so9305255ad.2 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=lists.infradead.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=Ev8UgB+E3/Gx7CaZjQ7aMyE6bM8JleSic5Fh2vPrbkba8f8ajYNsSp7vswjv9BvF0f sATSHd5OykAS61v5FDflYItDLRxmS8SYD2RqLp8lUGaf+9rqYea7z/UiqP2jWN8i38OB 2ly6Xm2n4kW45JK5EhcgG59dNQPDA6RQQv6GC4PM0iwbO5Z1NxlkQfhr/TGgvmESB5Z4 sysazVAPMRxpTIuCdQAywDh+NjFdbJEopENV6OJP6YjJnvMqeehoGJtQ+iBxORxvZzVJ 8akbRBQtt9bZaGs9qOOEmPoQpllvs6Y2Dm0Jq03wwaq1TClIe+ukwFZqrtuyQDOREsGq jrDA== 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=IJh/mZO80GRKbw5GWjeEqM4c2Q7/cks9Vfq6tO4syPWTUfLvEQEvRVrVsEZXnZ1fNF dF24W3B8tHTqmFgLPOrZMDDgaEeSAk4M7VTIMDK7YN0q2txfvrg+qJeOBbVzkLYW+8Rp fykMNWEpVwmc4cRzGJxHWVQ2EuCK/lca04PIoTRPAh7rTP3hJ1izfnH5/OtC4j4vs+1C 30uUB7Z3ApmkBF63tsyxRkqj+3SjQcZonot5M3I2hPU9x45gM+drbSpng2eGA9G6aMSc s3f2PJiAX79Aj8DZj78OcQiXBcGwxT5qpQX9nRXK0X5BcPB/9ig8UNraZJJ5LDMfRwSX hFNg== X-Forwarded-Encrypted: i=1; AJvYcCUaBqK/UrKX/p+/GxAM8pi8cKF+78dsAhXYVuTNW+HvxTMUvpwPaeKCYw4p7oo0uJmxW0JhKATDtJiiyCqRi5XQ@lists.infradead.org X-Gm-Message-State: AOJu0Yx2N1yKFxvTTdkp2rdHo8RbkDVz4b1WGkYrj81GTJhEDDGRWOAc cXVSEWxd/gH/oc+uX0/m3hadRF47Mr8uiJVnvd2mAU9XuOj9tsLZm6quucqHlrM= X-Gm-Gg: ASbGncsLItYsjLbyqdBaoLNhYtStbiMrTdB4L6JKvQhzA+MgL+FqubuNyB5VOJdo8D7 j08viMsXTQAAajj+bwf6gChkwHyPB+wQR6izTpy2zRxSZlOzsryL5pL62YJX9hWFbfto7sf5FR5 yOyCtXA8eYHD8Kw3KRP4uEn6WEZNFTJp3jlxMx9I7FZmW7RlAIZI/47kqpvFzHvnPG7s9W/dEas MKBrkJ623eXFbm3Osru0u6hx7ZhFCmVn56TGdWp6wIkon8Sn4/NJXLHNtKw7Uvi6FzDtlqRV2Dr WhhPyE7AgPo5v7nrgr+B38D4OvuHOhJGskVonAnxD5fn3Zog6o9RSnQ= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080053_003487_1535C61C X-CRM114-Status: GOOD ( 25.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; + /* + * Process pending local synchronization instead of waiting + * for per-CPU local timer to expire. + */ + imsic_local_sync_all(false); + chained_irq_enter(chip, desc); while ((local_id = 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); /* 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, unsigned long num_id, bool pend, } } -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 = true; int i; lockdep_assert_held(&lpriv->lock); @@ -143,35 +144,75 @@ static void __imsic_local_sync(struct imsic_local_priv *lpriv) __imsic_id_clear_enable(i); /* - * 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 = READ_ONCE(vec->move); - WRITE_ONCE(vec->move, NULL); - if (mvec && mvec != vec) { + mvec = 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 = 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 = READ_ONCE(vec->move_next); + if (mvec) { if (__imsic_id_read_clear_pending(i)) { mlocal = per_cpu_ptr(imsic->global.local, mvec->cpu); writel_relaxed(mvec->local_id, mlocal->msi_va); } + WRITE_ONCE(vec->move_next, NULL); imsic_vector_free(&lpriv->vectors[i]); } skip: bitmap_clear(lpriv->dirty_bitmap, i, 1); } + + return ret; } -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 = jiffies + 1; + add_timer_on(&lpriv->timer, smp_processor_id()); + } +} +#else +static inline void __imsic_local_timer_start(struct imsic_local_priv *lpriv) +{ +} +#endif + +void imsic_local_sync_all(bool force_all) { struct imsic_local_priv *lpriv = this_cpu_ptr(imsic->lpriv); unsigned long flags; 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); } @@ -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 = 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); } static void __imsic_remote_sync(struct imsic_local_priv *lpriv, unsigned int cpu) @@ -216,14 +252,11 @@ static void __imsic_remote_sync(struct imsic_local_priv *lpriv, unsigned int cpu */ if (cpu_online(cpu)) { if (cpu == smp_processor_id()) { - __imsic_local_sync(lpriv); - return; + if (__imsic_local_sync(lpriv)) + return; } - if (!timer_pending(&lpriv->timer)) { - lpriv->timer.expires = 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); } -static bool imsic_vector_move_update(struct imsic_local_priv *lpriv, struct 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_local_priv *lpriv, struct imsi /* Update enable and move details */ enabled = 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); /* 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, struct imsic_vector *new_ve * interrupt on the old vector while device was being moved * to the new vector. */ - enabled = imsic_vector_move_update(old_lpriv, old_vec, false, new_vec); - imsic_vector_move_update(new_lpriv, new_vec, enabled, new_vec); + enabled = imsic_vector_move_update(old_lpriv, old_vec, true, false, new_vec); + imsic_vector_move_update(new_lpriv, new_vec, false, enabled, old_vec); } #ifdef CONFIG_GENERIC_IRQ_DEBUGFS @@ -386,7 +423,8 @@ struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask vec = &lpriv->vectors[local_id]; vec->hwirq = hwirq; vec->enable = false; - vec->move = NULL; + vec->move_next = NULL; + vec->move_prev = NULL; 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; }; 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); } -void imsic_local_sync_all(void); +void imsic_local_sync_all(bool force_all); void imsic_local_delivery(bool enable); void imsic_vector_mask(struct imsic_vector *vec); @@ -87,7 +88,7 @@ static inline bool imsic_vector_isenabled(struct imsic_vector *vec) static inline struct imsic_vector *imsic_vector_get_move(struct imsic_vector *vec) { - return READ_ONCE(vec->move); + return READ_ONCE(vec->move_prev); } void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *new_vec); From patchwork Wed Feb 5 15:59:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4E2DC02192 for ; Wed, 5 Feb 2025 16:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RoqQmmMLZnhmH7e8y5iCPOfAA2UjM+1/YD5gOA06f3E=; b=VVRKjs6vJl7nSATHXAWL+0j0EQ r0G/bRPvSp+hKcd35FHSeszC9VliR8miQOQevteSHFTUF0gYsdVS9UK2vvTI5EfGXpME3xEFtrDRp tQfKEVk/g+xMltFIMfm8wiaTBe49PFZ93d0mZgoOzl9d0J1Ey9PlIl5QZ6tDjnOiL3zM6nilCgGCC oF6HHNsUGbdEVffgR7+X9PiVyHpzK7jiTTAsHSq/FeRV+1W9F3JtcOui9PJXpk6srrX4tJqVjZH+s jt6ApJ7CTa+/CRt5uxlhCbWsuI3BFEZ9S58IPYa7fxjJamVzagwwS1pp4M/2khQVnAx1Dj+kpIO21 k5MYfq5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi3J-00000003w30-30gu; Wed, 05 Feb 2025 16:15:01 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpr-00000003t4P-2wse for linux-arm-kernel@bombadil.infradead.org; Wed, 05 Feb 2025 16:01:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=RoqQmmMLZnhmH7e8y5iCPOfAA2UjM+1/YD5gOA06f3E=; b=Yi1TpON6QPCnB19z0FeDve8asX lz7QSI19cm9wnli/iUuX4entKdiAwKPa1ApDvRKh/VO/5xmw+ooXqV94ilOzgl1I4wT+164+RrUzw VICnPZoBuRBoEX9IeVt+cXvWtGWni/tGyJhzGH1vyNIz1hWLvMCTLQiytRJaTUNMXHI0Xjz9Ga5sJ b/E0nY2JV3zRYLfC02lBWKGFBMhEDUcYg4BBvk7bGLaEhJBW9AZ6mu74S/OjpRX8QFzEPwyDU8sLq C1oM3Sy1pJJcJOzRJlUXwetI74lZ3VidgfACarAI9PFB7NRDYjpG+KjBX42Dny6I4jILhFz/XgqIe cCWZyWvQ==; Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpo-0000000GgQX-3Tl0 for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:01:06 +0000 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-21f20666e72so11170805ad.1 for ; Wed, 05 Feb 2025 08:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771262; x=1739376062; darn=lists.infradead.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=KUOzjZ3pk/WuctByCJugIn0Yo+ZvLAGlAGpb0MQbW1f35ZXcrM8r4makroiw079ZCl w75qsY1JhDbdhNo47FAkkiHMbPtOs0NuI1DL51DuEr/ytE0zrbKtqW/p2hmtwTSaWK+k Bg5BTQPSr+ijxnILjs/cu8ltkfFvPwz7Wtkcum/hTeqXClx2oJxw8z9+vnsoFzhNuLg5 881Fxs4g9gk3lQ69mJXQ+gl7HdsQRqKmRNZXDyOJQlMjX2BcUT+94/q8XSGGZHhuRFWJ x6GNrBJQB6GQoE/bv8wm03P1wD4mxeK6TQiEcLPJ+K+Nl3LyEABCGE8Qj+m+3in+bu5y eJbQ== 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=dcdxa3600oINcXLJk240HDxT1r53P5hO29vkGEMtf9RIltkUGTzwnMPRiaBUwr3Fpg rGX1Ttl0Rd6cdXUKiKwMXeWGhRjJ4+QADNUPQs/YatIuTc+hZXHOQwKrXUDHq2hSIyIw /7oC4c53g0Do0eGkwZ79t23egV1wBTST5G2rDX42JY4AysDSgpG7Zc4X8xXkQW22ss4R LsU4SAV7aZVZBQOoiS7aTuEzMR6zB/5lP7lRWr8yfK8Keop8QS7sTb5QdXFGe3ZF7nYW UxbZaqc3ATxnFe0SGvvH8XozXZVwqTKOn1Jaujdg5qco6ImyTf+H+vZhXO2nWUiQOx+6 kG5w== X-Forwarded-Encrypted: i=1; AJvYcCVCzOb2lQiSoDieKBHjQK5XAsIKQR80AIzABi2u4jSuwJBJdIxRc6SxHAQdzL2NIca0Bz/4dANzVjXO7VZ7/cew@lists.infradead.org X-Gm-Message-State: AOJu0Yz28MUUtkLi8efDRqDKH6Od6G9r1HVGCpXeMzsneLK0N+egP/+j ryAQ4eN3vPRM57JWH+lZKf5lErbJfVB9FHv07nWrcP0eepMOS8aasf0fHEDe8So= X-Gm-Gg: ASbGncvM1o9NOMzjXDfn4YwuMgZJVimpqzy4jc0RuNI9dIB24Ps8cdDsIT+Nu/4xP34 8BxY0EtDGBSze3ifeIzUXgeKnAhXl5hecsDgg2oCg0xu6HmYWfh8rynxNeZnPj3k+nfNe2FoOIQ 72R7Wgo5wxkqjEdgjvk1/RBCsXTCAvrvOlwK8pL80Ymj44CmeqzPEOe9GXi5GbopLnoQbcY0cPE eGWQOKQsuFZ/x5fDjh64HKgRKovGX6HQenbz2crwefhmDIC1zmPoRXY5xZ9jqopTOC/nTVRBGAe qCi2DyaWQAUX+0lCGAvaK1GrOKV5bsj/tiZyqS0NNQBNouDwfzksa4E= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_160105_038654_55073779 X-CRM114-Status: GOOD ( 15.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/irq-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 return IRQ_SET_MASK_OK_DONE; } + +static void imsic_irq_force_complete_move(struct irq_data *d) +{ + struct imsic_vector *mvec, *vec = irq_data_get_irq_chip_data(d); + unsigned int cpu = smp_processor_id(); + + if (WARN_ON(!vec)) + return; + + /* Do nothing if there is no in-flight move */ + mvec = imsic_vector_get_move(vec); + if (!mvec) + return; + + /* Do nothing if the old IMSIC vector does not belong to current CPU */ + if (mvec->cpu != 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 static struct irq_chip imsic_irq_base_chip = { @@ -137,6 +168,7 @@ static struct irq_chip imsic_irq_base_chip = { .irq_unmask = imsic_irq_unmask, #ifdef CONFIG_SMP .irq_set_affinity = imsic_irq_set_affinity, + .irq_force_complete_move = imsic_irq_force_complete_move, #endif .irq_retrigger = imsic_irq_retrigger, .irq_compose_msi_msg = 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); } +void imsic_vector_force_move_cleanup(struct imsic_vector *vec) +{ + struct imsic_local_priv *lpriv; + struct imsic_vector *mvec; + unsigned long flags; + + lpriv = per_cpu_ptr(imsic->lpriv, vec->cpu); + raw_spin_lock_irqsave(&lpriv->lock, flags); + + mvec = 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); } +void imsic_vector_force_move_cleanup(struct imsic_vector *vec); void imsic_vector_move(struct imsic_vector *old_vec, struct imsic_vector *new_vec); struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id); From patchwork Wed Feb 5 15:59:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D39AC02192 for ; Wed, 5 Feb 2025 16:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=2uqH0LlhZdZ1/ZJgerOy14gnMEDsVqG8t0Fz3f/FUy8=; b=puF27MaddMYYTAweUvYkfXGPRC fF+viQJ2ZsQrxmUyG/rWML9zF+wJq2Rql30okYixUqqQvQa2mrnociXpl8GqNgy5kKVl5clUPGo5i OzHSbY5k1HNHinEcczxQbgj6u2NiYndPAyfKFywHb0rVLU/AZ5cAn2X1SmfC6NgSbMB/JlCZNl9tp TPF7OvC/9FxsnKOK85pQ/9PQZdi0m3pAlGBiaKC7sXclpwS4EAVLhD7ov9XR1CxrjXPGSevYoo0n2 GLlaytIF62ESJudOIkgApXe047Ysx4pymp9Lg77TEngIJp06NCKy2ojk99lQXXcbznX0Yi6xEObc+ BHZcyBZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi4f-00000003wJc-0BZ7; Wed, 05 Feb 2025 16:16:25 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpu-00000003t65-01l3 for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:01:11 +0000 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2ee9a780de4so9429761a91.3 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=lists.infradead.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=EJHUaDgVXOk6ExS4Lb3q6IogKQhFxky7eygMQFThZBVrZL5CVD3c5DI41qw8s9urF5 mz42FHKXVCbW6YskN89ZBPZpLAhe2sQ/s16qm95zCWGusuhH7tzxzgIlMqVw0n/MoBRD JL8KA1KLnFWWZ0BWgi3eFQVsLzEXpDpolvLzmGSfMnjb/vFcfNSlXjKB5SD7x+doWWVr DIO/2+wHp7r8Szdc2IA9Iwfjgej+yNOcT/OYI8xMAm4a9vmkVmrXZWlQrPVMrQAxY4cH yJlCTMem5idsUJ5lvTWR3GXvPXJ9UIaeEVuSuStGGrLVCgNtjbj0DjZWNp0dU6vo/DUS HGWw== 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=ZhNN7QST77nv9DUkGsdzT0/EqEyZ5FIuvYgyCon8W5iE4vsuJGuQ+gFtjScHQdnLAK IMNpB4il2dxaPHdlOy0LHVydPq4CUpuef9WnqGdMalyVVJSbwSc/t7WusfmHsQWC986y JUM3m123/BpWcSB9BgCwsnJxr7sMPJ1MdZS/3swFuUwVmncYv2rWuaF6hnlsTDWGcAmE JX0+AY65ws5TFZhzPrndAhtFAwsjaRjregA9vW29i/jDHaH/qHA4y8MuaQ5tQePjFnsT 0oP9utDpWtIcO5RUz0qvwDEmGR7OLXYn/afTs47K6aRi+DIXKA1ng8Kh4CKhBPUg3IFL dt6w== X-Forwarded-Encrypted: i=1; AJvYcCWJgr50W7jgcq1wnDQQqH/Zt2y80ZRNsyRLRH5HKfrzfd6kNG+z4hEjaJOjbTlEMMMKPCNrmnHQhomkPNlBcaZk@lists.infradead.org X-Gm-Message-State: AOJu0YwIHpA22Nk3lYaHGs7FrlErSCXKm8Z1b+u0mxJI28BFwnAb3j2Y 0sA3gIg5P90ezpirFirCE+L+8waaN3kC8hTkCk2++sdjGFU4vHF3Ub79FCgzxtc= X-Gm-Gg: ASbGncubZPFfvtsi5hUZsyszxsIiAH4TpGQ33be/OpO1O5d2vOkctEJpaZ+2XhFDku4 VBjU9ANSxz/MtmVdjCOsHKSlpnxQX55SYP7CGPyLtFtKckF1p08tDbmtHflKe6fSNPmahn4QqTF YFkPolY80lnqdrzrheK0Uegf5TJZLrMFa7Fa8ZVFHCdK1+LFDbQJbzMXztSKNNRJSxk+Khn/JT0 TsP23et70Rt6CcKhJRqiRiOkfVlCyALW3MRHVXgBE5BD4Z24hnTAoZRF+j3SuYevYwyNusGhhRD ldwFpxV8h32ZkqC5X5OMZRytgx7GMPRlO8sJZXQhl8WYt0JCOBMVgHI= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080110_046997_350BCE4C X-CRM114-Status: GOOD ( 18.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 = irq_desc_get_chip(desc); - int err, cpu = smp_processor_id(); + int cpu = smp_processor_id(); struct imsic_vector *vec; unsigned long local_id; @@ -103,9 +103,7 @@ static void imsic_handle_irq(struct irq_desc *desc) continue; } - err = 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); } chained_irq_exit(chip, desc); diff --git a/drivers/irqchip/irq-riscv-imsic-platform.c b/drivers/irqchip/irq-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, const struct cpumask *mask return -EBUSY; /* Get a new vector on the desired set of CPUs */ - new_vec = imsic_vector_alloc(old_vec->hwirq, mask_val); + new_vec = imsic_vector_alloc(old_vec->irq, mask_val); if (!new_vec) return -ENOSPC; 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(unsigned int cpu, unsigned int l return &lpriv->vectors[local_id]; } -struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask *mask) +struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask) { struct imsic_vector *vec = NULL; struct imsic_local_priv *lpriv; @@ -438,7 +438,7 @@ struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask lpriv = per_cpu_ptr(imsic->lpriv, cpu); vec = &lpriv->vectors[local_id]; - vec->hwirq = hwirq; + vec->irq = irq; vec->enable = false; vec->move_next = NULL; vec->move_prev = NULL; @@ -451,7 +451,7 @@ void imsic_vector_free(struct imsic_vector *vec) unsigned long flags; raw_spin_lock_irqsave(&imsic->matrix_lock, flags); - vec->hwirq = UINT_MAX; + vec->irq = 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 = &lpriv->vectors[i]; vec->cpu = cpu; vec->local_id = i; - vec->hwirq = UINT_MAX; + vec->irq = 0; } } 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, struct imsic_vector *new_ve struct imsic_vector *imsic_vector_from_local_id(unsigned int cpu, unsigned int local_id); -struct imsic_vector *imsic_vector_alloc(unsigned int hwirq, const struct cpumask *mask); +struct imsic_vector *imsic_vector_alloc(unsigned int irq, const struct cpumask *mask); void imsic_vector_free(struct imsic_vector *vector); void imsic_vector_debug_show(struct seq_file *m, struct imsic_vector *vec, int ind); From patchwork Wed Feb 5 15:59:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 13961498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A5A5C02198 for ; Wed, 5 Feb 2025 16:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KEjndyBD35lV6nr6NSLWRRyly4db2axy7koFOHZTKsQ=; b=0VEAJuqHxFicLjeyswpG0Arhy7 DGd49g92P11I0e6rwwkoaP+wVHe3Lbnf1/7KNmGNpwiL+QIpg9jL9Ddh+n7pYXSTCf92rDYKCOBG/ z8dA5rOEXfi7l5h6yvrJsxIxYUaocXZa1EsicjUBea3hJkjPju+YL+VBg0V3Z5cRitYem4ImjTuMr azQ+VjsJU0AkVMrwswq3FD5vR2P4Xnig8L6YZRh07Wv3WYwfZsbUvRKbjoUrPJdEgkQOPeEbSnq/N n7pyZPcvzRzemIhSmsaon5BOPG3cMuZf7jvaS8hj44U+lDUaux9aj6tlyHxvCQGktcCyD1hn2HA3f jmv8W4pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi5z-00000003wUF-3OWZ; Wed, 05 Feb 2025 16:17:47 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhq1-00000003t9d-3af6 for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 16:01:19 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21670dce0a7so9323815ad.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=lists.infradead.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=H5BQ6EI99cXdEEb5C2XpukoPYtVv6fMXEktKC92eLO0CPcUqEj8FD/qB5b2I7YG4jA t0wrc1577LM0vUrClIr3nUd5jlTdld/LtbpcSM2VOv7QVvVrG5uz+76dmhJOznoaH/ST Q1ClcjVyLMizB3uix2L/Pjv5aeAX1u9MdGax6BYar8wqsqBbxDw8xZxghLw5d/plrLNX EmMmwgc1RXpkRjsVXkvFSPhF+YuOVjlBmRNmHn8FhyhHZ2+9OC66aJQ+9xpghIawidxI sGjzKij/K/UaNX4LRq3oGfkYsU38JyRCm9LnJ+AAlfDVjf/Xge2AhLQqszRWMMiWiUWh kFLQ== 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=BRV80gv5Rs1rr2f6lfI71n/vUjpzTl7tiZereAc337cglZU3cnkwmW/u/zEWOWXN6B Hf4fE/hBiaHIMsJGa3Rm9fPqAwVS2B1AK8XbptdCUfCm8V6hZFsOigyhxjzCK33uRmDk /CVdTOezxJwmlmbN2BUe4lv8P7GM4w4cKziT9+5Oz0BNZu+9S/DBbKL6qoWMlhLCQi1E H3dci09xKlEFRQlhI+3vjv+OUWF2vIw1fJr0g2EQ/IHKz1PAGn1pgsD7Qi0ZlkEfA8iv v1S/0CqGkYD8lmtITHPqeFSFqxQe26AiwmmMN7Imm8jUWO0BHHhyzYCFLAHBLG/s6zTa Mv+g== X-Forwarded-Encrypted: i=1; AJvYcCUeJYvXd/YOAvL/9Vf1dClH94F2L5cjIWQpkMsC38vNBlBVUqCvMuvbO9eG9Pa1z+BQANa3l4aDjDGmrmtL+h9k@lists.infradead.org X-Gm-Message-State: AOJu0YwgBXmWywnHmgC2vCBXf3fG6PAcmw7sKYbakz2LPhq7VXtYWtgI QWoY0sA9lTvmzr3TAUH5ZnUqAhGGO3tMmuZPu6fTzN5HStCc0belBTIlnZsTBJA= X-Gm-Gg: ASbGncsFH43k7o0OwJReZR3xcQtaTgrsHw5qi9M4AcMTikFtzg+pMr+CHp5CKflrpWX bEJ6+WmkjYJxufSC++dJp3uZ8zzTNoRu7/vCYyCRknNXApiO7s/d0ZhMvblvc79eosreRGYF8y3 Nn4Vhex1AmPfx5+CLcrPLKIGypWc7uE7J5Z8ksUvnzoLhmwh8ePIK9k/Yr+yslJr+6JEhtuWO7w R0TYH6ltGZ6ORsEV5o1S+KTOdwQmjvHIm2Efl3jw6pKoOw+dRTJ80Nta/fRvf3c2kFwWya2rkM+ uktirE92VtLlv9aN6GRR2acGGJTFRXSdoF5sPAgkgYkvCCs2ksIfAtc= 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_080117_894992_A92F7FFA X-CRM114-Status: GOOD ( 23.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/irq-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; } +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, const 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. + */ old_vec = 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; + /* + * 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 != old_vec->local_id) { + /* Setup temporary vector */ + tmp_vec.cpu = old_vec->cpu; + tmp_vec.local_id = 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); @@ -171,6 +218,7 @@ static struct irq_chip imsic_irq_base_chip = { .irq_force_complete_move = imsic_irq_force_complete_move, #endif .irq_retrigger = imsic_irq_retrigger, + .irq_ack = imsic_irq_ack, .irq_compose_msi_msg = imsic_irq_compose_msg, .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, @@ -190,7 +238,7 @@ static int imsic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, return -ENOSPC; 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 = { #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) +{ + 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 |= IRQCHIP_MOVE_DEFERRED; + break; + default: + break; + } + + return true; +} + static const struct msi_parent_ops imsic_msi_parent_ops = { .supported_flags = MSI_GENERIC_FLAGS_MASK | MSI_FLAG_PCI_MSIX, .required_flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | MSI_FLAG_PCI_MSI_MASK_PARENT, + .chip_flags = MSI_CHIP_FLAG_SET_ACK, .bus_select_token = DOMAIN_BUS_NEXUS, .bus_select_mask = MATCH_PCI_MSI | MATCH_PLATFORM_MSI, - .init_dev_msi_info = msi_lib_init_dev_msi_info, + .init_dev_msi_info = imsic_init_dev_msi_info, }; 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, 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 = true; int i; @@ -169,13 +169,36 @@ static bool __imsic_local_sync(struct imsic_local_priv *lpriv) */ mvec = 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 = vec->local_id == 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 = per_cpu_ptr(imsic->global.local, tvec->cpu); + writel_relaxed(tvec->local_id, tlocal->msi_va); + } + + mlocal = 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 = per_cpu_ptr(imsic->global.local, mvec->cpu); writel_relaxed(mvec->local_id, mlocal->msi_va); } WRITE_ONCE(vec->move_next, NULL); - imsic_vector_free(&lpriv->vectors[i]); + imsic_vector_free(vec); } skip: