{"id":2215470,"url":"http://patchwork.ozlabs.org/api/patches/2215470/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260324165633.4583-11-ilpo.jarvinen@linux.intel.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20260324165633.4583-11-ilpo.jarvinen@linux.intel.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20260324165633.4583-11-ilpo.jarvinen@linux.intel.com/","date":"2026-03-24T16:56:33","name":"[10/10] PCI: Fix alignment calculation for resource size larger than align","commit_ref":null,"pull_url":null,"state":"handled-elsewhere","archived":false,"hash":"986c32aec75d938b464e905c5de0d4b28367981b","submitter":{"id":83553,"url":"http://patchwork.ozlabs.org/api/people/83553/?format=json","name":"Ilpo Järvinen","email":"ilpo.jarvinen@linux.intel.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260324165633.4583-11-ilpo.jarvinen@linux.intel.com/mbox/","series":[{"id":497317,"url":"http://patchwork.ozlabs.org/api/series/497317/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=497317","date":"2026-03-24T16:56:23","name":"PCI: Improve head free space usage","version":1,"mbox":"http://patchwork.ozlabs.org/series/497317/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2215470/comments/","check":"success","checks":"http://patchwork.ozlabs.org/api/patches/2215470/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linuxppc-dev+bounces-18736-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=CHEtpaS7;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-18736-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=198.175.65.15","lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com","lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=CHEtpaS7;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=linux.intel.com\n (client-ip=198.175.65.15; helo=mgamail.intel.com;\n envelope-from=ilpo.jarvinen@linux.intel.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgGX00Tldz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 04:01:04 +1100 (AEDT)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4fgGWz6c1dz2yqs;\n\tWed, 25 Mar 2026 04:01:03 +1100 (AEDT)","from mgamail.intel.com (mgamail.intel.com [198.175.65.15])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4fgGWy2JGfz2yng\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 25 Mar 2026 04:01:01 +1100 (AEDT)","from orviesa002.jf.intel.com ([10.64.159.142])\n  by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 Mar 2026 10:01:00 -0700","from ijarvine-mobl1.ger.corp.intel.com (HELO localhost)\n ([10.245.244.217])\n  by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 Mar 2026 10:00:51 -0700"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1774371663;\n\tcv=none;\n b=IZkc3B7WVdnqiLlSjjdkF6a6zUltVLMZwytZ9MA+dl4M/TuQ2OILPf+svpeoe+nsCvG7LtUbd6y0vk3lApz9NvUJIb6cpeYU3dd4DHLpw99jaftpmdeJycauWIuu57yyBJHPn6WaEiRQBJfsFBWZtY6l+cBdciy1aI9XQA2jnpbLTVwhSw1AEGNlmOp3pZtVl/kXx2CD5UGYBcmCTfmYVOXhuIQZ7H6VtXniW9xirTjhfdVdPz6htWuWb7EypRa1APaLP+vclCJrZojOXqaALaIC4O8+j8bdJvPmcTTPcEMz0E17a+PPxg10+i8gosfXJFDItdj2GeqiZCaf+nFyrg==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1774371663; c=relaxed/relaxed;\n\tbh=M0mN/BEfaeUwfXAKratLMt+/jZUNWSL3bKgrTzmMNj0=;\n\th=From:To:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=J1I0sMc9kASNfENj/pcgvp2pgtpe5zW2qTE7g3vblxwWvUNkVmov1zqxZtGzfvN+IjuyJlaaY2ndcfVVu8mPkp3NmU3rUeastrkyQr3VR0PZFN5c8HLt5OV9IUie0zdGOLpVPCRZXVsBwSptO/G/F9l29h4Eh8Kv9UmWUqBVjPATw2rP7yR+/mOzpBpocGGbbD/wT77r/ozxlaMfGTTkQFp4pnaR2CM6WIhMB1AuWyd0GULzW9dJUz75XXBQNgfciyYZZNcHwUeYOZIzKJmzSxOXE+QKkQatKzSgQW17Qjp59QMTJyjl9vXmI9EYdJjnTar2dguNmVCiQ4g0TPLPWg==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n dkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=CHEtpaS7; dkim-atps=neutral;\n spf=pass (client-ip=198.175.65.15; helo=mgamail.intel.com;\n envelope-from=ilpo.jarvinen@linux.intel.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=linux.intel.com","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n  t=1774371663; x=1805907663;\n  h=from:to:subject:date:message-id:in-reply-to:references:\n   mime-version:content-transfer-encoding;\n  bh=9odwDAEObJO7qnios8NXzgvO+dTMZAcsFe/K0R+E/MA=;\n  b=CHEtpaS7gicGyHG4ytDHRlOhnfgxoA8TcIJ/BFpkhm4bxWEGPqi9V+4e\n   LqCoE6kGbvnPBXfTKGagetYVwQb//hgP4vNCleL+gijrvBttABg+smD+2\n   ayyGp3KJV5ENNdVi6dP+jAiubwIZAZV54RFSDGSUvdatDWZlo5FOV5rp3\n   9UiIB+C2CRyXuxOk4bSRBiqkFLPIwcdIKBlvFn9cHn8dga6lIDgqc+otX\n   +n0Nh0nDCGPslTscaUiYx5+1ra6tWNfe9Hr2xg9KDQvzr+WI9a0rPr1rI\n   VS1kyXeb7DT+Q9caINTA/pjDHGwFzi04OK3e5p6fOz7drr8Z/aVmVzlB/\n   g==;","X-CSE-ConnectionGUID":["QgNdc3L9Tlu4wqSiur9l0g==","hHMisBSDR/+i1mWAm9Fh8g=="],"X-CSE-MsgGUID":["JH7xqPZBQ5qvD7gyAbs12g==","e4f6sgI4SzaAnXpv3WumJQ=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11739\"; a=\"78991854\"","E=Sophos;i=\"6.23,138,1770624000\";\n   d=\"scan'208\";a=\"78991854\"","E=Sophos;i=\"6.23,138,1770624000\";\n   d=\"scan'208\";a=\"254912161\""],"X-ExtLoop1":"1","From":"=?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>","To":"linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,\n Guenter Roeck <linux@roeck-us.net>, linux-alpha@vger.kernel.org,\n linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org,\n linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org,\n linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,\n linux-sh@vger.kernel.org, Russell King <linux@armlinux.org.uk>,\n Geert Uytterhoeven <geert@linux-m68k.org>,\n Thomas Bogendoerfer <tsbogend@alpha.franken.de>,\n \"James E.J. Bottomley\" <James.Bottomley@HansenPartnership.com>,\n Helge Deller <deller@gmx.de>, Michael Ellerman <mpe@ellerman.id.au>,\n Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,\n Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>,\n \"H. Peter Anvin\" <hpa@zytor.com>, Chris Zankel <chris@zankel.net>,\n Max Filippov <jcmvbkbc@gmail.com>, Madhavan Srinivasan <maddy@linux.ibm.com>,\n Yoshinori Sato <ysato@users.sourceforge.jp>, Rich Felker <dalias@libc.org>,\n John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>, =?utf-8?q?Ilpo_J?=\n\t=?utf-8?q?=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>,\n linux-kernel@vger.kernel.org","Subject":"[PATCH 10/10] PCI: Fix alignment calculation for resource size larger\n than align","Date":"Tue, 24 Mar 2026 18:56:33 +0200","Message-Id":"<20260324165633.4583-11-ilpo.jarvinen@linux.intel.com>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20260324165633.4583-1-ilpo.jarvinen@linux.intel.com>","References":"<20260324165633.4583-1-ilpo.jarvinen@linux.intel.com>","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED,\n\tDKIM_VALID,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"The commit bc75c8e50711 (\"PCI: Rewrite bridge window head alignment\nfunction\") did not use if (r_size <= align) check from pbus_size_mem()\nfor the new head alignment bookkeeping structure (aligns2[]). In some\nconfigurations, this can result in producing a gap into the bridge\nwindow which the resource larger than its alignment cannot fill.\n\nThe old alignment calculation algorithm was removed by the subsequent\ncommit 3958bf16e2fe (\"PCI: Stop over-estimating bridge window size\")\nwhich renamed the aligns2[] array leaving only aligns[] array.\n\nAdd the if (r_size <= align) check back to avoid this problem.\n\nFixes: bc75c8e50711 (\"PCI: Rewrite bridge window head alignment function\")\nCloses: https://lore.kernel.org/all/b05a6f14-979d-42c9-924c-d8408cb12ae7@roeck-us.net/\nReported-by: Guenter Roeck <linux@roeck-us.net>\nSigned-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>\n---\n drivers/pci/setup-bus.c | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c\nindex edc0d682dcad..e5af8799c36f 100644\n--- a/drivers/pci/setup-bus.c\n+++ b/drivers/pci/setup-bus.c\n@@ -1333,7 +1333,14 @@ static void pbus_size_mem(struct pci_bus *bus, struct resource *b_res,\n \t\t\tr_size = resource_size(r);\n \t\t\tsize += max(r_size, align);\n \n-\t\t\taligns[order] += align;\n+\t\t\t/*\n+\t\t\t * If resource's size is larger than its alignment,\n+\t\t\t * some configurations result in an unwanted gap in\n+\t\t\t * the head space that the larger resource cannot\n+\t\t\t * fill.\n+\t\t\t */\n+\t\t\tif (r_size <= align)\n+\t\t\t\taligns[order] += align;\n \t\t\tif (order > max_order)\n \t\t\t\tmax_order = order;\n \t\t}\n","prefixes":["10/10"]}