From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656921808; cv=none; d=zohomail.com; s=zohoarc; b=Lt+FcFcwQQKPhmnHvO4uQ8c2Tb+7OfuT/eZbUkKTRtyGEG/tAukmeL6UymJh7k3biRk23fN66IBQho1s+UYTmWtD5WCAUy9tef5DMbGBMl70n1LWvtsy98nfi0yDY49KQc6Bmil2M5rQSN+WFH8hZV9u4nOqqJ30Inu+vu8N41w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656921808; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T9X8uCpaGt4LkAajR7SXrttcvlXnN+TKt7zUIfAEtRE=; b=S6hhOw/J7EnfpVdoTY1uLF+RIBlhjKVBz1C789gGZFrfXDnxFxpA7cVowDtRZ6WmwhK6mibpT42PTDDIMdy+ADpjqTm+ikVAL8a6qEGxhs+rxZH1CFOqXaOeueFHTN10OEOjekWhXhti5w6T/qNYHk4AcVTlQ9iOoly0Yq+nm64= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656921808698345.36420549544437; Mon, 4 Jul 2022 01:03:28 -0700 (PDT) Received: from localhost ([::1]:35078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8H3F-00053t-VO for importer@patchew.org; Mon, 04 Jul 2022 04:03:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54528) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzt-0002EF-5A for qemu-devel@nongnu.org; Mon, 04 Jul 2022 03:59:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzp-0007ew-0Z for qemu-devel@nongnu.org; Mon, 04 Jul 2022 03:59:55 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-aOsF6E6OOuy07MtNxDd9YA-1; Mon, 04 Jul 2022 03:59:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4AB5B18812C0; Mon, 4 Jul 2022 07:59:48 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F07B518EB7; Mon, 4 Jul 2022 07:59:47 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9733D1800627; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T9X8uCpaGt4LkAajR7SXrttcvlXnN+TKt7zUIfAEtRE=; b=PPXo5b75Glfydlc9dX8+2zQ1XvQ6PKny6gseZoW400d+1Y4SV4y2fSHxPpiQvw7iXeqQnQ NkGqG4tH9aNV+RiQXd/xfn0kQBn/SbkSdlSsbzivMqMnZ9oPvmj9K6qyMLIQbjjPUZmFd4 hkLt7ppnynI+DWqCzH6ckOE/TcYkfew= X-MC-Unique: aOsF6E6OOuy07MtNxDd9YA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" , Simon Sapin Subject: [PULL 1/8] Rename docs/specs/fw_cfg.txt to .rst Date: Mon, 4 Jul 2022 09:59:39 +0200 Message-Id: <20220704075946.921883-2-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656921809634100002 Content-Type: text/plain; charset="utf-8" From: Simon Sapin This is a separate commit in order to make reviewing the next one easier. Signed-off-by: Simon Sapin Message-Id: <20220625161455.1232954-1-simon.sapin@exyr.org> Signed-off-by: Gerd Hoffmann --- docs/specs/{fw_cfg.txt =3D> fw_cfg.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/specs/{fw_cfg.txt =3D> fw_cfg.rst} (100%) diff --git a/docs/specs/fw_cfg.txt b/docs/specs/fw_cfg.rst similarity index 100% rename from docs/specs/fw_cfg.txt rename to docs/specs/fw_cfg.rst --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656921886; cv=none; d=zohomail.com; s=zohoarc; b=fTY2/8OugRg4H89F+r3IQcb+E84ihmEMXCmhNNaJuuE7tyOa/Voo4eKqQTn5nkHjFFEyO41kJwDWawURSuAJP8K4DPwTwpVYJgVAxiH7G65BJM9I8LIJtYfiVyRJWPnVoPlB1os34z8ckDzDt4dyFug1WFK3IwLGka/Breqagbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656921886; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WHa6suHDFTOxvuCePSkf6pccLxfHW4+mYYoeKujjsq0=; b=QKCpbYx1g7WmZZbEucAHDapVYZYuLlEdqGMuUttZ88Wk850InddayJ15tx8VC5fJFC2e3lyMBdoW9oDsSOf1qwa393eHiJxovIcvdE6+OEeZsRcyrX6u8SUzjbb/MHRm/SFfuvzQwrkUIWH3c2OGtr1g6SyFWPV1idt8HSpvUBE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656921886704693.2241385388307; Mon, 4 Jul 2022 01:04:46 -0700 (PDT) Received: from localhost ([::1]:37388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8H4W-0006Zr-PI for importer@patchew.org; Mon, 04 Jul 2022 04:04:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzx-0002Jd-3l for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38608) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzu-0007fb-L0 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-28-VrQtT0u9NjmqshZUw-q6Eg-1; Mon, 04 Jul 2022 03:59:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2EA498339D3; Mon, 4 Jul 2022 07:59:50 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94531C26E98; Mon, 4 Jul 2022 07:59:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id A708B1800629; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WHa6suHDFTOxvuCePSkf6pccLxfHW4+mYYoeKujjsq0=; b=OyIPrr+uf1iraCZHy6gTCuXI9cu2Y0XfYpVUyuS0UzDnwETrQJ+FhwA2gY5HBv75sJrUwH UWv+LOUpnKYto0dQ/G/qtEMNxj2OJ27cqQthRUafnYE/e7b4GCXGyXggjEunYT8kZd8byz 5D8kwf6oSULFioFxPo6Ou45fVwJcgtk= X-MC-Unique: VrQtT0u9NjmqshZUw-q6Eg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" , Simon Sapin Subject: [PULL 2/8] Convert fw_cfg.rst to reStructuredText syntax Date: Mon, 4 Jul 2022 09:59:40 +0200 Message-Id: <20220704075946.921883-3-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656921888448100001 Content-Type: text/plain; charset="utf-8" From: Simon Sapin And add it to specs/index.rst Signed-off-by: Simon Sapin Message-Id: <20220625161455.1232954-2-simon.sapin@exyr.org> Signed-off-by: Gerd Hoffmann --- docs/specs/fw_cfg.rst | 211 +++++++++++++++++++++++------------------- docs/specs/index.rst | 1 + 2 files changed, 119 insertions(+), 93 deletions(-) diff --git a/docs/specs/fw_cfg.rst b/docs/specs/fw_cfg.rst index 3e6d586f66bf..5ad47a901c9f 100644 --- a/docs/specs/fw_cfg.rst +++ b/docs/specs/fw_cfg.rst @@ -1,7 +1,9 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D QEMU Firmware Configuration (fw_cfg) Device =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -=3D Guest-side Hardware Interface =3D +Guest-side Hardware Interface +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =20 This hardware interface allows the guest to retrieve various data items (blobs) that can influence how the firmware configures itself, or may @@ -9,7 +11,8 @@ contain tables to be installed for the guest OS. Examples = include device boot order, ACPI and SMBIOS tables, virtual machine UUID, SMP and NUMA information, kernel/initrd images for direct (Linux) kernel booting, etc. =20 -=3D=3D Selector (Control) Register =3D=3D +Selector (Control) Register +--------------------------- =20 * Write only * Location: platform dependent (IOport or MMIO) @@ -30,10 +33,12 @@ of 1 means the item's data can be overwritten by writes= to the data register. In other words, configuration write mode is enabled when the selector value is between 0x4000-0x7fff or 0xc000-0xffff. =20 -NOTE: As of QEMU v2.4, writes to the fw_cfg data register are no +.. NOTE:: + As of QEMU v2.4, writes to the fw_cfg data register are no longer supported, and will be ignored (treated as no-ops)! =20 -NOTE: As of QEMU v2.9, writes are reinstated, but only through the DMA +.. NOTE:: + As of QEMU v2.9, writes are reinstated, but only through the DMA interface (see below). Furthermore, writeability of any specific ite= m is governed independently of Bit14 in the selector key value. =20 @@ -45,17 +50,19 @@ items are accessed with a selector value between 0x0000= -0x7fff, and architecture specific configuration items are accessed with a selector value between 0x8000-0xffff. =20 -=3D=3D Data Register =3D=3D +Data Register +------------- =20 * Read/Write (writes ignored as of QEMU v2.4, but see the DMA interface) -* Location: platform dependent (IOport [*] or MMIO) +* Location: platform dependent (IOport [#]_ or MMIO) * Width: 8-bit (if IOport), 8/16/32/64-bit (if MMIO) * Endianness: string-preserving =20 -[*] On platforms where the data register is exposed as an IOport, its -port number will always be one greater than the port number of the -selector register. In other words, the two ports overlap, and can not -be mapped separately. +.. [#] + On platforms where the data register is exposed as an IOport, its + port number will always be one greater than the port number of the + selector register. In other words, the two ports overlap, and can not + be mapped separately. =20 The data register allows access to an array of bytes for each firmware configuration data item. The specific item is selected by writing to @@ -74,91 +81,103 @@ An N-byte wide read of the data register will return t= he next available N bytes of the selected firmware configuration item, as a substring, in increasing address order, similar to memcpy(). =20 -=3D=3D Register Locations =3D=3D +Register Locations +------------------ =20 -=3D=3D=3D x86, x86_64 Register Locations =3D=3D=3D +x86, x86_64 + * Selector Register IOport: 0x510 + * Data Register IOport: 0x511 + * DMA Address IOport: 0x514 =20 -Selector Register IOport: 0x510 -Data Register IOport: 0x511 -DMA Address IOport: 0x514 +Arm + * Selector Register address: Base + 8 (2 bytes) + * Data Register address: Base + 0 (8 bytes) + * DMA Address address: Base + 16 (8 bytes) =20 -=3D=3D=3D Arm Register Locations =3D=3D=3D +ACPI Interface +-------------- =20 -Selector Register address: Base + 8 (2 bytes) -Data Register address: Base + 0 (8 bytes) -DMA Address address: Base + 16 (8 bytes) - -=3D=3D ACPI Interface =3D=3D - -The fw_cfg device is defined with ACPI ID "QEMU0002". Since we expect +The fw_cfg device is defined with ACPI ID ``QEMU0002``. Since we expect ACPI tables to be passed into the guest through the fw_cfg device itself, the guest-side firmware can not use ACPI to find fw_cfg. However, once the firmware is finished setting up ACPI tables and hands control over to the guest kernel, the latter can use the fw_cfg ACPI node for a more accurate inventory of in-use IOport or MMIO regions. =20 -=3D=3D Firmware Configuration Items =3D=3D +Firmware Configuration Items +---------------------------- =20 -=3D=3D=3D Signature (Key 0x0000, FW_CFG_SIGNATURE) =3D=3D=3D +Signature (Key 0x0000, ``FW_CFG_SIGNATURE``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 The presence of the fw_cfg selector and data registers can be verified -by selecting the "signature" item using key 0x0000 (FW_CFG_SIGNATURE), +by selecting the "signature" item using key 0x0000 (``FW_CFG_SIGNATURE``), and reading four bytes from the data register. If the fw_cfg device is -present, the four bytes read will contain the characters "QEMU". +present, the four bytes read will contain the characters ``QEMU``. =20 If the DMA interface is available, then reading the DMA Address -Register returns 0x51454d5520434647 ("QEMU CFG" in big-endian format). +Register returns 0x51454d5520434647 (``QEMU CFG`` in big-endian format). =20 -=3D=3D=3D Revision / feature bitmap (Key 0x0001, FW_CFG_ID) =3D=3D=3D +Revision / feature bitmap (Key 0x0001, ``FW_CFG_ID``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ =20 A 32-bit little-endian unsigned int, this item is used to check for enabled features. - - Bit 0: traditional interface. Always set. - - Bit 1: DMA interface. =20 -=3D=3D=3D File Directory (Key 0x0019, FW_CFG_FILE_DIR) =3D=3D=3D +- Bit 0: traditional interface. Always set. +- Bit 1: DMA interface. + +File Directory (Key 0x0019, ``FW_CFG_FILE_DIR``) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. highlight:: c =20 Firmware configuration items stored at selector keys 0x0020 or higher -(FW_CFG_FILE_FIRST or higher) have an associated entry in a directory +(``FW_CFG_FILE_FIRST`` or higher) have an associated entry in a directory structure, which makes it easier for guest-side firmware to identify -and retrieve them. The format of this file directory (from fw_cfg.h in -the QEMU source tree) is shown here, slightly annotated for clarity: +and retrieve them. The format of this file directory (from ``fw_cfg.h`` in +the QEMU source tree) is shown here, slightly annotated for clarity:: =20 -struct FWCfgFiles { /* the entire file directory fw_cfg item */ - uint32_t count; /* number of entries, in big-endian format */ - struct FWCfgFile f[]; /* array of file entries, see below */ -}; + struct FWCfgFiles { /* the entire file directory fw_cfg item */ + uint32_t count; /* number of entries, in big-endian format */ + struct FWCfgFile f[]; /* array of file entries, see below */ + }; =20 -struct FWCfgFile { /* an individual file entry, 64 bytes total */ - uint32_t size; /* size of referenced fw_cfg item, big-endian */ - uint16_t select; /* selector key of fw_cfg item, big-endian */ - uint16_t reserved; - char name[56]; /* fw_cfg item name, NUL-terminated ascii */ -}; + struct FWCfgFile { /* an individual file entry, 64 bytes total */ + uint32_t size; /* size of referenced fw_cfg item, big-endian */ + uint16_t select; /* selector key of fw_cfg item, big-endian */ + uint16_t reserved; + char name[56]; /* fw_cfg item name, NUL-terminated ascii */ + }; =20 -=3D=3D=3D All Other Data Items =3D=3D=3D +All Other Data Items +~~~~~~~~~~~~~~~~~~~~ =20 Please consult the QEMU source for the most up-to-date and authoritative l= ist of selector keys and their respective items' purpose, format and writeabil= ity. =20 -=3D=3D=3D Ranges =3D=3D=3D +Ranges +~~~~~~ =20 Theoretically, there may be up to 0x4000 generic firmware configuration items, and up to 0x4000 architecturally specific ones. =20 +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Selector Reg. Range Usage ---------------- ----------- +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D 0x0000 - 0x3fff Generic (0x0000 - 0x3fff, generally RO, possibly RW throu= gh - the DMA interface in QEMU v2.9+) + the DMA interface in QEMU v2.9+) 0x4000 - 0x7fff Generic (0x0000 - 0x3fff, RW, ignored in QEMU v2.4+) 0x8000 - 0xbfff Arch. Specific (0x0000 - 0x3fff, generally RO, possibly RW - through the DMA interface in QEMU v2.9+) + through the DMA interface in QEMU v2.9+) 0xc000 - 0xffff Arch. Specific (0x0000 - 0x3fff, RW, ignored in v2.4+) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =20 In practice, the number of allowed firmware configuration items depends on= the machine type/version. =20 -=3D Guest-side DMA Interface =3D +Guest-side DMA Interface +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 If bit 1 of the feature bitmap is set, the DMA interface is present. This = does not replace the existing fw_cfg interface, it is an add-on. This interface @@ -171,68 +190,74 @@ addresses can be triggered with just one write, where= as operations with 64-bit addresses can be triggered with one 64-bit write or two 32-bit writ= es, starting with the most significant half (at offset 0). =20 -In this register, the physical address of a FWCfgDmaAccess structure in RAM -should be written. This is the format of the FWCfgDmaAccess structure: +In this register, the physical address of a ``FWCfgDmaAccess`` structure i= n RAM +should be written. This is the format of the ``FWCfgDmaAccess`` structure:: =20 -typedef struct FWCfgDmaAccess { - uint32_t control; - uint32_t length; - uint64_t address; -} FWCfgDmaAccess; + typedef struct FWCfgDmaAccess { + uint32_t control; + uint32_t length; + uint64_t address; + } FWCfgDmaAccess; =20 The fields of the structure are in big endian mode, and the field at the l= owest -address is the "control" field. +address is the ``control`` field. =20 -The "control" field has the following bits: - - Bit 0: Error - - Bit 1: Read - - Bit 2: Skip - - Bit 3: Select. The upper 16 bits are the selected index. - - Bit 4: Write +The ``control`` field has the following bits: =20 -When an operation is triggered, if the "control" field has bit 3 set, the +- Bit 0: Error +- Bit 1: Read +- Bit 2: Skip +- Bit 3: Select. The upper 16 bits are the selected index. +- Bit 4: Write + +When an operation is triggered, if the ``control`` field has bit 3 set, the upper 16 bits are interpreted as an index of a firmware configuration item. This has the same effect as writing the selector register. =20 -If the "control" field has bit 1 set, a read operation will be performed. -"length" bytes for the current selector and offset will be copied into the -physical RAM address specified by the "address" field. +If the ``control`` field has bit 1 set, a read operation will be performed. +``length`` bytes for the current selector and offset will be copied into t= he +physical RAM address specified by the ``address`` field. =20 -If the "control" field has bit 4 set (and not bit 1), a write operation wi= ll be -performed. "length" bytes will be copied from the physical RAM address -specified by the "address" field to the current selector and offset. QEMU +If the ``control`` field has bit 4 set (and not bit 1), a write operation = will be +performed. ``length`` bytes will be copied from the physical RAM address +specified by the ``address`` field to the current selector and offset. QEMU prevents starting or finishing the write beyond the end of the item associ= ated with the current selector (i.e., the item cannot be resized). Truncated wr= ites are dropped entirely. Writes to read-only items are also rejected. All of = these -write errors set bit 0 (the error bit) in the "control" field. +write errors set bit 0 (the error bit) in the ``control`` field. =20 -If the "control" field has bit 2 set (and neither bit 1 nor bit 4), a skip +If the ``control`` field has bit 2 set (and neither bit 1 nor bit 4), a sk= ip operation will be performed. The offset for the current selector will be -advanced "length" bytes. +advanced ``length`` bytes. =20 -To check the result, read the "control" field: - error bit set -> something went wrong. - all bits cleared -> transfer finished successfully. - otherwise -> transfer still in progress (doesn't happen - today due to implementation not being async, - but may in the future). +To check the result, read the ``control`` field: =20 -=3D Externally Provided Items =3D +Error bit set + Something went wrong. +All bits cleared + Transfer finished successfully. +Otherwise + Transfer still in progress + (doesn't happen today due to implementation not being async, + but may in the future). + +Externally Provided Items +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =20 Since v2.4, "file" fw_cfg items (i.e., items with selector keys above -FW_CFG_FILE_FIRST, and with a corresponding entry in the fw_cfg file +``FW_CFG_FILE_FIRST``, and with a corresponding entry in the fw_cfg file directory structure) may be inserted via the QEMU command line, using -the following syntax: +the following syntax:: =20 -fw_cfg [name=3D],file=3D =20 -Or +Or:: =20 -fw_cfg [name=3D],string=3D =20 Since v5.1, QEMU allows some objects to generate fw_cfg-specific content, the content is then associated with a "file" item using the 'gen_id' option -in the command line, using the following syntax: +in the command line, using the following syntax:: =20 -object ,id=3D,[generator-specific-optio= ns] \ -fw_cfg [name=3D],gen_id=3D @@ -241,24 +266,24 @@ See QEMU man page for more documentation. =20 Using item_name with plain ASCII characters only is recommended. =20 -Item names beginning with "opt/" are reserved for users. QEMU will +Item names beginning with ``opt/`` are reserved for users. QEMU will never create entries with such names unless explicitly ordered by the user. =20 To avoid clashes among different users, it is strongly recommended -that you use names beginning with opt/RFQDN/, where RFQDN is a reverse +that you use names beginning with ``opt/RFQDN/``, where RFQDN is a reverse fully qualified domain name you control. For instance, if SeaBIOS -wanted to define additional names, the prefix "opt/org.seabios/" would +wanted to define additional names, the prefix ``opt/org.seabios/`` would be appropriate. =20 -For historical reasons, "opt/ovmf/" is reserved for OVMF firmware. +For historical reasons, ``opt/ovmf/`` is reserved for OVMF firmware. =20 -Prefix "opt/org.qemu/" is reserved for QEMU itself. +Prefix ``opt/org.qemu/`` is reserved for QEMU itself. =20 -Use of names not beginning with "opt/" is potentially dangerous and +Use of names not beginning with ``opt/`` is potentially dangerous and entirely unsupported. QEMU will warn if you try. =20 -Use of names not beginning with "opt/" is tolerated with 'gen_id' (that +Use of names not beginning with ``opt/`` is tolerated with 'gen_id' (that is, the warning is suppressed), but you must know exactly what you're doing. =20 diff --git a/docs/specs/index.rst b/docs/specs/index.rst index e10684bf5353..a58d9311cb36 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -20,3 +20,4 @@ guest hardware that is specific to QEMU. acpi_nvdimm acpi_erst sev-guest-firmware + fw_cfg --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656922163; cv=none; d=zohomail.com; s=zohoarc; b=WkRKtJB1I5235QDl2vHsSihbv4AinYkxpCEHbHnNlxz6y1XuKCxQyryFtchhsP+qsOQU649GXIyBK8I2n1y5t6JMzVBwp/pfTAXIH1pUDbyG6QVkMkxnbZWrgSGMK862WU2IkLlZu/1G0VasKM2jLak5MAdIMCaGHoHYpu2ZuqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656922163; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KpDwCl9xxE5Kfss1+7TIoNRzQ8MIqBjyxIFaC9olDrU=; b=Wc8Sg4DbtXMjm6Y3tmtn+yjETVy8wHkrZU8jLMnaRioYuAOaTDDJYtkgw47G5Cz0B9SHz7eLvbjSBhwAE+jctUfayb4F+OM50SfqPIouziudSotDBDa0SvIfmmSegzgBG/T6Jgybu2mG/TYlPkUYCC1GSDRXHj1lKI0zIo4/tGw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656922163427734.1795428222549; Mon, 4 Jul 2022 01:09:23 -0700 (PDT) Received: from localhost ([::1]:42602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8H90-0001ul-1x for importer@patchew.org; Mon, 04 Jul 2022 04:09:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzx-0002Jg-LA for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzu-0007fj-UB for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-674-rUVac3FSOfeLWc0XoVdgbg-1; Mon, 04 Jul 2022 03:59:50 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC6AC84ACA8; Mon, 4 Jul 2022 07:59:49 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F352492CA6; Mon, 4 Jul 2022 07:59:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id B51D8180062F; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KpDwCl9xxE5Kfss1+7TIoNRzQ8MIqBjyxIFaC9olDrU=; b=BBZXPW33trZi2nmBDyAP4e1hsUHpNfx4wFClL31j9liScqwq0p87uWmdK71iVR82E36YKE ZrAnwjiViV9QzueDkn4ja17uAEVhVEQ0z3QeeWirtEm4As0b8XCOThkBVEHexZ94qRuoB9 m+yHlCORKGfVKK+B9iCRfPjn+OFxo3Y= X-MC-Unique: rUVac3FSOfeLWc0XoVdgbg-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" , "Wen, Jianxian" , Jianxian Wen , Lu Gao Subject: [PULL 3/8] ui/console: allow display device to be labeled with given id Date: Mon, 4 Jul 2022 09:59:41 +0200 Message-Id: <20220704075946.921883-4-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656922165554100001 Content-Type: text/plain; charset="utf-8" From: "Wen, Jianxian" The update makes it easier to find and specify devices. They can only be found by device type name without the id field, for example, devices of the same type have the same label. The update also adds a head field, which is useful for devices that support multiple heads, such as virtio-gpu. Signed-off-by: Jianxian Wen Signed-off-by: Lu Gao Message-Id: <4C23C17B8E87E74E906A25A3254A03F4018FC045B0@SHASXM06.verisilico= n.com> Signed-off-by: Gerd Hoffmann --- include/ui/console.h | 1 + ui/console.c | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/ui/console.h b/include/ui/console.h index b64d82436097..c0520c694c23 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -463,6 +463,7 @@ bool qemu_console_is_visible(QemuConsole *con); bool qemu_console_is_graphic(QemuConsole *con); bool qemu_console_is_fixedsize(QemuConsole *con); bool qemu_console_is_gl_blocked(QemuConsole *con); +bool qemu_console_is_multihead(DeviceState *dev); char *qemu_console_get_label(QemuConsole *con); int qemu_console_get_index(QemuConsole *con); uint32_t qemu_console_get_head(QemuConsole *con); diff --git a/ui/console.c b/ui/console.c index 9331b85203a0..e139f7115e1f 100644 --- a/ui/console.c +++ b/ui/console.c @@ -2313,11 +2313,50 @@ bool qemu_console_is_gl_blocked(QemuConsole *con) return con->gl_block; } =20 +bool qemu_console_is_multihead(DeviceState *dev) +{ + QemuConsole *con; + Object *obj; + uint32_t f =3D 0xffffffff; + uint32_t h; + + QTAILQ_FOREACH(con, &consoles, next) { + obj =3D object_property_get_link(OBJECT(con), + "device", &error_abort); + if (DEVICE(obj) !=3D dev) { + continue; + } + + h =3D object_property_get_uint(OBJECT(con), + "head", &error_abort); + if (f =3D=3D 0xffffffff) { + f =3D h; + } else if (h !=3D f) { + return true; + } + } + return false; +} + char *qemu_console_get_label(QemuConsole *con) { if (con->console_type =3D=3D GRAPHIC_CONSOLE) { if (con->device) { - return g_strdup(object_get_typename(con->device)); + DeviceState *dev; + bool multihead; + + dev =3D DEVICE(con->device); + multihead =3D qemu_console_is_multihead(dev); + if (multihead) { + return g_strdup_printf("%s.%d", dev->id ? + dev->id : + object_get_typename(con->device), + con->head); + } else { + return g_strdup_printf("%s", dev->id ? + dev->id : + object_get_typename(con->device)); + } } return g_strdup("VGA"); } else { --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656922467; cv=none; d=zohomail.com; s=zohoarc; b=fChsdaFWCC4axhFV3vX3AZrlrDfUUcboxRTeiqiAK6YF1D2P+ZsIQfIho+SeDpvOyIGG/6+axkYFfg60rUWG31XAZ/eyk/IZfgGSW4Ii6K3DtTE67GINXafkOqsHMZc1hNFa6yg53sCYhxeAsgs7bHO7LuRs6LAlXC/TEY07OGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656922467; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FbJdS73OxROIhUmAgqiRN/3KnzFejn6dneuQRkLDcnQ=; b=dvl4u3kSX9d4Pcv9mYM/uoEWhNXXaSknPMTt8RKkJURPVrEs7v1IJ5S6lUBqcUjiQYE+zC+iLpsj3fRuaTzwbK+e3fhmQhQwxrG/l2AvYwt75BRnKfVb//cUmvs6B88KsEIGi7TyPURchWctImN7KMq4uQKgVbZH5YzZmwS0vrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656922467379571.5400048766894; Mon, 4 Jul 2022 01:14:27 -0700 (PDT) Received: from localhost ([::1]:51220 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8HDt-0007zX-PK for importer@patchew.org; Mon, 04 Jul 2022 04:14:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8H04-0002Kv-Hd for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40127) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8H02-0007ii-7g for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:07 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-15B4tYc8Pg-CB1d01LrmgQ-1; Mon, 04 Jul 2022 03:59:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 92C5D3C138A0; Mon, 4 Jul 2022 07:59:51 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5CF412166B29; Mon, 4 Jul 2022 07:59:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C113F180063D; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FbJdS73OxROIhUmAgqiRN/3KnzFejn6dneuQRkLDcnQ=; b=ANoMkluKDcb+u1TQ6+mcfIM+2zrM/H3M3/lanCcp2p6qCeeB0ju3ylcPrFfrUIErW/1ARj uualURqt96m9QwA628S8XIWEFp8NUa32hEKq3QYzWOszWxWUZHH2nwxPR7lQizKzW9RK1K f9F7CwNhcywd7eC4nDFbp62c1QPgby0= X-MC-Unique: 15B4tYc8Pg-CB1d01LrmgQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" Subject: [PULL 4/8] ui/cocoa: Fix clipboard text release Date: Mon, 4 Jul 2022 09:59:42 +0200 Message-Id: <20220704075946.921883-5-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656922468673100001 Content-Type: text/plain; charset="utf-8" From: Akihiko Odaki [-NSPasteboard dataForType:] returns an autoreleased NSString, and callings its release method will result in double-free when the global autorelease pool is released. Use NSAutoreleasePool to release it properly. Signed-off-by: Akihiko Odaki Reviewed-by: Peter Maydell Message-Id: <20220614212131.94696-1-akihiko.odaki@gmail.com> Signed-off-by: Gerd Hoffmann --- ui/cocoa.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 84c84e98fc5e..6a4dccff7f02 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1894,16 +1894,18 @@ static void cocoa_clipboard_notify(Notifier *notifi= er, void *data) static void cocoa_clipboard_request(QemuClipboardInfo *info, QemuClipboardType type) { + NSAutoreleasePool *pool; NSData *text; =20 switch (type) { case QEMU_CLIPBOARD_TYPE_TEXT: + pool =3D [[NSAutoreleasePool alloc] init]; text =3D [[NSPasteboard generalPasteboard] dataForType:NSPasteboar= dTypeString]; if (text) { qemu_clipboard_set_data(&cbpeer, info, type, [text length], [text bytes], true); - [text release]; } + [pool release]; break; default: break; --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656922339; cv=none; d=zohomail.com; s=zohoarc; b=B0D+xI+PMkEYUef+UcgEUsxsDfBV2335iA0WLk/ByPbk7uVaWJTGxvE4KioFdAlSWCdNG5wpoHrmEzVFtkQY9oyBvRsgdxP5gvPO5PM3bth6t5WjxMz3m3j0IoMktL7H5gsp+g8jAHR5Yvico45x+vYyXERN5IB26f50JzMunnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656922339; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hommaXIVvndUX4ym/deZGPDDEn+t48mF6l13jYObGTc=; b=k6/b0kphdDN/t6UA+6Sa7IgSzIKy3AvaavxtEzAzfH/gjuuvs1o+00ua2mNq5rFH4yOyfRK+bI9dArf9uRvU7j98vt3w0otjWNpn1B4yKjUj29xoceeE4Z208oK3gaD6sJWAyBrZJl8Kmf3wN8PmBX/pv4aZXsK3iG40ZMzpiyo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656922339051477.6373506616685; Mon, 4 Jul 2022 01:12:19 -0700 (PDT) Received: from localhost ([::1]:47146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8HBp-00053I-1I for importer@patchew.org; Mon, 04 Jul 2022 04:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzx-0002Je-Ey for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45747) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzu-0007ff-V7 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-516-K8E6wNFnN96bpicICQJAiQ-1; Mon, 04 Jul 2022 03:59:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D51171C18265; Mon, 4 Jul 2022 07:59:51 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EC12409B3E3; Mon, 4 Jul 2022 07:59:51 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id CD7871800790; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hommaXIVvndUX4ym/deZGPDDEn+t48mF6l13jYObGTc=; b=ZJzXcVIYYQt96EFz94lExvLWzu53yGJgFM/c0rikcWbFuECxJecGEo4mEC9R9yD7dso4zW xoGYPEZFdKXgKUMHzR6ejEH+0doltJ2YSkAQtLxBqJO57z8tmODHrkaCKMuS7edPX0Hiqy KIX6D4kgKHI+EvZ2PPc3VW/c0HALJis= X-MC-Unique: K8E6wNFnN96bpicICQJAiQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" , MkfsSion Subject: [PULL 5/8] hw/usb/canokey: Fix CCID ZLP Date: Mon, 4 Jul 2022 09:59:43 +0200 Message-Id: <20220704075946.921883-6-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656922341338100001 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" CCID could send zero-length packet (ZLP) if we invoke two data_in, two packets would be concated and we could not distinguish them. The CANOKEY_EMU_EP_CTAPHID is imported from canokey-qemu.h Reported-by: MkfsSion Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- hw/usb/canokey.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c index 4a08b1cbd776..86548923eb16 100644 --- a/hw/usb/canokey.c +++ b/hw/usb/canokey.c @@ -109,11 +109,10 @@ int canokey_emu_transmit( * Note: this is a quirk for CanoKey CTAPHID * because it calls multiple emu_transmit in one device_loop * but w/o data_in it would stuck in device_loop - * This has no side effect for CCID as it is strictly - * OUT then IN transfer - * However it has side effect for Control transfer + * This has side effect for CCID since CCID can send ZLP + * This also has side effect for Control transfer */ - if (ep_in !=3D 0) { + if (ep_in =3D=3D CANOKEY_EMU_EP_CTAPHID) { canokey_emu_data_in(ep_in); } return 0; --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656921809; cv=none; d=zohomail.com; s=zohoarc; b=UpmVGJHug+s1AsLDUuH64fSfuqaj1TnZuo56ZjHIOx989DGhGAW8unJAoPpwwPhlgdbl1+y+yqxXCwtHLhvj3oWJnL1zQJixRt/j6CF4d+TikPecQPBrOn3NeuWAhrG0o+EaARjKIk0Z8xXd5s8x6ideSS1dYwIFlGIyBp+qii8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656921809; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FzR7lYIrafuFhi1VuHjtQYaaEQWBZ0qYMLjB0IZb8uo=; b=nWXFQBTjQMM0/oKGVasPhUCrg2DyuiVnl/2U/J1fK7YfS3yXK3yOoOpqzaKKiV5o5edWFsE2aWS80pj+TDWp373Fdt2WyiWc2l0Ef4i73rnjzzX+uViF1jNDaE9YOWd2JkDf/czynjsp6ozJels1CsTXE/wov2e1SqwxF5pp99w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656921809190457.72205912972584; Mon, 4 Jul 2022 01:03:29 -0700 (PDT) Received: from localhost ([::1]:35196 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8H3H-000588-I6 for importer@patchew.org; Mon, 04 Jul 2022 04:03:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzx-0002Jf-GL for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzv-0007fu-I8 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-389-WFnVCIgAPtuB7q4rXI5Rcw-1; Mon, 04 Jul 2022 03:59:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 473CC80390C; Mon, 4 Jul 2022 07:59:53 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12FB718EB7; Mon, 4 Jul 2022 07:59:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA16C180079E; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FzR7lYIrafuFhi1VuHjtQYaaEQWBZ0qYMLjB0IZb8uo=; b=KPmlEV1rNGCaanr6dJ20XbgvEgYYrHAVcMpEAFSJbyu6o1qKHmkXkM13vEJMGdQJkMAwjI OM5wVyKH/0ociGxviMuNRxKuW4h9jssdCB/JH/DB/3YMz2FjunWdRljkveGOJGQUvlobMD gcKIVz4/FkJ3StcE68uucIpeZL3aRZo= X-MC-Unique: WFnVCIgAPtuB7q4rXI5Rcw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" Subject: [PULL 6/8] hw/usb/canokey: fix compatibility of qemu-xhci Date: Mon, 4 Jul 2022 09:59:44 +0200 Message-Id: <20220704075946.921883-7-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656921809613100001 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" XHCI wont poll interrupt IN endpoint if NAKed, and needs wakeup Suggested-by: Gerd Hoffmann Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- hw/usb/canokey.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c index 86548923eb16..8da0d65556af 100644 --- a/hw/usb/canokey.c +++ b/hw/usb/canokey.c @@ -103,6 +103,13 @@ int canokey_emu_transmit( pbuf, size); key->ep_in_size[ep_in] +=3D size; key->ep_in_state[ep_in] =3D CANOKEY_EP_IN_READY; + /* + * wake up controller if we NAKed IN token before + * Note: this is a quirk for CanoKey CTAPHID + */ + if (ep_in =3D=3D CANOKEY_EMU_EP_CTAPHID) { + usb_wakeup(usb_ep_get(&key->dev, USB_TOKEN_IN, ep_in), 0); + } /* * ready for more data in device loop * @@ -208,6 +215,22 @@ static void canokey_handle_data(USBDevice *dev, USBPac= ket *p) key->ep_out_size[ep_out] =3D out_len; canokey_emu_data_out(ep_out, NULL); } + /* + * Note: this is a quirk for CanoKey CTAPHID + * + * There is one code path that uses this device loop + * INTR IN -> useful data_in and useless device_loop -> NAKed + * INTR OUT -> useful device loop -> transmit -> wakeup + * (useful thanks to both data_in and data_out having been calle= d) + * the next INTR IN -> actual data to guest + * + * if there is no such device loop, there would be no further + * INTR IN, no device loop, no transmit hence no usb_wakeup + * then qemu would hang + */ + if (ep_in =3D=3D CANOKEY_EMU_EP_CTAPHID) { + canokey_emu_device_loop(); /* may call transmit multiple times= */ + } break; case USB_TOKEN_IN: if (key->ep_in_pos[ep_in] =3D=3D 0) { /* first time IN */ --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656922165; cv=none; d=zohomail.com; s=zohoarc; b=ckGYpGN9yk/fkdxs9zEoJWiVzNaqF1Di6JlYraTPI8LLYU8RNktn3De0JYRS1DGAVExnsro2CzTtbZ8elES8PjUgVYhzAyUmP9wExOgKj2me/zAAU8kamFqiG61Fsk5dB5UqfA2Cn+t1RkSw+uXZFtuFHUeqoBUK0HSE2MhlbOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656922165; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ewcJYKM5Fj+KWKp7jngHLW2pOaNxIRxCy6xMfuDFrjg=; b=i2nNhG/MqsyzkRa/8GLsOLqcehyMBkFQ7nXyyvXwmiPBcSFtARTOvfCbRUJ4VsQFDsgRwxVuSfFosHbvM0rScrn5ZNfhFH8mocoeLfwfge9b3VR5fmuSaZkeMvOzHrm1EQBDnU2D891syO7XNXvKiNE08bG3YEX80boeo0ONK9E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165692216556538.146379692005326; Mon, 4 Jul 2022 01:09:25 -0700 (PDT) Received: from localhost ([::1]:42798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8H91-00022u-KT for importer@patchew.org; Mon, 04 Jul 2022 04:09:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzw-0002IZ-3t for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43880) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzu-0007fW-L1 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 03:59:59 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-17-pzURgfQcPwaMfL5aHqqJng-1; Mon, 04 Jul 2022 03:59:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F5A81C18263; Mon, 4 Jul 2022 07:59:53 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B7282166B29; Mon, 4 Jul 2022 07:59:53 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E650218007A5; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ewcJYKM5Fj+KWKp7jngHLW2pOaNxIRxCy6xMfuDFrjg=; b=NKvBQtN29dmF+oSRlFaL2eMGRskixOudcZtgQlR4ocOSqTmgblgaov1sDYetcrN27E3yRr SkJv4hjrpH2+ftnOW8I5T4cQqEt4xfnwYX2rGJZ3sh1EojsKbsjiRrngfUIR/WkJfqhHhY kjeeb4AKMeOBB2VEqm0H1IC9Ll+gxg0= X-MC-Unique: pzURgfQcPwaMfL5aHqqJng-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" Subject: [PULL 7/8] docs/system/devices/usb/canokey: remove limitations on qemu-xhci Date: Mon, 4 Jul 2022 09:59:45 +0200 Message-Id: <20220704075946.921883-8-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656922167151100003 Content-Type: text/plain; charset="utf-8" From: "Hongren (Zenithal) Zheng" Signed-off-by: Hongren (Zenithal) Zheng Message-Id: Signed-off-by: Gerd Hoffmann --- docs/system/devices/canokey.rst | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/system/devices/canokey.rst b/docs/system/devices/canokey.= rst index 169f99b8eb82..c2c58ae3e7cb 100644 --- a/docs/system/devices/canokey.rst +++ b/docs/system/devices/canokey.rst @@ -146,16 +146,6 @@ multiple CanoKey QEMU running, namely you can not Also, there is no lock on canokey-file, thus two CanoKey QEMU instance can not read one canokey-file at the same time. =20 -Another limitation is that this device is not compatible with ``qemu-xhci`= `, -in that this device would hang when there are FIDO2 packets (traffic on -interrupt endpoints). If you do not use FIDO2 then it works as intended, -but for full functionality you should use old uhci/ehci bus and attach can= okey -to it, for example - -.. parsed-literal:: - - |qemu_system| -device piix3-usb-uhci,id=3Duhci -device canokey,bus=3Duh= ci.0 - References =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.36.1 From nobody Mon Feb 9 06:26:48 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1656922337; cv=none; d=zohomail.com; s=zohoarc; b=LQZKATOjYtc4G/XpdDHA1IdW9l7vr/nwEEe8LdHTJAeGx17QH9TIXcdqITbnE+bfOc7up0NMcEhZkjmJtwpX58mKLuO4wkIO6Zzp/bbT17xaSdapK5zFrl/HlivOW9ZremJweHlOp5YyrZhoG/ZG7ByXi/VoSWBnf1TQspg5Kak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656922337; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Kn/v7Mk4wMARn1wBNY2N6twhR78y8NEv+ubWJGeWg8o=; b=oIK7GXU3E0AVEYXvNz7Kx05lno6aZhw/baCXIH5/j+96zarIgDqx3CY0TCyYlRyHNB+pDeRZiZSYTFwzz8qkmg5IDElzGDM4WAODJmLqzSu5Z8m/VCOsla1ndpRQVPnUJez06b3I5AimLJeV6SZ/knLJeR3z1wO+sP4XEQD0yrc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1656922337159941.4160202282984; Mon, 4 Jul 2022 01:12:17 -0700 (PDT) Received: from localhost ([::1]:47044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8HBm-0004yj-Mu for importer@patchew.org; Mon, 04 Jul 2022 04:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzy-0002K6-R1 for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28780) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8Gzw-0007g0-7s for qemu-devel@nongnu.org; Mon, 04 Jul 2022 04:00:02 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-372-DBKzg3m3Nsiz0ww_JYHBKw-1; Mon, 04 Jul 2022 03:59:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 31169857A80; Mon, 4 Jul 2022 07:59:55 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E82822166B29; Mon, 4 Jul 2022 07:59:54 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F2B0A18007AC; Mon, 4 Jul 2022 09:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656921599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kn/v7Mk4wMARn1wBNY2N6twhR78y8NEv+ubWJGeWg8o=; b=T//0rQv3OtT3GcIFNTD/bxWHyDnjWnj8s+Mx9BMBRtzFSq216C49y+Vp/oUI+p5C+nhnMR x+lawfoXf/RlHdN+GfbQqdZwGwgyE6xWX5p1dvLpnR8VN3YB4HRnTqVel12pILxlsQtWAm K3CDn8qXR/4LEBNizhZg3TWBzNJp4Jk= X-MC-Unique: DBKzg3m3Nsiz0ww_JYHBKw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Akihiko Odaki , "Canokeys.org" , Gerd Hoffmann , Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Hongren (Zenithal) Zheng" , MkfsSion Subject: [PULL 8/8] hw: canokey: Remove HS support as not compliant to the spec Date: Mon, 4 Jul 2022 09:59:46 +0200 Message-Id: <20220704075946.921883-9-kraxel@redhat.com> In-Reply-To: <20220704075946.921883-1-kraxel@redhat.com> References: <20220704075946.921883-1-kraxel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656922339192100001 Content-Type: text/plain; charset="utf-8" From: MkfsSion Canokey core currently using 16 bytes as maximum packet size for control endpoint, but to run the device in high-speed a 64 bytes maximum packet size is required according to USB 2.0 specification. Since we don't acutally need to run the device in high-speed, simply don't assign high member in USBDesc. When canokey-qemu is used with xhci, xhci would drive canokey in high speed mode, since the bcdUSB in canokey-core is 2.1, yet canokey-core set bMaxPacketSize0 to be 16, this is out of the spec as the spec said that ``The allowable maximum control transfer data payload sizes...for high-speed devices, it is 64 bytes''. In this case, usb device validation in Windows 10 LTSC 2021 as the guest would fail. It would complain USB\DEVICE_DESCRIPTOR_VALIDATION_FAILURE. Note that bcdUSB only identifies the spec version the device complies, but it has no indication of its speed. So it is allowed for the device to run in FS but comply the 2.1 spec. To solve the issue we decided to just drop the high speed support. This only affects usb-ehci as usb-ehci would complain speed mismatch when FS device is attached to a HS port. That's why the .high member was initialized in the first place. Meanwhile, xhci is not affected as it works well with FS device. Since everyone is now using xhci, it does no harm to most users. Suggested-by: Hongren (Zenithal) Zheng Signed-off-by: YuanYang Meng Reviewed-by: Hongren (Zenithal) Zheng Message-Id: <20220625142138.19363-1-mkfssion@mkfssion.com> Signed-off-by: Gerd Hoffmann --- hw/usb/canokey.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c index 8da0d65556af..bbc5da07b58f 100644 --- a/hw/usb/canokey.c +++ b/hw/usb/canokey.c @@ -56,7 +56,6 @@ static const USBDesc desc_canokey =3D { .iSerialNumber =3D STR_SERIALNUMBER, }, .full =3D &desc_device_canokey, - .high =3D &desc_device_canokey, .str =3D desc_strings, }; =20 --=20 2.36.1