Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2609279rdh; Mon, 30 Oct 2023 02:24:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgq1NZEJJweh4Xh5eVkgS4tjCraAMBH+6zA7BtLU1HLFyyfndC6KC3mKzIBd5HsfZeJyd2 X-Received: by 2002:a05:6a20:12c7:b0:14c:3218:c1bd with SMTP id v7-20020a056a2012c700b0014c3218c1bdmr11337358pzg.11.1698657886183; Mon, 30 Oct 2023 02:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698657886; cv=none; d=google.com; s=arc-20160816; b=VfCAOXCng1pKMEQCz0uiNrMZf2I7xPJs9XuOFCIPw/dBFmKeCqRx8x3s7xdCYIYEqo jO46Xyjz3EfQsIj7IcThp3Yfw6C3SXpk1l2SLiYYMAV0ups1Tgi86gBdOnseNiRKq2Zn PS5VJ8xsph6W8FgalBleqCyLtu2Xpf59m6Iq6tIY8IyPVeK8tb8oCrtDxaPIx07UvJwJ XHw8WHJvXgf/jkeb2H6vJAT2nsmny6QSFKj6D5EG+phplwrc5fA9CWOmLZnDQhWO3uNM W/CQkakKdgsbPkE3aopPnhfKmT1XoXBtIW145pZzELEAIgjjh20qv9xGS/wInja49da5 XHVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=OtuMHNpIx6+0C6Sx8E6NHhYSjtGC7crcN/fqKXaOyuk=; fh=o7ni5FIZd06Rg9bJtoWDCKvlIHbFX201Rs4pIYTMliE=; b=pzsCIs2LVmp0S78sfY0qRwEi8Cr+U4ObFNYM6g4OaSqXWHjX29+3hKHfSwGDI//yT3 rIPfetJhOJ+qtBk27wj+xPZ3QpCbZp6aAQ6Hct74fnS6bHec+9kWJalaDD3IIwwjRvtm iaWiKiXWojjvZsy/4R+7qf488ELMidOPXHd9B6mr3H+dgNU2QWMmKRVXcYlD7Rcywr7a 9zRwgx3PSSZZ0LOGXHr8ePwe4Tk1YeaQoHQY6iwm90ch6rEJ3lep2G7XpoAl42I56BEk pWOpmGs1ygyK2ciheA4YJxuKiDvEP00AbxyoBg/xDuL3Bq8IXA8MlD9OY5inDWUAhmUQ /Fxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ZyQF/E7j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c68-20020a633547000000b00573f885c4edsi3406005pga.368.2023.10.30.02.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 02:24:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ZyQF/E7j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 02C3080B5A6F; Mon, 30 Oct 2023 02:24:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232241AbjJ3JYn (ORCPT + 99 others); Mon, 30 Oct 2023 05:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjJ3JYm (ORCPT ); Mon, 30 Oct 2023 05:24:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DA4AA7; Mon, 30 Oct 2023 02:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698657880; x=1730193880; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=PzE2WjM3liPGYO4o8GBic2JxQGQnXqgby3fh52nVXJs=; b=ZyQF/E7jh92Gm5qSZWfhxFK5qzB6Cy3bAmEM/bh7kXNkXxnvrE/2qw5s KaT1XuX+LXv3dRNJ4RwRK90h4rDrzQyXF6Se/lNWcuZAXtXUMIOgyPYGr 9eGk6hBoCk4orm1qzdLJNXgrG0yKGi0DCPtdTF1LtdrbVzBmRv6sH2ogX STkVvhLDJLjq3gFpUJUel6wrBPE2QK34afRsc7xb0iKl4r7SUZ3syC5GC xYBOyaiA9FNujfKxb1DxLEBvuHib5c2qbz0HcBDwDONByxahHKFpRAj0q p+OSZ9rVniUytYcy3bqX4tphKjkZQIfGL6qgp89/2NgXr0XU4lfgQmM5q g==; X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="373090942" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="373090942" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 02:24:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="710050263" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="710050263" Received: from sgruszka-mobl.ger.corp.intel.com ([10.252.50.181]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 02:24:36 -0700 Date: Mon, 30 Oct 2023 11:24:30 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Mark Hasemeyer , Shyam Sundar S K cc: LKML , stable@vger.kernel.org, Hans de Goede , Mark Gross , Sanket Goswami , platform-driver-x86@vger.kernel.org Subject: Re: [PATCH v1] platform/x86/amd/pmc: Get smu version before reading dram size In-Reply-To: <20231027212916.1035991-1-markhas@chromium.org> Message-ID: <2b8335a7-4b9b-825-c1b8-84158aaf2c42@linux.intel.com> References: <20231027212916.1035991-1-markhas@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 30 Oct 2023 02:24:45 -0700 (PDT) On Fri, 27 Oct 2023, Mark Hasemeyer wrote: > Calls to amd_pmc_get_dram_size can fail because the function assumes smu Always use () after function names, thank you. > version information has already been read when it hasn't. The smu > version is lazily read as opposed to being read at probe because it is > slow and increases boot time. > > Read the smu version information if it has not been read yet. > > Link: https://lore.kernel.org/all/a3ee6577-d521-6d18-0a15-2f97d6f8ac3a@amd.com/ > Fixes: be8325fb3d8c ("platform/x86/amd: pmc: Get STB DRAM size from PMFW") > Cc: stable@vger.kernel.org # 6.5.x > > Signed-off-by: Mark Hasemeyer > --- > > drivers/platform/x86/amd/pmc/pmc.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c > index cd6ac04c1468..f668eddbc5d5 100644 > --- a/drivers/platform/x86/amd/pmc/pmc.c > +++ b/drivers/platform/x86/amd/pmc/pmc.c > @@ -970,6 +970,11 @@ static int amd_pmc_get_dram_size(struct amd_pmc_dev *dev) > > switch (dev->cpu_id) { > case AMD_CPU_ID_YC: > + if (!dev->major) { > + ret = amd_pmc_get_smu_version(dev); > + if (ret) > + goto err_dram_size; > + } > if (!(dev->major > 90 || (dev->major == 90 && dev->minor > 39))) { > ret = -EINVAL; > goto err_dram_size; > Hi, Thank you for your patch. This has already come up but no acceptable patch has emerged since. Please see this thread for what needs to be done if you want to provide one (or maybe Shyam already has one which has just not been sent out yet): https://lore.kernel.org/platform-driver-x86/3b224c62-a1d8-41bd-aced-5825f5f20e66@amd.com/ (Since this dram size is on an init path that always needs SMU version, the SMU version can just be called by the init unconditonally rather than adding more of this lazy initialization everywhere). -- i.