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: 13961475 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 D2749C02192 for ; Wed, 5 Feb 2025 16:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2YG8nvKzX+4u0NuCuwmhLP+2BJ9iTaveZFvuVOPUbm8=; b=a5a0tGLbyGnNA1 iTURqQiN2MZl0+WLptMP5EfXaXHQVp6fhQXBJScUrWImHM3u2exYtGOsOsP/asIuF9wTPsG4L33Jd CsEV/MsPI9h2mGJsU9XtLjD1sFb0isRBpyHnYMDC8rLx8UrYrYbQ3Ok+NKB6MNwL0qubhx67Ac3Ax HK/y6PdnqGSLSS6BBD4OC5qSQWBhqqxTRSYfLn4Jj0hlFuyYFs3jagfse+33pWW2M2hvJz7FKWYht S96Lou5w6t7gQZeOPtI8DOAiADh3CS+Sw10olZViAgVYJyINv/0mfKUASktgL4YNzHNBeaNM4QlUK G2/nqNLaWw0FmfLHLbdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhrD-00000003tNH-2VEn; Wed, 05 Feb 2025 16:02:31 +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-00000003sqG-2N4e for linux-riscv@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-x62a.google.com ([2607:f8b0:4864:20::62a]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhot-0000000GgKm-2KCC for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:09 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2163dc5155fso124409485ad.0 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=ZhFy11dBBEoqmU0wrsJ0gchSuYQapiB9jXkSafwGVnWX6yJpt2vUzZCU3aPnY+aQ4K LMig6ZuDZtfJXZV+tMiZML1z1BTg/tQgp4VS6nuNep/CnILWtS9q+oV7WQqlUPT/6QkM e5g4UNFtCTeL7prFX7a8B9DOI2vOPlbpvuNYf2E5NOfr5HzIfDw43MxkiviAOT1d+3h/ ktSRiglZAaA8iRfj9It+RDAqlsE4olbpwLtoxB8FvG+85y+pKivFUaR+dgOxQXsFZAi4 KgxCRjQ2pD80wEJbjW09lauEG75IOfOLKsYUpq1KmHC79PNRW3LbCczTUI8jmyVlFbE0 6AzQ== X-Forwarded-Encrypted: i=1; AJvYcCVq9hTlaxncSjdyGnj8rCV6jt6dSeBbUAJUDMpqpAcfkl1e2tCB9OWqKBs+FksMaFjEtwh/b+7onU8AYQ==@lists.infradead.org X-Gm-Message-State: AOJu0YzNjgoSoNrifeWMK6h7XdboEqXuZ3TytHLPBlRda6Zq5EqSdVkt hoCxjt4+gWh/1DubAdJfRSw62jFXV2wBu315dtE3Yh3ZIckioT+3DFFxgahT55I= X-Gm-Gg: ASbGnct5/Us4pmmXykOLeqRHBW6cF7uKcIeBjHNZgqezQDSdD6GVOBtlKK1i2RVbS9B JCkyd8VxlRaWCh7ZFT1DNBhu7eDBTnBUVnJDz+/zs1QcHzDBjI3e0ps7MTrUxslsBrUFaDSo0MM xWuoigC1qVfflqtbqt45p27muQXeK7MVdy0HBsBDgXRjBv3wp5/1hn0XhCzyxgPfsDjj+EtI2ZF bevfrGYikexnPhcfvIEKK9+jySYMRln9D4pG/6on3UXzMEC0f7tlT1OybCQV4DkjHWW5Yn1V0MU wR8NEdatDMaHiFFLvaza0WTktJ3HLwJZHVKRlNoEt4Xci/twMZ6PtC4= 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 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_814755_DE8BA4C1 X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961481 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 6AF1DC02192 for ; Wed, 5 Feb 2025 16:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WlZP8SZYetYktHDMy89E58QpaLzD7a5abBH6Ap8cJUQ=; b=ppqZ57V8IMOpd3 2v1ac2g3daDNDUNmkBvHnVig3Aj0OTNbfNpIbrYnmJpDOl3LfvFsPHpk3yTdPYasOQvdSMj0uAXv4 IwTiLZIIum2S6GB/aFvb6v6Dxle625K8+GjyiBuWCh2IFDY0WarVrf6WCiFJyU+V4OZIWn32vVmSC cPei0gMBvM48piE2WEhM6XhyjJFedQUEN4jjDcvJFRb+FoSUtgvloAapfF/OSizrSvQ+wevZnIb1f NXWyL8NFHOCYQaDb/Q2r3+VDGpW7Wf6sj9SzBEYQw+lcfPoKi9sLVsMMjOF99m0GW+2HGmgSdkwyF VQYorCtEOOAdygyVXibw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhtt-00000003tt4-0SIG; Wed, 05 Feb 2025 16:05:17 +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 1tfhp5-00000003sst-2m9A for linux-riscv@bombadil.infradead.org; Wed, 05 Feb 2025 16:00:19 +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=dDa5uVtGTmKoF+EGxYZ14lQBrXBy+Zgm46G016g9yok=; b=IR9y7GB2VQnTpqSx0jx3qJr94P lbj0wG8SH99SzL3XJ6I7dMsaXzJXOAMMzu/3H/em8NvEsLZUf4x/a9oyrMfjpcDrZO4R/HYIeNc/7 +p399x9Omos90YGHH19gUfL6bkJRkdRyuXyetqpAbnUdSHclbQTzY3fi8GAmO/XqsrMmbYQjKrPH8 ALtmIKS7V7Y7872teaJMQ1Hc6FYd+PP+jAuzFLkknJNKB3HrzH20mQHFnHmCyrqJUmlk7gxH506TB WVXEFXHYQoIheZikOBr6k18FrDvjcIgUs5IoWEwWyT4OYaqn2ZSxzrWnWQ8LJwUnjIZWRxI8K8gQY b7cuv7dA==; Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhp2-0000000GgLy-15A5 for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:18 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-2165cb60719so127361365ad.0 for ; Wed, 05 Feb 2025 08:00:15 -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=TKckNr7RZ+GtF/D7GgsbPMJVV0Dtd/vuEhzoJP0z+N9uu10pn6Fy7nIkpbDZqnDINr c1vGPBk0QvW2ja1At64vU38HsznH6t6ITN3z3txJvKNTBz+J1/GCcBx6lyypBbTboyPk PQ3xLxLXS97x1WOFo0lzsEU0RGgWI7uRag6zatf98ui9oRcpVUSIVPm6Pn7ThUeGQk17 7hI3JBSvxyD6JVasJBvA4o92+twb4IZR6BemTSNM48DDrnWd4vlxsu/7EgjWYBg7O8+t CJcHQFqYSN4AZ3Q5YZcUAh+fCfqV+hvmoZPut92PQpT9Vho5cUI06zMolQlmw0I94p6l bOuQ== X-Forwarded-Encrypted: i=1; AJvYcCW98LL9E7CzgPsqBGZ0vxEZAz/7fjhB/rgIqzA3x4QdmwL2xQn60N9TODetDVYESfDI6K0UEN81bA6WYQ==@lists.infradead.org X-Gm-Message-State: AOJu0YxUCWQosuXeR8nyPNMsGyfGABdpjMinG/pbKKrjgI9qeCpXOqm1 PLnmmpK3gD5avyK+KQKtt9dOex0iWAn6UuC6qWOZlHkxyYLMQmEw2tii/x3P5Pg= X-Gm-Gg: ASbGnctPdvI1ZJ+x+8Lv79ysOiWWmKH5/jrV/rLJwQtmUn/tdMlW9ArrycHaxRRYnpx Uu6G27fsM6D8V1YiWWm17mmzV1jxIwQ5jlcQSH7Rc0t/VaXX8goy0i5LaCKe9SksdXh7+EwXEzt MKvvhDGs2gW3yVn/5R4a6NydVHt8Ikzdw9HkDtVvb5HV/REj9m8ZxArKo1svmxjiEpoQEYxAWBa 0afFlCOsJwrRm6VnCBLxfhm/9wE4Kavk6hb+kLBZ2D2WlWaOa1+KKhPZOtzb6azsyMTD2mPtBOa CskBEkI8TrTx0Kw3BQS6tXOz4ibrYt8n2W5PZf0eZcxkW3CgeMv86SQ= 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 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_160016_489814_AF01C1A2 X-CRM114-Status: GOOD ( 16.48 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961482 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 65843C02198 for ; Wed, 5 Feb 2025 16:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LOfkU+YQxegZ5CJGoO3JIFcxZ8EEupED4WM5kBBHd3U=; b=ulhaKYPeKKSmGM Fa9wuFUg9bMTsj1koL5dG/gKYJm+WPnCEmXgNS7TE2FJ7WjhNwTckRLNaaBUxXJxdmsBjIoGrDdfK y8rPKipAutXVliZrj69+KReIOEuI5g942sXOwZscZy/FJIMJcIuocO8j/bn3vhOyqsnklbb5C0akO QMkZT9/nZ970lmt2md3Yc7/mHsq3rGYvIcUoGd6RqaiLajZ09560LZxUwIo2/alVuW7iy7LUk8bzZ em0xw/pm4veUKE8ls0L9nVNSCpRyTJHcEbsCGEoVuMC/Zwy6O8Leg0sDDpuotWYU8sY93ZSeMLtXU OKQ8fveqoW/4wi8piCIw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhtt-00000003tt8-2iJO; Wed, 05 Feb 2025 16:05:17 +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 1tfhp7-00000003stJ-2I5M for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:22 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-21f01fe1ce8so30809105ad.2 for ; Wed, 05 Feb 2025 08:00:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771221; x=1739376021; darn=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=vuZOPeA/1pzUupTG/wImlUkbSke20/kIV2S+r2WFFyGnMHjlJnDm4ziHCndFeq8E84 g4ateSgtMxyl7JgM6+iWMBod6UuNzs1hJBkyVxdRFLj/ntqkygvRA8cV2Eum/o8qLqce 7yPHeTj3MLk/pc9snMNXkpgssFn0HANb6HZTqMjVhRtp+v42io2c52/jMdJYP+88+d7N aVB+aMa/FLWB4zFhV/A6WLg27xAYzSXwCFle7Dz+pCSAC03gIYxxPMmGAGF9kRafKsTx uWnJakTCbdplFxuKsKUPZQ+NGTLM1BgzEygAbYYXN0Q/290AUaSA4Ne3QYJsArc66aYK rEdQ== X-Forwarded-Encrypted: i=1; AJvYcCW2TiO5Fgc1anBv0cQCZkfvevgxVnf4LaCRLmWwbq+MlvfKbdJd+LlckfdfAoFNdjRT+xeMqaWoPFEq3Q==@lists.infradead.org X-Gm-Message-State: AOJu0Yyw4oogI8+5VTnQw4j3ULZuFZnU0IzW/qz9VJXemsXRzIEi8Gi2 DYrtH5a3WvXwpRgl/rXg8Q4QRoLeQJUu5uHoPhw4iZWH6ydOR0jUBft4ZCYxqGI= X-Gm-Gg: ASbGncsygC/DKcRYqLdRs31mLO0DpzyW92Vb+5/zRNprcRzWvqYBExejMxuOiU6x/Nq czt3h6FlQcBWHBdZnxA+75moIWGFr40NEKTUDeyRKBZFwl0E53pR+PNfc2OyLxoYasFpdggkhU1 nw4UeZmwUecfrhZvQ0MkJm8tNtDfz20c9epDjm/4z5usk8T4eR56hA3zeB8s1lVh8dWxjSb+Ulg ppiwtay3JaeIljlKA1nIU+uLLR/QvUhNGILNAuB4JhYjkxaWOPJJCw1UPcl+8vlgWnRynFtd4UM mI/JwzqsRZ5U3RUr4JC6kALqWLnBbiKudS7W0Rp+N/H+z5qyroGjD5Y= 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 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_080021_586509_66C20C7C X-CRM114-Status: GOOD ( 16.17 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961483 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 4EB1AC02192 for ; Wed, 5 Feb 2025 16:06: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: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6v3rCrAC9Tc9WC5bpmjJ6SnsLvxn/j3fkS4MH5jVyLE=; b=swhgCPmkiEaxr5 IyFb3RkU67dZb1ApyZTuPxmXOt9Ar0adhhGS6MEzleRs/jq44TjRwb4NmJrD+/hHsqcQd2QkhCeZy 1dfh4Wc3SuOq+85KL6Ca91s7kNn7F8kTT1P5UrOBSyzja83eHhaecvD/FM10jh+h4BCNN/gvXq9Cz wKedKHN1TARJuL1xMNPP89S0URqs7BsWFS0VLLIjwzUIsKYi++vJpsbzFgEmi/yrPeXZPvCt/fhXG iZ9u0vP449t2O+eRMDO/wINj2LkyrFifniCVbXf50YcAAOH4AfG5yPmFFkADXAa+cyXzDZxtJ6H0P uTM0YFq0i3bHfP1Ia+uA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhvE-00000003uGA-48zq; Wed, 05 Feb 2025 16:06:40 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpD-00000003suK-1SUX for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:28 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-21f200014f1so9661165ad.2 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=Qz3GDpMP8l3lRGByTpz/eyJpaZPnuTeiZOV2zrFGhtGFen2ANAoVl9W7UZ3f7wVBT2 t9Nh0pecEyFW1CjuSmStA7dR6frmS80VDcMfLl5i4Jsa7U0uZwqvOx7iD8zt2b98AWNN F87Uxwy+x2RYe3vEgf6iEz+3mf4YJ5FPc3enz+XC//FGx79ct0s/giYB9xl1rjoMS0Nz BovkJgXoEbmZeD2vgV0gI+vudkzSmCEkF3PCdLMLo5rTSVshcoOdb0RO0KhyI95SZBOY 8hyj9wy+v6wWFgEpRCmS/naMqxj504Rk2+30VjPaZkr2zzDl8dL3qhnyR3IdvM2c/DUL rw0g== X-Forwarded-Encrypted: i=1; AJvYcCWzdhMf6WZipSKouokTwp8fRMjHPTvXrlT3zYBNpLJe1M8q5MWzvCXFY9wr2EuYNlUYPV10Ha11iEHmfw==@lists.infradead.org X-Gm-Message-State: AOJu0Yw8Tcz/w3WjrtkhtQxTevy0EYD8oXfOt/os+/xFtsSlvJn8MUtf kcCPdLZQWx3r0FwliRT9NiR2bkMlFSrg6SmLioB68JLWJNVCHJOYyweH97wbZ9E= X-Gm-Gg: ASbGncv27IN0Hm8eXZsrLUC/qps8ga8/vUv4FjEqHtMpAklKZdMMQbEmudFOOUwxeL7 ip/kMrYJdEHXd/2ir4a+tT2qo/BfOGUB4l6QmqWf1qKk7EdTInm2ZFbsI9yMPc6MBdyrL+QBRDT lzPv1nBJFpApSIPJZ2gFRBp9z+cfd/okE1D/7UPBaA/16hf7NA9C1/BKU4f9KBeNqrx+C8/F0g3 aTYktD3Cg8m+jpR950MUw/2sEsWhPXmDGeWKsq94qjry/zozZoYDMPulEjN/lUuWhdfiRG0kQYd /aDtNRmgnhruang1FbdSRTC2Bas4XmcX8VPUB8kcifB+sDYCFLdzxu8= 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 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_386350_818E298D X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961484 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 95A07C02192 for ; Wed, 5 Feb 2025 16:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5bYAIGjq/bJVX3/UULXI5NdxuQxLoTMLo50wUxnDDzc=; b=Z3LA8cQeB+h54b LRN/57rxXJHB9AdzcZO+dgP6ghWkDE9v+2Z+CQGi3Q4u9cUqX8oaJbYR/epv99pR3NXFOlU4dh6LS G2Gyh+tyscrq8SNt21kE/CTTMBUGHv/QGY/ecPF6vpDDmrc9ZT3bRng0ZnPbrx86DtjutLpDwQiXZ Vj61fmwcPWd48C6ufZ1wdl0pZ41JjENvt9lX+U8+pxDFhaPR78ZsS1ePLPAh/ljZaKGU4ZlwiU39X O1Km/3C/F5VnxNAeVgpQGMcCGbdwRzH3SWwPA2Z9JYgJAXsifB46b+sPrwGB1bLBFTvqr5CwRVOsj +y97NTFjPvJ9BVjZy56g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfhwa-00000003uYk-0s0I; Wed, 05 Feb 2025 16:08:04 +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 1tfhpJ-00000003svk-2lmO for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:34 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2166651f752so42720625ad.3 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=GS4DjwJh5UtfswGdhMGquebzGCQzCxRfp0lJr9UMxJJrTuv0ZsyS0FhOGFm3RtOfYd 2wt3ldhtg6kusSRlpEYcx8NSqGOvtutyKANT+i1sR0L0gv2XPVeYgfF1i8RE0R9Q23D6 BRrLbTShc5FPqLkgZUZOXOKnJEGM1Irqpa/T7TEkASj2tNDyl0Nd/OCHHXuYLPwKzv22 lbSgqFebNjVF2oYnR4RLw4vAlmWiQrttMX4Hc1cCyjZZnPe9qBePDEre9+GTnvbDXUpv 6IOnBr7HXpZ0TSpQyTJAckNsKU95rQr89p9w0tB3zarsIskFqs7Wmbut11Pc3we9jdOC C8gA== X-Forwarded-Encrypted: i=1; AJvYcCW3n6+4pa7N9+LJoflb4u6+s+RkKC1JGJr4dmt97teRo+ZQVNfITlt2EHzkMKygzg5bzzJwONgGVmky/g==@lists.infradead.org X-Gm-Message-State: AOJu0YzztSxu21KubbYEw82gDC+evmEOaw5AG8r+BduYpMPWTBow7fug pojdF+jJMsOZUqjYTcTcgovmJaPGP9LAYfDVeFZ8XA6cHXziKiu9G7JdTMBgYEY= X-Gm-Gg: ASbGncuwWVgwK/eghkoiRBE3lwjLMvgKDF3H0jj1R6JH0ypzjjr+F7uBuaybIHYypue Sfrm30SjiYqPREOTF86QMhwPKs9YMSuZP7fTCgLF+UU4NnJ1d0pL9m76ma/pRkkr5BvGhhsv41O YuXx40zoFsCPXb4/xAld+FoT9wrbJzzx9K6YPA0FqhQDUZnKBEE0L/zQ/bYJvIOmHGrHnFlIEIk Z93L/1UaX1Td8eQVtcLQg6tqcf/rPxbBdnV8RL0jZkRKJto23PQMK1YQ+KtwgQEdS+JLerxeMDe v5rIEmBicoj6UQr/LG5/x2y5OW8fXPEWEVMZx3Gpf1/39hycNT24kBQ= 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 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_080033_709885_B8A40F98 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961578 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 DCE94C0219A 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: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kwZwE69TzK4bUS7MybKdSB8OOhDDaawc7lCtPJSxgyg=; b=wmrZ45yadvMMQd nYeseK+SYw5kKi8Gkz2XTprpx6glamP/J9Mi3JzZcVhohBdEJ+ehxi2gM2bZ/5bkzbrJ66IxR1oEI 9E5RnN9btrqU+cW6qtvj5JpUTSPFZtsmInt8MGAyM0UlPE5oLrZwdveLTuVNSbfKfUHRc7tnk80QR 0Cc4YT24a3JJh1JUA1SzHs6AkA0vnoh5xlBql4aWtoxzJQa56tb8Fq70wSAfEyY8KYarDR91QnCDj 6yOkIqIhLr0ExsZIosIV29qVU1F2EUIrcC7iYZvMMAM3EvvpQLb6l82qitpzYJv17v6SqB3A2VjsL Rx6RI/EwJI09CMaw1xxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfj0W-000000043jG-3XQp; Wed, 05 Feb 2025 17:16:12 +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 1tfhpP-00000003sx8-3pGM for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:41 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-21f200014f1so9665145ad.2 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=bJxv8Umeiw8wzmRffU5EzUHXlPcZ579OH8EGSl9DSjXt1xjSpj8hHJda28lWuT8jGk uLLnq5+ycaKv+x09FIABWMxfgRisREYf8PmQBrDEfoZuExM3xvG+3peQLu0tRqkQQQUM LGGs8cImhPojARwfurQhhsgYn0h5viy8uuU22WmSqkML4RKON15oW5BX0K/waKHrzpDd xGfdHdihM+bn/j8nOd2OL4xwRXUz3SsvuWk+1Gka2EU9FDCVdXlDnUfPe5jiPHp/YTJQ jn3GmN+qpHo1GQ6yKjDAGuhp4uehEhVtZUpz7OU2D9nO1mrGQdW0yVD2vxS/HqUxCqcL s1TA== X-Forwarded-Encrypted: i=1; AJvYcCUV5Z2P9duzS3xlVF1kH6Ke0v4QOnbKgg4dEiR+5OtQf+AHuM3qYBImsS0hNlwgeg7S2Uqbni44UPT3vg==@lists.infradead.org X-Gm-Message-State: AOJu0Yw9alCgmi/KrSZ9JvxNCyL28aJwx95FdWUHdHixlUpg8iNu5bF5 gojv1KrdY6BVHlHx7aIxBIcw/8ETFBWIKBAgFcKKjjzHwV9Me4/0QnXOc8WXLs0= X-Gm-Gg: ASbGncubQJp/Hub2a3VA7YgCTSIzVyVSl6W2GFuR709i8XDMHbQvUeTuQ35fGOhGG+W 4ZJJIoPHVC9vi4M8mfEPIwcDhFIWkjr79EBQ2JUdC4E+4c5thFN4X8w0X2FXXvdyJJbZEdWZDfG JIDS4Z9j1c2wSdGNyQm8ZHpLPnRsuydlpSJ9DWqDPCgWm51EcozIrwe7nfNUwCTvJoi0ydaqCQa MxxAynjneiSbI+vRC33u4kkXvfjAsrpTxEL3IZ24AVH4vdfugdSckV5VCpWP1yRKmZc2ft9lh34 OrBPOL5C3BfRnoYeImq+g5OZtTXd/jDJXU5hSFBj0pbGxCmlMWVDzJg= 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 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_967520_48155CD4 X-CRM114-Status: UNSURE ( 8.42 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961494 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 B4D16C02192 for ; Wed, 5 Feb 2025 16:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9VXajq6t60neUU9rMTpi4e1cYBZ5EDOWx8giU8SqC4w=; b=VppHIgFbzE3KII r/V/l3KsKfzNHqOY19D9W9wAyk4rZ+4eQTkgSdt7+PLbQ9vKo+HIBwHtCpU4h//OqfKiwz3/ZE3on j4+Ij5AoYPl6+P1uu+SzKs/Sr472UYPLOLmpoL1EIGEZrI9jQPYcOjZkjZ6T6uiWXwPfWVa9s4CMw cOzPnVg8iW2QS8cHRumq7wRcQNvCOP7DxzciMU7TDnGZclyxjHEqLsGzpxwsDexUNrlldCNLggoNc p2Dn4OVzz4rHJFS87J/iC1mwnj85vKx58OCwY1nS79q2QbnMKqS5cCjOVGhvO/6pHqYGTdSSLOSqi FRvSeT7bhldyj44nTzaw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi0c-00000003vRJ-2LCT; 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-00000003t09-44vT for linux-riscv@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-x62d.google.com ([2607:f8b0:4864:20::62d]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpY-0000000GgOQ-0wfM for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:49 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-21effc750d2so36411875ad.3 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=dkDG4ECGupq0Gu2QBwFzp6R66YH4LPzus8p3QGgOsqPZPmRRsfwuBpzgRicS8qGdHC dGStJlObzt80UBfa/WuYsBuiZ7tSCS1CeHDZltPEISlsmJwCweDhhGySBduN1GR0NsQS eAvLhKCM9HsdWPNz/z38taYMP6/NiElcaq2TaM40LyeqstOfxppewwtoC62o3Yx8pYiH 03LPvSKGJmUVNLXuLJ7Fdo2ikLe/K3Zxq2ZZqcHkusaYlKIuYf9el55L/5kQ/bFpJeh8 PiPB2RQebBNmtmVID8HPWr9ta3Vzzodgnnd2WrYOihcRwaSeWFK/xZvlu4BTW83X1sXv nS2w== X-Forwarded-Encrypted: i=1; AJvYcCWyhUnJXB0LzVEJlUqYA6AkuZW53JumVKSLAcnssDaFmJ+uYDHc9yDyGstaySMDZzPUtFVdXx+ti2XP1g==@lists.infradead.org X-Gm-Message-State: AOJu0YxbcIV+dLLuwHiBJ7DxkZLIjhj9/Z6BZ37AVVIIW5GH8R4gTe3e Mwa3jxnh3Rhx/NWaJvhrepR3hFQ5BsqnP4/7MO1t+SA18t7aIrJhdTJ4QVp2o2A= X-Gm-Gg: ASbGncslW3JjyYCXvSaOKrAm14j7y+P6ptWxz59tSEvZLj3NkYSb0NbM4mHyAk4E83d 9eOVbhIfwWaVlOeyIjSaYvwpoDLeNwEi1veWTIU064MJJT91VwyErnvWD83jCMrRbcWmthkZkIW 4pO1mqH85Ebu7l62SVW8tr2SQO85seCzoiE1vheEEPLeanD/cdPaYxicapkRcWDPVtT7/sgn6KJ 6ckdcerIJWABcqGOIduh7RBU4kYEY1sZT/GeIMvAIz+w8p0SXTkN+5ElUbP5YxLGpPUAkEWgkX6 tCrcVsx6eDnwD5de5y/L+vzlzHNMFA3jfKFTTgzlavpOIe/pjdk7OZc= 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 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_160048_394592_8DAA268F X-CRM114-Status: UNSURE ( 7.51 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961579 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 D1C83C02192 for ; Wed, 5 Feb 2025 17:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IBiUhJKjMMWVQOjwgvu86etvnRLsIWhVEL/Jd1Xd5Rw=; b=MTXVOL9vMdWgyL t7DYzmzsTrK4Vw8U884z6sq4HJAWp5ttm3PljIMhEekLnqeEIRTPhRzCicnvSOKLp6ekcr0VRvrl9 kawxhZRZAsk1nDnSiS7A/bo0s23xk+8FDy0w2k2Vo3gsySuFGlk2zN1XbDgnGdfV4DIkio02WHD2B Yf3nKHGiN8CNTHT3Q2bIvY+bSv8H1feBr1hlcM2AeJkaOdg3aJ8v2aKftFF9hjwEJqHdKKhG/pqGz YXiVKXJ7pl9Ca+bVxWwiPUVYGKt0SdReOgJosIpo1kj2OCNdtmom8qCFi6c9SRLwre20f4sfdOR/f wxUOumEyoE9NQV40feGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfj0X-000000043jQ-1jrB; Wed, 05 Feb 2025 17:16:13 +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-00000003t0M-41EE for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:00:54 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2165cb60719so127373115ad.0 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=WVWzmpV1UJgRlfEyBqcC+XQ9MLIeSyMz2jXsOUSu1Y0VqlDtLV47lZO28O0Zjq773j za1qYsXyMWnvz8TSijyxXB+Q/9TbhFlh+i8GfXNDuoh5JewjyrziNZXkLjLvzF7j1b35 b0dQxOyMMTISRa06hfn14eTsVGqLb0UR5fh10/oDCbHAfO0FMmJyA9cXOugFPm1tQzzb lAmPJcY8qY3lU1Pgt5DMXzjtQow1P2vkm3dKlauUuk1pQom8AHOkzmRybbrv2qzHJMaJ /PkY1TMU16AeTFqRJPcXPr+12fbpiz1IewxIPZQFOc/3dZbmxebBwtTPYPJCZoDDe3Va 3Wnw== X-Forwarded-Encrypted: i=1; AJvYcCV1rQebOV5WjwrIgHbspyQj7B32MJ+f8O7ku4MeTLO3c/ll9Xnea6Xn/Ud7Btfpk378qlmb1EbsVmAGcw==@lists.infradead.org X-Gm-Message-State: AOJu0Yz/Y6CqtdVcyiiAUfnEfITCNMk17nZiDulUE/gL2MzHVH49gXR3 VG3dCDO/jr40mRoFxW5KbW6i6lrdJhV6URM2ZGNAVBzxD0HBWi8bXejOoEJi2dw= X-Gm-Gg: ASbGncuX4NbjetpBaKXBAuPXmPYI/e6ZcEzHtSpu+iMzGevzwdvR+wTPzJUSqs3aWRJ Y1ZcqWnzGMrNxT+rTLjFuLCe0sAoa8jyXfzOeJGxJB5mV/nNDHJLH59FHiHZc1SGraM87zse+yi ZIl2ym8apkqXDFD4mnzwkNJutxBbkb05ZsfaRwGZyoR+F4vOMfK3q4YddegDlkFgo4wuN6ZOW// 44GRRz3djcuyDonS/xKk7MawZjn4L2UVngO3wxslfake3RXGB58RzgBN+fN4e1sbXs5WwAO6zl4 CPBPl2jEw+JDinlZPfhe9PqbVJblWYiwD2QQLmGx5r+1VBM8SdQhxJQ= 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 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_005329_3DE71923 X-CRM114-Status: GOOD ( 23.78 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961495 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 9C65EC02192 for ; Wed, 5 Feb 2025 16:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aYkGQtD89YXF5oo41GUIndlRaba6DKliLoofi/hRVSc=; b=cNrfGMKOr4b7Yv EK1SQRK9hm77L+MgotNyc9JLF1CLc2xhv3y0CUYvAGIqz7G2j6oY8OsMVBOM8fJicsLC7D5I8Rfah +0Edr90Xwe6cg3YBOdp35xV4JdoAoAhvg+IoNLYC8HkGlMmqNOYlHy3tIgnVjhlFUCejWWOM0kABl tPAtWMJl6IgZws+o0ViYRDPZ5pig32NlzNGTHUk/mJMdzGdFa/v6dkizLephMfl3Z9J7n2GIL7CcA mnB9gvoVGspA6W5rWDbKv4emBKc8j0s1UTfd0OcTF5r67yZbqL0jh/t0eXRO7X53srN+0Y/IK08y1 oZr3bvBIsWlx5ae6iGjg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi1y-00000003vn0-0SXw; Wed, 05 Feb 2025 16:13:38 +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 1tfhpm-00000003t3Q-3mPg for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:01:04 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-21f2cfd821eso3964235ad.3 for ; Wed, 05 Feb 2025 08:01:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1738771262; x=1739376062; darn=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=H9hZ4UBGxCkLR8CVqCMefdCffPbdmdPyE53wShpINctv8UFVMKXvkq78Qt3gyMUVJf 1dCXDnJ6Qu5mgEA91CZ8U5Ls1UUtuaFtrYNZFMulXLlogwDv37o/WcetmW7pQt2L3iQT hk1ibcKmo2uPOE8n39KVgu+uyJxXi5jX6gM1y1pnd0dSBh5W0kMILatsAp3VwcOYuOdv YaDgi6boC1Xi6EJ5YdMU/qApghuN17mDoJPgnYtYOtmRX0wWWEiwF2kU4AEFhw4vSxAe aj/OmA64tmaickK3s46nw8gPZrEnHhBd/B16rfqEjkiRVB/U5cO8Y19GRQXXeWTKJ/9U zFEQ== X-Forwarded-Encrypted: i=1; AJvYcCUOTSy0RTkWerfNx/V+JNmqBHK6Eydddz0ealz5/r7CsiyHhb8HBM1GjvVQgeYAzSi6e95Pq7HbD8cemA==@lists.infradead.org X-Gm-Message-State: AOJu0YxYqxSVNtYgpTJhDsmnB7TK3dVjTEv0dF0Z2QuZ073BLvnDRd6b lL1djPD/rtQhuDRdtbDtedtDYdvDDK+vo0z8FOo6jMGdzRuQQ4JSCMhneW/H+po= X-Gm-Gg: ASbGncuyA+ykUo6CWUW5K3HNpXMjRIwhwDNIIZklnoXNFjYeKgUVbyLlTLKPjKTmoOm Y3nbS3rJ3McAgKBdWvC0knfAJQGYAdnwO1BtafcnYrbVC/GMC/3D/GhuF6H23dEQvkY0fjKeJKy jiIV1vnqnoRS/K6EB5rw+MIrD9YfNRsPN13cFjxDO30iJneQf0FS+9AmzyG/bvfQWgdO6c+KECH Awbh24aCihxE1Uvm+RrEHjqKmOVUfmoDYW1rXJiW9X0xU4ihcWiQYnABD+vk924lyQpAzYlj2Y6 0AQoBIFfQvJLAUAxQacXWWMZJ2Dx6oai+UYfmMQi5M9s+GaljVWtONM= 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 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_080102_941030_B3C3DF05 X-CRM114-Status: GOOD ( 14.39 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961499 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 A322FC02192 for ; Wed, 5 Feb 2025 16:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ExNMvzogq+Y0cOv/uWbNl1TVVYdSsbo39ahMGzB6e60=; b=cyYGK0PEPSgptg WkfxLX0fZ+XwOY19C6OrqChOj6eKdJPyvjR670uMr7m6qCrvm23qJn0l+M9Dwqwg3jqSbcsOC8KMH B18g4ahcoGCFSOBvdvXaK/m2Ml4qiEegYGw8EvodO/3U5JPkVj60t7rYINnQ43a1FUoxAm0eK8H1E QBi1p3CVUyFeZkBthlsgD48oGxxExJLfZ6uI3mLmMHo9LwDLafehyt9FJj9SrSKiHZd+ODYHGrbvD D9wcAoDTHlKDHtkxHmye1WS+ud9U3eSOods+y9AaoknwhgInv9l6yxpFPUmbv7/IOs/K6+ESL9EI+ KSsaKMpcBOC96NeR4pZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi3K-00000003w3G-19vc; Wed, 05 Feb 2025 16:15:02 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tfhpt-00000003t64-31pm for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:01:10 +0000 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2ee9a780de4so9429760a91.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=R7Ul/eQmBMwWPLjGNcC0DXAmhaYG8/K2mlPsjDnxFup8Qv+HWYADvbquNp/CnZk25g p9NaXziBnnrLSOLqkstvrwjXrgXbwr2QD8M1yDbYGuNTbfwakc2bpnHmz85SGE2CmNq9 +p0Lt87gKCXxSA42Fe1dJKYsulKyPSmEL2rCSiAl+B3rlrboZ9CHCU5YY+esUrUGujNS 6/VGjxMzZhvE/K46AS7WTrXc5ky/Go1k/NSCtyDOwzi+royt106wvtEj53OOssh9QMUg 51WwnGM3IuhQlJTFlwh8uAcsf2unMyLO+B/c3hNS+VR2uLk+Vo7Ar1GuyI5wPFCDuK8k ygAA== X-Forwarded-Encrypted: i=1; AJvYcCWUPAkE9yqCQzrPMa3Lh3KJrg8zVwLSxA/83FlCThZ3NwiCo1/+qHS5gOpVXeXEhXVEs4cDcdqHM5F2nw==@lists.infradead.org X-Gm-Message-State: AOJu0YzpXaRvQHqxEPnlBJ3k+9RB5ngDM/Fcsdkd+DaL00UAn63MhFll DwKo16lyZpelCVmmzO2BIEAQSKoEA6eCB6fV8SRhwFRcOIUXwMOp4d+6qviSjMw= X-Gm-Gg: ASbGncvW6AgkXnLgRAq0Mm0LuBCGD/El9gsz3gwSiFNbSV/SpJrs2hn5OmahOUr6tYS mXIwFEY0OYcps5cGhBhICTjBBhO3YGj6XS/7BsUPGvmnQuWXdvAvon3wMrr/qARMDBW9rmojYVj c+KVRWxqP1y6GlL5LeTHaenYq3n5AV5jugL57EyZWVOLKwWFaxH8v9FJev2TgCqM344vM+2GprJ K66Yd8MIzL85rdPIc3D2TY0HpQ8Dj9M8CEsIxU+sC4tyeDJSs94kwCCZnX7dACyjh/CZTGe/fzk E30Pn0DpP+Zm/Dt86ls3DiAfwQqWRfz5ZA5NVHU2ykW4LjyDAaSmdL4= 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 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_080109_759222_10086556 X-CRM114-Status: GOOD ( 16.55 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: 13961500 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 3118AC02198 for ; Wed, 5 Feb 2025 16:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=l67vx6+O+Gzz9kxEY1fAybGouRr4OJWWYxHIz/fmS4Q=; b=FsXabqEgE0u1Pg R7lic0v8t7hF0sDjkku20WnbrtS5L7Cn3kqCA4k3o5uVQ5AVqeG8el86wovbXrP3JgkJnbqPOJx6V XNWldaKCz60UUZ8upia9/3BW3BBRw0e5VwiFpS6giQMlSyhQrgIn05blNRIhvrqvg3oSA2bGDeKyz qV0NVjq9g+gvKmAZTS83HAyHmKeirJg4LPnUg4caBl/wDcHo/gqwskwtI6RrRjs0hl0DR0DuzOB65 N4JWG4FVJbqgawWdoSDWjDOPrN+8C32og4ZZQ27PKM/kXUkFGkESztH52oTFtB+VOFVbYTBFxFRgO Rb/RuU4TyZUtlOWH4I5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfi60-00000003wUe-1UfI; Wed, 05 Feb 2025 16:17:48 +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 1tfhq1-00000003t9c-3iQR for linux-riscv@lists.infradead.org; Wed, 05 Feb 2025 16:01:19 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-21670dce0a7so9323805ad.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=KyFgfEBW+GITWcqnUYsrm+TJIP876JN+Z14rj4oUQ8SQJwRJ3ELD54lpwA6rjF9ihc iL/hnlTc7DfFUGsUtNGj38c3oMWo4vdjnwbWTCCoQjh2G0clOBMdsy9Xhd38297pZpna DHtnUZYg9BaCtnzArdpjfu4yGcBZDSOZcoK5EPs/0yjSuJowEGWdBRtCR8Qnq9yaaUPr On+jYmzQBs7MyQ2w1g0paRH4DNT56Sfqkdeb8UJOIVv6Ck0uF05BgNhgmfcMvMjHN8k5 9SF0o14ds2b3n6Yh5KPDX6kTW325UTKJ3KICzSSnSv9Ygoc1KqS7UjWz4yyH0peOsFao ly2Q== X-Forwarded-Encrypted: i=1; AJvYcCXVzMhX6JdaDorGPw+In/hwQmvtS1YQetqhpCrhGImQdwf51IzoE7QINrXwHPwPYsbZ6b7xtXG+ajBsKg==@lists.infradead.org X-Gm-Message-State: AOJu0Yxn2HzhezYXP17wPm0jPcDmrJ7R8vYFAiUqxr85+Jv7NSE2bNMj D22i28YPxasY13L45ItGzk1l5M6rbIDOjuqqidjXk+tyHfDNzfR8ktnO9fgXbXI= X-Gm-Gg: ASbGnctqm+DnSVbC5mHXpOOFMm7rMRQGzeBqR7dtqET9M5m3M3EyrPjTJwrxmaQ3PrP 9ZIamnDvs4E2xnKidDPqbF24nmtoU56nkB0zsumqOxFfKRhRMmoa3R/a92t1WXzJxEq/ZqW+uEk VgYfwxOLxb2C2J7mU3qIlU9r61Lz2nkca1YS4ZTVUzKYehAPskpWWDUKpRjt0Fvae+I3dQzpKkm lap3nzwARDFXwSHYNf54GzucUSeDQMDUnoVrFfJMkAWhqzdqOe/REmNufICoavRAzz3RJqswOuq ma+ZrX3CCVmPiEsjbclwAHO1xJwbtSe+sixoejzVoMIJHFsaD1qkAuE= 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 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_920553_BF3652C7 X-CRM114-Status: GOOD ( 21.68 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Andrew Lunn , imx@lists.linux.dev, Marc Zyngier , Sascha Hauer , Atish Patra , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Palmer Dabbelt , Pengutronix Kernel Team , Paul Walmsley , Anup Patel , Andrew Jones , Shawn Guo , Gregory Clement , linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=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: