get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2228587/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2228587,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2228587/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-ide/patch/20260427060546.1407439-1-dayou5941@163.com/",
    "project": {
        "id": 13,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/13/?format=api",
        "name": "Linux IDE development",
        "link_name": "linux-ide",
        "list_id": "linux-ide.vger.kernel.org",
        "list_email": "linux-ide@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<20260427060546.1407439-1-dayou5941@163.com>",
    "date": "2026-04-27T06:05:46",
    "name": "[v4] ata: ahci: fail probe if BAR too small for claimed ports",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "7dc25194ae4920283f0018449ca30a48c1b84658",
    "submitter": {
        "id": 93214,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/93214/?format=api",
        "name": "李佑鸿",
        "email": "dayou5941@163.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-ide/patch/20260427060546.1407439-1-dayou5941@163.com/mbox/",
    "series": [
        {
            "id": 501575,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/501575/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-ide/list/?series=501575",
            "date": "2026-04-27T06:05:46",
            "name": "[v4] ata: ahci: fail probe if BAR too small for claimed ports",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/501575/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2228587/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2228587/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "\n <linux-ide+bounces-5556-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 (1024-bit key;\n unprotected) header.d=163.com header.i=@163.com header.a=rsa-sha256\n header.s=s110527 header.b=QwDFK7ut;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-ide+bounces-5556-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=163.com header.i=@163.com\n header.b=\"QwDFK7ut\"",
            "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=220.197.31.4",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=163.com",
            "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=163.com"
        ],
        "Received": [
            "from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::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 4g3tNt6P9Lz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 16:06:22 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 9A4633001D54\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 06:06:18 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id DF9CF366816;\n\tMon, 27 Apr 2026 06:06:15 +0000 (UTC)",
            "from m16.mail.163.com (m16.mail.163.com [220.197.31.4])\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 535FE33B97F\n\tfor <linux-ide@vger.kernel.org>; Mon, 27 Apr 2026 06:06:09 +0000 (UTC)",
            "from localhost.localdomain (unknown [])\n\tby gzga-smtp-mtada-g1-2 (Coremail) with SMTP id\n _____wAHVOS9_O5pN53SBw--.40422S2;\n\tMon, 27 Apr 2026 14:05:51 +0800 (CST)"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777269975; cv=none;\n b=KAc8cxxOlCMJZn80SRpduGF6Y6qiKvftUfr5dqV2c5Kd/WaM3yyY7yT9GPefqLa7eBGfA32ITi42NC5RDgolktLbXDJunerScEIKIKKhQBLMAd867/zXdatCxo1Nplzl4RNAZlprijaUEfZkshHCHj0ygTCB9WWMlLSgefm5ZXs=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777269975; c=relaxed/simple;\n\tbh=kUmAnBbcNX8fuGV5z/55Xzzf8/BTD3UaldPCZW3B+SA=;\n\th=From:To:Cc:Subject:Date:Message-Id:MIME-Version;\n b=qEvQWPy9VhRM1Fe025pYBe+08j0Lh8NlOTAZTCWAxZE3eM6sn5qFyUdoMJ8cohir1AZMgBkoalIK4gUdE3j/DL1V+y5QNOSnl032hYaNUFmSdYOIeL89K0DLZsZ71DUBfVuXXTYjYBbBPnKonZ6IvEmgzdTlRplbxFyMClyx/LI=",
        "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=163.com;\n spf=pass smtp.mailfrom=163.com;\n dkim=pass (1024-bit key) header.d=163.com header.i=@163.com\n header.b=QwDFK7ut; arc=none smtp.client-ip=220.197.31.4",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;\n\ts=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=Sz\n\tkDcbEkKbEI9PF0QuJp3rJEm8DC3zbBZX3utA/tH9E=; b=QwDFK7utIspX30hX+g\n\t6B0MCoaXoceQA3nTqiH5cCRpZGcypV8IKOI4vnlYdX5JpcE3VgsZ/RIJbrtIxSS4\n\tt65IUQwa4KUelTGwXz3M4vuDWlAzNHTeQn2Bi29p99jxlbMgYqguPH+p7Pf2R8ff\n\twhDwLd3GVTrK8EOfpQIDKt32k=",
        "From": "dayou5941@163.com",
        "To": "linux-ide@vger.kernel.org",
        "Cc": "dlemoal@kernel.org,\n\tcassel@kernel.org,\n\tliyouhong@kylinos.cn",
        "Subject": "[PATCH v4] ata: ahci: fail probe if BAR too small for claimed ports",
        "Date": "Mon, 27 Apr 2026 14:05:46 +0800",
        "Message-Id": "<20260427060546.1407439-1-dayou5941@163.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "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-Transfer-Encoding": "8bit",
        "X-CM-TRANSID": "_____wAHVOS9_O5pN53SBw--.40422S2",
        "X-Coremail-Antispam": "1Uf129KBjvJXoWxJF4DCryfZF1fKFWkGFy8Zrb_yoW5Ar47pF\n\tWxGFZYyrWUWF47XayrAanrZry3Gws5GFW7trW3Ja93trn8K34kXr1fKa47Aay3J3ykG3WI\n\tqryqqr1rur1UZFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2\n\t9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j1pBfUUUUU=",
        "X-CM-SenderInfo": "5gd103ivzuiqqrwthudrp/xtbC3h+EM2nu-L9MUQAA3v"
    },
    "content": "From: Youhong Li <liyouhong@kylinos.cn>\n\nWhen an AHCI controller is disabled in BIOS, its HOST_CAP register may\ncontain invalid values (e.g., 0xFFFFFFFF) indicating an impossibly large\nnumber of ports. If CAP.NP claims more ports than can physically fit\nwithin the mapped BAR region, accessing port registers beyond the BAR\nboundary causes a kernel panic.\n\nAdd validation in ahci_init_one() to check that the BAR size is\nsufficient for the number of ports claimed in CAP.NP. The check\ncalculates the required MMIO size as:\n\n  required_size = 0x100 (global registers) + max_ports * 0x80\n\nIf required_size exceeds the actual BAR size, the probe fails with\n-ENODEV, preventing the panic and providing a clear error message.\n\nThis solution follows the suggestion by Damien Le Moal and Niklas Cassel\nto detect and reject obviously broken controller configurations early.\n\nReported-by: liyouhong <liyouhong@kylinos.cn>\nSuggested-by: Damien Le Moal <dlemoal@kernel.org>\nSuggested-by: Niklas Cassel <cassel@kernel.org>\nReviewed-by: Damien Le Moal <dlemoal@kernel.org>\nSigned-off-by: liyouhong <liyouhong@kylinos.cn>\n---\nv2:\n- Complete rewrite based on community feedback\n- Move check from libahci.c to ahci.c\n- Fail probe early instead of attempting to work around invalid state\n- Implement BAR size validation as suggested\n\nv3:\n- Fix patch format: add \"---\" separator and move changelog to correct location\n- Change dev_err to dev_warn as suggested\n\nv4:\n- Break long lines as suggested by Damien\n- Keep complete changelog history\n\n---\n drivers/ata/ahci.c | 23 +++++++++++++++++++++++\n 1 file changed, 23 insertions(+)",
    "diff": "diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c\nindex 1d73a53370cf..c04bee682605 100644\n--- a/drivers/ata/ahci.c\n+++ b/drivers/ata/ahci.c\n@@ -1888,6 +1888,25 @@ static ssize_t remapped_nvme_show(struct device *dev,\n \n static DEVICE_ATTR_RO(remapped_nvme);\n \n+static int ahci_validate_bar_size(struct pci_dev *pdev, void __iomem *mmio)\n+{\n+\tu32 cap = readl(mmio + HOST_CAP);\n+\tunsigned int max_ports = ahci_nr_ports(cap);\n+\tu32 last_port_end = 0x100 + (max_ports * 0x80);\n+\tresource_size_t bar_size =\n+\t\tpci_resource_len(pdev, AHCI_PCI_BAR_STANDARD);\n+\n+\tif (last_port_end > bar_size) {\n+\t\tdev_warn(&pdev->dev,\n+\t\t\t \"BAR5 too small for %u ports (last port ends at %u, BAR %llu)\\n\",\n+\t\t\t max_ports, last_port_end,\n+\t\t\t (unsigned long long)bar_size);\n+\t\treturn -ENODEV;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)\n {\n \tunsigned int board_id = ent->driver_data;\n@@ -1988,6 +2007,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)\n \tif (!hpriv->mmio)\n \t\treturn -ENOMEM;\n \n+\trc = ahci_validate_bar_size(pdev, hpriv->mmio);\n+\tif (rc)\n+\t\treturn rc;\n+\n \t/* detect remapped nvme devices */\n \tahci_remap_check(pdev, ahci_pci_bar, hpriv);\n \n",
    "prefixes": [
        "v4"
    ]
}