From mboxrd@z Thu Jan 1 00:00:00 1970 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 5285DD2F7D5 for ; Thu, 17 Oct 2024 05:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lFtVQTx6haK8+52oRba+8ohHiUcgcdnDFsNorYhcV3c=; b=tRdHnZxhkB1GRMgSDIhWWxQFUd k0sjmnXZO4IOOlk8CL5/flUNPLJfOVbE5vNCigJ2bKdNuE/uzcpQVnCzXSLhWBfjvHJ2JtIVBRbHh nk5xtHVT7emk/EI3qj3xlwSg6ENWRasj2THw7GAnlnMYrkQtlmZygAwicw1qbheMU4ZFv4H/SdN55 xfIgefG8joYqTWhKWia+mqxE8XVl0UR7k2LyXO8AHWnehT2YirZ6tY+5McxKgH14PxtMHHrHAk2Ja KreksE4wTDbDjEtypwBz7p+ZUcmoJd01cLYg3KfvFrjJZnQm0gJNFsC2e05o5rHUb8ktdkIFAwgPy K5C986ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t1Ihj-0000000DlY4-2gDJ; Thu, 17 Oct 2024 05:05:43 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t1IgF-0000000DlUH-0bF7 for linux-arm-kernel@lists.infradead.org; Thu, 17 Oct 2024 05:04:15 +0000 Received: by mail-pg1-x534.google.com with SMTP id 41be03b00d2f7-7eab7622b61so469874a12.1 for ; Wed, 16 Oct 2024 22:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729141450; x=1729746250; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=lFtVQTx6haK8+52oRba+8ohHiUcgcdnDFsNorYhcV3c=; b=SU54D6e+rqBmrm6PRl/HJDtvWAzdc8i67CG26KFnjBp1acWKe8EW5JfyWpvxrxL9jn xSTtf+5EwR3nnBPppj/V8laRUQ4S+a/fmomv4P87h68fX6SAUkek/8eNiTXyxnFR6iCC Y/udgxQ9qQdxQtbEG65S8bx/XGQBI7wseqgsfwS28xzbPKATx7D5Wi7rXkMz06ZkG4I/ ilDX9JOl+GnZ/dC6IGzYfQ6dJ+ks+IWLTK1+GNsxS6+p5+6Ls5euyw/5qsxq6z6QlTQY uABUMgxIWnjaxmyFdHHXRK6BqyXx68YPsU1Ix5nNA9CmRT442eJE+hKG2p7xylGy2HHa O00Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729141450; x=1729746250; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lFtVQTx6haK8+52oRba+8ohHiUcgcdnDFsNorYhcV3c=; b=wzY1psto5kU/vqvKiUa/7mfjAeo55jlB2/7X8o8vMZLGUmvTb5pD0XPWiyhbelH6tf DQVvlJm0Hb5dpUTGD25l02Vnagu3mzsmwB1snCMC450D1l3S3hb533WD3eW7moJvLBYA MdLI7DmBkJKp7o3PRcrsqf0DJuxNpyDcuOWQm+Y25yMS7pT8iNc6ptLrN00GK8/Ub/e/ oNW7FjuLxUlxyK1mej80kC/gFB6ogZYzON8tcUnpGG+0YaGLhml0Ig1l7ppD9KOj3dpj 1QlHaLHOHWZdmpKZjNb53dljBky/0s5ftcbKVXHfUUDfk0kevMjH0yvdtXMBzu+hGvnz 3ZQQ== X-Forwarded-Encrypted: i=1; AJvYcCWpL6rGvoCtH6G2PQw5eJ7xO/0Kv2WXGFwxXoZ6pznHmOg/TCi28fyMECyGkCEhPNXJdnSf+m64FB8Fs7f2PJJl@lists.infradead.org X-Gm-Message-State: AOJu0YyKkrBk2uYlJFtltUYRDBqjaBzYe748/JonHHCWE/MMmFluzM+x tnyn38o4TQZEEM44VZKteE06ai0etl9aI4+YwAcEuamA3EpTYt+uSoZ9FKGB/w== X-Google-Smtp-Source: AGHT+IGTwFuwtXLeGlVJfoGXkiv8qrqrthIjM6bH1YuWajVdRvCJvG1Kj0DECOfus6mAGZa/YtRYHw== X-Received: by 2002:a17:90a:a881:b0:2e1:89aa:65b7 with SMTP id 98e67ed59e1d1-2e3ab7f85b1mr8126771a91.9.1729141450224; Wed, 16 Oct 2024 22:04:10 -0700 (PDT) Received: from thinkpad ([220.158.156.88]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e3e090953fsm818288a91.57.2024.10.16.22.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2024 22:04:09 -0700 (PDT) Date: Thu, 17 Oct 2024 10:34:04 +0530 From: Manivannan Sadhasivam To: Marek =?utf-8?B?QmVow7pu?= Cc: Thomas Gleixner , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Andrew Lunn , Gregory Clement , Thomas Petazzoni , Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 1/2] PCI: Add pci_remove_irq_domain() helper Message-ID: <20241017050404.vkbbqsehfgknme5i@thinkpad> References: <20240715114854.4792-1-kabel@kernel.org> <20240715114854.4792-2-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240715114854.4792-2-kabel@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241016_220411_392385_C5EDBF5F X-CRM114-Status: GOOD ( 25.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 15, 2024 at 01:48:53PM +0200, Marek Behún wrote: > Add a helper function pci_remove_irq_domain() for disposing all > interrupt mappings of an IRQ domain and then removing said IRQ domain. > > As explained in the attached link, the PCI INTX interrupt may be shared, > and so the PCI device drivers do not dispose mapped interrupts when they > are unbound from a device, since other devices may be still using those > mapped interrupts. Thus the interrupts must be disposed by the PCI > controller driver when the IRQ domain is being removed. > > This function may be used by PCI controller drivers that wish to be > removable / modular. > > Link: https://lore.kernel.org/linux-pci/878qy5rrq7.ffs@tglx/ > Signed-off-by: Marek Behún Thomas shared the diff leading to this patch. Shouldn't you give some credit to him? For the patch though, Reviewed-by: Manivannan Sadhasivam - Mani > --- > drivers/pci/irq.c | 21 +++++++++++++++++++++ > drivers/pci/pci.h | 7 +++++++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/pci/irq.c b/drivers/pci/irq.c > index 4555630be9ec..30c8d930016a 100644 > --- a/drivers/pci/irq.c > +++ b/drivers/pci/irq.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > > #include "pci.h" > @@ -259,6 +260,26 @@ bool pci_check_and_unmask_intx(struct pci_dev *dev) > } > EXPORT_SYMBOL_GPL(pci_check_and_unmask_intx); > > +#ifdef CONFIG_IRQ_DOMAIN > +/** > + * pci_remove_irq_domain - dispose all IRQ mappings and remove IRQ domain > + * @domain: the IRQ domain to be removed > + * > + * Disposes all IRQ mappings of a given IRQ domain before removing the domain. > + */ > +void pci_remove_irq_domain(struct irq_domain *domain) > +{ > + for (irq_hw_number_t i = 0; i < domain->hwirq_max; i++) { > + unsigned int virq = irq_find_mapping(domain, i); > + > + if (virq) > + irq_dispose_mapping(virq); > + } > + > + irq_domain_remove(domain); > +} > +#endif > + > /** > * pcibios_penalize_isa_irq - penalize an ISA IRQ > * @irq: ISA IRQ to penalize > diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h > index fd44565c4756..1ba6a6f418ac 100644 > --- a/drivers/pci/pci.h > +++ b/drivers/pci/pci.h > @@ -170,6 +170,13 @@ void pci_no_msi(void); > static inline void pci_no_msi(void) { } > #endif > > +struct irq_domain; > +#ifdef CONFIG_IRQ_DOMAIN > +void pci_remove_irq_domain(struct irq_domain *domain); > +#else > +static inline void pci_remove_irq_domain(struct irq_domain *domain) { } > +#endif > + > void pci_realloc_get_opt(char *); > > static inline int pci_no_d1d2(struct pci_dev *dev) > -- > 2.44.2 > -- மணிவண்ணன் சதாசிவம்