Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217069/?format=api
{ "id": 2217069, "url": "http://patchwork.ozlabs.org/api/patches/2217069/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260327160132.2946114-29-yilun.xu@linux.intel.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260327160132.2946114-29-yilun.xu@linux.intel.com>", "list_archive_url": null, "date": "2026-03-27T16:01:29", "name": "[v2,28/31] coco/tdx-host: Parse ACPI KEYP table to init IDE for PCI host bridges", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "cf1a294704e58207fd04915f73ab75ec8b8b2159", "submitter": { "id": 87470, "url": "http://patchwork.ozlabs.org/api/people/87470/?format=api", "name": "Xu Yilun", "email": "yilun.xu@linux.intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260327160132.2946114-29-yilun.xu@linux.intel.com/mbox/", "series": [ { "id": 497793, "url": "http://patchwork.ozlabs.org/api/series/497793/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=497793", "date": "2026-03-27T16:01:02", "name": "PCI/TSM: PCIe Link Encryption Establishment via TDX platform services", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/497793/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217069/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217069/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-pci+bounces-51314-incoming=patchwork.ozlabs.org@vger.kernel.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "linux-pci@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=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=QmjYwiPm;\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-pci+bounces-51314-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=\"QmjYwiPm\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=198.175.65.14", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.intel.com" ], "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 4fj5x24WWFz1y1x\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 03:40:38 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 741E731B0C60\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 16:30:28 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 63D5640626D;\n\tFri, 27 Mar 2026 16:24:18 +0000 (UTC)", "from mgamail.intel.com (mgamail.intel.com [198.175.65.14])\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 06D9C405ACD;\n\tFri, 27 Mar 2026 16:24:17 +0000 (UTC)", "from fmviesa006.fm.intel.com ([10.60.135.146])\n by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Mar 2026 09:24:16 -0700", "from yilunxu-optiplex-7050.sh.intel.com ([10.239.159.165])\n by fmviesa006.fm.intel.com with ESMTP; 27 Mar 2026 09:24:13 -0700" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774628658; cv=none;\n b=aUs1fv+VvAHi1gq/y1Y1ITfyppRMdJShGE1xfDctYFHlcaHGfvIzLPZ5M9qBOPh7t0IGtN5HnejQtJlk40MCb4bj0TBTN0jppa/pU55DhiIpZfkc+vgW4je2Yb/JwqR2YtK2ogSXE0fTH2SIHjcnbtlToV72I2QOKLIoefIh1J0=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774628658; c=relaxed/simple;\n\tbh=qUyRwAaoP/Pd1LzP3/qJcfABY/rt+g58V38MuLi8Pu0=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t MIME-Version;\n b=YCo+ezs9wPNERTNvYRZb2CRBPrYtcZ87oUXcI3NokQopUmTcjfDjdnwh1MzcTDDmueDYKRMdHQanCy0UyYge6hAV5DYtrhq+EI/SDgXacpZ3z93F8i2XhnXIJ/6XO6FUX+DuMmCPtjsY4MkzJvFzIpK4+BNQiWfqeR5jQ5efWVM=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.intel.com;\n spf=pass smtp.mailfrom=linux.intel.com;\n dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com\n header.b=QmjYwiPm; arc=none smtp.client-ip=198.175.65.14", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1774628656; x=1806164656;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=qUyRwAaoP/Pd1LzP3/qJcfABY/rt+g58V38MuLi8Pu0=;\n b=QmjYwiPmNqOpsK9SuY9qoz0h+iUfbrRy8OdY+os4QYIO8G1vUSKTTfvy\n dBjc1ctxJITgZGM1Pnb894c0qFtF9MWbDU3/J9j6tRbjC4cqQ/V1B9R3Z\n KO9dFAtUGKZ/uJs6YbfWpkO6xWxtucOfTCQFXyF4AFxc/S9fIn7GUS5aW\n ZxpxbyTcNJeGrNOr1PPItRrSJ/5jpTYawMMpfrpDc5tRZytHDSGUbZPU5\n 3jY4RVsZCNf+GrjYS7h5tmhDRElgpRGJavMMHwVpU4nWlwq76za9RdosL\n iKwMsaH0o6CmbhkNBsbdNl837+CEz87OkXar7Cgf1VdQxwfS58/MiClOe\n w==;", "X-CSE-ConnectionGUID": [ "nnoW+v+qTiGShy/FICJgiQ==", "z4SQgsAsS+SrUSoIgdBDMg==" ], "X-CSE-MsgGUID": [ "FqEbF/gzTEuefFJnQXHq9w==", "MoAPMc/wRW+/IysahX6pRQ==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11741\"; a=\"79565686\"", "E=Sophos;i=\"6.23,144,1770624000\";\n d=\"scan'208\";a=\"79565686\"", "E=Sophos;i=\"6.23,144,1770624000\";\n d=\"scan'208\";a=\"220516380\"" ], "X-ExtLoop1": "1", "From": "Xu Yilun <yilun.xu@linux.intel.com>", "To": "linux-coco@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tdan.j.williams@intel.com,\n\tx86@kernel.org", "Cc": "chao.gao@intel.com,\n\tdave.jiang@intel.com,\n\tbaolu.lu@linux.intel.com,\n\tyilun.xu@linux.intel.com,\n\tyilun.xu@intel.com,\n\tzhenzhong.duan@intel.com,\n\tkvm@vger.kernel.org,\n\trick.p.edgecombe@intel.com,\n\tdave.hansen@linux.intel.com,\n\tkas@kernel.org,\n\txiaoyao.li@intel.com,\n\tvishal.l.verma@intel.com,\n\tlinux-kernel@vger.kernel.org", "Subject": "[PATCH v2 28/31] coco/tdx-host: Parse ACPI KEYP table to init IDE for\n PCI host bridges", "Date": "Sat, 28 Mar 2026 00:01:29 +0800", "Message-Id": "<20260327160132.2946114-29-yilun.xu@linux.intel.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20260327160132.2946114-1-yilun.xu@linux.intel.com>", "References": "<20260327160132.2946114-1-yilun.xu@linux.intel.com>", "Precedence": "bulk", "X-Mailing-List": "linux-pci@vger.kernel.org", "List-Id": "<linux-pci.vger.kernel.org>", "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit" }, "content": "Parse the KEYP Key Configuration Units (KCU), to decide the max IDE\nstreams supported for each host bridge.\n\nThe KEYP table points to a number of KCU structures that each associates\nwith a list of root ports (RP) via segment, bus, and devfn. Sanity check\nthe KEYP table, ensure all RPs listed for each KCU are included in one\nhost bridge. Then extact the max IDE streams supported to\npci_host_bridge via pci_ide_set_nr_streams().\n\nCo-developed-by: Dave Jiang <dave.jiang@intel.com>\nSigned-off-by: Dave Jiang <dave.jiang@intel.com>\nReviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>\nSigned-off-by: Xu Yilun <yilun.xu@linux.intel.com>\n---\n drivers/virt/coco/tdx-host/tdx-host.c | 111 ++++++++++++++++++++++++++\n 1 file changed, 111 insertions(+)", "diff": "diff --git a/drivers/virt/coco/tdx-host/tdx-host.c b/drivers/virt/coco/tdx-host/tdx-host.c\nindex 4d127b7c2591..d5072a68b81a 100644\n--- a/drivers/virt/coco/tdx-host/tdx-host.c\n+++ b/drivers/virt/coco/tdx-host/tdx-host.c\n@@ -5,6 +5,7 @@\n * Copyright (C) 2025 Intel Corporation\n */\n \n+#include <linux/acpi.h>\n #include <linux/bitfield.h>\n #include <linux/device/faux.h>\n #include <linux/dmar.h>\n@@ -12,6 +13,7 @@\n #include <linux/mod_devicetable.h>\n #include <linux/pci.h>\n #include <linux/pci-doe.h>\n+#include <linux/pci-ide.h>\n #include <linux/pci-tsm.h>\n #include <linux/tsm.h>\n #include <linux/vmalloc.h>\n@@ -474,6 +476,111 @@ static void unregister_link_tsm(void *link)\n \ttsm_unregister(link);\n }\n \n+#define KCU_STR_CAP_NUM_STREAMS\t\tGENMASK(8, 0)\n+\n+/* The bus_end is inclusive */\n+struct keyp_hb_info {\n+\t/* input */\n+\tu16 segment;\n+\tu8 bus_start;\n+\tu8 bus_end;\n+\t/* output */\n+\tu8 nr_ide_streams;\n+};\n+\n+static bool keyp_info_match(struct acpi_keyp_rp_info *rp,\n+\t\t\t struct keyp_hb_info *hb)\n+{\n+\treturn rp->segment == hb->segment && rp->bus >= hb->bus_start &&\n+\t rp->bus <= hb->bus_end;\n+}\n+\n+static int keyp_config_unit_handler(union acpi_subtable_headers *header,\n+\t\t\t\t void *arg, const unsigned long end)\n+{\n+\tstruct acpi_keyp_config_unit *acpi_cu =\n+\t\t(struct acpi_keyp_config_unit *)&header->keyp;\n+\tstruct keyp_hb_info *hb_info = arg;\n+\tint rp_size, rp_count, i;\n+\tvoid __iomem *addr;\n+\tbool match = false;\n+\tu32 cap;\n+\n+\trp_size = acpi_cu->header.length - sizeof(*acpi_cu);\n+\tif (rp_size % sizeof(struct acpi_keyp_rp_info))\n+\t\treturn -EINVAL;\n+\n+\trp_count = rp_size / sizeof(struct acpi_keyp_rp_info);\n+\tif (!rp_count || rp_count != acpi_cu->root_port_count)\n+\t\treturn -EINVAL;\n+\n+\tfor (i = 0; i < rp_count; i++) {\n+\t\tstruct acpi_keyp_rp_info *rp_info = &acpi_cu->rp_info[i];\n+\n+\t\tif (i == 0) {\n+\t\t\tmatch = keyp_info_match(rp_info, hb_info);\n+\t\t\t/* The host bridge already matches another KCU */\n+\t\t\tif (match && hb_info->nr_ide_streams)\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (match ^ keyp_info_match(rp_info, hb_info))\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\tif (!match)\n+\t\treturn 0;\n+\n+\taddr = ioremap(acpi_cu->register_base_address, sizeof(cap));\n+\tif (!addr)\n+\t\treturn -ENOMEM;\n+\tcap = ioread32(addr);\n+\tiounmap(addr);\n+\n+\thb_info->nr_ide_streams = FIELD_GET(KCU_STR_CAP_NUM_STREAMS, cap) + 1;\n+\n+\treturn 0;\n+}\n+\n+static u8 keyp_find_nr_ide_stream(u16 segment, u8 bus_start, u8 bus_end)\n+{\n+\tstruct keyp_hb_info hb_info = {\n+\t\t.segment = segment,\n+\t\t.bus_start = bus_start,\n+\t\t.bus_end = bus_end,\n+\t};\n+\tint rc;\n+\n+\trc = acpi_table_parse_keyp(ACPI_KEYP_TYPE_CONFIG_UNIT,\n+\t\t\t\t keyp_config_unit_handler, &hb_info);\n+\tif (rc < 0)\n+\t\treturn 0;\n+\n+\treturn hb_info.nr_ide_streams;\n+}\n+\n+static void keyp_setup_nr_ide_stream(struct pci_bus *bus)\n+{\n+\tstruct pci_host_bridge *hb = pci_find_host_bridge(bus);\n+\tu8 nr_ide_streams;\n+\n+\tnr_ide_streams = keyp_find_nr_ide_stream(pci_domain_nr(bus),\n+\t\t\t\t\t\t bus->busn_res.start,\n+\t\t\t\t\t\t bus->busn_res.end);\n+\n+\tpci_ide_set_nr_streams(hb, nr_ide_streams);\n+}\n+\n+static void tdx_setup_nr_ide_stream(void)\n+{\n+\tstruct pci_bus *bus = NULL;\n+\n+\twhile ((bus = pci_find_next_bus(bus)))\n+\t\tkeyp_setup_nr_ide_stream(bus);\n+}\n+\n static DEFINE_XARRAY(tlink_iommu_xa);\n \n static void tdx_iommu_clear(u64 iommu_id, struct tdx_page_array *iommu_mt)\n@@ -569,6 +676,8 @@ static int __maybe_unused tdx_connect_init(struct device *dev)\n \tif (ret)\n \t\treturn ret;\n \n+\ttdx_setup_nr_ide_stream();\n+\n \tlink = tsm_register(dev, &tdx_tsm_link_ops);\n \tif (IS_ERR(link))\n \t\treturn dev_err_probe(dev, PTR_ERR(link),\n@@ -612,5 +721,7 @@ static void __exit tdx_host_exit(void)\n }\n module_exit(tdx_host_exit);\n \n+MODULE_IMPORT_NS(\"ACPI\");\n+MODULE_IMPORT_NS(\"PCI_IDE\");\n MODULE_DESCRIPTION(\"TDX Host Services\");\n MODULE_LICENSE(\"GPL\");\n", "prefixes": [ "v2", "28/31" ] }