Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2230160/?format=api
{ "id": 2230160, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2230160/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260429121743.1346635-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": "<20260429121743.1346635-2-stefanb@linux.ibm.com>", "date": "2026-04-29T12:17:38", "name": "[v2,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/20260429121743.1346635-2-stefanb@linux.ibm.com/mbox/", "series": [ { "id": 502046, "url": "http://patchwork.ozlabs.org/api/1.1/series/502046/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=502046", "date": "2026-04-29T12:17:37", "name": "Add test case for TPM over I2C with swtpm", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/502046/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2230160/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2230160/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=EfMtYvj9;\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 4g5GYQ2DpXz1yHZ\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 22:18:34 +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 1wI3rZ-0004Fq-W8; Wed, 29 Apr 2026 08:17:58 -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 1wI3rX-0004Ew-B4\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 08:17:55 -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 1wI3rV-0000os-4Z\n for qemu-devel@nongnu.org; Wed, 29 Apr 2026 08:17:54 -0400", "from pps.filterd (m0360083.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63SN5qv41046341; Wed, 29 Apr 2026 12:17:51 GMT", "from ppma22.wdc07v.mail.ibm.com\n (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4drn44tg55-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Wed, 29 Apr 2026 12:17:51 +0000 (GMT)", "from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1])\n by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id\n 63TC975S002450;\n Wed, 29 Apr 2026 12:17:50 GMT", "from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7])\n by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4ds8avx969-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Wed, 29 Apr 2026 12:17:50 +0000 (GMT)", "from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com\n [10.39.53.231])\n by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 63TCHnai32899708\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Wed, 29 Apr 2026 12:17:49 GMT", "from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 6354D58045;\n Wed, 29 Apr 2026 12:17:49 +0000 (GMT)", "from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id DD72A58052;\n Wed, 29 Apr 2026 12:17:48 +0000 (GMT)", "from mycroft-2.pok.ibm.com (unknown [9.47.158.222])\n by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP;\n Wed, 29 Apr 2026 12:17:48 +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=KhmwtuPz647wE9lQY\n CX8IQtwAdej61plNxZ9W+w08AU=; b=EfMtYvj9/IZxPx/fJj/nwwelW+faMYbfl\n 7UpccGEmJnXYSnFCbYWk189rRWcAIaEeY7Pzxr8sQZOqHd//VddaXyZxvvSDwZ9h\n PWqcrFZnggQxxRedxtK7IeQ+n1/KExgSIttiim2nqewT9+wgai6ZwG4Qj2xXK9tF\n pdswIQ0j5+aqM5k5KaYEYyFiYIrknAf+SOFgAGh9PSzd7ru0YXOt6kkwA2az/8P2\n ClQ5YPC9nZqmHI6h4HXj6fmdVNUMW+QKMZ3e+mBMYSuONqbsOgIxxkpc5ESN6bZ0\n iu153yie13IiCQjDvkwp99O+kQxdHLKf80Ar6qV3tbOsgAEhxL6zQ==", "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 v2 1/6] tests: Move TPM I2C bus read/write functions to common\n files", "Date": "Wed, 29 Apr 2026 12:17:38 +0000", "Message-ID": "<20260429121743.1346635-2-stefanb@linux.ibm.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260429121743.1346635-1-stefanb@linux.ibm.com>", "References": "<20260429121743.1346635-1-stefanb@linux.ibm.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-TM-AS-GCONF": "00", "X-Proofpoint-ORIG-GUID": "jLOVYG8OPfiB47XMOjJVZUaX0aqbm5NX", "X-Authority-Analysis": "v=2.4 cv=Ft81OWrq c=1 sm=1 tr=0 ts=69f1f6ef cx=c_pps\n a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17\n a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22\n a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=20KFwNOVAAAA:8\n a=8hQrII4DcMiSDO2ebf0A:9", "X-Proofpoint-GUID": "jLOVYG8OPfiB47XMOjJVZUaX0aqbm5NX", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDI5MDEyNSBTYWx0ZWRfX70jYyFf+h0QD\n lOjWH2GMfyvnFPCwSx6f901JIURCr4vJ381iYXEqSOEfkqc4rVtH9hDi6H8FnGk4FBwvgWITd6J\n 4HLvf2Ck0vaGTNjmKhb+IgBKHLwZpk88TPIUfhmcQpbnFK4/M6ZV5xuotzb9Myl78ctDu0ovcN5\n RWAFWZ0mQfD3BHhYOCGbn8uFurbj8VpQKtPji+P5r1SUlHONZDkLgLE7LUMS0JEWY+OfTa6d5fN\n uTnlaK1FXFs21FVDlb24GOxVrIPohAgYs6RB10DR4l2ycD+jQLK+B93VgJsyaWMlMVYQaFpvoxL\n qMDSA1XJXa6aB2Mo9CTn54IJ14wZUmoq9yCK83o3wqcMF+hsMxS00TBzxtWFhkpL1v+hwJPyQ/L\n 1IMkQ1y4j/XYQjzL87OecZcMvfmg2tjwLuIcgYY0Vp+mqUyOwAvwuE3TGIlwmb0XPQg25EqOpfy\n 1OqJff0bzboO6r87lLA==", "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_05,2026-04-28_01,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0\n clxscore=1015 malwarescore=0 phishscore=0 suspectscore=0 adultscore=0\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2604290125", "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>\nReviewed-by: Arun Menon <armenon@redhat.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": [ "v2", "1/6" ] }