Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1571410/?format=api
{ "id": 1571410, "url": "http://patchwork.ozlabs.org/api/patches/1571410/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-18-marcandre.lureau@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/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": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20211221065855.142578-18-marcandre.lureau@redhat.com>", "list_archive_url": null, "date": "2021-12-21T06:58:36", "name": "[PULL,v2,17/36] ui: move qemu_spice_fill_device_address to ui/util.c", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "070470130d1173bac1b61d55876fc9c2d76c2d81", "submitter": { "id": 66774, "url": "http://patchwork.ozlabs.org/api/people/66774/?format=api", "name": "Marc-André Lureau", "email": "marcandre.lureau@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20211221065855.142578-18-marcandre.lureau@redhat.com/mbox/", "series": [ { "id": 277865, "url": "http://patchwork.ozlabs.org/api/series/277865/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=277865", "date": "2021-12-21T06:58:19", "name": "[PULL,v2,01/36] ui/vdagent: add CHECK_SPICE_PROTOCOL_VERSION", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/277865/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1571410/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1571410/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "bilbo.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=S/jsOFus;\n\tdkim-atps=neutral", "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=<UNKNOWN>)", "relay.mimecast.com;\n auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4JJ7FS17Dzz9s3q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Dec 2021 18:22:20 +1100 (AEDT)", "from localhost ([::1]:52490 helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1mzZTV-0004QR-Qf\n\tfor incoming@patchwork.ozlabs.org; Tue, 21 Dec 2021 02:22:17 -0500", "from eggs.gnu.org ([209.51.188.92]:58674)\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1mzZB2-0005zx-JE\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:03:13 -0500", "from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24517)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <marcandre.lureau@redhat.com>)\n id 1mzZB0-00026G-Fp\n for qemu-devel@nongnu.org; Tue, 21 Dec 2021 02:03:12 -0500", "from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com\n [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n us-mta-350-YtjZdW5FObGdOsXYkZNhtA-1; Tue, 21 Dec 2021 02:03:06 -0500", "from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com\n [10.5.11.11])\n (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n (No client certificate requested)\n by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4E40B1006AA3;\n Tue, 21 Dec 2021 07:03:05 +0000 (UTC)", "from localhost (unknown [10.39.208.37])\n by smtp.corp.redhat.com (Postfix) with ESMTP id DE7767EA36;\n Tue, 21 Dec 2021 07:03:03 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1640070189;\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=yZTKnnbpBds7/JO3O9qeODXIeEG4PnULWLhKLIpNrmw=;\n b=S/jsOFusZJ/9PSXKrvxwrZ2zrJLIBwo9ofvc37gwSSvSReodOajGKaeHkiyG8nzKmLtDl2\n GokYjsgEMGUx/GZwE/DUy3mQJ67/AJKDj4vBIXSER7mRfeJaKRQ9YozeyLBUkMFArp/ghi\n 6Z2zmkvSEDcBRSMzGFRbFeKdhVvPSy4=", "X-MC-Unique": "YtjZdW5FObGdOsXYkZNhtA-1", "From": "marcandre.lureau@redhat.com", "To": "qemu-devel@nongnu.org", "Subject": "[PULL v2 17/36] ui: move qemu_spice_fill_device_address to ui/util.c", "Date": "Tue, 21 Dec 2021 10:58:36 +0400", "Message-Id": "<20211221065855.142578-18-marcandre.lureau@redhat.com>", "In-Reply-To": "<20211221065855.142578-1-marcandre.lureau@redhat.com>", "References": "<20211221065855.142578-1-marcandre.lureau@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.11", "X-Mimecast-Spam-Score": "0", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=170.10.133.124;\n envelope-from=marcandre.lureau@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "X-Spam_score_int": "-29", "X-Spam_score": "-3.0", "X-Spam_bar": "---", "X-Spam_report": "(-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.203,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,\n SPF_HELO_NONE=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-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>", "Cc": "peter.maydell@linaro.org, richard.henderson@linaro.org, =?utf-8?q?Marc-A?=\n\t=?utf-8?q?ndr=C3=A9_Lureau?= <marcandre.lureau@redhat.com>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "From: Marc-André Lureau <marcandre.lureau@redhat.com>\n\nOther backends can use it.\n\nSigned-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>\nAcked-by: Gerd Hoffmann <kraxel@redhat.com>\n---\n include/ui/console.h | 6 +++\n include/ui/spice-display.h | 4 --\n hw/display/qxl.c | 7 +++-\n ui/spice-core.c | 50 -------------------------\n ui/spice-display.c | 5 ++-\n ui/util.c | 75 ++++++++++++++++++++++++++++++++++++++\n ui/meson.build | 1 +\n 7 files changed, 92 insertions(+), 56 deletions(-)\n create mode 100644 ui/util.c", "diff": "diff --git a/include/ui/console.h b/include/ui/console.h\nindex fe08b4dd040f..eefd7e4dc1f4 100644\n--- a/include/ui/console.h\n+++ b/include/ui/console.h\n@@ -495,4 +495,10 @@ int index_from_key(const char *key, size_t key_length);\n int udmabuf_fd(void);\n #endif\n \n+/* util.c */\n+bool qemu_console_fill_device_address(QemuConsole *con,\n+ char *device_address,\n+ size_t size,\n+ Error **errp);\n+\n #endif\ndiff --git a/include/ui/spice-display.h b/include/ui/spice-display.h\nindex a2fbf62c528e..e271e011da1a 100644\n--- a/include/ui/spice-display.h\n+++ b/include/ui/spice-display.h\n@@ -184,8 +184,4 @@ void qemu_spice_display_start(void);\n void qemu_spice_display_stop(void);\n int qemu_spice_display_is_running(SimpleSpiceDisplay *ssd);\n \n-bool qemu_spice_fill_device_address(QemuConsole *con,\n- char *device_address,\n- size_t size);\n-\n #endif\ndiff --git a/hw/display/qxl.c b/hw/display/qxl.c\nindex 29c80b4289b7..e2d6e317da5d 100644\n--- a/hw/display/qxl.c\n+++ b/hw/display/qxl.c\n@@ -2171,12 +2171,17 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)\n }\n \n #if SPICE_SERVER_VERSION >= 0x000e02 /* release 0.14.2 */\n+ Error *err = NULL;\n char device_address[256] = \"\";\n- if (qemu_spice_fill_device_address(qxl->vga.con, device_address, 256)) {\n+ if (qemu_console_fill_device_address(qxl->vga.con,\n+ device_address, sizeof(device_address),\n+ &err)) {\n spice_qxl_set_device_info(&qxl->ssd.qxl,\n device_address,\n 0,\n qxl->max_outputs);\n+ } else {\n+ error_report_err(err);\n }\n #endif\n \ndiff --git a/ui/spice-core.c b/ui/spice-core.c\nindex 31974b8d6c44..c3ac20ad4306 100644\n--- a/ui/spice-core.c\n+++ b/ui/spice-core.c\n@@ -884,56 +884,6 @@ bool qemu_spice_have_display_interface(QemuConsole *con)\n return false;\n }\n \n-/*\n- * Recursively (in reverse order) appends addresses of PCI devices as it moves\n- * up in the PCI hierarchy.\n- *\n- * @returns true on success, false when the buffer wasn't large enough\n- */\n-static bool append_pci_address(char *buf, size_t buf_size, const PCIDevice *pci)\n-{\n- PCIBus *bus = pci_get_bus(pci);\n- /*\n- * equivalent to if (!pci_bus_is_root(bus)), but the function is not built\n- * with PCI_CONFIG=n, avoid using an #ifdef by checking directly\n- */\n- if (bus->parent_dev != NULL) {\n- append_pci_address(buf, buf_size, bus->parent_dev);\n- }\n-\n- size_t len = strlen(buf);\n- ssize_t written = snprintf(buf + len, buf_size - len, \"/%02x.%x\",\n- PCI_SLOT(pci->devfn), PCI_FUNC(pci->devfn));\n-\n- return written > 0 && written < buf_size - len;\n-}\n-\n-bool qemu_spice_fill_device_address(QemuConsole *con,\n- char *device_address,\n- size_t size)\n-{\n- DeviceState *dev = DEVICE(object_property_get_link(OBJECT(con),\n- \"device\",\n- &error_abort));\n- PCIDevice *pci = (PCIDevice *) object_dynamic_cast(OBJECT(dev),\n- TYPE_PCI_DEVICE);\n-\n- if (pci == NULL) {\n- warn_report(\"Setting device address of a display device to SPICE: \"\n- \"Not a PCI device.\");\n- return false;\n- }\n-\n- strncpy(device_address, \"pci/0000\", size);\n- if (!append_pci_address(device_address, size, pci)) {\n- warn_report(\"Setting device address of a display device to SPICE: \"\n- \"Too many PCI devices in the chain.\");\n- return false;\n- }\n-\n- return true;\n-}\n-\n int qemu_spice_add_display_interface(QXLInstance *qxlin, QemuConsole *con)\n {\n if (g_slist_find(spice_consoles, con)) {\ndiff --git a/ui/spice-display.c b/ui/spice-display.c\nindex 798e0f6167e7..1043f47f9456 100644\n--- a/ui/spice-display.c\n+++ b/ui/spice-display.c\n@@ -1148,12 +1148,15 @@ static void qemu_spice_display_init_one(QemuConsole *con)\n qemu_spice_add_display_interface(&ssd->qxl, con);\n \n #if SPICE_SERVER_VERSION >= 0x000e02 /* release 0.14.2 */\n+ Error *err = NULL;\n char device_address[256] = \"\";\n- if (qemu_spice_fill_device_address(con, device_address, 256)) {\n+ if (qemu_console_fill_device_address(con, device_address, 256, &err)) {\n spice_qxl_set_device_info(&ssd->qxl,\n device_address,\n qemu_console_get_head(con),\n 1);\n+ } else {\n+ error_report_err(err);\n }\n #endif\n \ndiff --git a/ui/util.c b/ui/util.c\nnew file mode 100644\nindex 000000000000..7e8fc1ea537a\n--- /dev/null\n+++ b/ui/util.c\n@@ -0,0 +1,75 @@\n+/*\n+ * Copyright (C) 2021 Red Hat, Inc.\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public License as\n+ * published by the Free Software Foundation; either version 2 or\n+ * (at your option) version 3 of the License.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, see <http://www.gnu.org/licenses/>.\n+ */\n+\n+#include \"qemu/osdep.h\"\n+\n+#include \"hw/pci/pci.h\"\n+#include \"hw/pci/pci_bus.h\"\n+#include \"qapi/error.h\"\n+#include \"ui/console.h\"\n+\n+/*\n+ * Recursively (in reverse order) appends addresses of PCI devices as it moves\n+ * up in the PCI hierarchy.\n+ *\n+ * @returns true on success, false when the buffer wasn't large enough\n+ */\n+static bool append_pci_address(char *buf, size_t buf_size, const PCIDevice *pci)\n+{\n+ PCIBus *bus = pci_get_bus(pci);\n+ /*\n+ * equivalent to if (!pci_bus_is_root(bus)), but the function is not built\n+ * with PCI_CONFIG=n, avoid using an #ifdef by checking directly\n+ */\n+ if (bus->parent_dev != NULL) {\n+ append_pci_address(buf, buf_size, bus->parent_dev);\n+ }\n+\n+ size_t len = strlen(buf);\n+ ssize_t written = snprintf(buf + len, buf_size - len, \"/%02x.%x\",\n+ PCI_SLOT(pci->devfn), PCI_FUNC(pci->devfn));\n+\n+ return written > 0 && written < buf_size - len;\n+}\n+\n+bool qemu_console_fill_device_address(QemuConsole *con,\n+ char *device_address,\n+ size_t size,\n+ Error **errp)\n+{\n+ ERRP_GUARD();\n+ DeviceState *dev = DEVICE(object_property_get_link(OBJECT(con),\n+ \"device\",\n+ &error_abort));\n+ PCIDevice *pci = (PCIDevice *) object_dynamic_cast(OBJECT(dev),\n+ TYPE_PCI_DEVICE);\n+\n+ if (pci == NULL) {\n+ error_setg(errp, \"Setting device address of a display device: \"\n+ \"Not a PCI device.\");\n+ return false;\n+ }\n+\n+ strncpy(device_address, \"pci/0000\", size);\n+ if (!append_pci_address(device_address, size, pci)) {\n+ error_setg(errp, \"Setting device address of a display device: \"\n+ \"Too many PCI devices in the chain.\");\n+ return false;\n+ }\n+\n+ return true;\n+}\ndiff --git a/ui/meson.build b/ui/meson.build\nindex ee8ef27714cd..a9df5b911ec8 100644\n--- a/ui/meson.build\n+++ b/ui/meson.build\n@@ -12,6 +12,7 @@ softmmu_ss.add(files(\n 'kbd-state.c',\n 'keymaps.c',\n 'qemu-pixman.c',\n+ 'util.c',\n ))\n softmmu_ss.add([spice_headers, files('spice-module.c')])\n softmmu_ss.add(when: spice_protocol, if_true: files('vdagent.c'))\n", "prefixes": [ "PULL", "v2", "17/36" ] }