From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f181.google.com (mail-dy1-f181.google.com [74.125.82.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6ACEA34CFA8 for ; Wed, 14 Jan 2026 19:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768419028; cv=none; b=ajiw8Ykysbvtal4nuTCPCMJsR9backog70HTRjeRI63j6zqHxZfZk81f1xN6yQ4K9GdVZIkdtE+WqX8rUMcNQZHOP1rCPMJCxK9e5b3ij3+/7C7Yeyxmd1krN0v/k3Vc6mszrfUWkYqX+ySY+M9v+yElShGrOeIsWrGSfCk2t6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768419028; c=relaxed/simple; bh=IM7H/ZQgqjJxBEG5s3Aii6NpGMyiQs2dtjYKAYkjjMU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bpOjYE9hehmH6qDIxnPAdJJxuikAJyDcoehJd0bIHlsiJ6K2b0L0w/OlBaSp13hgLtSa9PzeBoLCfZyM9++bX5NyfcWjs3yXMgPeBBWrUiAWshVPfBXZ8fFCjpLE39rJz9I46SgvCeEFZGT0rmGsz60nDccY459T5DizGi/RgFE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=E07QDrLE; arc=none smtp.client-ip=74.125.82.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="E07QDrLE" Received: by mail-dy1-f181.google.com with SMTP id 5a478bee46e88-2b05fe2bf14so365813eec.1 for ; Wed, 14 Jan 2026 11:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1768419023; x=1769023823; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=OgKGq9opOB0J5kc1IsRO+3fBF7gaT8B4jDYyPKNcgiE=; b=E07QDrLEuZv5Te/DdarHvzkmPImCUsnJ1wKHW47ps+c9me4Mpky6dtJ7nTOVCzmrKD YYHGtymwQUJvfjaxXVWe4DE2kd5x5lCuyp6pOExIF9SDmz15OIP6arYdXBAfNzN2k5T/ sgPX5DxasIFDbfXHgXF50XaNen/dAte/eGa1w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768419023; x=1769023823; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OgKGq9opOB0J5kc1IsRO+3fBF7gaT8B4jDYyPKNcgiE=; b=jeLE7C2I203V+QuB4CJ4LAqTGI5wJJieroXSTxHxBJpBYD1sd9OSHfwGsk8ASl2dQs MPJCQdOkR41JUGuje3hQCF+gC+kFWHYcQemfaTI5+OYQtHUE8llSq+8mv7rj96fgPEQO NYzuN69Vk7nTviojXmSRa5Ivpd4wo616HOeulaZpUm3uqyIY9LHFSWhVtyNUjcFHfuDy yJp+ClCeF0PbHxuK3OGNYfF0vXZRa76mfyvuf2eVyPNPbTPCmzgyj2o4ylxrSyiZOiQt Wmdgvn5oP4izzpXTrClJp+YunxYIcTTmTVVu35suRjeMlFR8Cz+0limKrD37TEBbIJLg 8SbA== X-Forwarded-Encrypted: i=1; AJvYcCV4R4xY4rQxc01PGShwuUqm+Q1NHd5aUAVCX5nILjZ1GbyWBYoBlCTIfPkBw/hdDSdxzBvw18bxssopFWk=@vger.kernel.org X-Gm-Message-State: AOJu0YzrY3zSL6qhIXTQKHukKdFU79YcflVK8iQA1D2OauSRj6u9DiHl Yg4ArHWXwpzMY/IjeipO84QeKr86AVmBwv8NlM6InxClME4kr3gc9VkrAUShbHluew== X-Gm-Gg: AY/fxX4G2ES9H+i26LxKJr/9nVHVuiNf0sU2gCCEF9AnQOYbAqpWS635i8b+388mdaA 5oFXC01ia2vXCfooW+dlLqvL9s3oHRXg/o1W4QqufaBBmZgw7eQqYRxO4jMJkC/22lxpqMxiXOQ oYjrRswOopPjwYZZT3greX8ACs1hAe5YYFFqGtrNVRnjfMFqss5vcWhAA2YN3SkOw7pLGFEVUsw x+GUBmtphspZSPiG03pYmn3SRFH+owIx+93MSkT8L8ZVV/GpDzLCuYp3y+7yAuaiN/NOOCUeQZr VIy6QADU1lOVIMvhgWCiHcbGbPNlAVSgrfvzB4xc0581YEYdkoFc4akXJAhlyE6cABqywh3bDHI Jj2ArCp1okUQ99mPkeh0C1DyU+cVM3ZMCpJO03lTy7GL5XwmmOpCLYCg53pCW5mNvdkPr3XD4mX Q2rh+UJYq31ZiJH9bR5T1wzhYR4Ha92Zy26nDwu/s26bjqf+/JFg== X-Received: by 2002:a05:7301:7bc3:b0:2ae:5be6:f47a with SMTP id 5a478bee46e88-2b486c9600fmr5116768eec.17.1768419022747; Wed, 14 Jan 2026 11:30:22 -0800 (PST) Received: from localhost ([2a00:79e0:2e7c:8:ae4d:1d26:39a5:d7ab]) by smtp.gmail.com with UTF8SMTPSA id 5a478bee46e88-2b4549fc8e9sm4624393eec.28.2026.01.14.11.30.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Jan 2026 11:30:21 -0800 (PST) Date: Wed, 14 Jan 2026 11:30:19 -0800 From: Brian Norris To: Lukas Wunner Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: Re: [PATCH] PCI/portdrv: Allow probing even without child services Message-ID: References: <20260109152013.1.I5fd5d83f518681b3949d8ab2f16ba8244fd3e774@changeid> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Lukas, (FYI, I missed your email earlier because of errant spam filters. I'm sure that's on my end somewhere, or maybe some over-eager DKIM stuff. I only noticed when I checked lore... I'll try to keep my eyes open.) On Sat, Jan 10, 2026 at 07:10:52AM +0100, Lukas Wunner wrote: > On Fri, Jan 09, 2026 at 03:20:13PM -0800, Brian Norris wrote: > > @@ -355,29 +355,18 @@ static int pcie_port_device_register(struct pci_dev *dev) > > if (status) { > > capabilities &= PCIE_PORT_SERVICE_HP; > > if (!capabilities) > > - goto error_disable; > > + return 0; > > } > > This will keep the Bus Master Enable bit set (see call to > pci_set_master() further up in the function), even though > no MSIs are expected from the device. (I *think* these > would be the only memory writes that a port would perform.) > > That doesn't seem right. If there are no services, it seems > prudent to clear Bus Master Enable again (as is done by > pci_disable_device() right now). > > > /* Allocate child services if any */ > > - status = -ENODEV; > > - nr_service = 0; > > for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) { > > int service = 1 << i; > > if (!(capabilities & service)) > > continue; > > - if (!pcie_device_init(dev, service, irqs[i])) > > - nr_service++; > > + pcie_device_init(dev, service, irqs[i]); > > } > > - if (!nr_service) > > - goto error_cleanup_irqs; > > Same here. Why keep Bus Master Enable bit set and MSIs requested > if none of the port services probed successfully? Seems like a reasonable suggestion. I'll try pci_clear_master() in some of these no-op non-failure cases. Do you have the same concerns if pcie_init_service_irqs() falls back to INTx but does not fail? It seems like a potentially fraught exercise to guess what child services might need bus mastering though, so maybe it's better to limit this only to nr_service==0 cases? > > The PCIe port driver fails to probe if it finds no child services, > > presumably under the assumption that the driver is not useful in that > > case. However, the driver *can* still be useful for power management > > support -- namely, it still configures the port for runtime PM / D3, > > which may be important for allowing a bridge to enter low power modes. > > > > Thus, we allow probe to succeed even if no IRQs and no child services > > are available. This also mirrors existing behavior for ports that have > > no PCIe capabilities, where we'd also probe successfully. > > Nit: Please use imperative mood, i.e. "Thus, allow probe to succeed..." Ack. Brian