Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1955747rdb; Wed, 31 Jan 2024 14:44:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFG+xN55xtYfrW7SfArXUAlP+neZ3EyNTiF3E02Sxq9Ly7WflRRVRvMVfGO4Xnp0Bjy2kh8 X-Received: by 2002:a17:90b:218c:b0:290:7c4a:708 with SMTP id ku12-20020a17090b218c00b002907c4a0708mr3302207pjb.13.1706741055311; Wed, 31 Jan 2024 14:44:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706741055; cv=pass; d=google.com; s=arc-20160816; b=ztUfmYWGq1/0Vjbo0lrLdwQtFVXt5WU/xH8yS9pEeNHW4bFkASa8/hLxKHW3PdXY2x x7iWl78GRGZFSHap2nf3ti4twCumUMo3DDtve0jVzQAuxyJvTr7aOgJEtb5ucf4B4T6l GtdW2wakkowcxd0PGkQ+dRw1f08wfqhRCUadW0o12ieBmm2427lJJUh04KoqldVba+1a Vf8H1YtWorik1pDzMUL622bF5Z09Dq3+akw3Igsc9uolWgypxIH4h4CPw2m5yxb87CVy 8XBYua0hIQ2IGTiBjE87DcEN5QUlzmh4gajT04+VCtx/eTCE6kamuwzq578Uk+4zzxJk wmZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OlWknlN3xz2pchUVimTYuGFd87SDVBto4ceTi0ScQeM=; fh=2xVzdv8dWrGpOQYqV2hSomCbeggUSqiDgWJtiy9dZ9c=; b=c6TplABpPjp+P0NI/zdU0lfkBPGprT1Jmi0/PLEx+N5xBHb/8ZK4AanielEwDxQyJR th1lE6kWOrgbfzMeB0KwjuhWBJm+3j8yfoeFzuDCmlJA1nGSsDfhSpOOBeU0vBKnVD/Y YKgTvqqx3gjjmXrB3CT6St/juv1Egr8s71X+/1QlJH6/SXq4wTDlGkUNy1gIPeOQj6D3 O2GDwRcYMwxU5eD+gVR1yNqAHkEYgVUfLFZ2bNpTD2lypp6gSzqVspVuJPw15Gsipp6w MP2Nc01ZIUs0ljIH9oWxroUrTw2huRbJ69hSvNV8J5OTnojjUJNWvS4OSUhQ6+LaargY +a7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lkdCyod1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47271-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXqfB0jxaz4fanztzEwI8J7+yatJOnaLNLtnbWei1SUMyCXgxikDd4lx9nBUJyXTuDG0+R/ewQmby6J5TcmoWbboQk2teb3BJr3vdI9jw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id sj6-20020a17090b2d8600b00295b0502033si93998pjb.187.2024.01.31.14.44.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 14:44:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47271-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lkdCyod1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-47271-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47271-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F2C8428A327 for ; Wed, 31 Jan 2024 22:44:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 310463A29B; Wed, 31 Jan 2024 22:44:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lkdCyod1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 405C83A1D3; Wed, 31 Jan 2024 22:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706741047; cv=none; b=s5jFTLatFxxkqYPK4J9PNjKsE+0J60mIJOtMA/w4c/Ax1Si58WmJWf5FQLmBuRZ1RsrwlS4UIpNRX/npyopDArRcghGFn8vSXSsC/v3g3tLj/GN2u5pU5CtDbW62pULb2iz1RTd/InCya1e6E/bWVvgGbpAPg977CdVtqGZdVcY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706741047; c=relaxed/simple; bh=CDDV5nzO303GZ5Eq1xlfWVsb0CkQf/w57BtEmOpSHdY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PFsw+DTlrOgbEg0a+bEhCTh5RNEQGL0C986LVpL1qhG5PHVoppE2wU6w1T64YOwTFfspGSb5U5M5mY4xZdIKb5pOXSsExkhHKVfrYlvoyD0IIyUhLkuuzhgsZhKdqyAUfutkx/b3dM2xzcqOldZ5PiSaDpRECY/XoWuiQcXDU5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lkdCyod1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 476C7C433F1; Wed, 31 Jan 2024 22:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706741046; bh=CDDV5nzO303GZ5Eq1xlfWVsb0CkQf/w57BtEmOpSHdY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lkdCyod12UwkHMoZFnHdOixtATV3t5zPDh5xlxIgMXeux28RVHIflE5+YqXj/rg+h MMgsZA980RvF08seJZcLXNuJDf3Sek48tzM2qPuScpzmMv+5KWwK5LaXa57vRXIroP wyfksOn4zDYGvT/bO4mMJUmfFI0XjKZAwkQdiuQ6dvj/9PtTG8j34GiNb9t2Bxepdv Dq16Yt9VjalKAbOOobu357jmzicxGfgdpxnDcZb7z7fCvemOQGxVVD0V9usZ44HsxB kYhjW6q6igVmUbbckNxIiKrgL6ArF+SdSkloWNyFtDLABN1z9L5WiujB+r95aEk8QB pb3uKEe7KdK4Q== Date: Wed, 31 Jan 2024 23:43:59 +0100 From: Niklas Cassel To: Daniel Drake , Vitalii Solomonov Cc: Jian-Hong Pan , Mika Westerberg , David Box , Damien Le Moal , Nirmal Patel , Jonathan Derrick , linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org Subject: Re: [PATCH 1/2] ata: ahci: Add force LPM policy quirk for ASUS B1400CEAE Message-ID: References: <20240130095933.14158-1-jhp@endlessos.org> <20240130101335.GU2543524@black.fi.intel.com> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jan 31, 2024 at 07:08:12AM -0400, Daniel Drake wrote: > On Wed, Jan 31, 2024 at 6:57 AM Niklas Cassel wrote: > > Unfortunately, we don't have any of these laptops that has a Tiger Lake > > AHCI controller (with a disappearing drive), so until someone who does > > debugs this, I think we are stuck at status quo. > > I've asked for volunteers to help test things on those original bug > reports (and may have one already) and would appreciate any suggested > debugging approaches from those more experienced with SATA/AHCI. What > would be your first few suggested debugging steps? > > Non-LPM boot: > ata1: SATA max UDMA/133 abar m2048@0x50202000 port 0x50202100 irq 145 > ata2: SATA max UDMA/133 abar m2048@0x50202000 port 0x50202180 irq 145 > ata2: SATA link down (SStatus 0 SControl 300) > ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) > > LPM failed boot: > ata1: SATA max UDMA/133 abar m2048@0x50202000 port 0x50202100 irq 145 > ata2: SATA max UDMA/133 abar m2048@0x50202000 port 0x50202180 irq 145 > ata1: SATA link down (SStatus 4 SControl 300) > ata2: SATA link down (SStatus 4 SControl 300) > > note SStatus=4 on both ports (means "PHY in offline mode"?) Hello Daniel, Vitalii, The attachments that you uploaded to bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217114 namely dmesg_VMD_off and dmesg_VMD_on: dmesg_VMD_off:[ 1.020080] ahci 0000:00:17.0: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode dmesg_VMD_off:[ 1.020095] ahci 0000:00:17.0: flags: 64bit ncq sntf pm clo only pio slum part deso sadm sds dmesg_VMD_off:[ 1.020645] ata1: SATA max UDMA/133 abar m2048@0x80902000 port 0x80902100 irq 123 lpm-pol 0 dmesg_VMD_off:[ 1.330090] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) dmesg_VMD_on:[ 0.973901] ahci 10000:e0:17.0: AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode dmesg_VMD_on:[ 0.973904] ahci 10000:e0:17.0: flags: 64bit ncq sntf pm clo only pio slum part deso sadm sds dmesg_VMD_on:[ 0.974094] ata1: SATA max UDMA/133 abar m2048@0x82102000 port 0x82102100 irq 142 lpm-pol 0 dmesg_VMD_on:[ 1.287221] ata1: SATA link down (SStatus 4 SControl 300) I assume that both of these logs are from the same kernel binary. Does this kernel binary have the Tiger Lake LPM enablement patch included? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=104ff59af73aba524e57ae0fef70121643ff270e If so, since with Intel VMD turned off we can detect the SATA drive, but with Intel VMD turned on we do not, which strongly suggests that the problem is related to Intel VMD. In libata we perform a reset of the port at boot, see: libata-sata.c:sata_link_hardreset() after writing to SControl, we call libata-core.c:ata_wait_ready() that will poll for the port being ready by calling the check_ready callback. For AHCI, this callback funcion is set to: libahci.c:ahci_check_ready(). A reset should take the device out of deep power state and should be sufficient to establish a connection (and that also seems to be the case when not using Intel VMD). However, if you want to debug, I would start by adding prints to libata-sata.c:sata_link_hardreset() libata-core.c:ata_wait_ready() libahci.c:ahci_check_ready(). Vitalii, I noticed that the prints says "lpm-pol 0" Do you have: CONFIG_SATA_MOBILE_LPM_POLICY set to 0? CONFIG_SATA_MOBILE_LPM_POLICY=0 means do not touch any settings set by firmware. This means that this code: https://github.com/torvalds/linux/blob/v6.8-rc2/drivers/ata/libata-eh.c#L3572-L3579 https://github.com/torvalds/linux/blob/v6.8-rc2/drivers/ata/libata-eh.c#L3067-L3072 will not call ata_eh_set_lpm(), which means that ahci_set_lpm() will not be called, which means that sata_link_scr_lpm() will not be called. While this shouldn't make a difference, and I didn't check the code to see where "SATA link up" is printed, but possibly, when using VMD, perhaps it is so quick to put the device to a deeper power state after a reset, and with policy == 0, we will never send a ATA_LPM_WAKE_ONLY that sets PxCMD.ICC to the active state (brings the device out of sleep). Could you please try to set: CONFIG_SATA_MOBILE_LPM_POLICY=3 and enable VMD again, and see if that makes you able to detect the SATA drive even with VMD enabled. Kind regards, Niklas