Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1534775pxb; Fri, 20 Aug 2021 07:46:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGyqG/ri9ih9P1Zy20IYKf/88fkwXf2BvayIDNO++uVpFlga0kvJNmnoFNcSlFgugRHmML X-Received: by 2002:a05:6638:1448:: with SMTP id l8mr18118603jad.55.1629470802389; Fri, 20 Aug 2021 07:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629470802; cv=none; d=google.com; s=arc-20160816; b=QCAgJgipYTsvoWgZHBVDbNuNqHhfyW8WHjohXbLIkvZUaF2caQYIz1BQd1T6nGAxB7 06878ubs7v2FhjPv78vj5uQUh8dXLZ96+UL6A4DN6JzlyzgP+lWC3HE24VNs43ZP7hho /GXUIHNv6c8/Wvk/YMUgoO5g+oEA/pI903zEdQirgqQzy4nVi1h03/cOGvmdooPJ339e n2gGvLL7hBCSo+e1urkvnjxdgSe3ImfHPuDpruqwFOkB9T5X6dXdtHNK1rr4oSubFgSn L2/kIT4o5ypGQMykyv4g/DdbzjsyktQkcWvXbsODPk7F98t5WQa05KwWLUbn51ilH++a t/Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=5sb44fvqxQNTkVuembDiW71aATELq/e8jS6mXVrRN88=; b=Zt9iOnNoqv2/HHoQGZMKokd6E6VOdVMeOlcSgSpAW6+YEAteWleAl+q+7vK43DqjnP D5g5kqdZgbXGiHJpQ7bdNb2mPgCD9GNzVeaN1d8ZF+C6lxsHOkpSBNNqtPYqGwWTQIvl DiSQPbbu8TDcNkvfxau7M3Jvq0JPEpFmuLk6lA+EZJMmuO+kT8ntOJaeugyhBQMnsILT D8ohJNibwnPu50MgZ2doeAxLDwxX4z4tghCLkYEdqpARzgU3wIDZa8YVisTT69MU9bAg F83tMiKo6QuypWx+7NtuJdeZJ9hFTKE7KdPo+GBV6Y/6HX+h/0ZU9cxdMVA5e+KUrM1Q tmOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si6721243ila.114.2021.08.20.07.46.30; Fri, 20 Aug 2021 07:46:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240915AbhHTOqR (ORCPT + 99 others); Fri, 20 Aug 2021 10:46:17 -0400 Received: from bmailout3.hostsharing.net ([176.9.242.62]:54529 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240908AbhHTOqP (ORCPT ); Fri, 20 Aug 2021 10:46:15 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id EA76410325458; Fri, 20 Aug 2021 16:45:32 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id BC7314A5F7; Fri, 20 Aug 2021 16:45:32 +0200 (CEST) Date: Fri, 20 Aug 2021 16:45:32 +0200 From: Lukas Wunner To: Jan Kiszka Cc: "linux-pci@vger.kernel.org" , Bjorn Helgaas , Linux Kernel Mailing List Subject: Re: [PATCH] PCI/portdrv: Do not setup up IRQs if there are no users Message-ID: <20210820144532.GA25391@wunner.de> References: <43e1591d-51ed-39fa-3bc5-c11777f27b62@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43e1591d-51ed-39fa-3bc5-c11777f27b62@siemens.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 20, 2021 at 03:52:18PM +0200, Jan Kiszka wrote: > --- a/drivers/pci/pcie/portdrv_core.c > +++ b/drivers/pci/pcie/portdrv_core.c > @@ -312,7 +312,7 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq) > */ > int pcie_port_device_register(struct pci_dev *dev) > { > - int status, capabilities, i, nr_service; > + int status, capabilities, irq_services, i, nr_service; > int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; > > /* Enable PCI Express port device */ > @@ -326,18 +326,32 @@ int pcie_port_device_register(struct pci_dev *dev) > return 0; > > pci_set_master(dev); > - /* > - * Initialize service irqs. Don't use service devices that > - * require interrupts if there is no way to generate them. > - * However, some drivers may have a polling mode (e.g. pciehp_poll_mode) > - * that can be used in the absence of irqs. Allow them to determine > - * if that is to be used. > - */ > - status = pcie_init_service_irqs(dev, irqs, capabilities); > - if (status) { > - capabilities &= PCIE_PORT_SERVICE_HP; > - if (!capabilities) > - goto error_disable; > + > + irq_services = 0; > + if (IS_ENABLED(CONFIG_PCIE_PME)) > + irq_services |= PCIE_PORT_SERVICE_PME; > + if (IS_ENABLED(CONFIG_PCIEAER)) > + irq_services |= PCIE_PORT_SERVICE_AER; > + if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)) > + irq_services |= PCIE_PORT_SERVICE_HP; > + if (IS_ENABLED(CONFIG_PCIE_DPC)) > + irq_services |= PCIE_PORT_SERVICE_DPC; > + irq_services &= capabilities; get_port_device_capability() would seem like a more natural place to put these checks. Note that your check for CONFIG_PCIEAER is superfluous due to the "#ifdef CONFIG_PCIEAER" in get_port_device_capability(). Thanks, Lukas