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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e98151a1-eb1d-df41-ba78-1c810aadd540@linux.intel.com>
Date:   Thu, 6 Oct 2022 11:58:29 +0300
From:   Mathias Nyman <mathias.nyman@...ux.intel.com>
To:     Mario Limonciello <mario.limonciello@....com>,
        mathias.nyman@...el.com, mika.westerberg@...ux.intel.com,
        linux-kernel@...r.kernel.org
Cc:     Sanju.Mehta@....com,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org
Subject: Re: [PATCH 1/4] USB: ACPI: Look for `usb4-host-interface` property

Hi

On 5.10.2022 23.23, Mario Limonciello wrote:
> For optimal power consumption of USB4 routers the XHCI PCIe endpoint
> used for tunneling must be in D3.  Historically this is accomplished
> by a long list of PCIe IDs that correspond to these endpoints.
> 
> The linux thunderbolt CM currently uses the `usb4-host-interface` ACPI
> property to create a device link between the USB4 host router PCIe
> endpoint and the XHCI PCIe endpoint.  The device link will move
> the devices in out of D3 together.
> 
> To avoid having to maintain this never ending list of PCIe IDs, use
> the existence of `usb4-host-interface` property on a USB port as a
> proxy to allow runtime PM for these controllers.  The device links
> will continue to be created when the CM initializes the USB4
> host router and also discovers this property.
> 

Agree that maintaining this list isn't a long term solution.

> Link: https://learn.microsoft.com/en-us/windows-hardware/design/component-guidelines/usb4-acpi-requirements#port-mapping-_dsd-for-usb-3x-and-pcie
> Signed-off-by: Mario Limonciello <mario.limonciello@....com>
> ---
> RFC v1->PATCH v1
>   * Move this detection from Thunderbolt CM into USB core
> ---
>   drivers/usb/core/usb-acpi.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
> index 6d93428432f13..f91ab4fd84cf8 100644
> --- a/drivers/usb/core/usb-acpi.c
> +++ b/drivers/usb/core/usb-acpi.c
> @@ -177,6 +177,15 @@ usb_acpi_find_companion_for_port(struct usb_port *port_dev)
>   		port_dev->connect_type = usb_acpi_get_connect_type(handle, pld);
>   		ACPI_FREE(pld);
>   	}
> +	if (!acpi_dev_get_property(adev, "usb4-host-interface",
> +				   ACPI_TYPE_ANY, NULL)) {
> +		struct device *dev = &port_dev->dev;
> +
> +		while (dev && !dev_is_pci(dev))
> +			dev = dev->parent;
> +		if (dev)
> +			pm_runtime_allow(dev);

This would enable runtime pm for usb hosts during usb_acpi_bus acpi companion finding.
I think host drivers should be the ones making this decision.

Maybe it's time to enable runtime pm as default for most new xHC controllers.
How about we enable it for all AMD and Intel PCI xHC hosts with version 1.2 or later?

If it causes un-fixable regression to some controller we can add it to a denylist.

Thanks
-Mathias

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ