Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp502570rdb; Sat, 30 Sep 2023 13:18:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGQeawnB6T5Z0+LYGGzDl6fskaKPkwyXua+IIFq+B0YGQy0s0QYIiOjqJ0PbUFmy7QKiDs X-Received: by 2002:a05:6a20:970f:b0:153:a160:89dc with SMTP id hr15-20020a056a20970f00b00153a16089dcmr6090457pzc.58.1696105131086; Sat, 30 Sep 2023 13:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696105131; cv=none; d=google.com; s=arc-20160816; b=y71HlGNa3eWIJ8hLIID6S7UwY/nq8JOb/cxfTl1AwgoFesQcgDErVNQ2R4+RU95oZV RIZYrp27YTjBXnoDkfY+x2/DV1yC20GCaMAMLHkKl01zeKHUUHAZXwhDOK5zUvxVR1m0 +luUO2Ho7CnvB60QgDWfnptHriTCvIanLaQvBGqh4SR+gnW6AJFVJLz//3b0buvkSW+n 4QQejVXfW8mSIKpGT4h54IsidFW70rqM4ikRnkzelsNx/F1vfKmRvH+JNURZjiDdKXSY nZZ0Y3dyJ2KmhMy2g01qBTBNEs/b5u7AuZu5qViB8lsAebSbDSDbexyxiIwXe8FF4PP/ tSMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=waLaP2fwf0FEI5qyb/NaxPI96vfxCvUa5A+lL3krvoQ=; fh=4yqZa5qMIeexWjIRXZHjjSz79zM/hq9GqUqPY4KPUpg=; b=CHEeDnyeNs4ryVPacZLmqy0dHlNsf3UmGWFwlPe7OqWEpUIvkhlPTpA68AJKkKXGzp yKvgbcmm3uVArfNxxo9JTF+CZjKzbxTNeS2t5b41AV/iC7Xw7Xqc0kqF0GjIx39sWkTt 8mTaytGpAWQBU6jWLVpgWTtXbBYJ5QX7pgkMmGDDQR5f2yG5hFXKJdiHgsD1zmxZNkCN XEBwI+QuXgEQQ62v0JMnRlKG7++V3BE1EL7rKWOuLixm5QR8F7e7va+ikyFhxU8SACGe 4BTbEyk8A520zw4IkyIDHZnjOASiLjlm8iO5Gzfx2WCWhd+exOa33jaztFBIpPKzjLd9 bDdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CIf0m6kT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id mh12-20020a17090b4acc00b0027728f01512si4660288pjb.167.2023.09.30.13.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 13:18:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CIf0m6kT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id E7E0F817ABCE; Sat, 30 Sep 2023 13:18:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbjI3USd (ORCPT + 99 others); Sat, 30 Sep 2023 16:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjI3USc (ORCPT ); Sat, 30 Sep 2023 16:18:32 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 929FCBD; Sat, 30 Sep 2023 13:18:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1471C433C8; Sat, 30 Sep 2023 20:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696105110; bh=FTlwwgmgFwVTZLLMsU57H1kZgpJ32lA2eayUmZZAFx0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CIf0m6kTiLVmN7vphVVTDYVxtcA4zyYjmfiYHMlH96MAEvj7/X4JN20CtuRsbECYD H/CrCdw/GrmuVwnFhZhYkcbVFO/lmXXbqxGvI6PJWDyozRDaweQWgOmas9ozjn3iyT 9QItmVMox2fl713LAOO8P/bIdUBkArOe7B5ilyyk9dbU8aMyZFcDmqY7M3TZu7uCSQ 6FLEimcs9X0Fl/ds6Dl0zq70xHjEakA+Hyv28eehdHI858aYZhkNfOUCm3Ahzgqs+1 zr0WbMfVSTp5RMAjntTA25X0F0nhjDiDlSuUxoE70khv6ZC3N90gp526bZywSCvLPL neZLvDetlKMfQ== Received: by mercury (Postfix, from userid 1000) id 3236B10603F9; Sat, 30 Sep 2023 22:18:26 +0200 (CEST) Date: Sat, 30 Sep 2023 22:18:26 +0200 From: Sebastian Reichel To: Mario Limonciello Cc: amd-gfx@lists.freedesktop.org, Alex Deucher , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jun.ma2@amd.com Subject: Re: [PATCH 2/3] power: supply: Don't count 'unknown' scope power supplies Message-ID: <20230930201826.biy27esyw4ttxt4p@mercury.elektranox.org> References: <20230926225955.386553-1-mario.limonciello@amd.com> <20230926225955.386553-3-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="4p2i5gnoe5rlcwny" Content-Disposition: inline In-Reply-To: <20230926225955.386553-3-mario.limonciello@amd.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 30 Sep 2023 13:18:49 -0700 (PDT) --4p2i5gnoe5rlcwny Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Tue, Sep 26, 2023 at 05:59:54PM -0500, Mario Limonciello wrote: > On some systems AMD Navi3x dGPU triggers RAS errors on startup; but > only if the amdgpu kernel module is not part of the initramfs. > This is because the hardware is not properly programmed for the > AC/DC state of the system when it is loaded later in boot. I don't understand the last sentence. As far as I can see i2c_dw_pci_probe() either does not registers UCSI at all or with the dGPU properties (and thus scope) set. > The AC/DC state of the system is incorrect specifically when UCSI power > supplies have been initialized. These power supplies are marked as > POWER_SUPPLY_SCOPE_UNKNOWN scope. As they're 'offline' the power > supply count is increased but the resultant return value is > power_supply_is_system_supplied() 0. >=20 > To fix this look explicitly for `POWER_SUPPLY_SCOPE_SYSTEM` power > supplies before incrementing the count. If no system power supply > is found then the system is assumed to be on AC. >=20 > Cc: stable@vger.kernel.org > Tested-by: David Perry > Fixes: 95339f40a8b6 ("power: supply: Fix logic checking if system is runn= ing from battery") > Signed-off-by: Mario Limonciello > --- This effectively fully disables supply detection for UCSI, because it is never set to POWER_SUPPLY_SCOPE_SYSTEM. Please fix the amdgpu init part instead. -- Sebastian > drivers/power/supply/power_supply_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/sup= ply/power_supply_core.c > index d325e6dbc770..3de6e6d00815 100644 > --- a/drivers/power/supply/power_supply_core.c > +++ b/drivers/power/supply/power_supply_core.c > @@ -349,7 +349,7 @@ static int __power_supply_is_system_supplied(struct d= evice *dev, void *data) > unsigned int *count =3D data; > =20 > if (!psy->desc->get_property(psy, POWER_SUPPLY_PROP_SCOPE, &ret)) > - if (ret.intval =3D=3D POWER_SUPPLY_SCOPE_DEVICE) > + if (ret.intval !=3D POWER_SUPPLY_SCOPE_SYSTEM) > return 0; > =20 > (*count)++; > --=20 > 2.34.1 >=20 --4p2i5gnoe5rlcwny Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmUYgocACgkQ2O7X88g7 +pq7lA//a6K7B++DJWK3qkFLkvZrvZfxhxBV7WbHyZ/uCAaUihZnq2ItQVwlZlRE W4NvbCAtY4ifJhEaf+kpFSVF6xF2LEr0sw6Z6tsa822T+w+icl/+23elZwrJzuG5 xA66zaamIYkyVeirbMo/FW8YokslGc+LPzzl2VlPiv2YjupS0+US48HON00gFc8t OsGo9CAqbpXRMe9GZAtun0oVni/pMV3NZp9U1RVdfepE7GPuHQEQKxSjQnbf92/k hbgTNAA1ehb0I60YbCyyeoFkJvGVA5FMxmetlFQ5oR7Idb6AHhvU3Qs4jhFApC1Q yqX5tn2ieZS8gzhhUj0YPvFjJ8qXqDX6TKnjeUzcy3FzF1lZg5WiVqkVtFEHTClK cWPfr0MpMEDgnvcKWs9TJQb4cUNB1te5slrip86Goh0Au/RlL5cSsQDhx5U+vsCc Tz9S+lgkqUDTzmQ7/ecjZwiihXb49Uq4bLRm9ir9vNkOJNFCnoum6UboVh/UbROJ qN7HKK/HPdSlCdfNwfRsJMBj7q7uQj8SZZSRyGKA3k7BFiu2VmG0poM+nbK1gye7 Q0qHZSZo+UrdUqWEhS0zMDz/udJwCZvfrIxAo1DKwEyPwNNOynVmAMEtOGASUiV8 zxIHpH/ys1uLHSRop1O66W3uNxF+I1k6dljKdSIWxemE0CJo8bc= =skRU -----END PGP SIGNATURE----- --4p2i5gnoe5rlcwny--