Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp255070rdh; Tue, 13 Feb 2024 16:24:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUsh9poU3tSvdF99p93v78r7imrUDIu5DLXCcsfYOha8y8vhUixf3rA72jPHQCNS2ajtjOr4u6wfNzUVT3k1u3yoFVjWqvwYJp325eODQ== X-Google-Smtp-Source: AGHT+IGNAEGvYyJ2+vZ12LS3/UbC7v0M+bpm+iACZPVyGI7cJ5c49jmk4CDGQNwV7lhk9Kc2g6Yz X-Received: by 2002:a05:6808:2e87:b0:3c0:3309:2057 with SMTP id gt7-20020a0568082e8700b003c033092057mr1742361oib.26.1707870261174; Tue, 13 Feb 2024 16:24:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707870261; cv=pass; d=google.com; s=arc-20160816; b=rSaWhHEpkSOtbqw8qgcODKQI21HnwvciIGRMktIGr3fB/kZ1z7qQl7Yo0qrMopxKar qPcqaL/jbGNTEI7/C9GhHn8Hj8XGvQOIVYe1MT6YUKMqDM6gKy8oMWN3dtAhh2+eFG85 4RWn3quYq1HIhfbNiBQvKIpms5cceZmdeSz98Bc/ZVFuBqzXiR81HeB5RXAxB6yEw9eY wjVwcefR8WaVHznM65JQyXaXjMT4sq/ny0rK7SLNvmQ5WRGwfSFV9goPhFhax0i1+PML fIgpCjuc4fNvXV5tE1WiJvuToE7rxaDhtHWHijgpesElfkmYDDAuVdQeGZh+7Slw6yLV mSKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=LUHwCmgFvsLI2w7Qfq1pAeSWXQrKo7dao4Gqpb0bey4=; fh=4J5FtEAuTrgdqKatm4WIgqmGeONhL3PrmPCRK4tYUhM=; b=wcSU8r/0IslFEZ90/sOZJgzNfNfkT9o72nsN9WDcHPoAhvBrUrrgh6/WxpYEksdgo7 LQqLzHWdXs8x2PzNtW16gEZv/yWMSMUp/MJwIqSAF448oIwBNzIggqKKtxnuXjUo85ko WWqhhrjuk2yQR1OrlPQ4Ef/TdsfzJrCuSdJz7FNoqfVRnaWEBXfdcijZJXDp9aQ+e1P5 fdHCh97GEecEXw93Puxs9cwITycDdoV0otLaN3nvXkFGSjuofO2LxEHFc8SM3mY1nzWN pDnOBf5BrQwoCvlRfGH7wvIosRxqzEj56X5uRtV7sG3WeF01UhpkRPvm3wEbJC5VFt15 t/oQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HohXR0uB; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-64589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCWLXxVsZGxrWux15QSwM/rEhhQ1NDtzeTYjm4tmuyT563MjCgkLHdUxP1H9x8RrM51WMu6/ZEYZUAZN8pY0DZ/4rZPXRCR9WZPTYqWbCQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z29-20020a637e1d000000b005dc504b9628si2769133pgc.113.2024.02.13.16.24.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 16:24:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HohXR0uB; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-64589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 70E4FB20F5F for ; Wed, 14 Feb 2024 00:03:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAA9765C; Wed, 14 Feb 2024 00:03:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HohXR0uB" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 328267F for ; Wed, 14 Feb 2024 00:03:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707869011; cv=none; b=TeNMBisFCWmTtJpZinosamy/uj7gpKk/v22wI9OFK73n33JOycYr8uq4QUvD8fLiQp33Z8hMaMDK87rN+KD8AmhJGguVcXr7URNo593kgpLM0oBXIcP2odkBVgAgOuNiTdoY2uVD56tAaomLwRCtSuDHOedkBWgcraPjv27TGII= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707869011; c=relaxed/simple; bh=LUHwCmgFvsLI2w7Qfq1pAeSWXQrKo7dao4Gqpb0bey4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Ekz7jTwcErmhPK/X77YY4jg6SZB93YV7JlVcL0eHjibSS4D300tqBTRZJNynUI8Xjm4XqpIr2ZiYeB6Y5fChtXpX1DXZI/6qtkX05z0hNNsM+iHLMPpL9dVqggEmFRHguhzS0CYrSViTT4iGPLfsCGbN8I9hMiTMUUejJII7GvM= 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=HohXR0uB; arc=none smtp.client-ip=209.85.218.43 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 Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so223527366b.2 for ; Tue, 13 Feb 2024 16:03:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707869008; x=1708473808; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LUHwCmgFvsLI2w7Qfq1pAeSWXQrKo7dao4Gqpb0bey4=; b=HohXR0uBw/a0jNLqSD3RWB2JJ51gKvKRLLEpqIsp8+P0RTMT7nNvTXF58kjEgifod6 Qwnld6KZ13xh23UpOXLEHesq74Av7sy0u90WExt51sfpMTx2p2kVBh7OeJynlslSYL8A IepMan/+lXwGe1MWISJut/+3st5DitcOJcVkM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707869008; x=1708473808; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LUHwCmgFvsLI2w7Qfq1pAeSWXQrKo7dao4Gqpb0bey4=; b=tq3F1tB5QMUF94oquMhnyA5IK/TcZqigkhAMg9ky843VWMKw7/eULTLPAOOIqPReje hY2vr6qVc7rZ4+UxQxB53TtsinB5phd3yDTIHCd1osnBxfPZwHGYAeLcWehP1LJVyVhR fUe2i08dPmz/IL9HBJ17LuTAwsiNPN9SsKtfb9YtFk7qaYLWSCaqGXopvOU3muPB0sBl csEDuQ9l/9eoI835r7MyA0N0T3haQDjBMIK2a0UcLD0r64vdSbmOrj//24ZkxiiuWOh6 cKb6akhPe4I3cfgDqRIBzxiYVF/uvn1+ESEsoMhf6/9RRYB2lx7gym1ufI6DZouFhQri TW/w== X-Forwarded-Encrypted: i=1; AJvYcCWzeWbXVyXQdp89bdoIEJmPHuRQ1XigInMqs5V+oDOxhJHyUvc82+95NW9Yf4EtZuR7APQBsZ4ZtrFTf/yqiKTW+569M7RBdII1FQzt X-Gm-Message-State: AOJu0YzWxPLkTDXnSDaV8PKie2WJqJiyINWFdAIujWAa0Wko3u6022AT qegIB3V7CaUiEiCeySySL7Bpz4RGNv0Gc/YeY6fOl05HEYMLX1IbWX1Uduhw/e8DvNqvtxELben 91+Pn X-Received: by 2002:a17:906:54c8:b0:a3c:b313:fb57 with SMTP id c8-20020a17090654c800b00a3cb313fb57mr544144ejp.17.1707869008231; Tue, 13 Feb 2024 16:03:28 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVsNbZHw3ebJJxJpHGihusjzOpznQFYKV3XXS680Y2gu8ai59NQnlK++HV9hRgoFvfyDLMBk1hIIga9YFho+bzpfN4n0VtfxcFRh1mb Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com. [209.85.128.46]) by smtp.gmail.com with ESMTPSA id s7-20020a17090699c700b00a3cb136aef0sm1748030ejn.224.2024.02.13.16.03.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Feb 2024 16:03:27 -0800 (PST) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-411d9e901dcso42155e9.1 for ; Tue, 13 Feb 2024 16:03:27 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXpQ8Nb6lNMgVW99FV6CjGuXR78eYDYdS7G5DMFcU1uqh21Th7jZkIB5zKLfVz95R+SF8dKDHT2V3TAGhG136za8vHLrsyHIfCDT4q9 X-Received: by 2002:a05:600c:519b:b0:411:e5c1:9b2a with SMTP id fa27-20020a05600c519b00b00411e5c19b2amr21434wmb.2.1707869006878; Tue, 13 Feb 2024 16:03:26 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240210070934.2549994-1-swboyd@chromium.org> <20240210070934.2549994-5-swboyd@chromium.org> In-Reply-To: <20240210070934.2549994-5-swboyd@chromium.org> From: Doug Anderson Date: Tue, 13 Feb 2024 16:03:11 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 04/22] usb: core: Set connect_type of ports based on DT node To: Stephen Boyd Cc: chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Pin-yen Lin , Greg Kroah-Hartman , Matthias Kaehlcke , linux-usb@vger.kernel.org, maciek swiech Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Fri, Feb 9, 2024 at 11:09=E2=80=AFPM Stephen Boyd = wrote: > > When a USB hub is described in DT, such as any device that matches the > onboard-hub driver, the connect_type is set to "unknown" or > USB_PORT_CONNECT_TYPE_UNKNOWN. This makes any device plugged into that > USB port report their 'removable' device attribute as "unknown". Improve > the connect_type attribute for ports, and in turn the removable > attribute for USB devices, by looking for child devices with a reg > property or an OF graph when the device is described in DT. > > If the graph exists, endpoints that are connected to a remote node must > be something like a usb-{a,b,c}-connector compatible node, or an > intermediate node like a redriver, and not a hardwired USB device on the > board. Set the connect_type to USB_PORT_CONNECT_TYPE_HOT_PLUG in this > case because the device is going to be plugged in. Set the connect_type > to USB_PORT_CONNECT_TYPE_HARD_WIRED if there's a child node for the port > like 'device@2' for port2. Set the connect_type to USB_PORT_NOT_USED if > there isn't an endpoint or child node corresponding to the port number. The above sounds good, but then I look at patch #18 ("dt-bindings: chrome: Add binding for ChromeOS Pogo pin connector") and patch #22 ("arm64: dts: qcom: sc7180-trogdor: Wire up USB and DP to usb-c-connectors") and it makes my Spidey Sense tingle. Specifically, I _think_ if a port is "hard wired" that can sometimes tell the system that the port is a bit more trusted. In the case of the "pogo" pins on detachables, though, I don't _think_ there's anything that prevents someone from making a "pogo to USB A port" adapter and then you could plug anything you wanted into the pogo port. If there's any extra trust given to these "internal" ports a nefarious attacker could presumably abuse that trust for the pogo pins. I have no idea if this is a realistic concern or not. I'm about 95% sure that hardwired "PCIe" ports get extra trust and get "deferred IOMMU flush" enabled and, in the case of PCIe, that actually is a real security hole. For USB, though, I think the system is more isolated by the USB host controller so I'm not sure that there is any extra trust given to "hard wired" ports. ...so maybe the answer here is to just ignore my rambling. ...or maybe the answer here is that everything is fine but patches #18 and #22 should be modified not to cause the pogo pins to be considered as "hard wired" since they really aren't... -Doug