Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp761427rdb; Fri, 22 Dec 2023 04:29:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZJovjmgilY9u/uhPU5JEbcF41gOpjxkaeDALTOMN8o6gq6qipr4XAnwTVo65xsDBPOqt/ X-Received: by 2002:a17:903:22c8:b0:1d0:6ffe:9ee with SMTP id y8-20020a17090322c800b001d06ffe09eemr1319156plg.76.1703248198099; Fri, 22 Dec 2023 04:29:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703248198; cv=none; d=google.com; s=arc-20160816; b=j6treDylHwLd/WNpjGzSFkBnMLywl8vjyLauLMOLj1yN6udLVa2bil656QiJ5cqFK6 K++Mj07L0e9sjwyH8ZbFLr59o2Cus4sU9NVSRpOrdGphv/Eda7EiFY1XyWFg6I4+Cm49 qhNJ5oAaQzi4GdIQGvVm2lqhac/idi1W/MUdwJg6joqqZWdj33HEUF45y/GgHdSHQSVD calzBJ5VtWQCC/jIJAbVYZxR23KUnOJwtwPaFgddmUzJldRHCnjW60CrDCirdxyhAPlY S4ClbpJTS4zP4h2leQHncgvhpBrj8qrFiwXJEgSIX1/dS6MqPFd8kakBwVZG4z+6w2Bt 8C1Q== ARC-Message-Signature: i=1; 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=atS+D8bj+DCWD/kN8Tv6HbHRtpRxJKHvpPRhdvBxOyE=; fh=yqUIIgKqVOYsTyZW6w8zcpjOuZt/iZwb7E0FG62Kafw=; b=keLJOTviLgwbpaazrW5qmQVybx9sL9ZoM3EtsC0KudIGRs5cgOYcRnldAJ4XZnF7DL MzP2QsDkBghVKGzGNRpnaUukdSFaa0j4+aSr2wRkK/Tnjo42/t0WgVYU5W3jPQstIRBU KXSSA3BwQ2vAQoRW+jtA7ZkAaCjd99f8wrPxZ13cX4X0xiLkLpcC97412N89WOb2q+XP fzx7G86Yv99BP0efQDWBGswmVvz3mLAjYxVhYlV/T2WZp8hDdFWGnFNGrZYqGPgVk/RW 5+DhxJFzuP2jJ8rfY6AmSq+o8uJRIS7WRf0Pll3kcTfQ5QODMnyooTu4ZmLnWJBRF4ys adsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P+wgWllB; spf=pass (google.com: domain of linux-kernel+bounces-9701-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i15-20020a17090332cf00b001d3485656cbsi3224418plr.160.2023.12.22.04.29.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 04:29:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9701-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P+wgWllB; spf=pass (google.com: domain of linux-kernel+bounces-9701-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BF95CB21036 for ; Fri, 22 Dec 2023 12:29:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A55F1182AA; Fri, 22 Dec 2023 12:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="P+wgWllB" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 8206F18043; Fri, 22 Dec 2023 12:29:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703248155; x=1734784155; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=W9BM0HBysXXzPmYSLOHxDQBjtsNT8ib3ZOWo2DiabTc=; b=P+wgWllBIMF5mvV18Dl68n8K+Pz/uQ/yJtS3oS9IOJMgTkPE9ivW4aOe n/6MHiaJ8gemPbnbekG6aWGYmaHU7ogs4GxVgnObFh/YyQHgd+iRd5Qd5 LKNk5kFvSpzWZd4HsWs716FG7V3+AObFp29+jFkvQu+Glcg6BxrhFllnW Lds6BA3KMndONxcVbvfSjovmQs1RPOHNBToDZ5xjV5U44xJkqlSGDcmZj z6rEIz9YvlzqF4bi9pfzCuP1zhnmUD6cmQVFB60RvI3dWjP8MWYlqk27I XMrdF1UuuANZ7FrfqeqpIxnA2bFBBuhA6T2WATOGkXu8cHxHF+0w/pbvv A==; X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="3195357" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="3195357" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 04:29:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="805932771" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="805932771" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.94.248.105]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 04:29:09 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Igor Mammedov , Lukas Wunner , Mika Westerberg , Andy Shevchenko , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 0/7] PCI: Solve two bridge window sizing issues Date: Fri, 22 Dec 2023 14:28:54 +0200 Message-Id: <20231222122901.49538-1-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi all, Here's a series that contains two fixes to PCI bridge window sizing algorithm. Together, they should enable remove & rescan cycle to work for a PCI bus that has PCI devices with optional resources and/or disparity in BAR sizes. For the second fix, I chose to expose find_empty_resource_slot() from kernel/resource.c because it should increase accuracy of the cannot-fit decision (currently that function is called find_resource()). In order to do that sensibly, a few improvements seemed in order to make its interface and name of the function sane before exposing it. Thus, the few extra patches on resource side. Unfortunately I don't have a reason to suspect these would help with the issues related to the currently ongoing resource regression thread [1]. [1] https://lore.kernel.org/linux-pci/ZXpaNCLiDM+Kv38H@marvin.atrad.com.au/ Ilpo Järvinen (7): PCI: Fix resource double counting on remove & rescan resource: Rename find_resource() to find_empty_resource_slot() resource: Document find_empty_resource_slot() and resource_constraint resource: Use typedef for alignf callback resource: Handle simple alignment inside __find_empty_resource_slot() resource: Export find_empty_resource_slot() PCI: Relax bridge window tail sizing rules drivers/pci/bus.c | 10 +---- drivers/pci/setup-bus.c | 81 ++++++++++++++++++++++++++++++++++++++--- include/linux/ioport.h | 44 ++++++++++++++++++++-- include/linux/pci.h | 5 +-- kernel/resource.c | 69 ++++++++++++++++------------------- 5 files changed, 150 insertions(+), 59 deletions(-) -- 2.30.2