Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229548/?format=api
{ "id": 2229548, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229548/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260428130718.1325177-2-stefanb@linux.ibm.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.1/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260428130718.1325177-2-stefanb@linux.ibm.com>", "date": "2026-04-28T13:07:13", "name": "[1/6] tests: Move TPM I2C bus read/write functions to common files", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "95dc21688abbec4278b291ef4f4e3e0ff2a561b1", "submitter": { "id": 75097, "url": "http://patchwork.ozlabs.org/api/1.1/people/75097/?format=api", "name": "Stefan Berger", "email": "stefanb@linux.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260428130718.1325177-2-stefanb@linux.ibm.com/mbox/", "series": [ { "id": 501847, "url": "http://patchwork.ozlabs.org/api/1.1/series/501847/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=501847", "date": "2026-04-28T13:07:15", "name": "Add test case for TPM over I2C with swtpm", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501847/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229548/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229548/checks/", "tags": {}, "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=DhDkocj4;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4gkT6Ybyz1yJH\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 23:09:21 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wHiAM-0006Yr-Ee; Tue, 28 Apr 2026 09:07:54 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanb@linux.ibm.com>)\n id 1wHiA5-0006Sz-2E\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 09:07:38 -0400", "from mx0a-001b2d01.pphosted.com ([148.163.156.1])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanb@linux.ibm.com>)\n id 1wHiA2-0001Jl-Rm\n for qemu-devel@nongnu.org; Tue, 28 Apr 2026 09:07:36 -0400", "from pps.filterd (m0353729.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63S87CjF2932084; Tue, 28 Apr 2026 13:07:30 GMT", "from ppma12.dal12v.mail.ibm.com\n (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn9r5jpw-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 28 Apr 2026 13:07:29 +0000 (GMT)", "from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1])\n by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 63SCwAmx010502;\n Tue, 28 Apr 2026 13:07:28 GMT", "from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71])\n by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4ds7xq9wfj-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 28 Apr 2026 13:07:28 +0000 (GMT)", "from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com\n [10.241.53.103])\n by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63SD7RCL40960634\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Tue, 28 Apr 2026 13:07:28 GMT", "from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id CFBC75805A;\n Tue, 28 Apr 2026 13:07:27 +0000 (GMT)", "from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 8B4CD58052;\n Tue, 28 Apr 2026 13:07:27 +0000 (GMT)", "from mycroft-2.pok.ibm.com (unknown [9.47.158.222])\n by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP;\n Tue, 28 Apr 2026 13:07:27 +0000 (GMT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:in-reply-to:message-id\n :mime-version:references:subject:to; s=pp1; bh=4NVviGlb5bh+PXwzP\n d4clx4ddjYk8AJvga6aJCpuk8A=; b=DhDkocj4QW0iiEsnpn23ZcsU7Z1vRYkn+\n SqxaymmoaqV7zcruJ2VEke/BtsTTZMEYKc7p3mHG5qE52induYnZOYLObpTSWrwY\n 4d/F67QjhrX1qA3QLOwzdbMERswR5RP2qzxQFg92GoQ6iFU0AO0yhj3Zgg/TgAKZ\n 78MHSQ5QHWZPdjOlIHlsG5UlEKKh914K2+lWjTmir6tVNFVmFzCpnb0Ahn9BtPNH\n ToNLKz7lEgXr8a5XKJzCdKT1a5nG5WVyu5ZtiA+qW0QTflP26VOFtIKstCEQPDDT\n UzfChDEEf7kxuhrjbXkKIXDeVI3tKTLFDHTN+doFq+sO660k1qAxg==", "From": "Stefan Berger <stefanb@linux.ibm.com>", "To": "qemu-devel@nongnu.org", "Cc": "marcandre.lureau@redhat.com, armenon@redhat.com,\n Stefan Berger <stefanb@linux.ibm.com>", "Subject": "[PATCH 1/6] tests: Move TPM I2C bus read/write functions to common\n files", "Date": "Tue, 28 Apr 2026 13:07:13 +0000", "Message-ID": "<20260428130718.1325177-2-stefanb@linux.ibm.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260428130718.1325177-1-stefanb@linux.ibm.com>", "References": "<20260428130718.1325177-1-stefanb@linux.ibm.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-TM-AS-GCONF": "00", "X-Proofpoint-GUID": "VCyFsJgVuz4ZoCC4ynXetmwng-NRz9Hu", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDI4MDExOCBTYWx0ZWRfX1cNIhkfCVqKc\n EpAswt6Z3OLmLe/B0yzpKDmiCCZOe22aAwyO8nOHqIjRZZzVMRqsudThyZSWRjhCLvR7fkynHTU\n /9u2WBTHm6ysbT2Oen8p+cdRss1e/cBhMdqfBSnbofVdqJu0JqJUSaQlAExIsLWShPrxivVRBDV\n oQ8k/19S+G/HY3t+fwhFMUg2S0bI0tSQ8gyN0afM3FrS19RZ1iSPj1VeK2eJ8r2kLYAbbIKREaf\n ZupdG7kADFB334eCh2Pzo/Haucm+IcOTRYSRKHdumgxj/ZJg1PNh7SFUuc00G9YJ8Tx1sF4i8qZ\n TUH196f08oDgtrkZbNsdIEslrz8yEHL6ywxQ62DztcAuSpVo79kh1WAnO03zyvpz+Leu9/yS3Xr\n vUAc18yCSWnWUEaZ6r/HbguRkIA8j5kc8bdscMkb8DtT8C6DX8tdj1xcIy/9BFb4VefWkHwxvJj\n B/sJ8SooIIkoEoHrUOQ==", "X-Authority-Analysis": "v=2.4 cv=Kc7idwYD c=1 sm=1 tr=0 ts=69f0b111 cx=c_pps\n a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=8hQrII4DcMiSDO2ebf0A:9", "X-Proofpoint-ORIG-GUID": "VCyFsJgVuz4ZoCC4ynXetmwng-NRz9Hu", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-28_04,2026-04-28_01,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n clxscore=1015 phishscore=0 bulkscore=0 adultscore=0 spamscore=0\n malwarescore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0\n suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc=\n route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000\n definitions=main-2604280118", "Received-SPF": "pass client-ip=148.163.156.1;\n envelope-from=stefanb@linux.ibm.com;\n helo=mx0a-001b2d01.pphosted.com", "X-Spam_score_int": "-26", "X-Spam_score": "-2.7", "X-Spam_bar": "--", "X-Spam_report": "(-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\n RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Move functions for reading from and writing to the Aspeed I2C device into\na file so they can be reused by other functions.\n\nSigned-off-by: Stefan Berger <stefanb@linux.ibm.com>\n---\n tests/qtest/meson.build | 2 +-\n tests/qtest/tpm-tis-i2c-test.c | 50 +-------------------------\n tests/qtest/tpm-tis-i2c-util.c | 64 ++++++++++++++++++++++++++++++++++\n tests/qtest/tpm-tis-i2c-util.h | 30 ++++++++++++++++\n 4 files changed, 96 insertions(+), 50 deletions(-)\n create mode 100644 tests/qtest/tpm-tis-i2c-util.c\n create mode 100644 tests/qtest/tpm-tis-i2c-util.h", "diff": "diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build\nindex b735f55fc4..823be192e7 100644\n--- a/tests/qtest/meson.build\n+++ b/tests/qtest/meson.build\n@@ -397,7 +397,7 @@ qtests = {\n 'tpm-crb-test': [io, tpmemu_files],\n 'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],\n 'tpm-tis-test': [io, tpmemu_files, 'tpm-tis-util.c'],\n- 'tpm-tis-i2c-test': [io, tpmemu_files, 'qtest_aspeed.c'],\n+ 'tpm-tis-i2c-test': [io, tpmemu_files, 'tpm-tis-i2c-util.c', 'qtest_aspeed.c'],\n 'tpm-tis-device-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],\n 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'],\n 'virtio-net-failover': test_migration_files,\ndiff --git a/tests/qtest/tpm-tis-i2c-test.c b/tests/qtest/tpm-tis-i2c-test.c\nindex 3a1af026f2..02ddf76c2c 100644\n--- a/tests/qtest/tpm-tis-i2c-test.c\n+++ b/tests/qtest/tpm-tis-i2c-test.c\n@@ -20,6 +20,7 @@\n #include \"hw/pci/pci_ids.h\"\n #include \"qtest_aspeed.h\"\n #include \"tpm-emu.h\"\n+#include \"tpm-tis-i2c-util.h\"\n \n #define DEBUG_TIS_TEST 0\n \n@@ -36,58 +37,9 @@\n #define DPRINTF_STS \\\n DPRINTF(\"%s: %d: sts = 0x%08x\\n\", __func__, __LINE__, sts)\n \n-#define I2C_SLAVE_ADDR 0x2e\n-#define I2C_DEV_BUS_NUM 10\n-\n static const uint8_t TPM_CMD[12] =\n \"\\x80\\x01\\x00\\x00\\x00\\x0c\\x00\\x00\\x01\\x44\\x00\\x00\";\n \n-static uint32_t aspeed_bus_addr;\n-\n-static uint8_t cur_locty = 0xff;\n-\n-static void tpm_tis_i2c_set_locty(uint8_t locty)\n-{\n- if (cur_locty != locty) {\n- cur_locty = locty;\n- aspeed_i2c_writeb(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR,\n- TPM_I2C_REG_LOC_SEL, locty);\n- }\n-}\n-\n-static uint8_t tpm_tis_i2c_readb(uint8_t locty, uint8_t reg)\n-{\n- tpm_tis_i2c_set_locty(locty);\n- return aspeed_i2c_readb(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg);\n-}\n-\n-static uint16_t tpm_tis_i2c_readw(uint8_t locty, uint8_t reg)\n-{\n- tpm_tis_i2c_set_locty(locty);\n- return aspeed_i2c_readw(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg);\n-}\n-\n-static uint32_t tpm_tis_i2c_readl(uint8_t locty, uint8_t reg)\n-{\n- tpm_tis_i2c_set_locty(locty);\n- return aspeed_i2c_readl(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg);\n-}\n-\n-static void tpm_tis_i2c_writeb(uint8_t locty, uint8_t reg, uint8_t v)\n-{\n- if (reg != TPM_I2C_REG_LOC_SEL) {\n- tpm_tis_i2c_set_locty(locty);\n- }\n- aspeed_i2c_writeb(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg, v);\n-}\n-\n-static void tpm_tis_i2c_writel(uint8_t locty, uint8_t reg, uint32_t v)\n-{\n- if (reg != TPM_I2C_REG_LOC_SEL) {\n- tpm_tis_i2c_set_locty(locty);\n- }\n- aspeed_i2c_writel(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg, v);\n-}\n \n static void tpm_tis_i2c_test_basic(const void *data)\n {\ndiff --git a/tests/qtest/tpm-tis-i2c-util.c b/tests/qtest/tpm-tis-i2c-util.c\nnew file mode 100644\nindex 0000000000..07b1eeba69\n--- /dev/null\n+++ b/tests/qtest/tpm-tis-i2c-util.c\n@@ -0,0 +1,64 @@\n+/*\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ *\n+ * QTest utilities for TPM TIS over I2C\n+ *\n+ * Copyright (c) 2018, 2026 IBM Corporation\n+ *\n+ * Authors:\n+ * Stefan Berger <stefanb@linux.ibm.com>\n+ *\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"hw/acpi/tpm.h\"\n+#include \"libqtest-single.h\"\n+#include \"qtest_aspeed.h\"\n+#include \"tpm-tis-i2c-util.h\"\n+\n+uint32_t aspeed_bus_addr;\n+\n+static uint8_t cur_locty = 0xff;\n+\n+static void tpm_tis_i2c_set_locty(uint8_t locty)\n+{\n+ if (cur_locty != locty) {\n+ cur_locty = locty;\n+ aspeed_i2c_writeb(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR,\n+ TPM_I2C_REG_LOC_SEL, locty);\n+ }\n+}\n+\n+uint8_t tpm_tis_i2c_readb(uint8_t locty, uint8_t reg)\n+{\n+ tpm_tis_i2c_set_locty(locty);\n+ return aspeed_i2c_readb(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg);\n+}\n+\n+uint16_t tpm_tis_i2c_readw(uint8_t locty, uint8_t reg)\n+{\n+ tpm_tis_i2c_set_locty(locty);\n+ return aspeed_i2c_readw(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg);\n+}\n+\n+uint32_t tpm_tis_i2c_readl(uint8_t locty, uint8_t reg)\n+{\n+ tpm_tis_i2c_set_locty(locty);\n+ return aspeed_i2c_readl(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg);\n+}\n+\n+void tpm_tis_i2c_writeb(uint8_t locty, uint8_t reg, uint8_t v)\n+{\n+ if (reg != TPM_I2C_REG_LOC_SEL) {\n+ tpm_tis_i2c_set_locty(locty);\n+ }\n+ aspeed_i2c_writeb(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg, v);\n+}\n+\n+void tpm_tis_i2c_writel(uint8_t locty, uint8_t reg, uint32_t v)\n+{\n+ if (reg != TPM_I2C_REG_LOC_SEL) {\n+ tpm_tis_i2c_set_locty(locty);\n+ }\n+ aspeed_i2c_writel(global_qtest, aspeed_bus_addr, I2C_SLAVE_ADDR, reg, v);\n+}\ndiff --git a/tests/qtest/tpm-tis-i2c-util.h b/tests/qtest/tpm-tis-i2c-util.h\nnew file mode 100644\nindex 0000000000..dfe626b43d\n--- /dev/null\n+++ b/tests/qtest/tpm-tis-i2c-util.h\n@@ -0,0 +1,30 @@\n+/*\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ *\n+ * QTest TPM TIS I2C: Common test functions used for TPM I2C on Aspeed bus\n+ *\n+ * Copyright (c) 2026 IBM Corporation\n+ *\n+ * Authors:\n+ * Stefan Berger <stefanb@linux.ibm.com>\n+ *\n+ */\n+\n+#ifndef TESTS_TPM_TIS_I2C_UTIL_H\n+#define TESTS_TPM_TIS_I2C_UTIL_H\n+\n+#include \"qemu/osdep.h\"\n+\n+extern uint32_t aspeed_bus_addr;\n+\n+#define I2C_SLAVE_ADDR 0x2e\n+#define I2C_DEV_BUS_NUM 10\n+\n+uint8_t tpm_tis_i2c_readb(uint8_t locty, uint8_t reg);\n+uint16_t tpm_tis_i2c_readw(uint8_t locty, uint8_t reg);\n+uint32_t tpm_tis_i2c_readl(uint8_t locty, uint8_t reg);\n+\n+void tpm_tis_i2c_writeb(uint8_t locty, uint8_t reg, uint8_t v);\n+void tpm_tis_i2c_writel(uint8_t locty, uint8_t reg, uint32_t v);\n+\n+#endif /* TESTS_TPM_TIS_I2C_UTIL_H */\n", "prefixes": [ "1/6" ] }