Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2470374lqp; Sun, 24 Mar 2024 22:07:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV91ZU9/CAFK2wET2osVAIOZxFGSeBUgWaTUpvAMTFjxD6oo+lImEwf4Xx9GYy64TBlIFUlyKwxhddvqV8GrQOphI1LcDUzyv8m+z9ywg== X-Google-Smtp-Source: AGHT+IHzVHaV+XSDaHByXLpu/wCtAX31/gM/QuqlHOfPyfYrZL71W8G9ReiGcW0IjiSFKxSx9omy X-Received: by 2002:a05:622a:155:b0:431:5e72:b00c with SMTP id v21-20020a05622a015500b004315e72b00cmr728045qtw.1.1711343244978; Sun, 24 Mar 2024 22:07:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711343244; cv=pass; d=google.com; s=arc-20160816; b=OgdPCGi1HcK7GmwMctz+LpFeCHlyfefzdZaVvNVtk5tUWHjjveyvM7q+s3t1YeEy4I V/ELxUw+tFUyLhPTlHd0d3VlgEi0gnZxtU87pcl0+zPoZad3iJtI8+dPms55CHhCDMSQ VKBoAK1NuVXIrnqML27gbI9Xz6FrzAMjats/l7hmQhfSLu8urUEdF/a+5qbHo+zL9W0k 1MgKewINdbRLbUPnBGOs/vTcQ7gFT8SazXamWlBjhtXCFvCnlmofcg3h7797XtYMjw0D 4rPIQ7hM5Ngo3Nzrh7tJdddQ22U3Sxd0/7gpSRBPCUP9wUpQLlmrTdqHZmutVjZSvd1M wsuQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=sF89rROOV4YZnYW+fY3bg0bnBm2aI5752gb7R9CEZ7k=; fh=FKNea1swTMRBCiS62pBPo3SIB5vXlMTzNm7TX9OsjEs=; b=Pg40kPSTpNB0e3wQyywWxzV6FOegPgHMSuGl4V61dDLxEaU+kY5GO/YrUNjSMAk9L8 g1siKXlHxMinZSxv5DK83ZReDkG1Ub0OY1b803sLxCBV8oLZjUQ1+oLAUOvs7B8EspTB BGUllHAO6VFIv+xdo64A3fPxgVE8ZF1/CCJguuPko4zSaIa4Nr7v+a6yz+hHwCTeqEPD RCXMziB0W2aIonIiREtoOrC/sLvripnzk+A0EXoxHR70NDdjgLU0EfDiJNKcrplnIHpu 2MOuSKnmj5mZsEziul6zXRmZu/1Q+l+N9o7UL9kbeV0910hZchXZ8jeUPL0AjvmXWbvg 0ogg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SbAxdgMX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113611-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f7-20020ac85d07000000b00430d671297asi4531675qtx.808.2024.03.24.22.07.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 22:07:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113611-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=SbAxdgMX; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113611-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113611-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A3C4A1C29A68 for ; Mon, 25 Mar 2024 05:07:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC5B41CE99D; Sun, 24 Mar 2024 22:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SbAxdgMX" 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 C13231CF8BD; Sun, 24 Mar 2024 22:47:23 +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=1711320443; cv=none; b=TQpftWnv+tQtpwMPKArA1lpWgBKfh8fTOJ4ML3jlRSOhesYckSakjhcdR42fBKVgYQibCJizIrJEvE7jcqj7uxx/mXxBQb8MS7xbdQSjRVVfKPs7M+lQxTziXtUB9N9WErgfhUKznayIoNvsv8vzewsLcNUYuGAAljyClpr/EWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320443; c=relaxed/simple; bh=69h97DXk3sezN9njqO4oxBgBj5oS7i0ELO2Bz6h1VXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sDXLT6iWExHbIyskGUG6sEdQU4T6iuNRhIrfQ4hGCRH/UI/J/2FpDecyuRpz9O483qUzRbNia4f0t6qc890jEYuWt3XFoQbKV5FZXadkJT2sW7D75iCr9PyyAzULBfQYBCTKngpkC4B5gjcLLLI32/u/55Ra5Aea4STBUVLKGg8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SbAxdgMX; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05EB3C43399; Sun, 24 Mar 2024 22:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320443; bh=69h97DXk3sezN9njqO4oxBgBj5oS7i0ELO2Bz6h1VXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SbAxdgMXPcpWqWPwfmc2tYY/3G0Qn6iiyLi/tU43tjx/1p00RSOyHdqX0CuyzwCED nTpsWtkW33rV3NeiyffmWZIWCqgXxYlOqunR7Ccf42LXIjQjzhrBGL0IiNdPSq9Th4 lwfRx+NMOeSQVVJLWsO2GdA1C2C8CNyv0p3C2qkS2PUPMnAvmj/i+vXvXyH7eKc+7h fBF9trOXnaQXgdlCzunVP4mfeiNZe1NSGf8t+zj2w5F08tOHttNc41NvuFGKXAzeQD xWuLm2mSOl5/Au3p8RNBBfWh0B+WLZz8SU0yb7Xm3QqZ7Rbxaeq57lbFb32cDkwtor TBfRTY0Y2HO4Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Danil Rybakov , Sasha Levin Subject: [PATCH 6.7 001/713] platform/x86: p2sb: On Goldmont only cache P2SB and SPI devfn BAR Date: Sun, 24 Mar 2024 18:35:27 -0400 Message-ID: <20240324224720.1345309-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324224720.1345309-1-sashal@kernel.org> References: <20240324224720.1345309-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Hans de Goede [ Upstream commit aec7d25b497ce4a8d044e9496de0aa433f7f8f06 ] On Goldmont p2sb_bar() only ever gets called for 2 devices, the actual P2SB devfn 13,0 and the SPI controller which is part of the P2SB, devfn 13,2. But the current p2sb code tries to cache BAR0 info for all of devfn 13,0 to 13,7 . This involves calling pci_scan_single_device() for device 13 functions 0-7 and the hw does not seem to like pci_scan_single_device() getting called for some of the other hidden devices. E.g. on an ASUS VivoBook D540NV-GQ065T this leads to continuous ACPI errors leading to high CPU usage. Fix this by only caching BAR0 info and thus only calling pci_scan_single_device() for the P2SB and the SPI controller. Fixes: 5913320eb0b3 ("platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe") Reported-by: Danil Rybakov Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218531 Tested-by: Danil Rybakov Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20240304134356.305375-2-hdegoede@redhat.com Signed-off-by: Sasha Levin --- drivers/platform/x86/p2sb.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/platform/x86/p2sb.c b/drivers/platform/x86/p2sb.c index 17cc4b45e0239..a64f56ddd4a44 100644 --- a/drivers/platform/x86/p2sb.c +++ b/drivers/platform/x86/p2sb.c @@ -20,9 +20,11 @@ #define P2SBC_HIDE BIT(8) #define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1) +#define P2SB_DEVFN_GOLDMONT PCI_DEVFN(13, 0) +#define SPI_DEVFN_GOLDMONT PCI_DEVFN(13, 2) static const struct x86_cpu_id p2sb_cpu_ids[] = { - X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, PCI_DEVFN(13, 0)), + X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, P2SB_DEVFN_GOLDMONT), {} }; @@ -98,21 +100,12 @@ static void p2sb_scan_and_cache_devfn(struct pci_bus *bus, unsigned int devfn) static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn) { - unsigned int slot, fn; - - if (PCI_FUNC(devfn) == 0) { - /* - * When function number of the P2SB device is zero, scan it and - * other function numbers, and if devices are available, cache - * their BAR0s. - */ - slot = PCI_SLOT(devfn); - for (fn = 0; fn < NR_P2SB_RES_CACHE; fn++) - p2sb_scan_and_cache_devfn(bus, PCI_DEVFN(slot, fn)); - } else { - /* Scan the P2SB device and cache its BAR0 */ - p2sb_scan_and_cache_devfn(bus, devfn); - } + /* Scan the P2SB device and cache its BAR0 */ + p2sb_scan_and_cache_devfn(bus, devfn); + + /* On Goldmont p2sb_bar() also gets called for the SPI controller */ + if (devfn == P2SB_DEVFN_GOLDMONT) + p2sb_scan_and_cache_devfn(bus, SPI_DEVFN_GOLDMONT); if (!p2sb_valid_resource(&p2sb_resources[PCI_FUNC(devfn)].res)) return -ENOENT; -- 2.43.0