Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2225854/?format=api
{ "id": 2225854, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2225854/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421163438.3447280-8-clg@redhat.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": "<20260421163438.3447280-8-clg@redhat.com>", "date": "2026-04-21T16:34:31", "name": "[PULL,07/14] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to hw/vfio/kvm-spapr.c", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "dc4583681ebf1d952319caab3144c54dae51ebc4", "submitter": { "id": 85406, "url": "http://patchwork.ozlabs.org/api/1.1/people/85406/?format=api", "name": "Cédric Le Goater", "email": "clg@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260421163438.3447280-8-clg@redhat.com/mbox/", "series": [ { "id": 500853, "url": "http://patchwork.ozlabs.org/api/1.1/series/500853/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500853", "date": "2026-04-21T16:34:24", "name": "[PULL,01/14] hw/vfio/listener.c: remove CONFIG_KVM", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/500853/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225854/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225854/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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=SMmeLHcB;\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 4g0SkR6qShz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 02:39:43 +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 1wFE5L-0005La-Ki; Tue, 21 Apr 2026 12:36:27 -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 <clg@redhat.com>) id 1wFE47-0004gq-ET\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 12:35:15 -0400", "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <clg@redhat.com>) id 1wFE40-0007OI-7y\n for qemu-devel@nongnu.org; Tue, 21 Apr 2026 12:35:06 -0400", "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-711-Acl5_vHmM_KoYKEhIFPDCQ-1; Tue,\n 21 Apr 2026 12:34:59 -0400", "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 203AC18003F6; Tue, 21 Apr 2026 16:34:58 +0000 (UTC)", "from corto.redhat.com (unknown [10.44.32.70])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 350DB19560AB; Tue, 21 Apr 2026 16:34:55 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776789302;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=HN7usOvOD5JXKjKE5SLWxOEK8n3ue3orhToutZspIB8=;\n b=SMmeLHcB9oz77wkunKL1jdduRpqu3GzTlYMBjLxpCsnZ9jd/wwnR2jD0qBsxSftQUbt3So\n 6xYHNGMG5LmRr9CRAETxRkwvpQyoB0XrHuvPPlvD4ZMN9vrhOiDxxfQ4/fRjq+J4i33G5f\n BAcC2hlwUx2nnjs3RsBDN5NAdZWCuUQ=", "X-MC-Unique": "Acl5_vHmM_KoYKEhIFPDCQ-1", "X-Mimecast-MFC-AGG-ID": "Acl5_vHmM_KoYKEhIFPDCQ_1776789298", "From": "=?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>", "To": "qemu-devel@nongnu.org", "Cc": "Alex Williamson <alex@shazbot.org>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>, =?utf-8?q?Philippe_Mathieu-?=\n\t=?utf-8?q?Daud=C3=A9?= <philmd@linaro.org>,\n =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>", "Subject": "[PULL 07/14] hw/vfio/spapr.c: extract vfio_spapr_kvm_attach_tce to\n hw/vfio/kvm-spapr.c", "Date": "Tue, 21 Apr 2026 18:34:31 +0200", "Message-ID": "<20260421163438.3447280-8-clg@redhat.com>", "In-Reply-To": "<20260421163438.3447280-1-clg@redhat.com>", "References": "<20260421163438.3447280-1-clg@redhat.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17", "Received-SPF": "pass client-ip=170.10.129.124; envelope-from=clg@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_PASS=-0.001, 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": "From: Pierrick Bouvier <pierrick.bouvier@linaro.org>\n\nSince this function needs kvm specific types, we need to extract in\nanother file and link it only for KVM builds.\n\nReviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nSigned-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>\nReviewed-by: Cédric Le Goater <clg@redhat.com>\nTested-by: Cédric Le Goater <clg@redhat.com>\nTested-by: Philippe Mathieu-Daudé <philmd@linaro.org>\nLink: https://lore.kernel.org/qemu-devel/20260318174733.1717643-8-pierrick.bouvier@linaro.org\nSigned-off-by: Cédric Le Goater <clg@redhat.com>\n---\n hw/vfio/kvm-spapr.h | 12 ++++++++++++\n hw/vfio/kvm-spapr.c | 47 +++++++++++++++++++++++++++++++++++++++++++++\n hw/vfio/kvm-stubs.c | 8 ++++++++\n hw/vfio/spapr.c | 30 ++++-------------------------\n hw/vfio/meson.build | 1 +\n 5 files changed, 72 insertions(+), 26 deletions(-)\n create mode 100644 hw/vfio/kvm-spapr.h\n create mode 100644 hw/vfio/kvm-spapr.c", "diff": "diff --git a/hw/vfio/kvm-spapr.h b/hw/vfio/kvm-spapr.h\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..b1f68c686a7defbed94cc4c0d56b786bc436ed89\n--- /dev/null\n+++ b/hw/vfio/kvm-spapr.h\n@@ -0,0 +1,12 @@\n+/*\n+ * VFIO sPAPR KVM specific functions\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"hw/vfio/vfio-container.h\"\n+#include \"qapi/error.h\"\n+\n+bool vfio_spapr_kvm_attach_tce(VFIOContainer *bcontainer,\n+ MemoryRegionSection *section,\n+ Error **errp);\ndiff --git a/hw/vfio/kvm-spapr.c b/hw/vfio/kvm-spapr.c\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..ad71c5a85e273fbe8df9fda71ba21c7df171914d\n--- /dev/null\n+++ b/hw/vfio/kvm-spapr.c\n@@ -0,0 +1,47 @@\n+/*\n+ * VFIO sPAPR KVM specific functions\n+ *\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include <sys/ioctl.h>\n+#include <linux/vfio.h>\n+#include <linux/kvm.h>\n+\n+#include \"hw/vfio/vfio-container-legacy.h\"\n+#include \"hw/vfio/kvm-spapr.h\"\n+#include \"qapi/error.h\"\n+#include \"trace.h\"\n+#include \"vfio-helpers.h\"\n+\n+bool vfio_spapr_kvm_attach_tce(VFIOContainer *bcontainer,\n+ MemoryRegionSection *section,\n+ Error **errp)\n+{\n+ VFIOLegacyContainer *container = VFIO_IOMMU_LEGACY(bcontainer);\n+ VFIOGroup *group;\n+ IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);\n+ struct kvm_vfio_spapr_tce param;\n+ struct kvm_device_attr attr = {\n+ .group = KVM_DEV_VFIO_GROUP,\n+ .attr = KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE,\n+ .addr = (uint64_t)(unsigned long)¶m,\n+ };\n+\n+ if (!memory_region_iommu_get_attr(iommu_mr, IOMMU_ATTR_SPAPR_TCE_FD,\n+ ¶m.tablefd)) {\n+ QLIST_FOREACH(group, &container->group_list, container_next) {\n+ param.groupfd = group->fd;\n+ if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {\n+ error_setg_errno(errp, errno,\n+ \"vfio: failed GROUP_SET_SPAPR_TCE for \"\n+ \"KVM VFIO device %d and group fd %d\",\n+ param.tablefd, param.groupfd);\n+ return false;\n+ }\n+ trace_vfio_spapr_group_attach(param.groupfd, param.tablefd);\n+ }\n+ }\n+ return true;\n+}\ndiff --git a/hw/vfio/kvm-stubs.c b/hw/vfio/kvm-stubs.c\nindex 5a489d1b7110a5564054398cc354bb806ac39334..78c51b9915559ba3c328cb3bcc0d9e2896269f9f 100644\n--- a/hw/vfio/kvm-stubs.c\n+++ b/hw/vfio/kvm-stubs.c\n@@ -6,6 +6,7 @@\n \n #include \"qemu/osdep.h\"\n \n+#include \"hw/vfio/kvm-spapr.h\"\n #include \"hw/vfio/vfio-device.h\"\n #include \"qapi/error.h\"\n #include \"vfio-helpers.h\"\n@@ -24,3 +25,10 @@ int vfio_kvm_device_del_fd(int fd, Error **errp)\n {\n return 0;\n }\n+\n+bool vfio_spapr_kvm_attach_tce(VFIOContainer *bcontainer,\n+ MemoryRegionSection *section,\n+ Error **errp)\n+{\n+ g_assert_not_reached();\n+}\ndiff --git a/hw/vfio/spapr.c b/hw/vfio/spapr.c\nindex a9f093c357057eaa07378c77c86da096fe9f6297..42690e4323d20915c55591129d9fce0ae46b0cf3 100644\n--- a/hw/vfio/spapr.c\n+++ b/hw/vfio/spapr.c\n@@ -16,6 +16,7 @@\n #include \"system/address-spaces.h\"\n \n #include \"hw/vfio/vfio-container-legacy.h\"\n+#include \"hw/vfio/kvm-spapr.h\"\n #include \"hw/core/hw-error.h\"\n #include \"qemu/error-report.h\"\n #include \"qapi/error.h\"\n@@ -406,33 +407,10 @@ vfio_spapr_container_add_section_window(VFIOContainer *bcontainer,\n vfio_host_win_add(scontainer, section->offset_within_address_space,\n section->offset_within_address_space +\n int128_get64(section->size) - 1, pgsize);\n-#ifdef CONFIG_KVM\n- if (kvm_enabled()) {\n- VFIOGroup *group;\n- IOMMUMemoryRegion *iommu_mr = IOMMU_MEMORY_REGION(section->mr);\n- struct kvm_vfio_spapr_tce param;\n- struct kvm_device_attr attr = {\n- .group = KVM_DEV_VFIO_GROUP,\n- .attr = KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE,\n- .addr = (uint64_t)(unsigned long)¶m,\n- };\n-\n- if (!memory_region_iommu_get_attr(iommu_mr, IOMMU_ATTR_SPAPR_TCE_FD,\n- ¶m.tablefd)) {\n- QLIST_FOREACH(group, &container->group_list, container_next) {\n- param.groupfd = group->fd;\n- if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {\n- error_setg_errno(errp, errno,\n- \"vfio: failed GROUP_SET_SPAPR_TCE for \"\n- \"KVM VFIO device %d and group fd %d\",\n- param.tablefd, param.groupfd);\n- return false;\n- }\n- trace_vfio_spapr_group_attach(param.groupfd, param.tablefd);\n- }\n- }\n+ if (kvm_enabled() && !vfio_spapr_kvm_attach_tce(bcontainer, section, errp)) {\n+ return false;\n }\n-#endif\n+\n return true;\n }\n \ndiff --git a/hw/vfio/meson.build b/hw/vfio/meson.build\nindex 6c00a7f51bbe79d8e45d828a11d4deecf21512be..bab5f2b7f1555eed452e7a91b8a8984bb1f262c6 100644\n--- a/hw/vfio/meson.build\n+++ b/hw/vfio/meson.build\n@@ -10,6 +10,7 @@ vfio_ss.add(files(\n vfio_ss.add(when: 'CONFIG_KVM', if_true: files('kvm-helpers.c'))\n stub_ss.add(files('kvm-stubs.c'))\n vfio_ss.add(when: 'CONFIG_PSERIES', if_true: files('spapr.c'))\n+vfio_ss.add(when: ['CONFIG_KVM', 'CONFIG_PSERIES'], if_true: files('kvm-spapr.c'))\n vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(\n 'pci-quirks.c',\n 'pci.c',\n", "prefixes": [ "PULL", "07/14" ] }