From nobody Wed Jun 17 01:42:26 2026 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 6DE7A3822A1 for ; Tue, 28 Apr 2026 22:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777415519; cv=none; b=PByT5xQvBYgbc28LG4tKLfXyn6Y2yT18xX2MuPvKHWfyqSk1PBNitE9agLG7LPa8U4JUQSSMvYr9Vp61SICdu3OnEMo9/6Wf1nHS/TPfev/2ivnwnQaMpJA6OV98ysSMA2AZqxosChPamIe763C9w+dlIevCByf4H4+8gRnc5kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777415519; c=relaxed/simple; bh=1TILo7Kc7IXkpW2prs6AGO5QGWX2eoulzDvpaF+l4tc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=WyJndv9II2NPVXjMYtP+94RVKjTL9GsgNXglnep2SGDAze+2okP7P+LO8vHrm8AcUKrAS/o1+vDQKrgQ2kMdgI/pd5vwqJtdLE/mYDb6bPKxUg29tlzyUFE8K/sHo8f9Pr7+CYSxANXFEfeYNesQtAPcsQBSq0l7GyyU+8LNQn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jqluv.com; spf=none smtp.mailfrom=jqluv.com; dkim=pass (2048-bit key) header.d=jqluv-com.20251104.gappssmtp.com header.i=@jqluv-com.20251104.gappssmtp.com header.b=h+j/IdFu; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=jqluv.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=jqluv.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jqluv-com.20251104.gappssmtp.com header.i=@jqluv-com.20251104.gappssmtp.com header.b="h+j/IdFu" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-82f9fdfc965so4860884b3a.1 for ; Tue, 28 Apr 2026 15:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jqluv-com.20251104.gappssmtp.com; s=20251104; t=1777415517; x=1778020317; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hRQFtmX2KARB7XLU3bk156bMegoBkNu0rj20CmJIQFY=; b=h+j/IdFuNiUIQ66rVOdDJf1wpQqNWDq6nfzL3u8Sp/m7WjiFzmGFdBf+vBHWL6Liya zJtiegyaKNYbc3MN8/xg+cTWNe6Wna6obQRP9VSxiGypi/7lbGix1QrUjojIQt+2a7xk nthCL1zYnOw255qMeD2HVqWXvghnG0I8YyuAL/fYIly+3xwQXne5NbtpQ0xbDFqdIOD6 TsSURY/aI09KgglbctG53ZuyR1Jr5vNfpuaVpuqKHHNNFBaZZo+vRhw25X9vxH5p4ZuK J6PDd/BUz1P3v6whPZ3ibfFu+Dw0H2gqsrlvvom5ZLM9qOsTJS8cKOLm5SW/ZEDJRQWF dQhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777415517; x=1778020317; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hRQFtmX2KARB7XLU3bk156bMegoBkNu0rj20CmJIQFY=; b=CW0mJfdSyAAGce/kSNjUx+qjoDeoqv8os3C4nY9k6NdCm0m2n0tBm+VBJmlOrYOJ9o dO1/GTKbI4FeQMWktZzkxkXPPz9v9jhNi5qa2BR6CPJJwljYLSRMTL9YAKA+D9K9CAqH 8ujQwE7Txs/hRTwo7kWCKVm4m95L2zm9xC2FisQnrsYGYq0Ifs3yAOZvzrOBwlQFtUQD iJF75NalEWp3Q9ZaUUTmxTIuNCxwxV2ljQrB+Am8s2a8vPMNF5Li0dmXJUhih/XlQI9U dXUMgd+ujxvohs251773YxpY/CRrhK+yQggUaJOeKj9Dl7GTMpUM0e0II14IwPOvGp9h QghQ== X-Forwarded-Encrypted: i=1; AFNElJ+Dr2+ukShrv5wbPLZEzU++vqSWPbfUueNhRwfrJbgydRiAte6SpTGMAmSfTO+PGql8aBCTZFZUhKNWYD8=@vger.kernel.org X-Gm-Message-State: AOJu0YwyQS5cFH/Ujj0TTrDqpr981mxT8VR7BngiudOJ52xS7Cd6eL/S 3IzU/91jYExQ0Nfszfob9VBZ2y5RtrHjG4xr9644CASGAzQiQeYDpl4Lnd9A999wpC4= X-Gm-Gg: AeBDievGgpTFryNdbB0bLa3OEte7BVLAd7JzYOW8As1jGPW172vwve3BNxcxCa8+WpB /GZf1TUpmnB3tPodUXFiXu7qbJ6h/scVYB4cbRIZmEmebVeTpOaACiT1adrtS0LpP+v91dO2U9m 8XXcrEYcEvPyGZ7tP6mCXw6GhSt3zMqxLlJRI9lvpqgEUcqITgfP+doEH+Un1HtfLUu1kH58WaL u3xChD2+QAD2B1BTnAYY+1RJZsO0cE9WxgNdXw+x7nLewgHf04vAyEeSnERyHer01lXN6f+QA3H tcbGBgqM74170VK2cylZUXRGv4VtU5KXovzWjbVwJmcjcg58KOO5BMWnydEFw6F9bikJYSfJGcF 1l98EqfmdWIYaYDYePKQGs2QTHPFkTyWFjrt24pFziHbZdtC2mPfqbfE612qVd9aHeT2S8zZkZl vk1+pIFFtevGpVT8Z81qvj9QUJk9geU/oGak5yxvAxsHrIK4k= X-Received: by 2002:a05:6a00:f9a:b0:82c:2155:5b6d with SMTP id d2e1a72fcca58-834ddabdb7dmr5235533b3a.12.1777415516668; Tue, 28 Apr 2026 15:31:56 -0700 (PDT) Received: from geramyl-MS-S1-MAX.. ([2601:201:8080:e5c0:4857:38db:7c94:21e1]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-834ed5a1026sm110276b3a.4.2026.04.28.15.31.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2026 15:31:56 -0700 (PDT) From: Geramy Loveless To: bhelgaas@google.com Cc: mario.limonciello@amd.com, ilpo.jarvinen@linux.intel.com, christian.koenig@amd.com, cristi@ieee.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Geramy Loveless Subject: [PATCH] PCI: mark Thunderbolt-attached devices as removable Date: Tue, 28 Apr 2026 15:31:47 -0700 Message-ID: <20260428223147.3092087-1-gloveless@jqluv.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" pci_set_removable() only marks devices as removable if their upstream bridge has the ACPI ExternalFacingPort property set. Some firmware (e.g. MSI MS-S1 MAX with AMD Strix Halo) does not set this property on Thunderbolt root ports, so devices behind them are never marked removable. This causes all drivers that use dev_is_removable() to miss eGPU-specific code paths. Fall back to pci_is_thunderbolt_attached() when the parent is not already marked removable. set_pcie_thunderbolt() runs before pci_set_removable() during device add, so the is_thunderbolt flag is already available. This fixes the problem at the PCI core level so all drivers benefit from correct removable detection, not just individual drivers that add their own Thunderbolt checks. Signed-off-by: Geramy Loveless --- drivers/pci/probe.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index bccc7a4bdd7..2387edc5b89 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1761,17 +1761,23 @@ static void pci_set_removable(struct pci_dev *dev) if (!parent) return; /* - * We (only) consider everything tunneled below an external_facing - * device to be removable by the user. We're mainly concerned with - * consumer platforms with user accessible thunderbolt ports that are - * vulnerable to DMA attacks, and we expect those ports to be marked by - * the firmware as external_facing. Devices in traditional hotplug - * slots can technically be removed, but the expectation is that unless - * the port is marked with external_facing, such devices are less + * We consider everything tunneled below an external_facing device to + * be removable by the user. We're mainly concerned with consumer + * platforms with user accessible thunderbolt ports that are vulnerable + * to DMA attacks, and we expect those ports to be marked by the + * firmware as external_facing. Devices in traditional hotplug slots + * can technically be removed, but the expectation is that unless the + * port is marked with external_facing, such devices are less * accessible to user / may not be removed by end user, and thus not * exposed as "removable" to userspace. + * + * Some firmware does not set the ExternalFacingPort property on + * Thunderbolt root ports. In that case, fall back to checking + * whether the device sits below a Thunderbolt controller, which + * is itself inherently user-removable. */ - if (dev_is_removable(&parent->dev)) { + if (dev_is_removable(&parent->dev) || + pci_is_thunderbolt_attached(dev)) { dev_set_removable(&dev->dev, DEVICE_REMOVABLE); return; } --=20 2.43.0