Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp228473rdb; Thu, 1 Feb 2024 07:03:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEdq/6zScJIsiHM1/9jr042RyrjQBBpOfHRV8FLnX5iErBXXjn5OPEj9iSKg/H74EQlBpV X-Received: by 2002:a05:6870:c6a6:b0:210:e497:b37 with SMTP id cv38-20020a056870c6a600b00210e4970b37mr5049082oab.41.1706799822234; Thu, 01 Feb 2024 07:03:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706799822; cv=pass; d=google.com; s=arc-20160816; b=ab5tAQXfqMUhP9dr7w/JkX626kugBPR+VqPdXEljbJxWoXEFcAAuZURpP04suOkv2L p0EQWDkjst0iZcTRQcydp6Z6RlvKAjk7VFcFChlCuEeavI2Bj6eIsEF/bXFIoJjOgSzh Qo+lnHo5ep/VTDYVYHJz54Dg6EcBHOuh2wSr8+S3a+QvY+r7LKpF7jw3mxen4VqJnRlw p7hr1FrDBFjDRDdpsqPRNg3klSKviI+aHGtYqZ8QzXNc3rjASNvQ1lWXCVqFfhldGk+W /ryghOi40sVEqZ2mgiTW1iuWJ66Wwe741/ZzSoh/T9F8wLFQHIDo4O+B7talbxwQGCcV Z6zA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=iCwx7suWXxo+qX1P89Bc8nn6YH6wK3BMBBq16T7agww=; fh=s1TGabZszgQMqKK1bG5mo0AeQafb9Ki7R91A2u8zHdw=; b=R3jA8D/ACfPvfHOHigsAYtwEGSAJdhMmWqg8XUY4Yt5SGXz4u12P74e0jOMi3VD9IM 1Vdxj/4lKcL5dg7W/TLchxgFmICmznRJRV+izMAHgGT1X/5g5vGJw66Ej4FDVtIxP4CP qrPAMAv34l/le58Ni7DCo1F2vJ7bvGh55d9tKhmhUjfsDglXlI8J0ddzDYRknnOZjI7V fPw5nw4wMq6nPBjQtXg/Dd9kkTVlFSFBOhrzGHcKiq3XCwoNcztJDwLnWBBkW4Oum82y iNH72A+TMxjqwAoxUj94xi2qB2jDB8xiQ0H5/Zn8QcuVxekspDQl6lMBukpkh8y4vifG H2VA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JHGASKvr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48351-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48351-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; AJvYcCXMGmX7sE5kdS3tJJszk2P1ZpXnGHThZtjSYU8giJATVyS7Kz82N3bB1YhQ3fVQ2rerNdL+gqzZlLKDSfeJWc588k/fU5O+IfZtRQRuMw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u7-20020a05663825c700b00470b6e58114si3897839jat.83.2024.02.01.07.03.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:03:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48351-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=JHGASKvr; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-48351-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48351-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 63A47285C87 for ; Thu, 1 Feb 2024 15:01:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD3A544360; Thu, 1 Feb 2024 15:01:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JHGASKvr" 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 D1E705CDF8; Thu, 1 Feb 2024 15:01:48 +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=1706799708; cv=none; b=MEbRDr/As2W+1HYFG3081YMHC+sM4vKxqt/r7C3mWVPCOOX0jxfaM6Tn54gajuYigz6F/mgw1QYlZ+9yU8Q+GX/TZwavK8bORMJxFppEBmc5RIGRYyqxWQ4mzN9wcbxrDXHYnG96tj74AatLDyU2JBpCNN8KCXjReIeI7gtrcPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706799708; c=relaxed/simple; bh=fyS4E6dCzTmikshMEzUqt7RbzPw9XaUCcGp0oaYwbvw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S7vCTNJq7iEYlfPiZasjZHjMHQVlkofHn7HChYvF5B1LDAu+z/ySSltQo7jVsRr6Dlll9LJx0T1xTVbErHnDiM5mCn/HtSFpIcDn+ft9efhChWvQe3Hm++fhAwzA6KWDVqN30sZfyQdrLty6Dg5Mr4PmW2HLS3InkoaymNnFY/U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JHGASKvr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23B71C433F1; Thu, 1 Feb 2024 15:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706799708; bh=fyS4E6dCzTmikshMEzUqt7RbzPw9XaUCcGp0oaYwbvw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JHGASKvrmM3ACF7dACXxR5LVFZ309w8Y+Oe5Tmi/uyIgXkFWB2WJ+IJUWadUG1PG2 LpA1eYx1KtOryTb6fp4Q8TirguIZvuH/CQr9cCP4MRfd99cFJaGI/5EUufDgqzzaAI jnm9fqq6sdesM/lXyi2JA/k1ZQ/ypEgExbP/4znbW4sBWm1zSaB+9dDCz3pX0jUaY2 ghSNPgK1cc+Pcuf6hn6HSlZy6HyPGIVaKrTcDdMmOrmYp4ovah40D60RWwF5w9rvFJ 8e5oYEoiLmkH1oSPU3IIeJCrGybRSCOM6en2MPR7adJ1IqNMly64fLp0oJtTh6HYeI IrleBlpjTbPuA== Date: Thu, 1 Feb 2024 16:01:41 +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=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Jan 31, 2024 at 11:43:59PM +0100, Niklas Cassel wrote: > On Wed, Jan 31, 2024 at 07:08:12AM -0400, Daniel Drake wrote: (snip) > 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(). FWIW, this will dump SStatus.DET every time the check_ready callback function (ahci_check_ready()) is called: diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 1a63200ea437..0467e150601e 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -1533,6 +1533,12 @@ int ahci_check_ready(struct ata_link *link) { void __iomem *port_mmio = ahci_port_base(link->ap); u8 status = readl(port_mmio + PORT_TFDATA) & 0xFF; + u32 cur = 0; + + sata_scr_read(link, SCR_STATUS, &cur); + + ata_link_info(link, "BUSY ? %d (status: %#x) SStatus.DET: %#x\n", + status & ATA_BUSY, status, cur & 0xf); return ata_check_ready(status); }