Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1536525pxb; Fri, 20 Aug 2021 07:49:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPizzIFO/lLmh6TMnm9vdVQ/G4qotbmPyVE+BkIcRzLhCU6XMCAptAanMgAZxvBvIXNrtY X-Received: by 2002:a05:6e02:1c27:: with SMTP id m7mr14372214ilh.190.1629470982973; Fri, 20 Aug 2021 07:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629470982; cv=none; d=google.com; s=arc-20160816; b=P0jyp7arVksrTJQcCIVLrZDnr3MucL4rFMRsS0/7IAAzbHL56UYZseR7SUxcR6HfAo 6V45MuWk3pO5KZGb7YNwwCNKESk2pen5ZC7Yw4McsbHyyeIh2jOmNjT3DfUx33LBgkbL 80Fauz3jnTSmVsG9Wgw2LmqvFmMDbWTEJyH76qt9y0Ugp3PV8RYjhnHZ8se84dhI6sqA T/oOk1hRkIiDnfEmuJ5yp30FtrIo9rwYhqWDa/+7Rwz5xDxg7/tEUwQ5CC1sWiJmnoes zE/SKKy8cX1OaNfEstmDMpETc7PCu6smbXqd/rRWHfd+UZOTBz3VfbFACa2BQ6M9PKyU ZSWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=IAap0uEg+bEzDrlbJl9pDYzY5IR7LonRDU7yGixlUvo=; b=GL3TLdKSQJKzMRuLg/YPxOlAfdL2TEU04UFSQlr2/8d8YRVkK+A8ImbXXaVnHEsaFG FtH3DaueRp1CJ+ILM5SCFMQHGXzCwOVjtHY7PNtFyWFuXbs0wqhPbBhMgZ/okXbXf2HP hvwcS5cFQIbZYHcwY9hAG6YT8Zwtsnq+G4qU2Rp+t9Rm3YmaBh/ffe4dHegXJfwP+fah OQK69eF4ihrLV9ww4uIYQ7lnwMINz3WMPZ7x5hXuSWGdkQIil/pQui837DB96BRBYny1 Ly+n5QO8DWOk6TxQ+euUJMDwFdv0tfFEvzlAFMeHrmilUFlpTuI4QOFzSmy5f4EYsmf7 a6tw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m4si7087753ili.30.2021.08.20.07.49.31; Fri, 20 Aug 2021 07:49: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240955AbhHTOsR (ORCPT + 99 others); Fri, 20 Aug 2021 10:48:17 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:58472 "EHLO lizzard.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240935AbhHTOsQ (ORCPT ); Fri, 20 Aug 2021 10:48:16 -0400 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id 17KElYgX006287 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Aug 2021 16:47:34 +0200 Received: from [167.87.0.29] ([167.87.0.29]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 17KElX7I007803; Fri, 20 Aug 2021 16:47:33 +0200 Subject: Re: [PATCH] PCI/portdrv: Do not setup up IRQs if there are no users To: Lukas Wunner Cc: "linux-pci@vger.kernel.org" , Bjorn Helgaas , Linux Kernel Mailing List References: <43e1591d-51ed-39fa-3bc5-c11777f27b62@siemens.com> <20210820144532.GA25391@wunner.de> From: Jan Kiszka Message-ID: <53a826fb-ece9-450d-e5fc-f145c2513688@siemens.com> Date: Fri, 20 Aug 2021 16:47:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210820144532.GA25391@wunner.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20.08.21 16:45, Lukas Wunner wrote: > 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(). > Not all service drivers need IRQs. That's why the test is separate. See also the comment I shuffled around. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux