lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <53a826fb-ece9-450d-e5fc-f145c2513688@siemens.com>
Date:   Fri, 20 Aug 2021 16:47:33 +0200
From:   Jan Kiszka <jan.kiszka@...mens.com>
To:     Lukas Wunner <lukas@...ner.de>
Cc:     "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PCI/portdrv: Do not setup up IRQs if there are no users

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ