[{"id":3683170,"web_url":"http://patchwork.ozlabs.org/comment/3683170/","msgid":"<177735961706.2183577.4033506737290437474.b4-ty@b4>","list_archive_url":null,"date":"2026-04-28T07:08:20","subject":"Re: [PATCH v5] ata: ahci: fail probe if BAR too small for claimed\n ports","submitter":{"id":87751,"url":"http://patchwork.ozlabs.org/api/people/87751/","name":"Niklas Cassel","email":"cassel@kernel.org"},"content":"On Tue, 28 Apr 2026 10:09:35 +0800, dayou5941@163.com wrote:\n> When an AHCI controller is disabled in BIOS, its HOST_CAP register may\n> contain invalid values (e.g., 0xFFFFFFFF) indicating an impossibly large\n> number of ports.\n\nIndicating an impossibly large number of ports is simply not correct.\n\nThe CAP.NP field is a zeroes based 5-bit register field, so it can represent\nvalues in the range 1-32.\n\nValues in the range 1-32 is not impossibly large, it it simply the possible\nnumber of ports defined by the standard.\n\n\n> If CAP.NP claims more ports than can physically fit\n> within the mapped BAR region, accessing port registers beyond the BAR\n> boundary causes a kernel panic.\n> \n> Add validation in ahci_init_one() to check that the BAR size is\n> sufficient for the number of ports claimed in CAP.NP. The check\n> calculates the required MMIO size as:\n> \n> [...]\n\nApplied to libata/linux.git (for-7.2), thanks!\n\nI rephrased the \"impossible number of ports\" sentence while applying.\n\n[1/1] ata: ahci: fail probe if BAR too small for claimed ports\n      https://git.kernel.org/libata/linux/c/eb9c9a3a\n\nKind regards,\nNiklas","headers":{"Return-Path":"\n <linux-ide+bounces-5570-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ide@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=Sp6SmTjt;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ide+bounces-5570-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"Sp6SmTjt\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\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 4g4WnB1Nh8z1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 17:11:09 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 072E2300D14A\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 07:08:33 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 7E51334F25C;\n\tTue, 28 Apr 2026 07:08:31 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B859261B70;\n\tTue, 28 Apr 2026 07:08:31 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 99CF7C2BCAF;\n\tTue, 28 Apr 2026 07:08:29 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777360111; cv=none;\n b=POq7/b91BqgMLw2J3bMFwEtxvSx+M6zShusC9r+xAqAlQiIK1XGyRJPFWGwrKEmgD9428s3ODPSxNhtgl7ixuSuyhLwJbn6yWS8GqBTp5aHJhKiwc2jrkoJ63bF2ml1Tv+dTItD6hq7EhnMJefTB9xwYohNbMXnzjOaGNtQHoFs=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777360111; c=relaxed/simple;\n\tbh=AQjPUcIzNpSZyztCSPKpLqd6toajevEvMaRkLw61jT4=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=J9rBj+3UCl4uFAD6BypPIcR8dYxITnfpwOFOKNQ4nUqZsR4iVJp3L5c72DL2WPe1ptOnilS/5PJ7iMOScq6HOuiwF/G//L6Usx6jF1eZ5xKCjfqDW6bhNXZVJQCsh/ejicqIjxHQwmHgwRu9DmN2untDRgcoWjJ/d389+6cRvh8=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=Sp6SmTjt; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1777360111;\n\tbh=AQjPUcIzNpSZyztCSPKpLqd6toajevEvMaRkLw61jT4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Sp6SmTjtYdLeZCszt4ZXtII+cEV0ITZuL7vnSqE2+ubAJ04QJPzkHU+U2qerrtzO6\n\t ldMAA6ZdR40Odqf64ftBNM7CKA72o7DMsLOFUsNAYHyPXbuiW0KbYTxRXF4DtX8Med\n\t xQ00oN+4ka95O0nlJeDVFAGcREw41Wn1wW8Z8iK7YbIFq0PHxC0Tlv31Md80PBHMMn\n\t aZ0guZA1FtJhrDZ973BXHjiUiQ9l7hiGENimxwccSo+c0mctZVfWveH3jeo5MyAJeH\n\t rww0VSB1M2yNuAraA/X7M2yjn2Q09KFYrpZiM4eRzcK4Rbq1XI6AGHUcv/UKm3nwmS\n\t cFHWJZT/tkwmg==","From":"Niklas Cassel <cassel@kernel.org>","To":"linux-ide@vger.kernel.org,\n\tdayou5941@163.com,\n\tlinux-kernel@vger.kernel.org","Cc":"Niklas Cassel <cassel@kernel.org>,\n\tdlemoal@kernel.org,\n\tliyouhong@kylinos.cn","Subject":"Re: [PATCH v5] ata: ahci: fail probe if BAR too small for claimed\n ports","Date":"Tue, 28 Apr 2026 09:08:20 +0200","Message-ID":"<177735961706.2183577.4033506737290437474.b4-ty@b4>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<20260428020935.2049617-1-dayou5941@163.com>","References":"<20260428020935.2049617-1-dayou5941@163.com>","Precedence":"bulk","X-Mailing-List":"linux-ide@vger.kernel.org","List-Id":"<linux-ide.vger.kernel.org>","List-Subscribe":"<mailto:linux-ide+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ide+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","X-Developer-Signature":"v=1; a=openpgp-sha256; l=1160; i=cassel@kernel.org;\n h=from:subject:message-id; bh=AQjPUcIzNpSZyztCSPKpLqd6toajevEvMaRkLw61jT4=;\n b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGDI/xDzeO1MzMjhisj3zn/qHLwxcjq/U8t3fLTPZyyvgc\n 9xbdVuVjlIWBjEuBlkxRRbfHy77i7vdpxxXvGMDM4eVCWQIAxenAExkjwQjwy5WRf7Na0KTRBlc\n WH9u5l1a8Xgxs3N9u+Y8+Um73xQ3ejAyTLz1VvCcjYR6TbO0aHTZ5fUrU8qS43LzJbss6qtf1Dd\n yAwA=","X-Developer-Key":"i=cassel@kernel.org; a=openpgp;\n fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA","Content-Transfer-Encoding":"8bit"}}]