From patchwork Tue Jan 30 09:59:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jian-Hong Pan X-Patchwork-Id: 193945 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1111500dyb; Tue, 30 Jan 2024 02:04:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IH5/DvpZAcEgVcs0dHu5zF5eZeTbekUrMyNdBudThdkyhFRqksPeu1NQkZrCzv/8CElj+F4 X-Received: by 2002:a05:6402:13cc:b0:55e:f9c4:352b with SMTP id a12-20020a05640213cc00b0055ef9c4352bmr4153208edx.1.1706609065989; Tue, 30 Jan 2024 02:04:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706609065; cv=pass; d=google.com; s=arc-20160816; b=E8iOhy+XlsMra3jvl6bqdspgCHbQRy2WCpgrv+Us5hZgZcFQfSahNRKVBc/MOwgO4O FF+/XPymoi1UYdJUItU3ZM1G2ni8Pa+aukcQ2i4txLbQJggIBEMvONC0ynpZ9SLrLT8K 3e71nuu3Rp9u5TciT7lpkm18XnWJWQYQB6SOVV4SKnjzMWVIOf8KNr4hJ3U4BjiiHvam fC7peBDxML2VKU4qDwwF0g5JE2Uh2azE2MJW0e77QK1nBWDaZ/0omfDxd6nH6Hp23PRA AU8jISyX1xaVVIXKg6MEBoI0AGcr7AFHGBdfumHZbKApt7J49jipq/psgfsDW+eDDqAy Q62A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=b8wT6bcymUslDtltBZzAISdjS3jJfOOrz/LevDJCQnA=; fh=tBTIidyhDS9E7J3McbqbZa3c/zGMWarlKyvCcJI/R8o=; b=C84dsW2ynIoouOspygFMIw9NZMriD24T5rRXvXJBw9tMPMobzo9KAABB9rHYKkFIxN mO9R/xuB38dkmsp/PRUifarFNVqIGzpoAI2mzAONLEvWaohq47CnmGODVJO1ifgcULxD s1GoGE4gZ5poWDXvIKv8hY00hFRq31aHnxnAVKrQYRE+qGEa/PxwRAhN1AsySIycpEZt 6TQeWAH5nDLRibDNMFtDzM7dydWvSUw0DIjfnJNWZ3/9s2MdOunJ1eG80sD+5jBbVYJf Z8GZpCRbO+YS7zG9Er6mW1iUpwkLExBLAwtY1pUHGD/mb9fXbFMGZCWVoNM4n5lD9LPq WNrw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=XFxZfmIC; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-44341-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44341-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q30-20020a056402249e00b005591fde7b64si4692576eda.216.2024.01.30.02.04.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:04:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44341-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=XFxZfmIC; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-44341-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44341-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 975411F2AF3A for ; Tue, 30 Jan 2024 10:04:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 867AB6A358; Tue, 30 Jan 2024 10:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="XFxZfmIC" Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 36D266A32C for ; Tue, 30 Jan 2024 10:00:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608829; cv=none; b=kr5f4lsmKmXNO/jPnLZTf1BY6BlKlku0GuMBw6XmoHgLeTppJEAQFgqRVFjh4izFvpAyiz8WwkHeI0mHthd3RLOcrw1l94x3oMZQZRXe9SU8qFJSM0tLjZWM0bRZH/L2dmBH+rKu5TtLAY3XGfizO4IyNN79yPzP7HshQQZqSj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608829; c=relaxed/simple; bh=UXxOFnzyPjSmWhL7VN01cLQZkxTaV1mX68f4OmqP1C8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MCR/AJ8EvHMnhMc+xqA6KS4T34qSLXpoSDUdu2mAsM1epGBnLmSzYURbq5vgTzLmupBZ+4+Wmrds+LJVhS/IlEPNkLsNowkIVW30ZMbX4dZHWhCpFgBHDFjkIUm8uezeRJPK4kG6+5S5gIhV346b+UigtjgieAiyqUEt3PyUEWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org; spf=pass smtp.mailfrom=endlessos.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b=XFxZfmIC; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=endlessos.org Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6ddcfda697cso2825362b3a.2 for ; Tue, 30 Jan 2024 02:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1706608826; x=1707213626; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=b8wT6bcymUslDtltBZzAISdjS3jJfOOrz/LevDJCQnA=; b=XFxZfmICV3268PQyy8LsPPvJWfUwpbnkOgIuLrCTHiIIwHU4+G5pj/9KBrVGiA5DZI gr3rHTmTnECx62dynyV94UXRv3x1wDvmOlfPUYN7aN3NxfKHRB7XPL2kTk8PUJUKwGBQ kfu1Mb1rTwfZZLiB6IFgnybZyYoY8Fmd5lLW93r6C2ElBL8CH/q4jEgI8gcAgJMRbdvF p9o11P5r1oSSjGGYVP5+Z4pOqIEQnMpoEDCSBw7tfLWYWLq52vhuSwB72ZwFCexnUki4 QUSHGgyiy4r/nWhL2YwWyOIUSbLJ9xv8NlQWP8ocphquFTM4Oj3tNY/tQXVD33w5nMg5 V61g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706608826; x=1707213626; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=b8wT6bcymUslDtltBZzAISdjS3jJfOOrz/LevDJCQnA=; b=XHFMfHzsz+J1btJKM4OsxeqfakprrrAiJ3tR+gW1R0XPPAMbDqCrUGD0hsITxVx2x2 kCosrMxW+HZ5TtYgE0RhwhdRb1iDv11YX3S01v2jHGypM51AQcyWs00KsZ0OEYPOvIS/ WhqTHdm6WE9JQtZz39W2XUc6pkIVl/PfFd//ikdBQ8OIbO7TbBnkYFI8lZHmBLKUWCFy jrqDMe4paRNqH5fC+r82MtvPSHitMjk6gFX4UEHTlHrMgLZefZNY+BNH9O/UfaGmGQQT g7iUo5QwSwpGwHOjrn1JDM+5wOpGg7hfrMvOARiW+M7oWUOqBETTVW53wgQiOH+fJ22n SatQ== X-Gm-Message-State: AOJu0YwGtel1DJy8/luc/GwfyW0MDDhPdC8ALQgvRJP0G4BBH7/g8lT4 9qBIfxU47EvV3goel7mskmP1zrsNw2DW5kAVVjrW2hsmQslu/9RpB2PFHwi8vhQ= X-Received: by 2002:a05:6a00:179c:b0:6dd:7fd4:9fa1 with SMTP id s28-20020a056a00179c00b006dd7fd49fa1mr6712516pfg.8.1706608826374; Tue, 30 Jan 2024 02:00:26 -0800 (PST) Received: from localhost.localdomain ([123.51.167.56]) by smtp.googlemail.com with ESMTPSA id w22-20020aa78596000000b006dde44a2d16sm7345021pfn.199.2024.01.30.02.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:00:26 -0800 (PST) From: Jian-Hong Pan To: Mika Westerberg , David Box , Damien Le Moal , Niklas Cassel , Nirmal Patel , Jonathan Derrick Cc: linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan Subject: [PATCH 1/2] ata: ahci: Add force LPM policy quirk for ASUS B1400CEAE Date: Tue, 30 Jan 2024 17:59:33 +0800 Message-ID: <20240130095933.14158-1-jhp@endlessos.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789509307455725853 X-GMAIL-MSGID: 1789509307455725853 Some systems, like ASUS B1400CEAE equipped with the SATA controller [8086:a0d3] can use LPM policy to save power, especially for s2idle. However, the same controller may be failed on other platforms. So, commit (ata: ahci: Revert "ata: ahci: Add Tiger Lake UP{3,4} AHCI controller") drops LPM policy for [8086:a0d3]. But, this blocks going to deeper CPU Package C-state when s2idle with enabled Intel VMD. This patch adds ahci_force_lpm_policy DMI quirk for ASUS B1400CEAE to fix s2idle's power consumption issue when Intel VMD feature is enabled. Link: https://bugzilla.kernel.org/show_bug.cgi?id=218394 Signed-off-by: Jian-Hong Pan --- drivers/ata/ahci.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index d2460fa985b7..6bc5298a4adf 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1434,6 +1434,33 @@ static bool ahci_broken_devslp(struct pci_dev *pdev) return pci_match_id(ids, pdev); } +static bool ahci_force_lpm_policy(void) +{ + /* + * Some systems, like ASUS B1400CEAE equipped with the SATA controller + * [8086:a0d3] can use LPM policy to save power, especially for s2idle. + * However, the same controller may be failed on other platforms. So, + * commit (ata: ahci: Revert "ata: ahci: Add Tiger Lake UP{3,4} AHCI + * controller") drops LPM policy for [8086:a0d3]. + * + * https://bugzilla.kernel.org/show_bug.cgi?id=218394 + */ + static const struct dmi_system_id sysids[] = { + { + .ident = "ASUS B1400CEAE", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, + "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, + "ASUS EXPERTBOOK B1400CEAE"), + }, + }, + { } /* terminate list */ + }; + + return dmi_first_match(sysids); +} + #ifdef CONFIG_ATA_ACPI static void ahci_gtf_filter_workaround(struct ata_host *host) { @@ -1760,6 +1787,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ahci_pci_bar = AHCI_PCI_BAR_LOONGSON; } + if (ahci_force_lpm_policy()) { + pi = ahci_port_info[board_ahci_low_power]; + dev_info(&pdev->dev, "force controller follow LPM policy\n"); + } + /* acquire resources */ rc = pcim_enable_device(pdev); if (rc) From patchwork Tue Jan 30 10:00:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jian-Hong Pan X-Patchwork-Id: 193947 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1111758dyb; Tue, 30 Jan 2024 02:04:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRp60cf6yns6+oj8UmD3ZEo6bPZemNVn2wb3lOerNkyBZ7TWCdUw1diwoUMY6YBql0BV+3 X-Received: by 2002:a05:6214:d6a:b0:685:7e91:b423 with SMTP id 10-20020a0562140d6a00b006857e91b423mr9408829qvs.11.1706609097729; Tue, 30 Jan 2024 02:04:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706609097; cv=pass; d=google.com; s=arc-20160816; b=u1iRFc+kKXld8ohu4aXHv5F3w1MAnEmk7/FxaSCMT64gFOwZmXUSn4IOvPzoIZwMPA ftOm80O5lsWCzDC5sj/yGhDBFas6qd2rVVujBMAy2kogPUvh90cSdLuD4nzX2oyxWst3 9iy617YUKNnxjQc+kplIV/saoK8JAr5cu0xPHJwzH8Rj5eJKRuHRcO3U265vfX6HL1p1 FcU2M3PcC3UYbV3sUt/7m08wuJkJJoFGsBtVB6DjxSvtoXG9aN+oKrzmZoU5Vg8QCCXy IzN/hywfhE6NowcCBscVBRLZ3lUV5nUhB7pmQtMTC5BRunQq5F4TZa7LERZ+ri684Pkz tInw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=QKkQF0FpW08UeteOAoIxviKy11wOo5codk8APJXnHpw=; fh=tBTIidyhDS9E7J3McbqbZa3c/zGMWarlKyvCcJI/R8o=; b=PCEe/pn8HpruLUT3sqbw7HjMngrMVhUy5caAO8PWEbeQOUPUMulPvSklyQd68DIOIB FshGi5i7bVUPfKfy0mBybRSMo/LQsx+ZHD5NTEWYmJOaBXyaK8ZjKv6eLWRfhoLEmgac SxaOebJXRliaLRU7m8X7fMcTgWIvC2eCJFuM3WstyFF4ISjOxJ3sPHk0RdLtLSj4zEbJ swI9W+tUqKtlVI9zA6Cfl/OWbfF8gZ/N7PB2cDVhSLACu1kFxeEuZcslEBF8N/naL1xm WBmjuj36aOONX20jkWXquMW1xY3Ft/M3Umy90JckI+5pJH0KGSo8RhLWiiOWHr2l6zh4 B5hw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=Pg8ZQJsu; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-44343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44343-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i14-20020ad45c6e000000b00681b44eed98si9801224qvh.136.2024.01.30.02.04.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:04:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=Pg8ZQJsu; arc=pass (i=1 spf=pass spfdomain=endlessos.org dkim=pass dkdomain=endlessos.org dmarc=pass fromdomain=endlessos.org); spf=pass (google.com: domain of linux-kernel+bounces-44343-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44343-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 863961C26E97 for ; Tue, 30 Jan 2024 10:04:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9840F664AE; Tue, 30 Jan 2024 10:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b="Pg8ZQJsu" Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 7C87F65BBF for ; Tue, 30 Jan 2024 10:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608901; cv=none; b=uWH/mkiwAR2dOBZfsxVFHXbIzxPrIpekyUd1RSbrjebaPbadvPbNzZYuCylz0lVzXOV3G3DPgxUv5EVuUQi4Uhn4vRidr/rAzaXm5Jc8vSu69VG7dng5Z3CLTeHNsWaCZWGlnXSQyAXshw9vFKQzhA1zbnzSQ/RMIcf5p8NJHAk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706608901; c=relaxed/simple; bh=teXt9OHZdZez3wzxIY3fbH5xLvmsOi4Wj5q2dFRSqx0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=p0xMCQT1UKtTlf7Iq+lWWqjOHy651ehRZhD+safqo0FCJQZzt/hnAcmJI1zprBUCj74ykXVCuDVGxeoyJHHt2mPn7ELPav0XxyGZ7bZoY5FZXFFQPEwQZDfqnxaJfMBm2G60ak2pMQ+8uyn4bM9ihyHs/c3532/oTzLSl6QTeyw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org; spf=pass smtp.mailfrom=endlessos.org; dkim=pass (2048-bit key) header.d=endlessos.org header.i=@endlessos.org header.b=Pg8ZQJsu; arc=none smtp.client-ip=209.85.216.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=endlessos.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=endlessos.org Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2901f9ea918so1738972a91.3 for ; Tue, 30 Jan 2024 02:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; t=1706608900; x=1707213700; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QKkQF0FpW08UeteOAoIxviKy11wOo5codk8APJXnHpw=; b=Pg8ZQJsuOIKrKWAPtAdwj5JEMcqmwByEUHyPkHoyIeI6rd8cAgKB7dODgs4H37vWof UZOFF+qg83yKXNm1ar+ZncH5VL0C3KU6guVI3nVf41V1ZP/Jk+AXXD/rI5uO75TBa3uW slx4fV5rysnvznkjxxcVw+4lhidKLB5fVCWSF+yFSw+FX6wEe25t4qnKtte8gSAhuCL2 7egLUuUH77GBRVIvWT8XnkT3pDanYR/kS1iUTpA7k8wC21NL3UZavlf+0PuD9i/elSvP 7FKO+zU5JD6DSaHcSVCv3zMMXywKe4Sq9+A9jfjgYkuTNyaoYy8EmHIzYB98d2R6Fvab jzAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706608900; x=1707213700; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QKkQF0FpW08UeteOAoIxviKy11wOo5codk8APJXnHpw=; b=UXDpalcLYmRYTtnZp7irnpcD4K6+pKEyhXgsppE9xyYlnUPUhsl9nn3moob2QX8UI6 mA4ldJwafv297WFTOSnVAeN3m0zocwV0Ms+Ey3c0DSEQ/5ukLDlvE4mdtExMLlSoaN+A Tm731tpJWLlIyOsAAAaZWYkS+BYtCr0rmFwWUHJhqxqaXcmkC0AD6KHNyKOGMEHAf47m h8n961bHPQCF+z50lzQ8dEsHTQMlP4zy5rWR8GZqJupIvpERB+zJmDcvJW2RAAy1QP2v 8lNf5kw77Tlknyhw6Pvh4R06/jPdCxfCk3iF0B/1//1AbL26KqPVFcy1oL2NYflfFkCe X3LQ== X-Gm-Message-State: AOJu0Yw0KxtQ55pyGUcihePwPqLfaGNG8K5ZU1HLNiEkkrwUyUlZvMiG 72kex97DtQTOXS2BDR87189nFBMPIAyYvU1nTAGJzIF/psZ8KtVb4zvLytGWlSE= X-Received: by 2002:a17:90a:604f:b0:295:b7d0:eadc with SMTP id h15-20020a17090a604f00b00295b7d0eadcmr456213pjm.24.1706608899779; Tue, 30 Jan 2024 02:01:39 -0800 (PST) Received: from localhost.localdomain ([123.51.167.56]) by smtp.googlemail.com with ESMTPSA id sg14-20020a17090b520e00b00295bc312ceasm730672pjb.34.2024.01.30.02.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 02:01:39 -0800 (PST) From: Jian-Hong Pan To: Mika Westerberg , David Box , Damien Le Moal , Niklas Cassel , Nirmal Patel , Jonathan Derrick Cc: linux-ide@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux@endlessos.org, Jian-Hong Pan Subject: [PATCH 2/2] PCI: vmd: enable PCI PM's L1 substates of remapped PCIe port and NVMe Date: Tue, 30 Jan 2024 18:00:51 +0800 Message-ID: <20240130100050.14182-2-jhp@endlessos.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789509340790715719 X-GMAIL-MSGID: 1789509340790715719 The remmapped PCIe port and NVMe have PCI PM L1 substates capability on ASUS B1400CEAE, but they are disabled originally: Capabilities: [900 v1] L1 PM Substates L1SubCap: PCI-PM_L1.2+ PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- L1_PM_Substates+ PortCommonModeRestoreTime=32us PortTPowerOnTime=10us L1SubCtl1: PCI-PM_L1.2- PCI-PM_L1.1- ASPM_L1.2+ ASPM_L1.1- T_CommonMode=0us LTR1.2_Threshold=0ns L1SubCtl2: T_PwrOn=10us Power on all of the VMD remapped PCI devices before enable PCI-PM L1 PM Substates by following "Section 5.5.4 of PCIe Base Spec Revision 5.0 Version 0.1". Then, PCI PM's L1 substates control are enabled accordingly. Link: https://bugzilla.kernel.org/show_bug.cgi?id=218394 Signed-off-by: Jian-Hong Pan --- drivers/pci/controller/vmd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c index 87b7856f375a..b1bbe8e6075a 100644 --- a/drivers/pci/controller/vmd.c +++ b/drivers/pci/controller/vmd.c @@ -738,6 +738,12 @@ static void vmd_copy_host_bridge_flags(struct pci_host_bridge *root_bridge, vmd_bridge->native_dpc = root_bridge->native_dpc; } +static int vmd_power_on_pci_device(struct pci_dev *pdev, void *userdata) +{ + pci_set_power_state(pdev, PCI_D0); + return 0; +} + /* * Enable ASPM and LTR settings on devices that aren't configured by BIOS. */ @@ -928,6 +934,13 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features) vmd_acpi_begin(); pci_scan_child_bus(vmd->bus); + + /* + * Make PCI devices at D0 when enable PCI-PM L1 PM Substates from + * Section 5.5.4 of PCIe Base Spec Revision 5.0 Version 0.1 + */ + pci_walk_bus(vmd->bus, vmd_power_on_pci_device, NULL); + vmd_domain_reset(vmd); /* When Intel VMD is enabled, the OS does not discover the Root Ports