From patchwork Fri Oct 27 21:28:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Hasemeyer X-Patchwork-Id: 159162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp894640vqb; Fri, 27 Oct 2023 14:30:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzcnE3I9LEWBa/VTQ4THfiTnkdkG5ZsnsTmsem56fYcQ2NTT0kWh1fVzJjfQTpNv1xHNnj X-Received: by 2002:a25:ac08:0:b0:da0:7936:5265 with SMTP id w8-20020a25ac08000000b00da079365265mr3412481ybi.56.1698442233307; Fri, 27 Oct 2023 14:30:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698442233; cv=none; d=google.com; s=arc-20160816; b=gwSFUEugo+fYk4dvxYUpsjGKMDLEqdQ7mav61kjQ2Mo9oDaGv9UVTDfL1Am4qjp0WN I/m/OPyyCWTgDKCbRWKZx2EHEvCnWuqYciU4aDfEEcgPKYgcfl2LMlbkP9qqMbX1DN4e VbzKrhaNXaIaiPSLHzWQcwoE7EqnQwavLyaXIQrKNAweFhr41sQcufGeyO0+XcK9afR1 De0GKsRgz/ji7rBBTLvcUUxd0AOkEw0e+v4xTZD8PqDYBlnWFQ3yJ5QIzXHSmGinC95K SHip+De/317reWq7of1etvCTURxyiNI3uqoNmLaYeYO1Dejefpdk/5hZijgIuYBg5DlT VKlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=C3v2FO97IXXXiaSzXTYxRflnbKiHcASyLC55jbu8gdA=; fh=0LCWpvfbloeYq2snjoFw65inzixd9MmthR8v+muTCp4=; b=GrCZcbaMOY6wZFNgKUcCJGt+5urSZmfjGkl6nFwU9pfBHzqLXlj8PZGc3Nxi5wAX1W 5mW19JfLY2/6M+IgIIxK4RTjiLj29TS0qRAb4PsJOLjbzBl0dH2eAaGpbN8pvHaD6LhG 8c+HmaUhRj+zkhobALFdbZKMYXzr2unRb8bb0WDPcYP5hD37ehPsx5VnSntyzFe900RR 6ycy5g09vOJ4Ujrsw9DxRI8g0237Dw99UX2kV6s6Y/i14o+ltbf/lgsMED6wKYpCPYzE nMP8RoTcOBwDbr1m7TQaMoZGey8inF2QmlOjULTWG4LQP8Lo1JUWpPwrw4cwQkpq/vj6 ULSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=c3ATuOYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id c66-20020a25c045000000b00da08c840874si3493558ybf.502.2023.10.27.14.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 14:30:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=c3ATuOYW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 93DB7803D02C; Fri, 27 Oct 2023 14:29:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346555AbjJ0V30 (ORCPT + 27 others); Fri, 27 Oct 2023 17:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232848AbjJ0V3Y (ORCPT ); Fri, 27 Oct 2023 17:29:24 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78BE71AA for ; Fri, 27 Oct 2023 14:29:21 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-7a66a7fc2d4so81974639f.0 for ; Fri, 27 Oct 2023 14:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1698442160; x=1699046960; 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=C3v2FO97IXXXiaSzXTYxRflnbKiHcASyLC55jbu8gdA=; b=c3ATuOYWyCDACC3DEW0JvY5bnwPi9AoyjtREvkAyEAooLuhtuYtf5+EkMSaeupyTXX jCy5+XgCxY/MtSKU9Omd1ApwJfk03iXJm73ORAbpmNXN6Pgh2ZvVSuetSSsOdmFJIR3Y nP1TUwEcTI/PK1kyf3pNEBFRN/I2qgl0lFVzg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698442160; x=1699046960; 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=C3v2FO97IXXXiaSzXTYxRflnbKiHcASyLC55jbu8gdA=; b=ks+Nkpmfl82u7fwJoMCrhWO0Wy+iYI8ro1Ob0BtJof5NjiInDUv2sVUKowUXY7WM2V HErpVnkGbjTy/RXiSBpv6+mhhHSbYGvPVGB17Zb/JhdD60lmQaczj2zN/BFjKn/9Lenu dfTBdajd8pCGr0gFJG5N8ys1TR/P0KxMjjtSU1sAJYr1ivrSuqOKc2vBOnmRbCOr3g/N kcffz35T/z/jgLFwQ9EEw1aUyQ3gfE/dVQpWEeLbEEW9znuavsc0B8DvAoayjDZH2rIr WKTvr2+s2OP8VxchSLschZF5fa2Xsd2FiHjiXfnY8d31uzXKbzEiav2QsAYBpxB8FRvL 2+Yg== X-Gm-Message-State: AOJu0YyzULV1XhWHEQE54zlacjpX758QI/1ImjtX90GCTaFoYvz7yq2z xATdz1kyrR2aHKtmmqftObcvMYtTKqsGrcyuJtU= X-Received: by 2002:a05:6602:1495:b0:79f:d671:c732 with SMTP id a21-20020a056602149500b0079fd671c732mr5229077iow.10.1698442160591; Fri, 27 Oct 2023 14:29:20 -0700 (PDT) Received: from markhas1.lan (71-218-45-6.hlrn.qwest.net. [71.218.45.6]) by smtp.gmail.com with ESMTPSA id q26-20020a6bf21a000000b0079f9efd067asm677101ioh.1.2023.10.27.14.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 14:29:19 -0700 (PDT) From: Mark Hasemeyer To: LKML Cc: Shyam Sundar S K , stable@vger.kernel.org, Mark Hasemeyer , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Mark Gross , Sanket Goswami , platform-driver-x86@vger.kernel.org Subject: [PATCH v1] platform/x86/amd/pmc: Get smu version before reading dram size Date: Fri, 27 Oct 2023 15:28:05 -0600 Message-ID: <20231027212916.1035991-1-markhas@chromium.org> X-Mailer: git-send-email 2.42.0.820.g83a721a137-goog MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, 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 groat.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 (groat.vger.email [0.0.0.0]); Fri, 27 Oct 2023 14:29:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780945762852750353 X-GMAIL-MSGID: 1780945762852750353 Calls to amd_pmc_get_dram_size can fail because the function assumes smu 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;