From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f50.google.com (mail-dl1-f50.google.com [74.125.82.50]) (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 08E4425C80E for ; Fri, 15 May 2026 01:49:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778809794; cv=none; b=nwjLm9wi9i6Ir8ZDHiEasP4ufCQqenPRARbE+h/ugVBxSXWrG3OVnHuDEF/Y1XfXSHEMBbi4FRhcwRtbF36lffGMPMWUCd7ZxcAi6vNsV1WveFu2marOm8orF572T0ZPGuqYmCJw0y7I9bUDdTZE7Ikj0bxTZd64drQEz3Nh1YQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778809794; c=relaxed/simple; bh=SIkgv8WQ93LCQ71jhhL3Di/xP8TbuCuowvj1KosLZko=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=X0AxvKiABWjVPeOpJhoi3iAagUOvuztEQBF5W9dq/n6pndV9fkzYobpvh5l3U7/JJ1K7a3LQMvvJIUvqiKra4P0sj4Prz6gqoCCn9ij6lIUzKuQ6Kai6B86E6Ee10y3DfRiPky1kNa29MITdg4VQ2xJmShtEWO3fkGeF13BbErc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=oWBhPXr0; arc=none smtp.client-ip=74.125.82.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oWBhPXr0" Received: by mail-dl1-f50.google.com with SMTP id a92af1059eb24-12c1a170a50so12195287c88.0 for ; Thu, 14 May 2026 18:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778809792; x=1779414592; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=zrNDITa07PIrUrnI0P0l/esE24/KQSx6Tox+P9NMGxo=; b=oWBhPXr0SycOWAmTPteIs17tKJBKkiUQxpVoUCn7ddRMGeMbZSgoaVGcRJ/OeFEntF TnJgPbe1AdXoUBSPoJR51y/8dY5QUn1n9VIaY5Omuj7au3txbRX3fifNKE8B751aZd6Q UzYZbKuwPdyKS6z7BsARsIjXuvVP9nBU+1mlwQadJyKT4XeaJG5FvliDHSDacX0hbahi 4wz/vyQNg4vCsg6EKP0yQypUz1HB/gA3C71EJFuemGN1ZnjH+KqAG6oPpZ2FOde5SaIW bIpa+fuhGLYa1zmVQCgVxjY7rbxx4IP3FypX88VKVK2Zp9ONFaz8b9NNmkqFwukoC/wp yyYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778809792; x=1779414592; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zrNDITa07PIrUrnI0P0l/esE24/KQSx6Tox+P9NMGxo=; b=i3t2RCxm15chnTF5P5wycES9PFSEgGhBjNgjmbPjWCOiQENA90aNk9gIkUlFDThrrP D2kDylgcVRulyDFOGEWqe5YX/zS8a3+VVjnp18MQskj/3Kw1Sd10oXCjIma/dJvQKAVx 51R3gFueYEhdKrQjx/1Fkt79F/RMK1AuF0KbWqc2yoQ2wQQk+MOxSRl3Welr50SH6HUz xv2Df7pt0c+Lo80hWrfMhMaiHYCDUl3fJAv5haDUOqn6jfCd8USYU1wneQDnfgjgipQd 4lJou7vh6r30lyyQ+fCadKA0XY5il2maX3qtAPqFReyMPUvRBMhGnyEZA4ErkBP2rVw2 w9YQ== X-Gm-Message-State: AOJu0YxskHxXMmv2fwabpKhCGHPQVw4kXFVmqBHNybbrjftjwg8S2F8e kY5y1+glGBoA4khGOFq9ps/7a4wYCLX80n7fwyvC1T21OEAAvmhDydidnjiKnA== X-Gm-Gg: Acq92OHNIQ0hLpu1GZxuw6zt96t3o5dWFZ5R8M9B6uG2CdC7vduSQrTlUzjFRO9an4j tGk1HulrQ/JYvZurQP9E3D24qnwkVwmUkhG6Xj1lqLCFKkPyHz9ZFs27weYzw3IL6Jq4l4hUW98 saWs29JRfFBc4DAWBQ3DNng7AKV0TvXRHxPPXl30BFmVZmuYWLHjQliOwDJI+G/S6hPaW3/5cUE rQbcl0ZBg2O8QoN82p2+5icvVAmFXE7rdqAVhL5FebI2x1gTStAA9UvWSbgnYzbmhfl409Dv8cY plnLpBStLW+gLg5wwNVJEf06pUqhAUiB+hfMNoSlnjDJCdfVbygmkoNXEqA9pIu68pYb26EO0fC vRohH8zPBGvKVbjwNWAVm+VwX64DGurMThat0VGnDeRX/mRe4YiYpdQrO20vq25UEDWjKcyi2Bh clr8SWP/oqFGFWcXKfrw408r6jCXaCxPk2QBqKyKGwHugH2uxl2RJrhl7wgEVV3KQHiGzBHP3uk 3LQjw9/XlA= X-Received: by 2002:a05:7022:311:b0:12d:b396:eaed with SMTP id a92af1059eb24-1350440ae04mr818420c88.9.1778809792003; Thu, 14 May 2026 18:49:52 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:da43:aeff:fecc:bfd5? ([2600:1700:e321:62f0:da43:aeff:fecc:bfd5]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-134cbed2232sm7676638c88.7.2026.05.14.18.49.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 May 2026 18:49:51 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Thu, 14 May 2026 18:49:50 -0700 Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/2] usb: xhci-pci: add AMD Promontory 21 PCI glue To: Jihong Min , sashiko-reviews@lists.linux.dev, Jihong Min Cc: linux-hwmon@vger.kernel.org, linux-pci@vger.kernel.org References: <20260512213910.871859-2-hurryman2212@gmail.com> <20260514004055.1BBCAC19425@smtp.kernel.org> <110e9a0d-bc91-4959-8a7b-1a055d0b49f7@roeck-us.net> <1f296d29-3d43-4dd3-b751-8a0892b4095a@icloud.com> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy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Q/RY/EX35neH2/F7B RgSloce2+zWfpELyS1qRkCUTt1tlGV2p+y2BPfXzrHn2vxvbhEn1QpQ6t+85FKN8YEhJEygJ F0WaMvQMNrk9UAUziVcUkLU52NS9SXqpVg8vgrO0JKx97IXFPcNh0DWsSj/0Y8HO/RDkGXYn FDMj7fZSPKyPQPmEHg+W/KzxSSfdgWIHF2QaQ0b2q1wOSec4Rti52ohmNSY+KNIW/zODhugJ np3900V20aS7eD9K8GTU0TGC1pyz6IVJwIE= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/14/26 06:44, Jihong Min wrote: > > On 5/14/26 22:38, Jihong Min wrote: >> >> On 5/14/26 10:20, Guenter Roeck wrote: >>> On 5/13/26 17:40, sashiko-bot@kernel.org wrote: >>>> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: >>>> - [High] The Kconfig dependency `depends on USB_XHCI_PCI=y` completely disables PROM21 support for systems where the core driver is built as a module. >>>> - [Low] Signed integer overflow when calculating the auxiliary device ID. >>>> -- >>>> >>>> commit 20f4e35b2f88ebe2b8988b4f07fe7cc28199096b >>>> Author: Jihong Min >>>> Subject: usb: xhci-pci: add AMD Promontory 21 PCI glue >>>> >>>> This commit adds a small PCI glue driver for AMD Promontory 21 xHCI >>>> controllers. It binds the controllers, delegates USB host operation to >>>> the common xHCI PCI core, and creates an auxiliary device for optional >>>> temperature sensor support. >>>> >>>>> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig >>>>> --- a/drivers/usb/host/Kconfig >>>>> +++ b/drivers/usb/host/Kconfig >>>> >>>> [ ... ] >>>> >>>>> @@ -42,6 +42,26 @@ config USB_XHCI_PCI >>>>>       depends on USB_PCI >>>>>       default y >>>>>   +config USB_XHCI_PCI_PROM21 >>>>> +    bool "AMD Promontory 21 xHCI PCI support" >>>>> +    depends on X86 >>>>> +    depends on USB_XHCI_PCI=y >>>> >>>> Does depending strictly on USB_XHCI_PCI=y cause a configuration regression >>>> for most distributions where the core driver is configured as a module? >>>> >>>> The driver source appears fully capable of being built as a module, using >>>> module-related macros and module_pci_driver(). >>>> >>>> If the intent is to prevent an early boot mismatch where xhci-pci is >>>> built-in but the PROM21 glue is a module, could this instead be a tristate >>>> option using depends on USB_XHCI_PCI and depends on !(USB_XHCI_PCI=y && m)? >>>> This would enforce the boot constraint while preserving support for modular >>>> kernel builds. >>>> >>> >>> That makes sense to me. That would be stronger than using default (which >>> was my idea of dealing with the problem). Restricting the code to USB_XHCI_PCI=y >>> seems to be a bit extreme. >> >> Hi Guenter, >> >> I looked more closely at the Kconfig part of the Sashiko suggestion. >> >> The concern itself is valid: the v5 dependency on USB_XHCI_PCI=y is too >> strict because it prevents the PROM21 PCI glue from being built when >> USB_XHCI_PCI=m. >> >> However, I do not think the suggested expression works as intended: >> >>   depends on !(USB_XHCI_PCI=y && m) >> >> With Kconfig tristate logic, `m` is a tristate literal, not "this symbol is >> being built as a module". If USB_XHCI_PCI=y, then: >> >>   USB_XHCI_PCI=y && m  => m >>   !(USB_XHCI_PCI=y && m) => m >> >> So the dependency becomes `m`, which limits USB_XHCI_PCI_PROM21 to `m` instead >> of allowing `y`. That is the opposite of what we need for the built-in >> xhci-pci case. >> >> The combinations I think we want are: >> >>   USB_XHCI_PCI=y  -> USB_XHCI_PCI_PROM21=y or n, but not m >>   USB_XHCI_PCI=m  -> USB_XHCI_PCI_PROM21=m or n >>   USB_XHCI_PCI=n  -> USB_XHCI_PCI_PROM21=n >> >> I see a few possible ways to handle this: >> >> 1. Keep USB_XHCI_PCI_PROM21 as a visible tristate: >> >>      config USB_XHCI_PCI_PROM21 >>        tristate "AMD Promontory 21 xHCI PCI support" >>        depends on X86 >>        depends on USB_XHCI_PCI >>        default USB_XHCI_PCI >>        select AUXILIARY_BUS >> >>    This supports USB_XHCI_PCI=m, but it still lets a user select the unsafe >>    USB_XHCI_PCI=y / USB_XHCI_PCI_PROM21=m combination. >> >> 2. Keep it visible and rely on help text to warn users not to select `m` when >>    USB_XHCI_PCI=y. >> >>    This is simple, but it does not actually prevent the bad combination. >> >> 3. Use IS_REACHABLE() in xhci-pci.c instead of IS_ENABLED(). >> >>    That would prevent built-in xhci-pci from rejecting PROM21 devices when the >>    PROM21 glue is only available as a module. However, it also means the >>    PROM21 glue/hwmon path would not be used in that configuration unless the >>    PCI device is rebound later, so I do not think it is ideal. >> >> 4. Make USB_XHCI_PCI_PROM21 a hidden tristate that follows USB_XHCI_PCI: >> >>      config USB_XHCI_PCI_PROM21 >>        tristate >>        depends on X86 >>        depends on USB_XHCI_PCI >>        default USB_XHCI_PCI >>        select AUXILIARY_BUS >> >>    Then the value follows the common xhci-pci driver: >> >>      USB_XHCI_PCI=y  -> USB_XHCI_PCI_PROM21=y >>      USB_XHCI_PCI=m  -> USB_XHCI_PCI_PROM21=m >>      USB_XHCI_PCI=n  -> USB_XHCI_PCI_PROM21=n >> >>    This prevents the unsafe y/m split while still supporting modular >>    USB_XHCI_PCI builds. The actual user-visible sensor option remains >>    SENSORS_PROM21_XHCI. >> >> My current preference is option 4, because the PROM21 PCI glue is not really a >> user-facing feature by itself. It exists so the common xhci-pci driver can hand >> PROM21 devices to the PROM21-specific glue and so the optional hwmon driver can >> bind through the auxiliary device. The user-visible part remains the hwmon >> sensor driver. >> >> Does that sound reasonable to you, or would you prefer one of the other >> approaches? >> >> Thanks, >> Jihong >> > One follow-up to my previous mail: > > If we go with option 4 and make USB_XHCI_PCI_PROM21 a hidden tristate > symbol, I think its help text should probably be removed as well, since the > symbol would no longer have a user-visible prompt. > Agreed. > The user-visible option would remain SENSORS_PROM21_XHCI, where the hwmon > sensor help text can stay. > > Does that sound right? > Yes. Thanks, Guenter