From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647576611483.2388038338611; Mon, 7 Mar 2022 02:06:16 -0800 (PST) Received: from localhost ([::1]:59576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAFr-0007FL-LM for importer@patchew.org; Mon, 07 Mar 2022 05:06:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34296) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABL-0008CA-Ne for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:37 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABK-0002ZA-5G for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:35 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-hAyIPbIbP8WJdkDJ__RwRQ-1; Mon, 07 Mar 2022 05:01:30 -0500 Received: by mail-ed1-f71.google.com with SMTP id x5-20020a50ba85000000b004161d68ace6so3201528ede.15 for ; Mon, 07 Mar 2022 02:01:30 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id bn14-20020a170906c0ce00b006c5ef0494besm4527622ejb.86.2022.03.07.02.01.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=t4EYi98Ftt5LJhR9VhEfDFIVBGMtEa4o0BZ3KdoQjXY=; b=Q53VB6CihdhEZSB9qcgnLzs9nMdJQ0oYzzLlC4s+7GSTSB/J1yLxAgt9C8FeP9ezVifndY p+iCO/2QnBVYk4sppTYT1zeJLfS91GYQyJY9JAsHmUN2x8u6lop68jEW/Bif8e0iJop0zX 07YmfpLeFb1CtlsYkFvqkwPSGIQfTPQ= X-MC-Unique: hAyIPbIbP8WJdkDJ__RwRQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=t4EYi98Ftt5LJhR9VhEfDFIVBGMtEa4o0BZ3KdoQjXY=; b=XpRxQiyM2lFUTStiRtmCOpyd4/qkv8EJR48se/zyPQwpn45QuIs7NwGOMytIkbP+2t D4k8rSmuc97R+vqoHcqFaw6QC7Dam/kOceIWkl5gMSbcxyebcfcUeDPTZLz/JSuzRssw 7F1mjDEmu8w66NimIwAby8Q9QjP4OwtYGkJQA/q+LBPdBlQGmBbvcpeM7HfspThZrTCh f0+J8Vq9G+FUCeER0LTQO7SH3QwcA6vMy4W6HF+pjohsQ1gx/IoZVhg3k2X+t6EDgF4Q wH2pudtxX/vmig9ANo6b62Td79rHLSI06tGDQW4856sORIHeSAsQSPROqpyaNdGy2/hW 6Umg== X-Gm-Message-State: AOAM532Uqx/l8L90mIatY29akilPy/BAhpoxv/Fw4VddRiKtAJfcZAMa yv+FspExWK9LjO0FqenPNzWwrD6H9MDguQKG0JNUuCewVc4S5IUt50fhLKoaPlhTtJKTLQJphhp uzAO6A6aTsUhr6ceoyP/sL2E3aAAj7Ak2Y/W4fUuoF+mH0X0cC/vGD5YaRYC6 X-Received: by 2002:a17:906:ae0c:b0:6a6:a09f:f8d5 with SMTP id le12-20020a170906ae0c00b006a6a09ff8d5mr8487198ejb.627.1646647289156; Mon, 07 Mar 2022 02:01:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCRRHMlUARz0l1l3mioZ3vmuqS7OUgWlMkE2ysEDGtleKnjF5ve3XO/uW6BaZRadJwpqMO/Q== X-Received: by 2002:a17:906:ae0c:b0:6a6:a09f:f8d5 with SMTP id le12-20020a170906ae0c00b006a6a09ff8d5mr8487176ejb.627.1646647288868; Mon, 07 Mar 2022 02:01:28 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:26 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 01/47] qom: assert integer does not overflow Message-ID: <20220307100058.449628-2-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647577515100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" QOM reference counting is not designed with an infinite amount of references in mind, trying to take a reference in a loop without dropping a reference will overflow the integer. It is generally a symptom of a reference leak (a missing deref, commonly as part of error handling - such as one fixed here: https://lore.kernel.org/r/20220228095058.27899-1-sgarzare%40redhat.com ). All this can lead to either freeing the object too early (memory corruption) or never freeing it (memory leak). If we happen to dereference at just the right time (when it's wrapping around to 0), we might eventually assert when dereferencing, but the real problem is an extra object_ref so let's assert there to make such issues cleaner and easier to debug. Some micro-benchmarking shows using fetch and add this is essentially free on x86. Since multiple threads could be incrementing in parallel, we assert around INT_MAX to make sure none of these approach the wrap around point: this way we get a memory leak and not a memory corruption, the former is generally easier to debug. Signed-off-by: Michael S. Tsirkin --- qom/object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qom/object.c b/qom/object.c index 9f7a33139d..a27532a6ba 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1167,10 +1167,14 @@ GSList *object_class_get_list_sorted(const char *im= plements_type, Object *object_ref(void *objptr) { Object *obj =3D OBJECT(objptr); + uint32_t ref; + if (!obj) { return NULL; } - qatomic_inc(&obj->ref); + ref =3D qatomic_fetch_inc(&obj->ref); + /* Assert waaay before the integer overflows */ + g_assert(ref < INT_MAX); return obj; } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647783738568.5748320460503; Mon, 7 Mar 2022 02:09:43 -0800 (PST) Received: from localhost ([::1]:40078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAJC-0004kC-IG for importer@patchew.org; Mon, 07 Mar 2022 05:09:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABO-0008CP-AU for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50218) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABM-0002ZP-8l for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:38 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-222-wrBOh1Q_PW6UBovvmXairQ-1; Mon, 07 Mar 2022 05:01:34 -0500 Received: by mail-ed1-f71.google.com with SMTP id bq19-20020a056402215300b0040f276105a4so8330592edb.2 for ; Mon, 07 Mar 2022 02:01:34 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id y41-20020a50bb2c000000b0041622779c50sm3148565ede.37.2022.03.07.02.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XeQBcgSTA77UnPuO7PlkD0Xr2iB/iyYJplo2PFCvlMQ=; b=Yt/4nfqUWcBF3BDb/+UXNYQB8X3k2MpHd7/Io9Pn1p96K7C+DOq1AtB3PVdcLqVoFmItAF ZjOt8mvbH+O1cZyfZi4Zb84sSIEvFso+LYOLW9g0PIfCDLDFQlgfSmUMfcNA5U/WjTG2IB sdhRISLqENa1YtOeZY0tjKU5/4xw5Eg= X-MC-Unique: wrBOh1Q_PW6UBovvmXairQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XeQBcgSTA77UnPuO7PlkD0Xr2iB/iyYJplo2PFCvlMQ=; b=aD1URtruMAP2t054q/saI+jvgzMLUBagx2p067Y/9lSHaTZhbAFKu7tXKPlwSEOQKG dM3HTmc0Ax8pdPqrlb4DGEdKP5M5tSWGu/TfCmdDBXkSqbSSR0h3u0Dcs8QzT+/qZdiw ml7a9Wd9XoR03iTcaqSyLvUjzVM+mJPo+KjJaSairXV+XPNuR+MESg05THx2gbH9e8VK lXgrlBwn3bSTh2nddxSgkR8eT1jEs7UnuLjv5zFvxeBohWl9CgD1l0gfLvAyG5Dxrxf4 vAmWwidmynFBESyRMDudKY7Vr1MCfOuCVi8XhPr47FeWo/UGAIKXzpO0iebddwlHlHCj RMbQ== X-Gm-Message-State: AOAM532YI/S1lStdSPDxqnoZRS/QlTnKZHwanza3zi3JOTrc3OQ6YX0A QdniIDhZXRLDrZveGDLPNR+U1hAGdo9cu4uaNxxQhhGf+fJ81sM0v8b+IoM/PhGDLqgWFDI4yae FTXwtl5P20rmmlbi4gtBRZ+Ubw83uU+KP80Vo9oNF0BSd2CItufxlajfwpnwe X-Received: by 2002:a05:6402:5194:b0:409:97ec:3bdc with SMTP id q20-20020a056402519400b0040997ec3bdcmr10457926edd.314.1646647292572; Mon, 07 Mar 2022 02:01:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzN3kDEQQsBiZKV6YGSiwRofGQjBZeYFZTZP8gz81ugeZ21y9JWEB648OglElMbz0mVAAQ4Og== X-Received: by 2002:a05:6402:5194:b0:409:97ec:3bdc with SMTP id q20-20020a056402519400b0040997ec3bdcmr10457899edd.314.1646647292180; Mon, 07 Mar 2022 02:01:32 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:29 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 02/47] ACPI ERST: specification for ERST support Message-ID: <20220307100058.449628-3-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , Markus Armbruster , Ani Sinha , Igor Mammedov , Eric DeVolder Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647784807100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eric DeVolder Information on the implementation of the ACPI ERST support. Signed-off-by: Eric DeVolder Acked-by: Ani Sinha Message-Id: <20220223143322.927136-2-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/acpi_erst.rst | 200 +++++++++++++++++++++++++++++++++++++++ docs/specs/index.rst | 1 + 2 files changed, 201 insertions(+) create mode 100644 docs/specs/acpi_erst.rst diff --git a/docs/specs/acpi_erst.rst b/docs/specs/acpi_erst.rst new file mode 100644 index 0000000000..a8a9d22d25 --- /dev/null +++ b/docs/specs/acpi_erst.rst @@ -0,0 +1,200 @@ +ACPI ERST DEVICE +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The ACPI ERST device is utilized to support the ACPI Error Record +Serialization Table, ERST, functionality. This feature is designed for +storing error records in persistent storage for future reference +and/or debugging. + +The ACPI specification[1], in Chapter "ACPI Platform Error Interfaces +(APEI)", and specifically subsection "Error Serialization", outlines a +method for storing error records into persistent storage. + +The format of error records is described in the UEFI specification[2], +in Appendix N "Common Platform Error Record". + +While the ACPI specification allows for an NVRAM "mode" (see +GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES) where non-volatile RAM is +directly exposed for direct access by the OS/guest, this device +implements the non-NVRAM "mode". This non-NVRAM "mode" is what is +implemented by most BIOS (since flash memory requires programming +operations in order to update its contents). Furthermore, as of the +time of this writing, Linux only supports the non-NVRAM "mode". + + +Background/Motivation +--------------------- + +Linux uses the persistent storage filesystem, pstore, to record +information (eg. dmesg tail) upon panics and shutdowns. Pstore is +independent of, and runs before, kdump. In certain scenarios (ie. +hosts/guests with root filesystems on NFS/iSCSI where networking +software and/or hardware fails, and thus kdump fails), pstore may +contain information available for post-mortem debugging. + +Two common storage backends for the pstore filesystem are ACPI ERST +and UEFI. Most BIOS implement ACPI ERST. UEFI is not utilized in all +guests. With QEMU supporting ACPI ERST, it becomes a viable pstore +storage backend for virtual machines (as it is now for bare metal +machines). + +Enabling support for ACPI ERST facilitates a consistent method to +capture kernel panic information in a wide range of guests: from +resource-constrained microvms to very large guests, and in particular, +in direct-boot environments (which would lack UEFI run-time services). + +Note that Microsoft Windows also utilizes the ACPI ERST for certain +crash information, if available[3]. + + +Configuration|Usage +------------------- + +To use ACPI ERST, a memory-backend-file object and acpi-erst device +can be created, for example: + + qemu ... + -object memory-backend-file,id=3Derstnvram,mem-path=3Dacpi-erst.backing,s= ize=3D0x10000,share=3Don \ + -device acpi-erst,memdev=3Derstnvram + +For proper operation, the ACPI ERST device needs a memory-backend-file +object with the following parameters: + + - id: The id of the memory-backend-file object is used to associate + this memory with the acpi-erst device. + - size: The size of the ACPI ERST backing storage. This parameter is + required. + - mem-path: The location of the ACPI ERST backing storage file. This + parameter is also required. + - share: The share=3Don parameter is required so that updates to the + ERST backing store are written to the file. + +and ERST device: + + - memdev: Is the object id of the memory-backend-file. + - record_size: Specifies the size of the records (or slots) in the + backend storage. Must be a power of two value greater than or + equal to 4096 (PAGE_SIZE). + + +PCI Interface +------------- + +The ERST device is a PCI device with two BARs, one for accessing the +programming registers, and the other for accessing the record exchange +buffer. + +BAR0 contains the programming interface consisting of ACTION and VALUE +64-bit registers. All ERST actions/operations/side effects happen on +the write to the ACTION, by design. Any data needed by the action must +be placed into VALUE prior to writing ACTION. Reading the VALUE +simply returns the register contents, which can be updated by a +previous ACTION. + +BAR1 contains the 8KiB record exchange buffer, which is the +implemented maximum record size. + + +Backend Storage Format +---------------------- + +The backend storage is divided into fixed size "slots", 8KiB in +length, with each slot storing a single record. Not all slots need to +be occupied, and they need not be occupied in a contiguous fashion. +The ability to clear/erase specific records allows for the formation +of unoccupied slots. + +Slot 0 contains a backend storage header that identifies the contents +as ERST and also facilitates efficient access to the records. +Depending upon the size of the backend storage, additional slots will +be designated to be a part of the slot 0 header. For example, at 8KiB, +the slot 0 header can accomodate 1021 records. Thus a storage size +of 8MiB (8KiB * 1024) requires an additional slot for use by the +header. In this scenario, slot 0 and slot 1 form the backend storage +header, and records can be stored starting at slot 2. + +Below is an example layout of the backend storage format (for storage +size less than 8MiB). The size of the storage is a multiple of 8KiB, +and contains N number of slots to store records. The example below +shows two records (in CPER format) in the backend storage, while the +remaining slots are empty/available. + +:: + + Slot Record + <------------------ 8KiB --------------------> + +--------------------------------------------+ + 0 | storage header | + +--------------------------------------------+ + 1 | empty/available | + +--------------------------------------------+ + 2 | CPER | + +--------------------------------------------+ + 3 | CPER | + +--------------------------------------------+ + ... | | + +--------------------------------------------+ + N | empty/available | + +--------------------------------------------+ + +The storage header consists of some basic information and an array +of CPER record_id's to efficiently access records in the backend +storage. + +All fields in the header are stored in little endian format. + +:: + + +--------------------------------------------+ + | magic | 0x0000 + +--------------------------------------------+ + | record_offset | record_size | 0x0008 + +--------------------------------------------+ + | record_count | reserved | version | 0x0010 + +--------------------------------------------+ + | record_id[0] | 0x0018 + +--------------------------------------------+ + | record_id[1] | 0x0020 + +--------------------------------------------+ + | record_id[...] | + +--------------------------------------------+ + | record_id[N] | 0x1FF8 + +--------------------------------------------+ + +The 'magic' field contains the value 0x524F545354535245. + +The 'record_size' field contains the value 0x2000, 8KiB. + +The 'record_offset' field points to the first record_id in the array, +0x0018. + +The 'version' field contains 0x0100, the first version. + +The 'record_count' field contains the number of valid records in the +backend storage. + +The 'record_id' array fields are the 64-bit record identifiers of the +CPER record in the corresponding slot. Stated differently, the +location of a CPER record_id in the record_id[] array provides the +slot index for the corresponding record in the backend storage. + +Note that, for example, with a backend storage less than 8MiB, slot 0 +contains the header, so the record_id[0] will never contain a valid +CPER record_id. Instead slot 1 is the first available slot and thus +record_id_[1] may contain a CPER. + +A 'record_id' of all 0s or all 1s indicates an invalid record (ie. the +slot is available). + + +References +---------- + +[1] "Advanced Configuration and Power Interface Specification", + version 4.0, June 2009. + +[2] "Unified Extensible Firmware Interface Specification", + version 2.1, October 2008. + +[3] "Windows Hardware Error Architecture", specfically + "Error Record Persistence Mechanism". diff --git a/docs/specs/index.rst b/docs/specs/index.rst index ecc43896bb..32863b4aa5 100644 --- a/docs/specs/index.rst +++ b/docs/specs/index.rst @@ -18,3 +18,4 @@ guest hardware that is specific to QEMU. acpi_mem_hotplug acpi_pci_hotplug acpi_nvdimm + acpi_erst --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164664796079216.89357432094107; Mon, 7 Mar 2022 02:12:40 -0800 (PST) Received: from localhost ([::1]:48724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAM3-000295-MO for importer@patchew.org; Mon, 07 Mar 2022 05:12:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABR-0008Gg-EM for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47167) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABP-0002Zj-R7 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:41 -0500 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-648-gL3m1RaHM5umnbldtyA1FA-1; Mon, 07 Mar 2022 05:01:38 -0500 Received: by mail-ej1-f70.google.com with SMTP id lf15-20020a170906ae4f00b006da86a43346so5605670ejb.14 for ; Mon, 07 Mar 2022 02:01:36 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id h12-20020a1709060f4c00b006b4ec988cc3sm4544652ejj.4.2022.03.07.02.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TYa/f3CO+AQEfD01xoN40acPIyF1N0ddSlAR4JbVXkw=; b=PZb6YZ4MiDROoucBrslhERIksPUGTmaNtUyPBwQgLrTK8z5DO2/y/LAdHWbX3Gz6JSaL2V rnoDuGqrwLtm6blaHPy86eRezO/dFmm70tdc1K1WN8qUrIzu79N8eha8IFJe/cCjs9i6B2 8nLDFk21795ycgqyWMtrbi1JQWfXuA8= X-MC-Unique: gL3m1RaHM5umnbldtyA1FA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=TYa/f3CO+AQEfD01xoN40acPIyF1N0ddSlAR4JbVXkw=; b=0ZXe2zNJpNen8tcW7DBLX5PRFE2FxKnCcmMIRovSBDDRGHC9F8bbd+3i/Gw6Ok/5GB jN63TPfPJbJKtI9lkNLzQIj7BQZnXLbqwGaU4uMRO0ptbi4s5O/DvhkXSGYYLs0Zbqaj 8xtNqFYqzPrA24sw0MDlNhH36H55zWzXMaGvHbuBmN+JMoKpIwc5IcD4PeooHoK5JbKg KHPmoEi0yq4wcb0leYih2Xd7vPnbWfscAKQqtaPOrVIkSfDh+fQ8ulu/4z8v/SSLXysq r6H2nZfuiz70N8vBcbNB+dwjBMNH094nC+afXBYxta5jbKKMtZjTryxVCfkk6StDeK57 QVkg== X-Gm-Message-State: AOAM532pu6iGLzpoAQOuUwRy5FNvHgdWl/dxywE7ZWuWfozZVKhfPEJD qm7YP2xXC/Nw0dzi28ck2o3zOzF7XEbxeAa61b9HvMXbNtW6MrQQeqqAxgSxE6e3n50ugZiHWY+ r1d+IM/ELpnmv0XyNepaCI+AasjNkzyaq74zWNXCvUN259VlrXI2Bq5RFbZ11 X-Received: by 2002:a17:906:3a4f:b0:6cf:86e0:586c with SMTP id a15-20020a1709063a4f00b006cf86e0586cmr8398630ejf.626.1646647295595; Mon, 07 Mar 2022 02:01:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvkeHOyrMxdS5SJb0d7ccl3sE6c/ZiwNhbjo0NQjBkb9BwoU5rK0qpwPsCcbpKfvcAFs+k4Q== X-Received: by 2002:a17:906:3a4f:b0:6cf:86e0:586c with SMTP id a15-20020a1709063a4f00b006cf86e0586cmr8398606ejf.626.1646647295315; Mon, 07 Mar 2022 02:01:35 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:32 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 03/47] MAINTAINERS: no need to add my name explicitly as a reviewer for VIOT tables Message-ID: <20220307100058.449628-4-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Thomas Huth , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Ani Sinha , Alex =?utf-8?Q?Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647961929100008 From: Ani Sinha I am already listed as a reviewer for ACPI/SMBIOS subsystem. There is no ne= ed to again add me as a reviewer for ACPI/VIOT. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Ani Sinha Message-Id: <20220223143322.927136-3-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 68adaac373..83a9f79c1c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1819,7 +1819,6 @@ F: docs/specs/acpi_hw_reduced_hotplug.rst =20 ACPI/VIOT M: Jean-Philippe Brucker -R: Ani Sinha S: Supported F: hw/acpi/viot.c F: hw/acpi/viot.h --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647608944340.58843819304116; Mon, 7 Mar 2022 02:06:48 -0800 (PST) Received: from localhost ([::1]:32872 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAGO-0008EN-HQ for importer@patchew.org; Mon, 07 Mar 2022 05:06:48 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABT-0008Ks-M4 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:49272) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABS-0002Zu-1x for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:43 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-wRZRzIruNxqY2iruXCsZcA-1; Mon, 07 Mar 2022 05:01:40 -0500 Received: by mail-ed1-f70.google.com with SMTP id o20-20020aa7dd54000000b00413bc19ad08so8338496edw.7 for ; Mon, 07 Mar 2022 02:01:39 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id bm23-20020a170906c05700b006d597fd51c6sm4628764ejb.145.2022.03.07.02.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ma9iWGjH8QtszJxbcW9JyMpOmAV16xFQyYJbaD6EIFc=; b=bxIwF1SO8jzCgYgxesUQ9onZv/Wo/9vEVyccJenTYpLxlENAHVSqTLQWpwY5RBmTBMJlpA xh9fRZMknQHm2LFMQpGFKDS2uYGmDOC4Sc+u7kHcYik3cQE9WMJQfn1+7/tA+NpLbXu7xp 0F8FSeHSshON7KwzkF6KttK/Tv/vUxA= X-MC-Unique: wRZRzIruNxqY2iruXCsZcA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ma9iWGjH8QtszJxbcW9JyMpOmAV16xFQyYJbaD6EIFc=; b=ylKkORd3neJZNCsckL03tpfxhdRYlbtOUMLoEpDugqMbViFnF+cXRxrnw5MXCA6+Vd Jreu6Rs0mcn3pRCvFWvPvhCc9I+yL5yCYb5HVkPn5gbA/t6QAbUsRsDpod1ce3hBgcSo umPzoU6FPnauBWn1rhDpKrXaTVY0VLKFRW2Nkuq2pwXR03Gt2YAXb6UWYizb2gWYTHj/ oECeBuXArICgLd2iWoTvOef2aG8ycn4riXib11ewMnhHRwEE83AVVivlVqLjz43Ft5Bo 0tHszMXC+x+ghSlFP5twyMYxYKoncbZimXd/F+mtRbpgfNn1TSdIh2MGv2W+iyudrXDs pG7g== X-Gm-Message-State: AOAM532coQYGlXc3cr2po3pzOQuTR/O/JeQ28aRATy6dPxkiYgX3LxzD KwoZZP4qY4tE31lIIctFAXU7MkG79IXEqW8457Tzd9ShUeySpyqih/xy4IazUQ1/3+/bDjbvOOl sxp9V48C6g+mnNC/xU8WXD1NBbaJ5ooxtMNgJs7oubcKlM4kQotgIXtjX9cyD X-Received: by 2002:a05:6402:1775:b0:416:537f:f422 with SMTP id da21-20020a056402177500b00416537ff422mr2009087edb.20.1646647298407; Mon, 07 Mar 2022 02:01:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+fr0gX03GD/84tanC6Mnl/SBml6FgXUoapLigBxuv1z5Vcm3dUqCBo2tKeggULzi25tib7A== X-Received: by 2002:a05:6402:1775:b0:416:537f:f422 with SMTP id da21-20020a056402177500b00416537ff422mr2009057edb.20.1646647298052; Mon, 07 Mar 2022 02:01:38 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:35 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 04/47] docs/acpi/erst: add device id for ACPI ERST device in pci-ids.txt Message-ID: <20220307100058.449628-5-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647612542100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ani Sinha Adding device ID for ERST device in pci-ids.txt. It was missed when ERST related patches were reviewed. CC: Eric DeVolder Reviewed-by: Eric DeVolder Signed-off-by: Ani Sinha Message-Id: <20220223143322.927136-4-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/pci-ids.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/specs/pci-ids.txt b/docs/specs/pci-ids.txt index 5e407a6f32..dd6859d039 100644 --- a/docs/specs/pci-ids.txt +++ b/docs/specs/pci-ids.txt @@ -65,6 +65,7 @@ PCI devices (other than virtio): 1b36:000f mdpy (mdev sample device), linux/samples/vfio-mdev/mdpy.c 1b36:0010 PCIe NVMe device (-device nvme) 1b36:0011 PCI PVPanic device (-device pvpanic-pci) +1b36:0012 PCI ACPI ERST device (-device acpi-erst) =20 All these devices are documented in docs/specs. =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647478531116.34917323747504; Mon, 7 Mar 2022 02:04:38 -0800 (PST) Received: from localhost ([::1]:53302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAEH-000351-B3 for importer@patchew.org; Mon, 07 Mar 2022 05:04:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABX-0008Ro-Bd for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABV-0002aE-Qn for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:47 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-230-M7zrvvooP3KrNpKkc-qsWA-1; Mon, 07 Mar 2022 05:01:42 -0500 Received: by mail-ed1-f70.google.com with SMTP id b24-20020a50e798000000b0041631767675so2422816edn.23 for ; Mon, 07 Mar 2022 02:01:42 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id q9-20020a170906770900b006d20acf7e2bsm4593963ejm.200.2022.03.07.02.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1o/co5SzJ3afQc19M+6XwM/OcyfK5XPAzn/pSwX2qvQ=; b=fFdnoejDJJhm+PyPpwoS4ONfmtqHZT6RQBY4xj5FbXweNLgAtIyS0rlC0I3+uw6Ahtfaid v9ludksw2fVcN+3rrl0EGGHXnoWM+RLhmLARCwlaBIX0V7aQmhIQBYPZ2Iy/3x2Xlh4TLi 5JwhV7onL1VsnuS27dE/7DVd/+UzPKo= X-MC-Unique: M7zrvvooP3KrNpKkc-qsWA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=1o/co5SzJ3afQc19M+6XwM/OcyfK5XPAzn/pSwX2qvQ=; b=2tgS9H9QvPiVgcAH/EHignEjeCoyOFW+x9I9JW9TlWHuEXJruso/jAU/HmU/AcYt9w QiXCwN0fBaah8qx9VVsI+lciUHYjWdflgBjRYdLW6zHSvo/R8+BxNoxIQuYhkq5/d5Iv VCCHyB+5CvfnpW2RhbzuFOComp/V44UTonxcYJtc6gqAUZwAIe1oe2qvEI6VCYRNMgHG TRWXmfbu+1jhQLxDBzPb86kEcx1TAVrdIIM6btQ5POGxvStMxH45tc3/GjvqSxLRPr+x Y1B5UrTxTPN4N+dfM1noi5uz//dhIWr87xriXZoV7q1+GKJYxRFvUCcjoq8gV/PfeTDz M4xA== X-Gm-Message-State: AOAM533pSIOkqVPDRZwY+f8NM/eNjUkaa33sYkzaIZA4qnC9Q3uyxELN xzLHjJUYlNrXRMITNjN0bFWNIs4vzn1JlaPvcq8ikC7IaYOWGA/sOT6I0moYaDxcKLyRCjr+ynU Oa9Oj8r1+DQmn6YNxqe52lqgwwK9ormIC0CCBlLiXFZUxJhwDDnPQwd6laTXd X-Received: by 2002:a50:d592:0:b0:415:e599:4166 with SMTP id v18-20020a50d592000000b00415e5994166mr10178806edi.195.1646647300942; Mon, 07 Mar 2022 02:01:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVTCJsUdEKLwmI0F5B1b8bvaPtpBSyam3BO6+9gWEdWJ0s3VcrjBS/Fz0AxdbCaMFzsGnzkw== X-Received: by 2002:a50:d592:0:b0:415:e599:4166 with SMTP id v18-20020a50d592000000b00415e5994166mr10178785edi.195.1646647300711; Mon, 07 Mar 2022 02:01:40 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:38 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 05/47] hw/acpi/erst: clean up unused IS_UEFI_CPER_RECORD macro Message-ID: <20220307100058.449628-6-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Eric DeVolder , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647480797100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ani Sinha This change is cosmetic. IS_UEFI_CPER_RECORD macro definition that was added as a part of the ERST implementation seems to be unused. Remove it. CC: Eric DeVolder Reviewed-by: Eric DeVolder Signed-off-by: Ani Sinha Message-Id: <20220223143322.927136-5-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/erst.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c index c0a23cf467..de509c2b48 100644 --- a/hw/acpi/erst.c +++ b/hw/acpi/erst.c @@ -80,11 +80,6 @@ #define UEFI_CPER_RECORD_MIN_SIZE 128U #define UEFI_CPER_RECORD_LENGTH_OFFSET 20U #define UEFI_CPER_RECORD_ID_OFFSET 96U -#define IS_UEFI_CPER_RECORD(ptr) \ - (((ptr)[0] =3D=3D 'C') && \ - ((ptr)[1] =3D=3D 'P') && \ - ((ptr)[2] =3D=3D 'E') && \ - ((ptr)[3] =3D=3D 'R')) =20 /* * NOTE that when accessing CPER fields within a record, memcpy() --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16466478276741008.8357720442295; Mon, 7 Mar 2022 02:10:27 -0800 (PST) Received: from localhost ([::1]:41436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAJu-0005d3-Ip for importer@patchew.org; Mon, 07 Mar 2022 05:10:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABY-0008To-KN for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23214) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABW-0002aN-Qc for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:48 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-CCu9b-YvMlWpsjQ3hE_8tQ-1; Mon, 07 Mar 2022 05:01:45 -0500 Received: by mail-ed1-f69.google.com with SMTP id y10-20020a056402358a00b00410deddea4cso8318593edc.16 for ; Mon, 07 Mar 2022 02:01:45 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id b6-20020a50e386000000b00410d64cb3e4sm6132975edm.75.2022.03.07.02.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UdCEFmroOMq8HjIXyQ0uo/r5UiIIhp1W/Xv1KnE50ho=; b=O0UgigmGhEsBddo60BvpxfwgzxtAI6STKp4z+Lnimh8AL9NL2V9/jb38wAK+KB5z/A/o0G KjyrPKe7az+bqX6PvH7RZcVW/saOjpjwszTrHXN7TIOQmVLkepspV7TRhW+ihWO3oL9T17 HhKr7xwyjB/rJZEGyhPFzk/ASXrL/Hk= X-MC-Unique: CCu9b-YvMlWpsjQ3hE_8tQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=UdCEFmroOMq8HjIXyQ0uo/r5UiIIhp1W/Xv1KnE50ho=; b=jmU4sajnmGYBHeNq8NEcPEXTAKSuKhqowQM5SNfMcDImqmORrMXleq0IZHLhYnn4Ls 4ZD0bAKmYAtjfxDuzUtFMpYw4gpLzbzyROQVxKKTB8iPUXo8hDw30isKpaJ6Gdo6zapk vh78uphfG6LJQLWZfN5tfZXsSicyZHHW6DperRIPR6SdaTGXANeSHIJUba4llVETnCCn VoDZqCvL2T+7Pnwik6GxnFiIeMFUSONLz99nIpE1PzCJ31V8OmRu0XjS0y1NlbwyMI9u 0fPGYFpUSGF9yguONNVad3O4wYDWhoeQuOHB3hBz2FHylAkaHRgJ3smsEzV04UWxtEWl Najw== X-Gm-Message-State: AOAM531zd0x+6Gw1MQaBCDPHgeJx+VtvoWjP70s4E0kosLU3nX83Huob mlrkh7b6z/uN/PTSRdNcIgQSscPXrmhXNEK0h7jjpu0Zt9VVD/i+++069/SdEO7vtXn1BAV6Ked xRyYVQE8u0bWZGHZTijxkUObaeP2gZYMoG8MmiieYd16zRYG7H3d+eCHeKBHR X-Received: by 2002:a17:907:869f:b0:6da:888b:4258 with SMTP id qa31-20020a170907869f00b006da888b4258mr8532288ejc.720.1646647303688; Mon, 07 Mar 2022 02:01:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8awBFT0Z82KlBrdEuQpS/5Sg/b49oMe07sfdx9EmTDivU4tElFzNSZOUWHUPGx1SdpnvdnA== X-Received: by 2002:a17:907:869f:b0:6da:888b:4258 with SMTP id qa31-20020a170907869f00b006da888b4258mr8532263ejc.720.1646647303321; Mon, 07 Mar 2022 02:01:43 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:40 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 06/47] hw/smbios: code cleanup - use macro definitions for table header handles Message-ID: <20220307100058.449628-7-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647829082100001 From: Ani Sinha This is a minor cleanup. Using macro definitions makes the code more readable. It is at once clear which tables use which handle numbers in their header. It also makes it easy to calculate the gaps between the numbers and update them if needed. Reviewed-by: Igor Mammedov Signed-off-by: Ani Sinha Message-Id: <20220223143322.927136-6-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/smbios/smbios.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 6013df1698..56b412ce35 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -549,9 +549,23 @@ bool smbios_skip_table(uint8_t type, bool required_tab= le) return true; } =20 +#define T0_BASE 0x000 +#define T1_BASE 0x100 +#define T2_BASE 0x200 +#define T3_BASE 0x300 +#define T4_BASE 0x400 +#define T11_BASE 0xe00 + +#define T16_BASE 0x1000 +#define T17_BASE 0x1100 +#define T19_BASE 0x1300 +#define T32_BASE 0x2000 +#define T41_BASE 0x2900 +#define T127_BASE 0x7F00 + static void smbios_build_type_0_table(void) { - SMBIOS_BUILD_TABLE_PRE(0, 0x000, false); /* optional, leave up to BIOS= */ + SMBIOS_BUILD_TABLE_PRE(0, T0_BASE, false); /* optional, leave up to BI= OS */ =20 SMBIOS_TABLE_SET_STR(0, vendor_str, type0.vendor); SMBIOS_TABLE_SET_STR(0, bios_version_str, type0.version); @@ -599,7 +613,7 @@ static void smbios_encode_uuid(struct smbios_uuid *uuid= , QemuUUID *in) =20 static void smbios_build_type_1_table(void) { - SMBIOS_BUILD_TABLE_PRE(1, 0x100, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(1, T1_BASE, true); /* required */ =20 SMBIOS_TABLE_SET_STR(1, manufacturer_str, type1.manufacturer); SMBIOS_TABLE_SET_STR(1, product_name_str, type1.product); @@ -619,7 +633,7 @@ static void smbios_build_type_1_table(void) =20 static void smbios_build_type_2_table(void) { - SMBIOS_BUILD_TABLE_PRE(2, 0x200, false); /* optional */ + SMBIOS_BUILD_TABLE_PRE(2, T2_BASE, false); /* optional */ =20 SMBIOS_TABLE_SET_STR(2, manufacturer_str, type2.manufacturer); SMBIOS_TABLE_SET_STR(2, product_str, type2.product); @@ -637,7 +651,7 @@ static void smbios_build_type_2_table(void) =20 static void smbios_build_type_3_table(void) { - SMBIOS_BUILD_TABLE_PRE(3, 0x300, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(3, T3_BASE, true); /* required */ =20 SMBIOS_TABLE_SET_STR(3, manufacturer_str, type3.manufacturer); t->type =3D 0x01; /* Other */ @@ -662,7 +676,7 @@ static void smbios_build_type_4_table(MachineState *ms,= unsigned instance) { char sock_str[128]; =20 - SMBIOS_BUILD_TABLE_PRE(4, 0x400 + instance, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(4, T4_BASE + instance, true); /* required */ =20 snprintf(sock_str, sizeof(sock_str), "%s%2x", type4.sock_pfx, instance= ); SMBIOS_TABLE_SET_STR(4, socket_designation_str, sock_str); @@ -702,7 +716,7 @@ static void smbios_build_type_11_table(void) return; } =20 - SMBIOS_BUILD_TABLE_PRE(11, 0xe00, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(11, T11_BASE, true); /* required */ =20 snprintf(count_str, sizeof(count_str), "%zu", type11.nvalues); t->count =3D type11.nvalues; @@ -722,7 +736,7 @@ static void smbios_build_type_16_table(unsigned dimm_cn= t) { uint64_t size_kb; =20 - SMBIOS_BUILD_TABLE_PRE(16, 0x1000, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(16, T16_BASE, true); /* required */ =20 t->location =3D 0x01; /* Other */ t->use =3D 0x03; /* System memory */ @@ -749,7 +763,7 @@ static void smbios_build_type_17_table(unsigned instanc= e, uint64_t size) char loc_str[128]; uint64_t size_mb; =20 - SMBIOS_BUILD_TABLE_PRE(17, 0x1100 + instance, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(17, T17_BASE + instance, true); /* required */ =20 t->physical_memory_array_handle =3D cpu_to_le16(0x1000); /* Type 16 ab= ove */ t->memory_error_information_handle =3D cpu_to_le16(0xFFFE); /* Not pro= vided */ @@ -790,7 +804,7 @@ static void smbios_build_type_19_table(unsigned instanc= e, { uint64_t end, start_kb, end_kb; =20 - SMBIOS_BUILD_TABLE_PRE(19, 0x1300 + instance, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(19, T19_BASE + instance, true); /* required */ =20 end =3D start + size - 1; assert(end > start); @@ -814,7 +828,7 @@ static void smbios_build_type_19_table(unsigned instanc= e, =20 static void smbios_build_type_32_table(void) { - SMBIOS_BUILD_TABLE_PRE(32, 0x2000, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(32, T32_BASE, true); /* required */ =20 memset(t->reserved, 0, 6); t->boot_status =3D 0; /* No errors detected */ @@ -828,7 +842,7 @@ static void smbios_build_type_41_table(Error **errp) struct type41_instance *t41; =20 QTAILQ_FOREACH(t41, &type41, next) { - SMBIOS_BUILD_TABLE_PRE(41, 0x2900 + instance, true); + SMBIOS_BUILD_TABLE_PRE(41, T41_BASE + instance, true); =20 SMBIOS_TABLE_SET_STR(41, reference_designation_str, t41->designati= on); t->device_type =3D t41->kind; @@ -871,7 +885,7 @@ static void smbios_build_type_41_table(Error **errp) =20 static void smbios_build_type_127_table(void) { - SMBIOS_BUILD_TABLE_PRE(127, 0x7F00, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(127, T127_BASE, true); /* required */ SMBIOS_BUILD_TABLE_POST; } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647480650366.3230168766904; Mon, 7 Mar 2022 02:04:40 -0800 (PST) Received: from localhost ([::1]:53450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAEJ-0003BY-BI for importer@patchew.org; Mon, 07 Mar 2022 05:04:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34426) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABb-00008I-B7 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:42777) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABZ-0002ag-ER for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:51 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-fGLKVDKwMyG5ZZPSLQgg2A-1; Mon, 07 Mar 2022 05:01:47 -0500 Received: by mail-ed1-f69.google.com with SMTP id e10-20020a056402190a00b00410f20467abso8304221edz.14 for ; Mon, 07 Mar 2022 02:01:47 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id da19-20020a056402177300b00413583e0996sm5875929edb.14.2022.03.07.02.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647308; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vqmzhFEM37dr6U0Ojjhlq+BZMQJdriqtIDbTT9ZpStw=; b=KKn1sQv6MZp9Zw1jeFcfBfeZaKOPn2NgUO4RBln1r0XqdL7favI5vJKal4kkd7tze7GvW/ vyIZwX4oLfhJBCZMx1XBAh9Oc4ZW26FwondgBIV3b4EZeVr0PEo+2I5UJ0jMrb6MQmVPyt E8zle4Ep3cOordzFWxRVNvdJHTPTuR8= X-MC-Unique: fGLKVDKwMyG5ZZPSLQgg2A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vqmzhFEM37dr6U0Ojjhlq+BZMQJdriqtIDbTT9ZpStw=; b=2vEwZvbzyt7kANGHp2k+YY9toN3itXboMFNvj3AwsH3YcwxwR9vnP6k/EGPhMhZbuD +tokxYzgmsBdn19/m+WsUXVZPZ2RCmTClClnZAq1eB2TyiqqrnpTWkJXGCDB7hy+d2OI 5WoNEAIGIHGmjUJeQM+hC9neFvf9DAxpUY0G9WTVrYyoc8NRODBxNFlv3luMjOY971hu dUWv+/7x+7B5ppKMxCue2Pfugwpcptmt+emxwjUs0668o2Q+v+7AlfK9TrIIpR/Gyc7B z3VUwEd0Ypc3uMlko1WhyUZFcl0xtSbeVgvu0MVC9tqF4LaOTw+acJAV24W7og92GBNI TNpw== X-Gm-Message-State: AOAM530FFdDS8QpU+/4nEuJ7Rvq7Bo+HfVRZpQ4oKKTOQZCfvVOodKbr ktatSbsc273ofSg0v9NBQlq3g6mj2b0p8SdnS/xU+TcNckAMEkyIXhNcA33O5SM4YfkClAarMUL rDozi9/P+h9whESnrhLtO9rDFaJQz7omhfY1/yaH7KOE2ciK2aWBXvoG/hHfm X-Received: by 2002:a17:907:3f93:b0:6da:b5e2:f325 with SMTP id hr19-20020a1709073f9300b006dab5e2f325mr8311384ejc.120.1646647306361; Mon, 07 Mar 2022 02:01:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyssRTaOaH5uPfEocCJrhKQLH0w7lQOauYr/D1x0kXuvAHt9t7oOwW3hgd9Jqbjz9k8MYJU8Q== X-Received: by 2002:a17:907:3f93:b0:6da:b5e2:f325 with SMTP id hr19-20020a1709073f9300b006dab5e2f325mr8311370ejc.120.1646647306084; Mon, 07 Mar 2022 02:01:46 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:43 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 07/47] hw/smbios: fix overlapping table handle numbers with large memory vms Message-ID: <20220307100058.449628-8-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647482808100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ani Sinha The current smbios table implementation splits the main memory in 16 GiB (DIMM like) chunks. With the current smbios table assignment code, we can h= ave only 512 such chunks before the 16 bit handle numbers in the header for tab= les 17 and 19 conflict. A guest with more than 8 TiB of memory will hit this limitation and would fail with the following assertion in isa-debugcon: ASSERT_EFI_ERROR (Status =3D Already started) ASSERT /builddir/build/BUILD/edk2-ca407c7246bf/OvmfPkg/SmbiosPlatformDxe/Sm= biosPlatformDxe.c(125): !EFI_ERROR (Status) This change adds an additional offset between tables 17 and 19 handle numbe= rs when configuring VMs larger than 8 TiB of memory. The value of the offset is calculated to be equal to the additional space required to be reserved in order to accomodate more DIMM entries without the table handles collidin= g. In normal cases where the VM memory is smaller or equal to 8 TiB, this offs= et value is 0. Hence in this case, no additional handle numbers are reserved a= nd table handle values remain as before. Since smbios memory is not transmitted over the wire during migration, this change can break migration for large memory vms if the guest is in the middle of generating the tables during migration. However, in those situations, qemu generates invalid table handles anyway with or without this fix. Hence, we do not preserve the old bug by introducing compat knobs/mach= ine types. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2023977 Signed-off-by: Ani Sinha Reviewed-by: Igor Mammedov Message-Id: <20220223143322.927136-7-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 56b412ce35..44c53797a4 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -799,12 +799,13 @@ static void smbios_build_type_17_table(unsigned insta= nce, uint64_t size) SMBIOS_BUILD_TABLE_POST; } =20 -static void smbios_build_type_19_table(unsigned instance, +static void smbios_build_type_19_table(unsigned instance, unsigned offset, uint64_t start, uint64_t size) { uint64_t end, start_kb, end_kb; =20 - SMBIOS_BUILD_TABLE_PRE(19, T19_BASE + instance, true); /* required */ + SMBIOS_BUILD_TABLE_PRE(19, T19_BASE + offset + instance, + true); /* required */ =20 end =3D start + size - 1; assert(end > start); @@ -996,7 +997,7 @@ void smbios_get_tables(MachineState *ms, uint8_t **anchor, size_t *anchor_len, Error **errp) { - unsigned i, dimm_cnt; + unsigned i, dimm_cnt, offset; =20 if (smbios_legacy) { *tables =3D *anchor =3D NULL; @@ -1026,6 +1027,16 @@ void smbios_get_tables(MachineState *ms, =20 dimm_cnt =3D QEMU_ALIGN_UP(current_machine->ram_size, MAX_DIMM_SZ)= / MAX_DIMM_SZ; =20 + /* + * The offset determines if we need to keep additional space betwe= een + * table 17 and table 19 header handle numbers so that they do + * not overlap. For example, for a VM with larger than 8 TB guest + * memory and DIMM like chunks of 16 GiB, the default space between + * the two tables (T19_BASE - T17_BASE =3D 512) is not enough. + */ + offset =3D (dimm_cnt > (T19_BASE - T17_BASE)) ? \ + dimm_cnt - (T19_BASE - T17_BASE) : 0; + smbios_build_type_16_table(dimm_cnt); =20 for (i =3D 0; i < dimm_cnt; i++) { @@ -1033,7 +1044,7 @@ void smbios_get_tables(MachineState *ms, } =20 for (i =3D 0; i < mem_array_size; i++) { - smbios_build_type_19_table(i, mem_array[i].address, + smbios_build_type_19_table(i, offset, mem_array[i].address, mem_array[i].length); } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647719234180.14672646263864; Mon, 7 Mar 2022 02:08:39 -0800 (PST) Received: from localhost ([::1]:36684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAIA-0002Ro-7b for importer@patchew.org; Mon, 07 Mar 2022 05:08:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABd-0000Bk-9a for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABb-0002bC-MJ for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:52 -0500 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-54-_s0PTW7-PJmxbFLZHVSqrw-1; Mon, 07 Mar 2022 05:01:50 -0500 Received: by mail-ed1-f72.google.com with SMTP id bd4-20020a056402206400b004162b6d8618so2561216edb.19 for ; Mon, 07 Mar 2022 02:01:49 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id i26-20020a17090671da00b006d9b2150a22sm4651878ejk.146.2022.03.07.02.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5n/FHmC/Dor0xLSEuoyybbuicDeG0aqX5h3Rj+dixSE=; b=FQ6nPaJKLEIngn2iXjtOSrS5g8ZEs+Orb8EA/c4VUpmYjV1BnwmsYiSn7J1bgicf2ObjYl Lpl6dLQLySxSx/3TaFL67CFO7l0C2kncLcjVu9BnpLL3SZ9vsk0snpFNZCKuo4J4uxhcbl jUSw0pAVmfUqeMrb/Gz2oGnJS2v1T7w= X-MC-Unique: _s0PTW7-PJmxbFLZHVSqrw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5n/FHmC/Dor0xLSEuoyybbuicDeG0aqX5h3Rj+dixSE=; b=SObNq9gkl/n5mdyOw/apDJSxmyrlGR84RyWFJ+p4tfboUa/5OuggWxqQnyjZTzWs9w BvlhlFjcV5GEa/pawEx2ddQY9ixpdjvjFa6/GxgHsDh0F6t7e/GLG4XKLuC528FqkYSS /uWSXM72iskWRWk2FyD+8FKrgqA7MpOBynfVRJPUHF2tkVeI7G4dSo+cc9uNFbht9Lx/ wLYQgy/4lENt0390MGTiFMQ9Aqr/NaHveW12tr2nAU0qe5tsIXH5P69FJEUPPR2xRFCO +gRJl6plAn9rZTWr3xCNOF7TB4/kIpGOywsD8EmrNCIR32vW8HUuB1LVapXJYYBpr5uF A+3g== X-Gm-Message-State: AOAM531v7EOSqy5PIvWveHHpfzGKbDPmWXWS/55qIJAe7aAdAbHqG5Bf MDHsvcDJnvl55RQmsrxGvibV9hikDwOAw7gTPPkZ5B7s1g0U6IN3wM/E2haQiFJCitSaErChqnL I87i4IBSxmeAKY8WD0mAFLKjH0gO1Dh/KP0ciIxxs2IWrVkkG0odTn4fOtdQY X-Received: by 2002:a17:907:9712:b0:6b7:98d6:6139 with SMTP id jg18-20020a170907971200b006b798d66139mr8549558ejc.498.1646647308722; Mon, 07 Mar 2022 02:01:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7+44txkDeE4+PSVlgcOq0LMXGnWDA6jRjcc0u+ULqCT/0NzyrmENCGE4dyTx8swFiSVkizQ== X-Received: by 2002:a17:907:9712:b0:6b7:98d6:6139 with SMTP id jg18-20020a170907971200b006b798d66139mr8549540ejc.498.1646647308505; Mon, 07 Mar 2022 02:01:48 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:46 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 08/47] hw/smbios: add assertion to ensure handles of tables 19 and 32 do not collide Message-ID: <20220307100058.449628-9-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647721145100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ani Sinha Since change dcf359832eec02 ("hw/smbios: fix table memory corruption with l= arge memory vms") we reserve additional space between handle numbers of tables 17 and 19 for large VMs. This may cause table 19 to collide with table 32 in their handle numbers for those large VMs. This change adds an assertion to ensure numbers do not collide. If they do, qemu crashes with useful debug information for taking additional steps. Signed-off-by: Ani Sinha Reviewed-by: Igor Mammedov Message-Id: <20220223143322.927136-8-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 44c53797a4..1f8d5c252f 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1048,6 +1048,12 @@ void smbios_get_tables(MachineState *ms, mem_array[i].length); } =20 + /* + * make sure 16 bit handle numbers in the headers of tables 19 + * and 32 do not overlap. + */ + assert((mem_array_size + offset) < (T32_BASE - T19_BASE)); + smbios_build_type_32_table(); smbios_build_type_38_table(); smbios_build_type_41_table(errp); --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647884965952.9139702507149; Mon, 7 Mar 2022 02:11:24 -0800 (PST) Received: from localhost ([::1]:45298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAKq-0008IG-13 for importer@patchew.org; Mon, 07 Mar 2022 05:11:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34466) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABg-0000Jc-99 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:56 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABe-0002cP-JC for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:55 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-176-EJfIXZ9FPWia2M_xDamzAA-1; Mon, 07 Mar 2022 05:01:53 -0500 Received: by mail-ed1-f71.google.com with SMTP id n11-20020aa7c68b000000b0041641550e11so1945812edq.8 for ; Mon, 07 Mar 2022 02:01:52 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id fs6-20020a170907600600b006da8ec6e4a6sm4538663ejc.26.2022.03.07.02.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tZpSULKN+Xln7Ddi4XAIsi4Ma9E+7GOx9U1W/EkBGEQ=; b=jSdg67DdEXCMdi/Ia+uRBca6UoOIZ+BrxHIf1Q1VkkNgtqX/Z4KVgm2gSLFz9EL58cZxNH BibBt+dV+h4z1PqeG56IV0B7uryx8WUNQYk1ht2ozeB6sC6UaSMjRxj8GcYVE6JMzXm++m BZJNZmLRFUW9qQUGgXolNW9lLYSgKL8= X-MC-Unique: EJfIXZ9FPWia2M_xDamzAA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=tZpSULKN+Xln7Ddi4XAIsi4Ma9E+7GOx9U1W/EkBGEQ=; b=A9GYw9rorAde7A0YNajZum/0E0vifzqH0lybzR/xJRqN7aMm7Guap5futmZS0n6ZHs EHAQN1etrVwPOXp+wZwkqAoZrdIDcwWS1brlRF3Iv3kGrXW1g7pybCqyL4npAHTS/3Sl 6TU5HH9vFz+XbIcHtlPZwAa2HUahAM1Xh2+ervpIvl+yLE6AUJOat0C8/Zoz5Pw6qFEc R25ra3mceybANEexUzs1ca9TgHZvEuApIVKpDqRHgggbmAECmuxvGfwEDpmXRHrrVE+m +rahExEeV+qXOO26Ds8+HkvFsYwf1W1c/1Apx6GIhB8SmKGsgDtWfEtwe3qigN0lcbNB 6HUQ== X-Gm-Message-State: AOAM532Wc8BcyG3O2MRrUuvNuEgsPTHhDWYinLyWxBeYfYCkc1r8HFbU 6grYpl2NotxVzSdyBbUgmbmuytGk/sL3HhbaBBaQ9lFQbZhpaNjRE4k4ERyOnj1IKEO58elrzVl 6isJuSFrDpX0HNGY52I0Sc0rGFfB1CgjNgyzvYzkUy0m33fQubb7PUCssE8Ao X-Received: by 2002:a17:907:3e18:b0:6da:7ac5:4ad4 with SMTP id hp24-20020a1709073e1800b006da7ac54ad4mr8615303ejc.212.1646647311558; Mon, 07 Mar 2022 02:01:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJynOShM+dr+Vgk2lUAfefIcA0Fo2SO1kqhnA5d7d1dKatbwPAFdpFO66HGUpXx/jbdpAVwPNQ== X-Received: by 2002:a17:907:3e18:b0:6da:7ac5:4ad4 with SMTP id hp24-20020a1709073e1800b006da7ac54ad4mr8615286ejc.212.1646647311257; Mon, 07 Mar 2022 02:01:51 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:48 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 09/47] vhost-user: remove VirtQ notifier restore Message-ID: <20220307100058.449628-10-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , qemu-stable@nongnu.org, Xueming Li Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647885439100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xueming Li Notifier set when vhost-user backend asks qemu to mmap an FD and offset. When vhost-user backend restart or getting killed, VQ notifier FD and mmap addresses become invalid. After backend restart, MR contains the invalid address will be restored and fail on notifier access. On the other hand, qemu should munmap the notifier, release underlying hardware resources to enable backend restart and allocate hardware notifier resources correctly. Qemu shouldn't reference and use resources of disconnected backend. This patch removes VQ notifier restore, uses the default vhost-user notifier to avoid invalid address access. After backend restart, the backend should ask qemu to install a hardware notifier if needed. Fixes: 44866521bd6e ("vhost-user: support registering external host notifie= rs") Cc: qemu-stable@nongnu.org Signed-off-by: Xueming Li Message-Id: <20220207071929.527149-2-xuemingl@nvidia.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user.h | 1 - hw/virtio/vhost-user.c | 19 +------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index a9abca3288..f6012b2078 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -14,7 +14,6 @@ typedef struct VhostUserHostNotifier { MemoryRegion mr; void *addr; - bool set; } VhostUserHostNotifier; =20 typedef struct VhostUserState { diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 662853513e..ebe9bd58d0 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1162,19 +1162,6 @@ static int vhost_user_set_vring_num(struct vhost_dev= *dev, return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring); } =20 -static void vhost_user_host_notifier_restore(struct vhost_dev *dev, - int queue_idx) -{ - struct vhost_user *u =3D dev->opaque; - VhostUserHostNotifier *n =3D &u->user->notifier[queue_idx]; - VirtIODevice *vdev =3D dev->vdev; - - if (n->addr && !n->set) { - virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true); - n->set =3D true; - } -} - static void vhost_user_host_notifier_remove(struct vhost_dev *dev, int queue_idx) { @@ -1182,17 +1169,14 @@ static void vhost_user_host_notifier_remove(struct = vhost_dev *dev, VhostUserHostNotifier *n =3D &u->user->notifier[queue_idx]; VirtIODevice *vdev =3D dev->vdev; =20 - if (n->addr && n->set) { + if (n->addr) { virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, false); - n->set =3D false; } } =20 static int vhost_user_set_vring_base(struct vhost_dev *dev, struct vhost_vring_state *ring) { - vhost_user_host_notifier_restore(dev, ring->index); - return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring); } =20 @@ -1558,7 +1542,6 @@ static int vhost_user_slave_handle_vring_host_notifie= r(struct vhost_dev *dev, } =20 n->addr =3D addr; - n->set =3D true; =20 return 0; } --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647636917761.5695974789315; Mon, 7 Mar 2022 02:07:16 -0800 (PST) Received: from localhost ([::1]:33892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAGp-0000VV-QD for importer@patchew.org; Mon, 07 Mar 2022 05:07:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABk-0000Pg-W2 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:44871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABh-0002ew-Cn for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:01:58 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-608-5t8v02GhM5idarutIA3SSA-1; Mon, 07 Mar 2022 05:01:55 -0500 Received: by mail-ed1-f69.google.com with SMTP id bq19-20020a056402215300b0040f276105a4so8331182edb.2 for ; Mon, 07 Mar 2022 02:01:55 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id g2-20020aa7c842000000b0041314b98872sm5885768edt.22.2022.03.07.02.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=OvugmdpxhIxwfz2HUJRV04yMbqV2en4XJ2MBN9Lfiv4=; b=DhEbmwyzCUUtQgodD+fDn1nNSJ8MXijAU5H0e/L+GtFukVfKyJnDrc5N5pngIEYVGJzQHE 81ynpEpRYKxjO/jGZIhVqXi2inkzYnGLyMAgXt2CmbjRQA2Vt6GPGXm+MIirCDLa+rtDzw VCCcQ9sbYxQTI6fmm2MosHJnuuBhxSo= X-MC-Unique: 5t8v02GhM5idarutIA3SSA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OvugmdpxhIxwfz2HUJRV04yMbqV2en4XJ2MBN9Lfiv4=; b=Q69xMBCEutyZqKmI7EOH4RzobcY4rkn3+FiQgFookfwrY4OYJ2WVqRbS3hAqvSL1zO DAP0MmX0lpyjn7zqm51jcAt4s2aiP7U7At6I2MK+zXcQs7En7ac/1VMxkCUjAAmRNpYJ RmWzs7qSytFXrK1bEsM9aaM+vrH7b8rBo1DOUd6mDOLeGf4D+7BxjBhysELTGEzqErX9 ca08ejDJPkMnIwgXGQXtJxRF3FOkAD6ljrlI5NmodpW/TNWWFbx7fk28XAGF+sq9l8Jd FMlRaqG3CiYSZkZv2JAtVefhSDifviQNQu4vIEDBt2XwHWAiMwIs8nFwL6WaBiwyTWiS YZNw== X-Gm-Message-State: AOAM5317VIyU1Sg3DF6tj+faww3SE2Gnfy4iH38+RJfKWSfKWgz7hAfS Z9rRruclcZG+8Ew7MOf2xiOSW5vlKeW11BF4zIvWJqVqQfTYUNIgTty5KGeV4Z5xq1ivhelKCli 2Xq+d3HmBmIyGeTk9N9KlLYzGhf3u3zfaTest6ebClYOfel9JxU55/QABo3qu X-Received: by 2002:a50:f68b:0:b0:415:a36c:5c0b with SMTP id d11-20020a50f68b000000b00415a36c5c0bmr10110511edn.272.1646647314307; Mon, 07 Mar 2022 02:01:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwk6RNWyMxbGCKeORgMhqu9FfMM8ZUyxaocZ+ON9ffuTa5BgDsPlV4Lk8v/cmUFM/k4YaI8NQ== X-Received: by 2002:a50:f68b:0:b0:415:a36c:5c0b with SMTP id d11-20020a50f68b000000b00415a36c5c0bmr10110483edn.272.1646647313969; Mon, 07 Mar 2022 02:01:53 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:51 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 10/47] vhost-user: fix VirtQ notifier cleanup Message-ID: <20220307100058.449628-11-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , qemu-stable@nongnu.org, Xueming Li Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647638183100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Xueming Li When vhost-user device cleanup, remove notifier MR and munmaps notifier address in the event-handling thread, VM CPU thread writing the notifier in concurrent fails with an error of accessing invalid address. It happens because MR is still being referenced and accessed in another thread while the underlying notifier mmap address is being freed and becomes invalid. This patch calls RCU and munmap notifiers in the callback after the memory flatview update finish. Fixes: 44866521bd6e ("vhost-user: support registering external host notifie= rs") Cc: qemu-stable@nongnu.org Signed-off-by: Xueming Li Message-Id: <20220207071929.527149-3-xuemingl@nvidia.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user.h | 2 ++ hw/virtio/vhost-user.c | 48 ++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h index f6012b2078..e44a41bb70 100644 --- a/include/hw/virtio/vhost-user.h +++ b/include/hw/virtio/vhost-user.h @@ -12,8 +12,10 @@ #include "hw/virtio/virtio.h" =20 typedef struct VhostUserHostNotifier { + struct rcu_head rcu; MemoryRegion mr; void *addr; + void *unmap_addr; } VhostUserHostNotifier; =20 typedef struct VhostUserState { diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index ebe9bd58d0..6abbc9da32 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -25,6 +25,7 @@ #include "migration/migration.h" #include "migration/postcopy-ram.h" #include "trace.h" +#include "exec/ramblock.h" =20 #include #include @@ -1162,15 +1163,26 @@ static int vhost_user_set_vring_num(struct vhost_de= v *dev, return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring); } =20 -static void vhost_user_host_notifier_remove(struct vhost_dev *dev, - int queue_idx) +static void vhost_user_host_notifier_free(VhostUserHostNotifier *n) { - struct vhost_user *u =3D dev->opaque; - VhostUserHostNotifier *n =3D &u->user->notifier[queue_idx]; - VirtIODevice *vdev =3D dev->vdev; + assert(n && n->unmap_addr); + munmap(n->unmap_addr, qemu_real_host_page_size); + n->unmap_addr =3D NULL; +} + +static void vhost_user_host_notifier_remove(VhostUserState *user, + VirtIODevice *vdev, int queue_= idx) +{ + VhostUserHostNotifier *n =3D &user->notifier[queue_idx]; =20 if (n->addr) { - virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, false); + if (vdev) { + virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, fal= se); + } + assert(!n->unmap_addr); + n->unmap_addr =3D n->addr; + n->addr =3D NULL; + call_rcu(n, vhost_user_host_notifier_free, rcu); } } =20 @@ -1219,8 +1231,9 @@ static int vhost_user_get_vring_base(struct vhost_dev= *dev, .payload.state =3D *ring, .hdr.size =3D sizeof(msg.payload.state), }; + struct vhost_user *u =3D dev->opaque; =20 - vhost_user_host_notifier_remove(dev, ring->index); + vhost_user_host_notifier_remove(u->user, dev->vdev, ring->index); =20 ret =3D vhost_user_write(dev, &msg, NULL, 0); if (ret < 0) { @@ -1506,12 +1519,7 @@ static int vhost_user_slave_handle_vring_host_notifi= er(struct vhost_dev *dev, =20 n =3D &user->notifier[queue_idx]; =20 - if (n->addr) { - virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, false); - object_unparent(OBJECT(&n->mr)); - munmap(n->addr, page_size); - n->addr =3D NULL; - } + vhost_user_host_notifier_remove(user, vdev, queue_idx); =20 if (area->u64 & VHOST_USER_VRING_NOFD_MASK) { return 0; @@ -1530,9 +1538,12 @@ static int vhost_user_slave_handle_vring_host_notifi= er(struct vhost_dev *dev, =20 name =3D g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]", user, queue_idx); - if (!n->mr.ram) /* Don't init again after suspend. */ + if (!n->mr.ram) { /* Don't init again after suspend. */ memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name, page_size, addr); + } else { + n->mr.ram_block->host =3D addr; + } g_free(name); =20 if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) { @@ -2505,17 +2516,16 @@ bool vhost_user_init(VhostUserState *user, CharBack= end *chr, Error **errp) void vhost_user_cleanup(VhostUserState *user) { int i; + VhostUserHostNotifier *n; =20 if (!user->chr) { return; } memory_region_transaction_begin(); for (i =3D 0; i < VIRTIO_QUEUE_MAX; i++) { - if (user->notifier[i].addr) { - object_unparent(OBJECT(&user->notifier[i].mr)); - munmap(user->notifier[i].addr, qemu_real_host_page_size); - user->notifier[i].addr =3D NULL; - } + n =3D &user->notifier[i]; + vhost_user_host_notifier_remove(user, NULL, i); + object_unparent(OBJECT(&n->mr)); } memory_region_transaction_commit(); user->chr =3D NULL; --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648173482391.1708171230115; Mon, 7 Mar 2022 02:16:13 -0800 (PST) Received: from localhost ([::1]:58536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAPU-0000Ng-S4 for importer@patchew.org; Mon, 07 Mar 2022 05:16:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABs-0000UC-D5 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:21505) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABk-0002gZ-QH for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:06 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-294-BX7uUI2WOf-rC4zHnTUy-w-1; Mon, 07 Mar 2022 05:01:59 -0500 Received: by mail-ed1-f71.google.com with SMTP id s7-20020a508dc7000000b0040f29ccd65aso8322501edh.1 for ; Mon, 07 Mar 2022 02:01:59 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id p7-20020aa7cc87000000b00410ee30cefbsm5979845edt.71.2022.03.07.02.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647320; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TX6EjlT2hSkO078tNRAKGmtPlKuyy6GjReGhr8QOnJA=; b=Scd3fnrpGqEaaUYXWP6SkFVK1Xax6TpPdPzIBsgsMcx4h6eFOwD7kKVmq9OtUu0zo4/ZGX xun54cGgQfLDzZ6NVpol7PKotiZh+9TW6A+yg49g06wK8A9B2d8ZYtx+TZ/VKjNjZTWMhg /5TCq4S9s/0RdLymikQn3w/jlL0pkN8= X-MC-Unique: BX7uUI2WOf-rC4zHnTUy-w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TX6EjlT2hSkO078tNRAKGmtPlKuyy6GjReGhr8QOnJA=; b=s6PfCVdaylqoCVHMKudXOiayyCcfJjL3RYk41IHIVyvwvaJt17/NosBhXat19+N87N EI++d3qUNnMg2T7xBlQcvY9Mf0cdXlbmUquNI/KUTcC5H2iq7h4rXBj7T3qV+UHbebXZ CSokkDcVI2eP8zerE0eyCN2BbpOic0igCLlxG/n9qJ6Eq3x8AnTVq/LSeo3iID2AXEky XZweuYyfXG1Q0yEJLqQkgbLXIfZvjkrqXVHn1HXu7wXVdPH/L+yn6xaE7DpNbcax8O69 HYqgGs6di2lkIeosaZt13gW9isdN7apIqikxRsRnBlqAumwJgC7NkgAAiRPQ7dlGWudQ JU4A== X-Gm-Message-State: AOAM533+Kbq9QzcTG/tMtopC97xpl50Cawyrd8W07qwmxel/6LG9XHNg fmHei5z2lcGATm1QqOY8Hxdd9ItbYyu5axuV+KHOmAzXSEPjEzYrV5AJUWO1qiMjP7RCExCKsei kOLR1ao8S2R/+cF0JOgfsFV5oUJoG1kAW3JaCGcEA1JvjhMVfeEJXjYboOe5A X-Received: by 2002:a17:906:4fc8:b0:6d8:5059:f998 with SMTP id i8-20020a1709064fc800b006d85059f998mr8453541ejw.487.1646647317616; Mon, 07 Mar 2022 02:01:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCprXD5IcA9trnn58KVwfMHx7GJalHstwr5Au+ge0Ek3fHLwtvAAh3QJNqLqXpFVsCxybNpg== X-Received: by 2002:a17:906:4fc8:b0:6d8:5059:f998 with SMTP id i8-20020a1709064fc800b006d85059f998mr8453501ejw.487.1646647317340; Mon, 07 Mar 2022 02:01:57 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:54 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 11/47] virtio: fix the condition for iommu_platform not supported Message-ID: <20220307100058.449628-12-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Cc: Kevin Wolf , Peter Maydell , Daniel Henrique Barboza , Jason Wang , Cornelia Huck , qemu-stable@nongnu.org, Halil Pasic , Jakob Naucke Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648175755100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Halil Pasic The commit 04ceb61a40 ("virtio: Fail if iommu_platform is requested, but unsupported") claims to fail the device hotplug when iommu_platform is requested, but not supported by the (vhost) device. On the first glance the condition for detecting that situation looks perfect, but because a certain peculiarity of virtio_platform it ain't. In fact the aforementioned commit introduces a regression. It breaks virtio-fs support for Secure Execution, and most likely also for AMD SEV or any other confidential guest scenario that relies encrypted guest memory. The same also applies to any other vhost device that does not support _F_ACCESS_PLATFORM. The peculiarity is that iommu_platform and _F_ACCESS_PLATFORM collates "device can not access all of the guest RAM" and "iova !=3D gpa, thus device needs to translate iova". Confidential guest technologies currently rely on the device/hypervisor offering _F_ACCESS_PLATFORM, so that, after the feature has been negotiated, the guest grants access to the portions of memory the device needs to see. So in for confidential guests, generally, _F_ACCESS_PLATFORM is about the restricted access to memory, but not about the addresses used being something else than guest physical addresses. This is the very reason for which commit f7ef7e6e3b ("vhost: correctly turn on VIRTIO_F_IOMMU_PLATFORM") fences _F_ACCESS_PLATFORM from the vhost device that does not need it, because on the vhost interface it only means "I/O address translation is needed". This patch takes inspiration from f7ef7e6e3b ("vhost: correctly turn on VIRTIO_F_IOMMU_PLATFORM"), and uses the same condition for detecting the situation when _F_ACCESS_PLATFORM is requested, but no I/O translation by the device, and thus no device capability is needed. In this situation claiming that the device does not support iommu_plattform=3Don is counter-productive. So let us stop doing that! Signed-off-by: Halil Pasic Reported-by: Jakob Naucke Fixes: 04ceb61a40 ("virtio: Fail if iommu_platform is requested, but unsupported") Acked-by: Cornelia Huck Reviewed-by: Daniel Henrique Barboza Tested-by: Daniel Henrique Barboza Cc: Kevin Wolf Cc: qemu-stable@nongnu.org Message-Id: <20220207112857.607829-1-pasic@linux.ibm.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang --- hw/virtio/virtio-bus.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c index d23db98c56..0f69d1c742 100644 --- a/hw/virtio/virtio-bus.c +++ b/hw/virtio/virtio-bus.c @@ -48,6 +48,7 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error = **errp) VirtioBusClass *klass =3D VIRTIO_BUS_GET_CLASS(bus); VirtioDeviceClass *vdc =3D VIRTIO_DEVICE_GET_CLASS(vdev); bool has_iommu =3D virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFO= RM); + bool vdev_has_iommu; Error *local_err =3D NULL; =20 DPRINTF("%s: plug device.\n", qbus->name); @@ -69,11 +70,6 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error= **errp) return; } =20 - if (has_iommu && !virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFOR= M)) { - error_setg(errp, "iommu_platform=3Dtrue is not supported by the de= vice"); - return; - } - if (klass->device_plugged !=3D NULL) { klass->device_plugged(qbus->parent, &local_err); } @@ -82,9 +78,15 @@ void virtio_bus_device_plugged(VirtIODevice *vdev, Error= **errp) return; } =20 + vdev_has_iommu =3D virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFO= RM); if (klass->get_dma_as !=3D NULL && has_iommu) { virtio_add_feature(&vdev->host_features, VIRTIO_F_IOMMU_PLATFORM); vdev->dma_as =3D klass->get_dma_as(qbus->parent); + if (!vdev_has_iommu && vdev->dma_as !=3D &address_space_memory) { + error_setg(errp, + "iommu_platform=3Dtrue is not supported by the devi= ce"); + return; + } } else { vdev->dma_as =3D &address_space_memory; } --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648018144280.64028304066744; Mon, 7 Mar 2022 02:13:38 -0800 (PST) Received: from localhost ([::1]:51356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAMz-0003x1-21 for importer@patchew.org; Mon, 07 Mar 2022 05:13:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABs-0000UD-D2 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABn-0002hT-AI for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:06 -0500 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-8LRMnF3TMMa8IFvh4cubZQ-1; Mon, 07 Mar 2022 05:02:01 -0500 Received: by mail-ej1-f70.google.com with SMTP id le4-20020a170907170400b006dab546bc40so3492319ejc.15 for ; Mon, 07 Mar 2022 02:02:01 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id y18-20020a170906471200b006da8a883b5fsm4528304ejq.54.2022.03.07.02.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:01:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xYUjGCjqDKAb5NDT97RnxRdsQlEA2CnL9zsqzwpbiAQ=; b=eoPD3Ro9b7e/OA2V/jBSK3E9cMcgKWOh20hzU8RyKvQFB8k7iNSDguKI4F0o9nLRjrkUXa QwptJfxYu/JsPfF4v1Il3zD6WQwlYnq8CLZ0P0MEI1SFQw+lMBxBw4hykUgL4/gLynNYls 04z6I7TUvkKT7GCISGEmEI/Cg6rKSHk= X-MC-Unique: 8LRMnF3TMMa8IFvh4cubZQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=xYUjGCjqDKAb5NDT97RnxRdsQlEA2CnL9zsqzwpbiAQ=; b=kYrs23zC9N9pJK2p51C3pZw5sxhTe9ffTNLYv0ngyGZ63RC7QD5a+KWZF+0K6gXsjQ nwgTGD2UZl3qqIfTCCy3o1jdquj2ZYIQcNfNJWXzmD2FyuIQ9YAm9OF+/BGff38QmBMt JkDj4hp7ApRezFxn1EBZVOdN23V24ZlZz1WHJJrVpKsw5Yo6WM4wuE1qmbSY3SgMaevt 06+VGgjjkR98wXS20IS1hrnMYdTHoHJhYzmmCpOjtX4j9CihwljXtlXUf9fdFYrIRG9a I5h07BV/lk2Rd/nc4kjhaDcAWXFbagmPqE85eG1pKcoA/C8EmsvBZiZSdwCg2UkYGk4Z IB+g== X-Gm-Message-State: AOAM530IYg43XPOh1gwuPaRQ+NR/tkQ8qSUOgIhwraWM82GF3+gGuNdP 0ML9D5FFrJJ0gELZ7iLHngiZVT2mwz6uhhOl2+AEdNM9wA8tijxFmup8KlQd9oADbjg5dA4qiFg qHx4mT+YMHbX1CRUG93EempcqpE54XXYmTuEILqFtjgpvwF5SHUQPNmz7+4V5 X-Received: by 2002:a17:907:7d94:b0:6db:207:c0cd with SMTP id oz20-20020a1709077d9400b006db0207c0cdmr8218415ejc.362.1646647320114; Mon, 07 Mar 2022 02:02:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzC8Zg6VoOxBScylGaqQxjlF6IgAcGpvmaRmbRLiEqVpcxpXp+7JxkitQvgcRIsp2InfoLgHQ== X-Received: by 2002:a17:907:7d94:b0:6db:207:c0cd with SMTP id oz20-20020a1709077d9400b006db0207c0cdmr8218395ejc.362.1646647319880; Mon, 07 Mar 2022 02:01:59 -0800 (PST) Date: Mon, 7 Mar 2022 05:01:57 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 12/47] hw/vhost-user-i2c: Add support for VIRTIO_I2C_F_ZERO_LENGTH_REQUEST Message-ID: <20220307100058.449628-13-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Alex =?utf-8?Q?Benn=C3=A9e?= , Viresh Kumar Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648018488100001 From: Viresh Kumar VIRTIO_I2C_F_ZERO_LENGTH_REQUEST is a mandatory feature, that must be implemented by everyone. Add its support. Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Viresh Kumar Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user-i2c.h | 3 +++ hw/virtio/vhost-user-i2c.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/vhost-user-i2c.h b/include/hw/virtio/vhost-u= ser-i2c.h index deae47a76d..d8372f3b43 100644 --- a/include/hw/virtio/vhost-user-i2c.h +++ b/include/hw/virtio/vhost-user-i2c.h @@ -25,4 +25,7 @@ struct VHostUserI2C { bool connected; }; =20 +/* Virtio Feature bits */ +#define VIRTIO_I2C_F_ZERO_LENGTH_REQUEST 0 + #endif /* _QEMU_VHOST_USER_I2C_H */ diff --git a/hw/virtio/vhost-user-i2c.c b/hw/virtio/vhost-user-i2c.c index d172632bb0..42c7f6d9e5 100644 --- a/hw/virtio/vhost-user-i2c.c +++ b/hw/virtio/vhost-user-i2c.c @@ -19,6 +19,11 @@ #define VIRTIO_ID_I2C_ADAPTER 34 #endif =20 +static const int feature_bits[] =3D { + VIRTIO_I2C_F_ZERO_LENGTH_REQUEST, + VHOST_INVALID_FEATURE_BIT +}; + static void vu_i2c_start(VirtIODevice *vdev) { BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); @@ -113,8 +118,10 @@ static void vu_i2c_set_status(VirtIODevice *vdev, uint= 8_t status) static uint64_t vu_i2c_get_features(VirtIODevice *vdev, uint64_t requested_features, Error **e= rrp) { - /* No feature bits used yet */ - return requested_features; + VHostUserI2C *i2c =3D VHOST_USER_I2C(vdev); + + virtio_add_feature(&requested_features, VIRTIO_I2C_F_ZERO_LENGTH_REQUE= ST); + return vhost_get_features(&i2c->vhost_dev, feature_bits, requested_fea= tures); } =20 static void vu_i2c_handle_output(VirtIODevice *vdev, VirtQueue *vq) --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648405529499.54010058037545; Mon, 7 Mar 2022 02:20:05 -0800 (PST) Received: from localhost ([::1]:38822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRATF-0006Ja-6m for importer@patchew.org; Mon, 07 Mar 2022 05:20:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34580) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABv-0000VD-6v for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABq-0002hg-9A for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:08 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-240-kKQxzg9jN86FYeMZZLLaHw-1; Mon, 07 Mar 2022 05:02:04 -0500 Received: by mail-ed1-f69.google.com with SMTP id bq19-20020a056402215300b0040f276105a4so8331401edb.2 for ; Mon, 07 Mar 2022 02:02:04 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id v2-20020a509d02000000b00412d53177a6sm5999457ede.20.2022.03.07.02.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647325; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2MmbtRN8dUw8oStDJevhrQCWdjKFEsw6VGH8lAmLmm4=; b=BZl/6xBYchDhLOR+YnNHRCANXuHORimRqj1iTtjhc9iYMksctI35JzSqlrmuOUD+FRVxwu mO90f0TwonOau9fjqF58VSQ9RCFOIE4SRdQ9eq2ltojAXBaNvX5ybxT0CKrYcTlSxy0kB+ Xk70hS0GL7sjAahhdzxn6/sGA5m0iNA= X-MC-Unique: kKQxzg9jN86FYeMZZLLaHw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2MmbtRN8dUw8oStDJevhrQCWdjKFEsw6VGH8lAmLmm4=; b=UPB/SHfS8NSnv3vkmJ5NobtKgOrSSHY2CY9MKDLxV6Y6cxCCKz305VxWx0AvwfQ65X O1fpjs8xXYWTJSs5G3ubFWTuUsAqS2gqQRcJjQ0D0LupoBP7aF+KnKyz4qScg8YHaGyC lO8V74SzjZdAYNx+A5mejHXi+KztaDU16UhCrFVU4eyLF6YUrozA0ULWfRk09HB8Lu5B t+IbSjE1wXDgQKSgIsHC5aILUPE1SG4bY9PoFXcv+8hrVlwp1qeN4tMB3kgCvRwZl3C/ vlEzfeph28rltZdzj591EQsuk0+0VDYKJvSYsZuYIbjrRRtjoMBQvT2PMvQA1I/PsrXz wI6w== X-Gm-Message-State: AOAM531RqvWTeoi+C/7SsFTLTtjVu/bzHi2Equo49dKM3vSsBh3fOUgu GjTE67o1N8ZxtRafuMFuF1Z7H6vwmtzf7SBq9JF79aDy9eAEzhWqwjT6S39vbbkSU2lg3UGruas g8FzQKeU91cfkBoq71y5uEJ2CMJnQ84Gq8WhXABKDKTK6xKtQuC5Q0EY2++lz X-Received: by 2002:a17:907:3ea5:b0:6da:6ef4:b058 with SMTP id hs37-20020a1709073ea500b006da6ef4b058mr8781934ejc.124.1646647322776; Mon, 07 Mar 2022 02:02:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1hAcJCcE4CFbWfxuTvMaT2t+peAlxG4mTvK3jFRo5SmHartrsqhkFUhdFrreq8OuN1vCOtg== X-Received: by 2002:a17:907:3ea5:b0:6da:6ef4:b058 with SMTP id hs37-20020a1709073ea500b006da6ef4b058mr8781908ejc.124.1646647322548; Mon, 07 Mar 2022 02:02:02 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:00 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 13/47] hw/virtio: vdpa: Fix leak of host-notifier memory-region Message-ID: <20220307100058.449628-14-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Cc: Laurent Vivier , Peter Maydell , jasowang@redhat.com, qemu-stable@nongnu.org, Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648407573100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier If call virtio_queue_set_host_notifier_mr fails, should free host-notifier memory-region. This problem can trigger a coredump with some vDPA drivers (mlx5, but not with the vdpasim), if we unplug the virtio-net card from the guest after a stop/start. The same fix has been done for vhost-user: 1f89d3b91e3e ("hw/virtio: Fix leak of host-notifier memory-region") Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possib= le") Cc: jasowang@redhat.com Resolves: https://bugzilla.redhat.com/2027208 Signed-off-by: Laurent Vivier Message-Id: <20220211170259.1388734-1-lvivier@redhat.com> Cc: qemu-stable@nongnu.org Acked-by: Jason Wang Reviewed-by: Stefano Garzarella Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 04ea43704f..11f696468d 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -431,6 +431,7 @@ static int vhost_vdpa_host_notifier_init(struct vhost_d= ev *dev, int queue_index) g_free(name); =20 if (virtio_queue_set_host_notifier_mr(vdev, queue_index, &n->mr, true)= ) { + object_unparent(OBJECT(&n->mr)); munmap(addr, page_size); goto err; } --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648589992182.95115457601707; Mon, 7 Mar 2022 02:23:09 -0800 (PST) Received: from localhost ([::1]:47326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAWC-0003hU-P0 for importer@patchew.org; Mon, 07 Mar 2022 05:23:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABy-0000Xm-4Y for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45133) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABu-0002i9-6d for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:13 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-D5pDOZzLO16mPAzojNIcpg-1; Mon, 07 Mar 2022 05:02:07 -0500 Received: by mail-ej1-f71.google.com with SMTP id go11-20020a1709070d8b00b006cf0d933739so6746179ejc.5 for ; Mon, 07 Mar 2022 02:02:07 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id r11-20020a170906350b00b006dae77c09b3sm2952572eja.154.2022.03.07.02.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XiwXEThr1SLQJqLQ68T7zcCUyaMzcHqcL8oJCLXsU/A=; b=IL5uiEucXYHMtjMC7SqLKM1OxVNK0eKXrXbcW5pJP8tqAD+OOS9IOWoQtijOEjzCeXVF6P OewMZW+iEo+15tRf3TA+0qTPnto7RY+ZYHJQSD+8xWNv3+bSf/SEJG6GNbx1KU8+kSoIvb cohvJCEyoXUaboJVnItwSsEYt1vncrk= X-MC-Unique: D5pDOZzLO16mPAzojNIcpg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=XiwXEThr1SLQJqLQ68T7zcCUyaMzcHqcL8oJCLXsU/A=; b=DpU+372EiWzRuZR2P/vF03deT/2duRlNA6jbGsyMN3hcR7KPSRCCkjLc8yGlXFqCbO q+Dq2e3F5zOZGX0cokdnm2B6qbas4Gyho7IOKA8riWWIEy+wTeNOG7oyToeYr+Zp3H6T uVPuCRPW5MOLHefXMhpTwqSsyQJtRzNopy4R/bZIofC5ueXvXb2/EfcwaZcpY+S0rtyk Zjcf5BHrxUnc3XluEQdrYR1+/XODdpDCJRg1GOhzibRU4AeoIW2Gxwxifm2CSe2CWnaZ tITYX55DKr5nTRzF796I9pvO69V3pbwfPfEIUA2Xp0ZWwhHJxm3B+oEu2ETztQHEfTKl sSqQ== X-Gm-Message-State: AOAM531ru2yKZNOQv6nGjk158n/HCXCS58u7pNHzu/N3xZomNqyneX49 3T4+w//WbJfBup/9aj7qZ907osJ19kQGTBBZT7hGAyPfa8y8h1vETg1z/Z96iSeIgV3mrsPu3PM qJR85/m1L7oRXyol7ulb2dpVHIGAkjPyuAIkxBVskKg/QAYVzYw+5npKFEaMD X-Received: by 2002:a05:6402:4389:b0:410:9a9d:ab53 with SMTP id o9-20020a056402438900b004109a9dab53mr10594453edc.16.1646647325633; Mon, 07 Mar 2022 02:02:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaBAOzzTyH2qQ5jxbIrRYOs97ZCsaa8qGyj4yIbDQqyXSrElZdIgDLMqJ9MvSe7XXGGfv8mw== X-Received: by 2002:a05:6402:4389:b0:410:9a9d:ab53 with SMTP id o9-20020a056402438900b004109a9dab53mr10594430edc.16.1646647325367; Mon, 07 Mar 2022 02:02:05 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:02 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 14/47] vhost-vdpa: make notifiers _init()/_uninit() symmetric Message-ID: <20220307100058.449628-15-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Laurent Vivier , Peter Maydell , jasowang@redhat.com, Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648596713100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Laurent Vivier vhost_vdpa_host_notifiers_init() initializes queue notifiers for queues "dev->vq_index" to queue "dev->vq_index + dev->nvqs", whereas vhost_vdpa_host_notifiers_uninit() uninitializes the same notifiers for queue "0" to queue "dev->nvqs". This asymmetry seems buggy, fix that by using dev->vq_index as the base for both. Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possib= le") Cc: jasowang@redhat.com Signed-off-by: Laurent Vivier Message-Id: <20220211161309.1385839-1-lvivier@redhat.com> Acked-by: Jason Wang Reviewed-by: Stefano Garzarella Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 11f696468d..6c67d5f034 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -395,15 +395,6 @@ static void vhost_vdpa_host_notifier_uninit(struct vho= st_dev *dev, } } =20 -static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n) -{ - int i; - - for (i =3D 0; i < n; i++) { - vhost_vdpa_host_notifier_uninit(dev, i); - } -} - static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_= index) { size_t page_size =3D qemu_real_host_page_size; @@ -443,6 +434,15 @@ err: return -1; } =20 +static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n) +{ + int i; + + for (i =3D dev->vq_index; i < dev->vq_index + n; i++) { + vhost_vdpa_host_notifier_uninit(dev, i); + } +} + static void vhost_vdpa_host_notifiers_init(struct vhost_dev *dev) { int i; @@ -456,7 +456,7 @@ static void vhost_vdpa_host_notifiers_init(struct vhost= _dev *dev) return; =20 err: - vhost_vdpa_host_notifiers_uninit(dev, i); + vhost_vdpa_host_notifiers_uninit(dev, i - dev->vq_index); return; } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648703331570.5304135107708; Mon, 7 Mar 2022 02:25:03 -0800 (PST) Received: from localhost ([::1]:55892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAY2-0000ve-JF for importer@patchew.org; Mon, 07 Mar 2022 05:25:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC0-0000YW-23 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:16 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABw-0002iV-JN for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:14 -0500 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-pEuWaoMdNQixhhiYmEVEiA-1; Mon, 07 Mar 2022 05:02:10 -0500 Received: by mail-ej1-f72.google.com with SMTP id m12-20020a1709062acc00b006cfc98179e2so6769183eje.6 for ; Mon, 07 Mar 2022 02:02:10 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id et3-20020a170907294300b006d6534ef273sm4481168ejc.156.2022.03.07.02.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647331; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0lVkB02NxWofYSS4as/4ncAO6TZl7kf9saq/7ls1Nww=; b=FWB1sGnQyr3TKx3spM21/DZX8G1/nLs6rk/ke0bvNSXKwShd2uF2Kgnv+TBH+GfPBdl+0h G0K0JxehHEX3MCOd54RfFrkonK6lNO9DLoYKwAORdwcL1TBEdlCagS5MIGPbXMkhcLaQ6P caWPPvItnecdPO3PZKub7McuRcN/5rs= X-MC-Unique: pEuWaoMdNQixhhiYmEVEiA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0lVkB02NxWofYSS4as/4ncAO6TZl7kf9saq/7ls1Nww=; b=khtsWhLdjT8Njqz4cMqvRzaqGmlFZjLXbJLY9apZ1VOdiXP9T9ZsQV1JHpViut1o0U mmiAlYQ3SvIvgeQzctgPf9vclc4W5AWR+9qpMDaeOZA/RQqQNziQxuYLTFPgcsjzbNNf enp9oryuxlc6fct0yedqnXYhOnf0WEl+kl6DcdL+FM1v49hM682ZunBh3Q7NvHnVSRB2 PXqAc74E+KssSWqGtpbur4g4oIEzn/Dso7F26azSSSsuqmgBcqs4yNTekW9p86bYq4Hm is9YKnJUcTXDaMIkFs5ggVxfwr/pMrBxmOGwPGtzxPY/N2oeIxC/syZKJKuNaRh2S6kQ azJw== X-Gm-Message-State: AOAM532m6QRA3l8hTDYIneGO0mjsAYU+cUYpCXlibzfRn7z77EvLHp9/ cRPiw4UCg7MeajwRZ6nTgzS7s8ebqQFy+rMx5XAfo+fKz0BZ0xcVgj/YUZ2S6ZXCDWD6PX9IDqK 0FFRJVf8Q5PQdg9T+/zFE8PNTcdep5alGomR4FK47C48EvT5eXg6RsSLpM+hu X-Received: by 2002:a17:906:584:b0:6b0:8987:90af with SMTP id 4-20020a170906058400b006b0898790afmr8797658ejn.264.1646647328814; Mon, 07 Mar 2022 02:02:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPXPh//W4NXGBD7YFX6xt9HwjVSgRIpLSg3ijZBGyYYsGqlZ3WhZPLATdoSM2Qn0sixoVHpg== X-Received: by 2002:a17:906:584:b0:6b0:8987:90af with SMTP id 4-20020a170906058400b006b0898790afmr8797629ejn.264.1646647328446; Mon, 07 Mar 2022 02:02:08 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:05 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 15/47] intel_iommu: support snoop control Message-ID: <20220307100058.449628-16-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Jason Wang , Richard Henderson , Peter Xu , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648705956100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jason Wang SC is required for some kernel features like vhost-vDPA. So this patch implements basic SC feature. The idea is pretty simple, for software emulated DMA it would be always coherent. In this case we can simple advertise ECAP_SC bit. For VFIO and vhost, thing will be more much complicated, so this patch simply fail the IOMMU notifier registration. In the future, we may want to have a dedicated notifiers flag or similar mechanism to demonstrate the coherency so VFIO could advertise that if it has VFIO_DMA_CC_IOMMU, for vhost kernel backend we don't need that since it's a software backend. Signed-off-by: Jason Wang Message-Id: <20220214060346.72455-1-jasowang@redhat.com> Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 1 + include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index a6c788049b..1ff13b40f9 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -188,6 +188,7 @@ #define VTD_ECAP_IR (1ULL << 3) #define VTD_ECAP_EIM (1ULL << 4) #define VTD_ECAP_PT (1ULL << 6) +#define VTD_ECAP_SC (1ULL << 7) #define VTD_ECAP_MHMV (15ULL << 20) #define VTD_ECAP_SRS (1ULL << 31) #define VTD_ECAP_SMTS (1ULL << 43) diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index 41783ee46d..3b5ac869db 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -228,6 +228,7 @@ struct IntelIOMMUState { =20 bool caching_mode; /* RO - is cap CM enabled? */ bool scalable_mode; /* RO - is Scalable Mode supported? */ + bool snoop_control; /* RO - is SNP filed supported? */ =20 dma_addr_t root; /* Current root table pointer */ bool root_scalable; /* Type of root table (scalable or not= ) */ diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 4c6c016388..32471a44cb 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3030,6 +3030,13 @@ static int vtd_iommu_notify_flag_changed(IOMMUMemory= Region *iommu, VTDAddressSpace *vtd_as =3D container_of(iommu, VTDAddressSpace, iommu= ); IntelIOMMUState *s =3D vtd_as->iommu_state; =20 + /* TODO: add support for VFIO and vhost users */ + if (s->snoop_control) { + error_setg_errno(errp, -ENOTSUP, + "Snoop Control with vhost or VFIO is not supporte= d"); + return -ENOTSUP; + } + /* Update per-address-space notifier flags */ vtd_as->notifier_flags =3D new; =20 @@ -3113,6 +3120,7 @@ static Property vtd_properties[] =3D { VTD_HOST_ADDRESS_WIDTH), DEFINE_PROP_BOOL("caching-mode", IntelIOMMUState, caching_mode, FALSE), DEFINE_PROP_BOOL("x-scalable-mode", IntelIOMMUState, scalable_mode, FA= LSE), + DEFINE_PROP_BOOL("snoop-control", IntelIOMMUState, snoop_control, fals= e), DEFINE_PROP_BOOL("dma-drain", IntelIOMMUState, dma_drain, true), DEFINE_PROP_END_OF_LIST(), }; @@ -3643,7 +3651,7 @@ static void vtd_init(IntelIOMMUState *s) vtd_spte_rsvd_large[3] =3D VTD_SPTE_LPAGE_L3_RSVD_MASK(s->aw_bits, x86_iommu->dt_sup= ported); =20 - if (s->scalable_mode) { + if (s->scalable_mode || s->snoop_control) { vtd_spte_rsvd[1] &=3D ~VTD_SPTE_SNP; vtd_spte_rsvd_large[2] &=3D ~VTD_SPTE_SNP; vtd_spte_rsvd_large[3] &=3D ~VTD_SPTE_SNP; @@ -3674,6 +3682,10 @@ static void vtd_init(IntelIOMMUState *s) s->ecap |=3D VTD_ECAP_SMTS | VTD_ECAP_SRS | VTD_ECAP_SLTS; } =20 + if (s->snoop_control) { + s->ecap |=3D VTD_ECAP_SC; + } + vtd_reset_caches(s); =20 /* Define registers with default values and bit semantics */ --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648195071826.6768225521729; Mon, 7 Mar 2022 02:16:35 -0800 (PST) Received: from localhost ([::1]:60052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAPq-0001QW-2X for importer@patchew.org; Mon, 07 Mar 2022 05:16:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC1-0000dV-D2 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRABz-0002in-OI for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:17 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-XIH1NRjFO5iW-VQJM7azsA-1; Mon, 07 Mar 2022 05:02:14 -0500 Received: by mail-ej1-f71.google.com with SMTP id r18-20020a17090609d200b006a6e943d09eso6720851eje.20 for ; Mon, 07 Mar 2022 02:02:13 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id l20-20020a1709066b9400b006dabdbc8350sm3287698ejr.30.2022.03.07.02.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hG63fk2e7vwNR105jMKcH2PAlFDWHa3moRydXJnnvuY=; b=J1aEWKft+Megn95gk2jxc6SeIP+eXqh/0jBvPFtHTwkDYuUQt6Rlj4OaxcLsjVURNo1Pr0 cL7FY/to5jHOJULWxQgjsYVriL+9HdCh1IHaN05f18UVAnED0dLTVkN8fRK1TGujhRzMh1 7+QR2hChUtphu3fZGXfBBKGB7DIIusc= X-MC-Unique: XIH1NRjFO5iW-VQJM7azsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=hG63fk2e7vwNR105jMKcH2PAlFDWHa3moRydXJnnvuY=; b=798Au8A8ThzC2EEz9jmQ2ppBTKo9q48JcOPRx989fa+2BEmF7oCkm5hbT9NyICnpfu 8yzTzXl1XphOEv1ED+6H8JxORUD/V1E28OIQOuyfZZg4DOXD+VvAxFBTnAOUdbY8Cuse xWNkbF/B3bi1aEuYrN/AuiJGQRjjIhYLBsIXIoGSwmjIdhxPuBeb+XkfmK5CKNBhbx0J 1tKWhPEMfhn8w2qoYpnwHFolJTWCwgsyqWORfCkDUtI4d4t8BPDwOPnHdN9TsCcp4uxP 29A76AxHTMvyYVCYduroxNf5BWYAZPDKeuk1vilXWPKyrJIRxA3UgGWdbfOLn78b8DFh E15g== X-Gm-Message-State: AOAM530sWBFFH3QIIFffzPBbu+JWUjkVa8gQrDg9YBs+g2HXfUnSsyAP yBBNn6/qyYE4T7pxD+hB7EUBRmuxtxfUNT2tIn+feP53fRWmqsFVDV0o7xNS0ptZ4W8VX2Nrz3X Sk+6Ko5iTfC0l8/DWXNZlcY32unyyB4rTctpVQ1i83JM5T7Ut07cRz5K6HbOv X-Received: by 2002:a17:906:18b2:b0:6d0:ee54:1add with SMTP id c18-20020a17090618b200b006d0ee541addmr8489607ejf.499.1646647332445; Mon, 07 Mar 2022 02:02:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD352Zlh1g3fU5ES686TgbT2PT1ZWrTE6EmIhj1uw0EOmgqGn30dq/fXC8MZ4ZoWpDZJ2v3A== X-Received: by 2002:a17:906:18b2:b0:6d0:ee54:1add with SMTP id c18-20020a17090618b200b006d0ee541addmr8489581ejf.499.1646647332219; Mon, 07 Mar 2022 02:02:12 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:08 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 16/47] hw/i386: Improve bounds checking in OVMF table parsing Message-ID: <20220307100058.449628-17-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Daniel P =?utf-8?B?LiBCZXJyYW5nw6k=?= , Richard Henderson , "Dr . David Alan Gilbert" , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Dov Murik , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648195934100001 From: Dov Murik When pc_system_parse_ovmf_flash() parses the optional GUIDed table in the end of the OVMF flash memory area, the table length field is checked for sizes that are too small, but doesn't error on sizes that are too big (bigger than the flash content itself). Add a check for maximal size of the OVMF table, and add an error report in case the size is invalid. In such a case, an error like this will be displayed during launch: qemu-system-x86_64: OVMF table has invalid size 4047 and the table parsing is skipped. Signed-off-by: Dov Murik Message-Id: <20220222071906.2632426-2-dovmurik@linux.ibm.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Dr. David Alan Gilbert --- hw/i386/pc_sysfw_ovmf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_sysfw_ovmf.c b/hw/i386/pc_sysfw_ovmf.c index f4dd92c588..df15c9737b 100644 --- a/hw/i386/pc_sysfw_ovmf.c +++ b/hw/i386/pc_sysfw_ovmf.c @@ -24,6 +24,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/i386/pc.h" #include "cpu.h" =20 @@ -66,7 +67,13 @@ void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, size= _t flash_size) ptr -=3D sizeof(uint16_t); tot_len =3D le16_to_cpu(*(uint16_t *)ptr) - sizeof(guid) - sizeof(uint= 16_t); =20 - if (tot_len <=3D 0) { + if (tot_len < 0 || tot_len > (ptr - flash_ptr)) { + error_report("OVMF table has invalid size %d", tot_len); + return; + } + + if (tot_len =3D=3D 0) { + /* no entries in the OVMF table */ return; } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648460433242.09131379243252; Mon, 7 Mar 2022 02:21:00 -0800 (PST) Received: from localhost ([::1]:40464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAU7-0007R9-CF for importer@patchew.org; Mon, 07 Mar 2022 05:20:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC4-0000mD-KA for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:20 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59768) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC3-0002k9-2X for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:20 -0500 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-180-zy8YCBtvPoWszThVzUF0bg-1; Mon, 07 Mar 2022 05:02:17 -0500 Received: by mail-ej1-f69.google.com with SMTP id 13-20020a170906328d00b006982d0888a4so6693487ejw.9 for ; Mon, 07 Mar 2022 02:02:17 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id kw5-20020a170907770500b006db075e5358sm2121288ejc.66.2022.03.07.02.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647338; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xIYTx9xMPVdCirDAB9Y8FCSD6kEXvGl7DGfbZeP6K2A=; b=gUQaHjcC4SUmviuN7u6y6qC2yhcQXf5CnZQMH7Ro0dXQ/6i7okOeDOZE2Ub4iM5UNZggb6 AASwS79MuEOSrersS7me+qHtiX9OjpGcYKnlP+TJwV31sP3wXj+JUUAD6KVrYD6kW+OSqf hOQn25p+J+We9m1TS4WxYUL+d/6myRA= X-MC-Unique: zy8YCBtvPoWszThVzUF0bg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=xIYTx9xMPVdCirDAB9Y8FCSD6kEXvGl7DGfbZeP6K2A=; b=RfwLfcxZz3hkEpLdotYC3uaNAzB6oEWKt4x0Y7Riujq+12mQoe18FYOaG0L8V6evd3 DClu/GzJjkCXyAJWF53hGQdrNKhLk8Ug5su4FQJzZr7KD2dLncxbzabwATZp3yhya44j Di1RX7go9wGzsB2ooxBX1aIqEslTBux/mD4rhXRseNKw0jAjTa8eDL3CcLox57OF941q T5E0hBbwxi5L72z2U+PuZwL1iBoNZ0utioy2253rfSBt2auIQ5j0OifCcdKLynG7Ydig ky40Q0twuGV3/6kXIbXF9T8heNVACNju3l7aJ/tqi+pbkWwRh0hipWoUt1Kq8ksPSe7Q ErAw== X-Gm-Message-State: AOAM530/7cB2uCsVx3f3BulZAwX1woFq6eWB6aDmLC3L+Sl/EPgkFfp2 cIqweP67X48Tj5mo5P1/KQPudVhNEwCEXmiQy+mADYQUUOpgj3DM3dF1BDskAmSm2Z0gMTum2Cx S8qub1uz4UBmqnKlf5N4DrhIe13EGw3zKDyY7SsxuYaRV0xf+Ts2U9QmgvsxM X-Received: by 2002:aa7:c80b:0:b0:416:463c:309c with SMTP id a11-20020aa7c80b000000b00416463c309cmr4296731edt.413.1646647335961; Mon, 07 Mar 2022 02:02:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5e6dBcxeNTgKBJ57jBtNFctF36uloJS2bQTdB9go52laQwxVHsdanAMkr6yewhQ2dL9/F8Q== X-Received: by 2002:aa7:c80b:0:b0:416:463c:309c with SMTP id a11-20020aa7c80b000000b00416463c309cmr4296695edt.413.1646647335572; Mon, 07 Mar 2022 02:02:15 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:12 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 17/47] hw/i386: Replace magic number with field length calculation Message-ID: <20220307100058.449628-18-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Daniel P =?utf-8?B?LiBCZXJyYW5nw6k=?= , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Dov Murik , Gerd Hoffmann , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648461753100049 From: Dov Murik Replce the literal magic number 48 with length calculation (32 bytes at the end of the firmware after the table footer + 16 bytes of the OVMF table footer GUID). No functional change intended. Signed-off-by: Dov Murik Message-Id: <20220222071906.2632426-3-dovmurik@linux.ibm.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/i386/pc_sysfw_ovmf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc_sysfw_ovmf.c b/hw/i386/pc_sysfw_ovmf.c index df15c9737b..07a4c267fa 100644 --- a/hw/i386/pc_sysfw_ovmf.c +++ b/hw/i386/pc_sysfw_ovmf.c @@ -30,6 +30,8 @@ =20 #define OVMF_TABLE_FOOTER_GUID "96b582de-1fb2-45f7-baea-a366c55a082d" =20 +static const int bytes_after_table_footer =3D 32; + static bool ovmf_flash_parsed; static uint8_t *ovmf_table; static int ovmf_table_len; @@ -53,12 +55,13 @@ void pc_system_parse_ovmf_flash(uint8_t *flash_ptr, siz= e_t flash_size) =20 /* * if this is OVMF there will be a table footer - * guid 48 bytes before the end of the flash file. If it's - * not found, silently abort the flash parsing. + * guid 48 bytes before the end of the flash file + * (=3D 32 bytes after the table + 16 bytes the GUID itself). + * If it's not found, silently abort the flash parsing. */ qemu_uuid_parse(OVMF_TABLE_FOOTER_GUID, &guid); guid =3D qemu_uuid_bswap(guid); /* guids are LE */ - ptr =3D flash_ptr + flash_size - 48; + ptr =3D flash_ptr + flash_size - (bytes_after_table_footer + sizeof(gu= id)); if (!qemu_uuid_is_equal((QemuUUID *)ptr, &guid)) { return; } --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648073160708.0265876199046; Mon, 7 Mar 2022 02:14:33 -0800 (PST) Received: from localhost ([::1]:54008 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRANs-0005mF-1v for importer@patchew.org; Mon, 07 Mar 2022 05:14:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC7-0000sq-Um for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC5-0002ke-VE for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:23 -0500 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-287-EZJqqqapPCKF927wfj-sKA-1; Mon, 07 Mar 2022 05:02:20 -0500 Received: by mail-ej1-f70.google.com with SMTP id m4-20020a170906160400b006be3f85906eso6756777ejd.23 for ; Mon, 07 Mar 2022 02:02:20 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id d8-20020a170906640800b006d5853081b7sm4554243ejm.70.2022.03.07.02.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AvJNwnWWD1CymBBhgu2K/AQWWIjBAXRCR+0fK9AzI+o=; b=XBAjaKxFZ+iN7HmiPTy/lnc3QRzRIneTHN7mH0eCmtEvkuYUxThU7OaGqVD99bq4ayhXSv CQv3uwd+xi8pZum3DwOHKWdlqB6C0XzpOfAAvDq5ETePIw7Eplin2qN/z3MQA7i/TQkmrH uHJYoEkBsa9YPHQ5JvIDMlD/68dBj+k= X-MC-Unique: EZJqqqapPCKF927wfj-sKA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AvJNwnWWD1CymBBhgu2K/AQWWIjBAXRCR+0fK9AzI+o=; b=m8B0moQXNTKYFSottZNHT3tUlavAJvTfDqC6appeWdkJGL8TGpURCk1Gh/CzTce4Ge W4CMsDX9sX9Eg+p0mTupQgxI49HyHqIJLAoN3DI/XKqX5VDFWmpD7X0QZYonRLvWM5Fm S/NtqjASpqzEcm0+QLWQXB3Y4ojGprqvjnHqzBRtdem7qSQMmtcw/A7UCw3TRzqil4UE vQaJi1XyztMu+ADnzG3bdqAc3F2J3uVzmniY+JmeKLaFfOqjOZ3iz7oazB/y9UZn3jW5 BWpqfpLpjFa3HULC5BxNYFpzeuyU0C5bxJHOxSywsh+Of5wQi4VOatQwp0KAV40iGZtx m8Aw== X-Gm-Message-State: AOAM5336K7I5cNZ4losPi2Yp9JuGBglRbsgdMhbEgjxwHsz5avNA+Jmj D/wGu8GwoEjkzswKirU/RXHGi+9jHDyaDbkGFCB5fNMr250dBs2y9Xxnq8AHHJDIyFq5wdxYq4l 5kONyoiBjUGMpwGQUtT5R18f7s4Oc1ldmBEcaOLPQVthPr8587bmEYQL6hB3+ X-Received: by 2002:a05:6402:3586:b0:415:be04:2b10 with SMTP id y6-20020a056402358600b00415be042b10mr10337612edc.120.1646647338584; Mon, 07 Mar 2022 02:02:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzErLPshfcPW8+mAjt61dgMHEUxCa6y5qeSP2EtDx+WflrpDUHbKlm5vHZmIP+wGNsCWhAfgA== X-Received: by 2002:a05:6402:3586:b0:415:be04:2b10 with SMTP id y6-20020a056402358600b00415be042b10mr10337589edc.120.1646647338272; Mon, 07 Mar 2022 02:02:18 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:15 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 18/47] virtio-iommu: Default to bypass during boot Message-ID: <20220307100058.449628-19-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Cornelia Huck , Eric Auger , Jean-Philippe Brucker Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648074890100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jean-Philippe Brucker Currently the virtio-iommu device must be programmed before it allows DMA from any PCI device. This can make the VM entirely unusable when a virtio-iommu driver isn't present, for example in a bootloader that loads the OS from storage. Similarly to the other vIOMMU implementations, default to DMA bypassing the IOMMU during boot. Add a "boot-bypass" property, defaulting to true, that lets users change this behavior. Replace the VIRTIO_IOMMU_F_BYPASS feature, which didn't support bypass before feature negotiation, with VIRTIO_IOMMU_F_BYPASS_CONFIG. We add the bypass field to the migration stream without introducing subsections, based on the assumption that this virtio-iommu device isn't being used in production enough to require cross-version migration at the moment (all previous version required workarounds since they didn't support ACPI and boot-bypass). Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker Message-Id: <20220214124356.872985-3-jean-philippe@linaro.org> Acked-by: Cornelia Huck Reviewed-by: Eric Auger Tested-by: Eric Auger Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-iommu.h | 1 + hw/virtio/virtio-iommu.c | 60 +++++++++++++++++++++++++++----- hw/virtio/trace-events | 4 ++- 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-io= mmu.h index e2339e5b72..84391f8448 100644 --- a/include/hw/virtio/virtio-iommu.h +++ b/include/hw/virtio/virtio-iommu.h @@ -58,6 +58,7 @@ struct VirtIOIOMMU { GTree *domains; QemuMutex mutex; GTree *endpoints; + bool boot_bypass; }; =20 #endif diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index aa9c16a17b..4ca36db4ac 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -24,6 +24,7 @@ #include "hw/qdev-properties.h" #include "hw/virtio/virtio.h" #include "sysemu/kvm.h" +#include "sysemu/reset.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "trace.h" @@ -728,8 +729,7 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemory= Region *mr, hwaddr addr, .perm =3D IOMMU_NONE, }; =20 - bypass_allowed =3D virtio_vdev_has_feature(&s->parent_obj, - VIRTIO_IOMMU_F_BYPASS); + bypass_allowed =3D s->config.bypass; =20 sid =3D virtio_iommu_get_bdf(sdev); =20 @@ -831,13 +831,37 @@ static void virtio_iommu_get_config(VirtIODevice *vde= v, uint8_t *config_data) out_config->domain_range.start =3D cpu_to_le32(dev_config->domain_rang= e.start); out_config->domain_range.end =3D cpu_to_le32(dev_config->domain_range.= end); out_config->probe_size =3D cpu_to_le32(dev_config->probe_size); + out_config->bypass =3D dev_config->bypass; =20 trace_virtio_iommu_get_config(dev_config->page_size_mask, dev_config->input_range.start, dev_config->input_range.end, dev_config->domain_range.start, dev_config->domain_range.end, - dev_config->probe_size); + dev_config->probe_size, + dev_config->bypass); +} + +static void virtio_iommu_set_config(VirtIODevice *vdev, + const uint8_t *config_data) +{ + VirtIOIOMMU *dev =3D VIRTIO_IOMMU(vdev); + struct virtio_iommu_config *dev_config =3D &dev->config; + const struct virtio_iommu_config *in_config =3D (void *)config_data; + + if (in_config->bypass !=3D dev_config->bypass) { + if (!virtio_vdev_has_feature(vdev, VIRTIO_IOMMU_F_BYPASS_CONFIG)) { + virtio_error(vdev, "cannot set config.bypass"); + return; + } else if (in_config->bypass !=3D 0 && in_config->bypass !=3D 1) { + virtio_error(vdev, "invalid config.bypass value '%u'", + in_config->bypass); + return; + } + dev_config->bypass =3D in_config->bypass; + } + + trace_virtio_iommu_set_config(in_config->bypass); } =20 static uint64_t virtio_iommu_get_features(VirtIODevice *vdev, uint64_t f, @@ -963,6 +987,19 @@ static int virtio_iommu_set_page_size_mask(IOMMUMemory= Region *mr, return 0; } =20 +static void virtio_iommu_system_reset(void *opaque) +{ + VirtIOIOMMU *s =3D opaque; + + trace_virtio_iommu_system_reset(); + + /* + * config.bypass is sticky across device reset, but should be restored= on + * system reset + */ + s->config.bypass =3D s->boot_bypass; +} + static void virtio_iommu_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); @@ -988,9 +1025,9 @@ static void virtio_iommu_device_realize(DeviceState *d= ev, Error **errp) virtio_add_feature(&s->features, VIRTIO_IOMMU_F_INPUT_RANGE); virtio_add_feature(&s->features, VIRTIO_IOMMU_F_DOMAIN_RANGE); virtio_add_feature(&s->features, VIRTIO_IOMMU_F_MAP_UNMAP); - virtio_add_feature(&s->features, VIRTIO_IOMMU_F_BYPASS); virtio_add_feature(&s->features, VIRTIO_IOMMU_F_MMIO); virtio_add_feature(&s->features, VIRTIO_IOMMU_F_PROBE); + virtio_add_feature(&s->features, VIRTIO_IOMMU_F_BYPASS_CONFIG); =20 qemu_mutex_init(&s->mutex); =20 @@ -1001,6 +1038,8 @@ static void virtio_iommu_device_realize(DeviceState *= dev, Error **errp) } else { error_setg(errp, "VIRTIO-IOMMU is not attached to any PCI bus!"); } + + qemu_register_reset(virtio_iommu_system_reset, s); } =20 static void virtio_iommu_device_unrealize(DeviceState *dev) @@ -1008,6 +1047,8 @@ static void virtio_iommu_device_unrealize(DeviceState= *dev) VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtIOIOMMU *s =3D VIRTIO_IOMMU(dev); =20 + qemu_unregister_reset(virtio_iommu_system_reset, s); + g_hash_table_destroy(s->as_by_busptr); if (s->domains) { g_tree_destroy(s->domains); @@ -1141,21 +1182,22 @@ static int iommu_post_load(void *opaque, int versio= n_id) =20 static const VMStateDescription vmstate_virtio_iommu_device =3D { .name =3D "virtio-iommu-device", - .minimum_version_id =3D 1, - .version_id =3D 1, + .minimum_version_id =3D 2, + .version_id =3D 2, .post_load =3D iommu_post_load, .fields =3D (VMStateField[]) { VMSTATE_GTREE_DIRECT_KEY_V(domains, VirtIOIOMMU, 1, &vmstate_domain, VirtIOIOMMUDomain), + VMSTATE_UINT8_V(config.bypass, VirtIOIOMMU, 2), VMSTATE_END_OF_LIST() }, }; =20 static const VMStateDescription vmstate_virtio_iommu =3D { .name =3D "virtio-iommu", - .minimum_version_id =3D 1, + .minimum_version_id =3D 2, .priority =3D MIG_PRI_IOMMU, - .version_id =3D 1, + .version_id =3D 2, .fields =3D (VMStateField[]) { VMSTATE_VIRTIO_DEVICE, VMSTATE_END_OF_LIST() @@ -1164,6 +1206,7 @@ static const VMStateDescription vmstate_virtio_iommu = =3D { =20 static Property virtio_iommu_properties[] =3D { DEFINE_PROP_LINK("primary-bus", VirtIOIOMMU, primary_bus, "PCI", PCIBu= s *), + DEFINE_PROP_BOOL("boot-bypass", VirtIOIOMMU, boot_bypass, true), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -1180,6 +1223,7 @@ static void virtio_iommu_class_init(ObjectClass *klas= s, void *data) vdc->unrealize =3D virtio_iommu_device_unrealize; vdc->reset =3D virtio_iommu_device_reset; vdc->get_config =3D virtio_iommu_get_config; + vdc->set_config =3D virtio_iommu_set_config; vdc->get_features =3D virtio_iommu_get_features; vdc->set_status =3D virtio_iommu_set_status; vdc->vmsd =3D &vmstate_virtio_iommu_device; diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index f7ad6be5fb..a5102eac9e 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -89,9 +89,11 @@ virtio_mmio_setting_irq(int level) "virtio_mmio setting = IRQ %d" =20 # virtio-iommu.c virtio_iommu_device_reset(void) "reset!" +virtio_iommu_system_reset(void) "system reset!" virtio_iommu_get_features(uint64_t features) "device supports features=3D0= x%"PRIx64 virtio_iommu_device_status(uint8_t status) "driver status =3D %d" -virtio_iommu_get_config(uint64_t page_size_mask, uint64_t start, uint64_t = end, uint32_t domain_start, uint32_t domain_end, uint32_t probe_size) "page= _size_mask=3D0x%"PRIx64" input range start=3D0x%"PRIx64" input range end=3D= 0x%"PRIx64" domain range start=3D%d domain range end=3D%d probe_size=3D0x%x" +virtio_iommu_get_config(uint64_t page_size_mask, uint64_t start, uint64_t = end, uint32_t domain_start, uint32_t domain_end, uint32_t probe_size, uint8= _t bypass) "page_size_mask=3D0x%"PRIx64" input range start=3D0x%"PRIx64" in= put range end=3D0x%"PRIx64" domain range start=3D%d domain range end=3D%d p= robe_size=3D0x%x bypass=3D0x%x" +virtio_iommu_set_config(uint8_t bypass) "bypass=3D0x%x" virtio_iommu_attach(uint32_t domain_id, uint32_t ep_id) "domain=3D%d endpo= int=3D%d" virtio_iommu_detach(uint32_t domain_id, uint32_t ep_id) "domain=3D%d endpo= int=3D%d" virtio_iommu_map(uint32_t domain_id, uint64_t virt_start, uint64_t virt_en= d, uint64_t phys_start, uint32_t flags) "domain=3D%d virt_start=3D0x%"PRIx6= 4" virt_end=3D0x%"PRIx64 " phys_start=3D0x%"PRIx64" flags=3D%d" --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648608191657.8064072864017; Mon, 7 Mar 2022 02:23:28 -0800 (PST) Received: from localhost ([::1]:48938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAWV-0004k9-Vo for importer@patchew.org; Mon, 07 Mar 2022 05:23:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACA-00010s-QM for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAC8-0002kx-UZ for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:26 -0500 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-UCvsyqx_OE-5J2vuU7gV5g-1; Mon, 07 Mar 2022 05:02:23 -0500 Received: by mail-ed1-f72.google.com with SMTP id co2-20020a0564020c0200b00415f9fa6ca8so4848258edb.6 for ; Mon, 07 Mar 2022 02:02:23 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id o23-20020a170906861700b006da745f7233sm4521160ejx.5.2022.03.07.02.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647344; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JMuvtu5n6lVU0KTov6tttqgUMeVGZs5d6LsC2M1zLP4=; b=GRCiLZVa0mta6RAiGV8TxZ+jZJS58TuzWrYE93CGME2DaNQduhYx8SBEzRu3ydkuIJ8B7y ELVS6c2xcdFjEd+kDxvz6kmVulstjTPqtn/fMJo64m20xe2YqXN17VvZ97GC6NJqWW5i71 pn6p4gFp6lG5tuITfZb2SuegUeuP99o= X-MC-Unique: UCvsyqx_OE-5J2vuU7gV5g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JMuvtu5n6lVU0KTov6tttqgUMeVGZs5d6LsC2M1zLP4=; b=BKoFLWNq/fiv7haBkzencqEoIYBi5fK2v4fTk8ThDpnx29jeI9LYJcmHc28S1hPY9o Yd4zSlTRUtJCKW1qm5jivKzq0Dj6PyDtlt1jUXEsYmHNsPnvvUBNqUcHzv2sJygKbthz ldLXkKomz4ZwaQHZhTQzEsEvxAy+/DXMNHXPjLHKBFRv7KVGjSIMBBhjqqK15c1I2W0X b6AH39QUlxFFJCH0PER7bdmpKlDcYATs/V6NGRJ6wAxta12IA50dQm0CS5cKMJ9N6kp1 gCCXNDpxWajUL1vcAJDKzYtaI7ONYfq1RlCpf6E8eRTpE/FQbtYJKDVVgZOvOwWlUwNA 7Wrw== X-Gm-Message-State: AOAM5319Q0OCAPCChUwcTFSYfDrPOC6ByiYBb/mXup7eZ4wms67HAwwj 9wswExmlxbvJ8XlBHtcnP3KnDqrhaSYV7dEE3XG+wYokX/UNTcD/432OyywsGuFc08/fueaMiEE 4oV6vm4+cq6m/7QjYjYxiVIT2p9kRRzLXmqcPUq5SqHaGY/4NfHdFx2ldVqhI X-Received: by 2002:a17:906:a057:b0:6cf:2736:ba65 with SMTP id bg23-20020a170906a05700b006cf2736ba65mr8587857ejb.171.1646647341892; Mon, 07 Mar 2022 02:02:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMvOhO1MYkim1Fv/aVoZ7Bgebz5h7oGtaTHV8J5vcibJZlbQOzFu4WP3O06eRiPt9kNY9rag== X-Received: by 2002:a17:906:a057:b0:6cf:2736:ba65 with SMTP id bg23-20020a170906a05700b006cf2736ba65mr8587835ejb.171.1646647341632; Mon, 07 Mar 2022 02:02:21 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:18 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 19/47] virtio-iommu: Support bypass domain Message-ID: <20220307100058.449628-20-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Cornelia Huck , Eric Auger , Jean-Philippe Brucker Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648638867100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jean-Philippe Brucker The driver can create a bypass domain by passing the VIRTIO_IOMMU_ATTACH_F_BYPASS flag on the ATTACH request. Bypass domains perform slightly better than domains with identity mappings since they skip translation. Signed-off-by: Jean-Philippe Brucker Message-Id: <20220214124356.872985-4-jean-philippe@linaro.org> Acked-by: Cornelia Huck Reviewed-by: Eric Auger Tested-by: Eric Auger Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/hw/virtio/virtio-iommu.c b/hw/virtio/virtio-iommu.c index 4ca36db4ac..239fe97b12 100644 --- a/hw/virtio/virtio-iommu.c +++ b/hw/virtio/virtio-iommu.c @@ -43,6 +43,7 @@ =20 typedef struct VirtIOIOMMUDomain { uint32_t id; + bool bypass; GTree *mappings; QLIST_HEAD(, VirtIOIOMMUEndpoint) endpoint_list; } VirtIOIOMMUDomain; @@ -258,12 +259,16 @@ static void virtio_iommu_put_endpoint(gpointer data) } =20 static VirtIOIOMMUDomain *virtio_iommu_get_domain(VirtIOIOMMU *s, - uint32_t domain_id) + uint32_t domain_id, + bool bypass) { VirtIOIOMMUDomain *domain; =20 domain =3D g_tree_lookup(s->domains, GUINT_TO_POINTER(domain_id)); if (domain) { + if (domain->bypass !=3D bypass) { + return NULL; + } return domain; } domain =3D g_malloc0(sizeof(*domain)); @@ -271,6 +276,7 @@ static VirtIOIOMMUDomain *virtio_iommu_get_domain(VirtI= OIOMMU *s, domain->mappings =3D g_tree_new_full((GCompareDataFunc)interval_cmp, NULL, (GDestroyNotify)g_free, (GDestroyNotify)g_free); + domain->bypass =3D bypass; g_tree_insert(s->domains, GUINT_TO_POINTER(domain_id), domain); QLIST_INIT(&domain->endpoint_list); trace_virtio_iommu_get_domain(domain_id); @@ -334,11 +340,16 @@ static int virtio_iommu_attach(VirtIOIOMMU *s, { uint32_t domain_id =3D le32_to_cpu(req->domain); uint32_t ep_id =3D le32_to_cpu(req->endpoint); + uint32_t flags =3D le32_to_cpu(req->flags); VirtIOIOMMUDomain *domain; VirtIOIOMMUEndpoint *ep; =20 trace_virtio_iommu_attach(domain_id, ep_id); =20 + if (flags & ~VIRTIO_IOMMU_ATTACH_F_BYPASS) { + return VIRTIO_IOMMU_S_INVAL; + } + ep =3D virtio_iommu_get_endpoint(s, ep_id); if (!ep) { return VIRTIO_IOMMU_S_NOENT; @@ -356,7 +367,12 @@ static int virtio_iommu_attach(VirtIOIOMMU *s, } } =20 - domain =3D virtio_iommu_get_domain(s, domain_id); + domain =3D virtio_iommu_get_domain(s, domain_id, + flags & VIRTIO_IOMMU_ATTACH_F_BYPASS); + if (!domain) { + /* Incompatible bypass flag */ + return VIRTIO_IOMMU_S_INVAL; + } QLIST_INSERT_HEAD(&domain->endpoint_list, ep, next); =20 ep->domain =3D domain; @@ -419,6 +435,10 @@ static int virtio_iommu_map(VirtIOIOMMU *s, return VIRTIO_IOMMU_S_NOENT; } =20 + if (domain->bypass) { + return VIRTIO_IOMMU_S_INVAL; + } + interval =3D g_malloc0(sizeof(*interval)); =20 interval->low =3D virt_start; @@ -464,6 +484,11 @@ static int virtio_iommu_unmap(VirtIOIOMMU *s, if (!domain) { return VIRTIO_IOMMU_S_NOENT; } + + if (domain->bypass) { + return VIRTIO_IOMMU_S_INVAL; + } + interval.low =3D virt_start; interval.high =3D virt_end; =20 @@ -780,6 +805,9 @@ static IOMMUTLBEntry virtio_iommu_translate(IOMMUMemory= Region *mr, hwaddr addr, entry.perm =3D flag; } goto unlock; + } else if (ep->domain->bypass) { + entry.perm =3D flag; + goto unlock; } =20 found =3D g_tree_lookup_extended(ep->domain->mappings, (gpointer)(&int= erval), @@ -1139,8 +1167,8 @@ static const VMStateDescription vmstate_endpoint =3D { =20 static const VMStateDescription vmstate_domain =3D { .name =3D "domain", - .version_id =3D 1, - .minimum_version_id =3D 1, + .version_id =3D 2, + .minimum_version_id =3D 2, .pre_load =3D domain_preload, .fields =3D (VMStateField[]) { VMSTATE_UINT32(id, VirtIOIOMMUDomain), @@ -1149,6 +1177,7 @@ static const VMStateDescription vmstate_domain =3D { VirtIOIOMMUInterval, VirtIOIOMMUMapping), VMSTATE_QLIST_V(endpoint_list, VirtIOIOMMUDomain, 1, vmstate_endpoint, VirtIOIOMMUEndpoint, next), + VMSTATE_BOOL_V(bypass, VirtIOIOMMUDomain, 2), VMSTATE_END_OF_LIST() } }; @@ -1186,7 +1215,7 @@ static const VMStateDescription vmstate_virtio_iommu_= device =3D { .version_id =3D 2, .post_load =3D iommu_post_load, .fields =3D (VMStateField[]) { - VMSTATE_GTREE_DIRECT_KEY_V(domains, VirtIOIOMMU, 1, + VMSTATE_GTREE_DIRECT_KEY_V(domains, VirtIOIOMMU, 2, &vmstate_domain, VirtIOIOMMUDomain), VMSTATE_UINT8_V(config.bypass, VirtIOIOMMU, 2), VMSTATE_END_OF_LIST() --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649303838579.3386284942202; Mon, 7 Mar 2022 02:35:03 -0800 (PST) Received: from localhost ([::1]:56238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAhi-0003Fr-Kt for importer@patchew.org; Mon, 07 Mar 2022 05:35:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACq-0002El-Jo for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACp-0002pn-29 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:08 -0500 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-CJHyleHVPpKkZh-qbs0pHw-1; Mon, 07 Mar 2022 05:02:27 -0500 Received: by mail-ej1-f69.google.com with SMTP id go11-20020a1709070d8b00b006cf0d933739so6746603ejc.5 for ; Mon, 07 Mar 2022 02:02:26 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id z16-20020a05640240d000b004165f6ce23bsm252852edb.24.2022.03.07.02.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wqPGtWFCVDPRGhVgRp/c/kDyoLIXiZZqdrhcBaAKsjU=; b=bBLMJZQJA/JdPQJfOSpFsaZpAZVsW2DNYQpX4wLltDrOkSNI1EAVhU/DxJRJMThl6B93m8 /qgVkvvmTVNohw6xO0ce2AbO9YeqlVkr0nJl1rZ5PomMio2B1lH0iFAYQtRpok+87q/tCH SLdYFfP5U7/aZ2oa4qJP9pg/3rCzkds= X-MC-Unique: CJHyleHVPpKkZh-qbs0pHw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wqPGtWFCVDPRGhVgRp/c/kDyoLIXiZZqdrhcBaAKsjU=; b=QeOGZY6w2b/WJtVnrzczfn71IQgazR9mqxvIy9oaWB4EILJQCAv1oyBxLyM8umWXZn llUlrM0NFdXjZA7623T7PNfTDOnUPj+h3aI55mXCO7iyabfvp5tgacR1tbJOy+QBSr1K uUbILzlbOLYZfzkIsXwY70zrXcBqyNklbw3MhRV9o10sCuM4/rgFlAGhlLisdmLlW/xE E2Tdx8iqCtdPl5effk1dg8YRt/nMd2BArIkJ1H81t3Id8TkZ96lq7Y7vEpevE2mdIfZ5 +LQrM05dMS9hrqcstFOP/d0cbnq9lcZmvtfOGsKcZ/csLwV1K/JkTFG8Q2KUR7aXj0ob CMmg== X-Gm-Message-State: AOAM533g20vblaIY2Z5POzHBUCgMuNGWs0OvmvLNa/eX5ahXeQtyLPK6 2SZPrHI14B3TZcbdkYYmZhclOQv3jlv4nkUMZMcL2+oCO/ycEJ0L1DPV6/VSuJ4ZwdFqGcnGEwz 5zvUaWHobgmRWVnQuEaeBOfs5LKudB3shSYLNQPa2AuBr2GOcSDIlM5CLQw6k X-Received: by 2002:a05:6402:278e:b0:416:5064:b39b with SMTP id b14-20020a056402278e00b004165064b39bmr2441142ede.157.1646647345313; Mon, 07 Mar 2022 02:02:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLgxahKK5LBj/t4CFAaNStdt/KB/G2BJhO2apL3GixsFlsnN6+lKJOrxNsnjV1lJaHuvO5Bg== X-Received: by 2002:a05:6402:278e:b0:416:5064:b39b with SMTP id b14-20020a056402278e00b004165064b39bmr2441115ede.157.1646647345107; Mon, 07 Mar 2022 02:02:25 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:21 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 20/47] tests/qtest/virtio-iommu-test: Check bypass config Message-ID: <20220307100058.449628-21-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Jean-Philippe Brucker , Cornelia Huck , Eric Auger , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649304267100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jean-Philippe Brucker The bypass config field should be initialized to 1 by default. Reviewed-by: Eric Auger Signed-off-by: Jean-Philippe Brucker Message-Id: <20220214124356.872985-5-jean-philippe@linaro.org> Acked-by: Cornelia Huck Reviewed-by: Eric Auger Tested-by: Eric Auger Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Thomas Huth --- tests/qtest/virtio-iommu-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qtest/virtio-iommu-test.c b/tests/qtest/virtio-iommu-tes= t.c index 47e68388a0..068e7a9e6c 100644 --- a/tests/qtest/virtio-iommu-test.c +++ b/tests/qtest/virtio-iommu-test.c @@ -31,11 +31,13 @@ static void pci_config(void *obj, void *data, QGuestAll= ocator *t_alloc) uint64_t input_range_end =3D qvirtio_config_readq(dev, 16); uint32_t domain_range_start =3D qvirtio_config_readl(dev, 24); uint32_t domain_range_end =3D qvirtio_config_readl(dev, 28); + uint8_t bypass =3D qvirtio_config_readb(dev, 36); =20 g_assert_cmpint(input_range_start, =3D=3D, 0); g_assert_cmphex(input_range_end, =3D=3D, UINT64_MAX); g_assert_cmpint(domain_range_start, =3D=3D, 0); g_assert_cmpint(domain_range_end, =3D=3D, UINT32_MAX); + g_assert_cmpint(bypass, =3D=3D, 1); } =20 static int read_tail_status(struct virtio_iommu_req_tail *buffer) --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1646647359; cv=none; d=zohomail.com; s=zohoarc; b=T2YyhvioKDq0bkUcMi0q3qy8QNwPpXCZmaXcNVhAPdmLiYYzsTWWVg339WjDlchHzvzskPvmqL+hcJIPWDDaZpmDC/+/h6cGTSwl9knWrdOVfMbVecr7KNjU7/vSJ/f+OznVrtQZ+j/0TdX95EKaOMGcbmkkhLBAusGaqGYerMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646647359; h=Content-Type: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=ezHczUZNer51n68XHQRo+8Gd2wahCXeNyLSEi3/WKiI=; b=c5r9EjX+brQa8eyrItoypBR3q4qYosVjUmr3ZJjRtGgUS81dazi04GYgPhKUTXTG1bEebekl+n3Mmz/PJc44Yl7J/SwZM+Z9qcP8dat8kbIJ26LtdbEecYaPGnnfh2xC0wFAF7WW2thuLbUOiUkQOxi8lysqPjHX1SJUqt0gtMY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1646647359331561.4585039388407; Mon, 7 Mar 2022 02:02:39 -0800 (PST) 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-642-yehkM2mZMCmtAvGKP675MQ-1; Mon, 07 Mar 2022 05:02:34 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E1DE0185A7BA; Mon, 7 Mar 2022 10:02:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEBFC401E3B; Mon, 7 Mar 2022 10:02:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 887E41931BE9; Mon, 7 Mar 2022 10:02:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C42AD1931BDD for ; Mon, 7 Mar 2022 10:02:30 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 96051401E38; Mon, 7 Mar 2022 10:02:30 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 92671401E4E for ; Mon, 7 Mar 2022 10:02:30 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78050805A30 for ; Mon, 7 Mar 2022 10:02:30 +0000 (UTC) Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-571-BcFP_QFkPdK8j1Wk5WGB9g-1; Mon, 07 Mar 2022 05:02:29 -0500 Received: by mail-ej1-f69.google.com with SMTP id lf15-20020a170906ae4f00b006da86a43346so5606828ejb.14 for ; Mon, 07 Mar 2022 02:02:29 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id hg11-20020a1709072ccb00b006cee4fb36c7sm4618430ejc.64.2022.03.07.02.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647358; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=ezHczUZNer51n68XHQRo+8Gd2wahCXeNyLSEi3/WKiI=; b=BsB1sz3KatbTZARrNqFyqLc8E0Hjxg16kUl+vDVTI7QJcP9hOnk+4dkXfqwrpaIo6PchGr TpJq85PeWtqBMohrcClflRbPhJqakAlPfH3fKUSCf9FsWj3mQeyPqMWHd9h/UnJVh2/Mp+ H6iblMTXdEjzNqdgLz6LFcpWnxAw7Zc= X-MC-Unique: yehkM2mZMCmtAvGKP675MQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: BcFP_QFkPdK8j1Wk5WGB9g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ezHczUZNer51n68XHQRo+8Gd2wahCXeNyLSEi3/WKiI=; b=SNzPS6C6NoJCXeO5za+EcsnCG7FpbOROZMfEnX69RtBukrrBVEiWsiZ5xmhI7/wNrf +/SNKUswTFbhcSpk98lnYHTWjwe5kGxEBR6B6Qc0NmYKLexIXnCfY04pNvhADXr9q/Hz GG6UjCSOZHgkqusFvtJKXOcWv95CvlYLPacyc6fUWdlK/qDKX+EXr5TZXONf7jYkSmpK vygGI0rauRupL//127IstL4+R+JGZvTstYySMTLJF77ngCEvLOxpyLRdaeYriSzv/Rao vsY35YoS5R0EA4/SyDTF05fK+vdKdGZhzjxSeLEydS0gkYwWbFrAJCtAQx7PCrmsGqUp 7dvg== X-Gm-Message-State: AOAM5305ShibzBrXRS6t+oF4W20B0+DVX/Kb/xsOFcFB7Um98Yo7+ACu I/pJE19E4zlIBz++Yh3jpHhIZs/q9EaQrMz0Wn6AeE6By9nh6NbLal16sHh0bdt6wVw25yw8+1j XoZhY7HY1uF1+01+lm5M= X-Received: by 2002:a05:6402:369b:b0:416:5aa6:1584 with SMTP id ej27-20020a056402369b00b004165aa61584mr1275486edb.28.1646647348307; Mon, 07 Mar 2022 02:02:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8NSoNdCBJEvuxslFeIuYJa0LnUNKJGCVvEpmN+UzsM2Y11gPFuVXoO/OVw1pbmwEKHkJV5Q== X-Received: by 2002:a05:6402:369b:b0:416:5aa6:1584 with SMTP id ej27-20020a056402369b00b004165aa61584mr1275476edb.28.1646647348120; Mon, 07 Mar 2022 02:02:28 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:25 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 21/47] hw/i386/pc_piix: Mark the machine types from version 1.4 to 1.7 as deprecated Message-ID: <20220307100058.449628-22-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Maydell , Thomas Huth , libvir-list@redhat.com, Richard Henderson , Marcel Apfelbaum , Paolo Bonzini Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1646647359896100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Huth The list of machine types grows larger and larger each release ... and it is unlikely that many people still use the very old ones for live migration. QEMU v1.7 has been released more than 8 years ago, so most people should have updated their machines to a newer version in those 8 years at least once. Thus let's mark the very old 1.x machine types as deprecated now. Signed-off-by: Thomas Huth Message-Id: <20220117191639.278497-1-thuth@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc_piix.c | 1 + docs/about/deprecated.rst | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8d33cf689d..b72c03d0a6 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -757,6 +757,7 @@ static void pc_i440fx_1_7_machine_options(MachineClass = *m) m->hw_version =3D "1.7.0"; m->default_machine_opts =3D NULL; m->option_rom_has_mr =3D true; + m->deprecation_reason =3D "old and unattended - use a newer version in= stead"; compat_props_add(m->compat_props, pc_compat_1_7, pc_compat_1_7_len); pcmc->smbios_defaults =3D false; pcmc->gigabyte_align =3D false; diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 85773db631..cf02ef6821 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -324,6 +324,14 @@ machine is hardly emulated at all (e.g. neither the LC= D nor the USB part had been implemented), so there is not much value added by this board. Use the ``ref405ep`` machine instead. =20 +``pc-i440fx-1.4`` up to ``pc-i440fx-1.7`` (since 7.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''' + +These old machine types are quite neglected nowadays and thus might have +various pitfalls with regards to live migration. Use a newer machine type +instead. + + Backend options --------------- =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648273820281.68001831284744; Mon, 7 Mar 2022 02:17:53 -0800 (PST) Received: from localhost ([::1]:34452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAR6-0003FU-Q3 for importer@patchew.org; Mon, 07 Mar 2022 05:17:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACJ-0001R9-UM for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:36 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACI-0002mE-AA for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:35 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-hXoQ7aQWNcOOCx0nJwjiKA-1; Mon, 07 Mar 2022 05:02:32 -0500 Received: by mail-ed1-f71.google.com with SMTP id l14-20020a056402344e00b0041593c729adso8333571edc.18 for ; Mon, 07 Mar 2022 02:02:32 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id r29-20020a50c01d000000b00415fb0dc793sm4676156edb.47.2022.03.07.02.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647353; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gahauiWtzKVRJbmFnIa2BytU7N4O8wddJUnc6uKh6Qk=; b=Vvcqz/cxr7nQx9bsEomwMwQnNSkSKshhLThsYZkYPOdNZKeLWaKagCFGQKUz9ohNVwrREw ihCwCaqC4AM5Bbz2xJr+cQkoXdF0wbGquGazvX7xuGg/tX7f9hzKymK5YZVVm2iM2e676p 2I7KeavTBN870PRFiSNTZDku8SvaFU8= X-MC-Unique: hXoQ7aQWNcOOCx0nJwjiKA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=gahauiWtzKVRJbmFnIa2BytU7N4O8wddJUnc6uKh6Qk=; b=cs/xa9txb2V4G+pV2cvhUZfIL+vr29GSWHuiTIUHDMxuOMf0ZzFSsnR46UnuJg3ZqV lxGWYtZHjAZdgJCMixPwEMJ5SQ1zJIKJRnNuLhMP+Q4P5ah4O3ombYyo3o65Yg+MB76m uWnkC21fycgsog/FTJH/utzqq6D8ISmfQlg1sQEHta4rFv/tEjizWDy3GmKszEok4SPw p3WdjEOiXidoT0UEvyVU6DYS6YyJ5GD7waJVSyeudCcgcGepdSinzWRrb/1xR55xDVRl gxNUtW1m81WJGEYyRrSEzPd8K0AJ1/YivZGpT8KrMILL4eun5YmT7KO3y1zpbPak3Kro BqzQ== X-Gm-Message-State: AOAM532v0QQuHBsL0Teef3CsXh86bS1yh0epQ9VJ3mRZ7mJWMdHGK4Pd zab8KTcpyBj4FQldiTx0SUyDEw7UbtTNDlIIRQj9hvETEpDiNzA0hRT/oe5bL5zq+Ztovh93O38 g03LCvb0g6FVUxt9ncNGFKoi28u/BzL3ZqXPUa6TiJUUE3G0v1g3wEiOIvGED X-Received: by 2002:a50:9d89:0:b0:410:ff04:5a98 with SMTP id w9-20020a509d89000000b00410ff045a98mr10364010ede.404.1646647350995; Mon, 07 Mar 2022 02:02:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwy+01gp79Ij4AbSZOmStX1m/L2J4+4fGm/m0eFSJ7E1BUm1IfeSH4gexGS1XztsywDWqWgzQ== X-Received: by 2002:a50:9d89:0:b0:410:ff04:5a98 with SMTP id w9-20020a509d89000000b00410ff045a98mr10363984ede.404.1646647350705; Mon, 07 Mar 2022 02:02:30 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:28 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 22/47] hw/pci-bridge/pxb: Fix missing swizzle Message-ID: <20220307100058.449628-23-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Jonathan Cameron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648274307100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron pxb_map_irq_fn() handled the necessary removal of the swizzle applied to the PXB interrupts by the bus to which it was attached but neglected to apply the normal swizzle for PCI root ports on the expander bridge. Result of this was on ARM virt, the PME interrupts for a second RP on a PXB instance were miss-routed to #45 rather than #46. Tested with a selection of different configurations with 1 to 5 RP per PXB instance. Note on my x86 test setup the PME interrupts are not triggered so I haven't been able to test this. Signed-off-by: Jonathan Cameron Cc: Michael S. Tsirkin Cc: Marcel Apfelbaum Message-Id: <20220118174855.19325-1-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-bridge/pci_expander_bridge.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expand= er_bridge.c index 10e6e7c2ab..de932286b5 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -192,6 +192,12 @@ static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin) { PCIDevice *pxb =3D pci_get_bus(pci_dev)->parent_dev; =20 + /* + * First carry out normal swizzle to handle + * multple root ports on a pxb instance. + */ + pin =3D pci_swizzle_map_irq_fn(pci_dev, pin); + /* * The bios does not index the pxb slot number when * it computes the IRQ because it resides on bus 0 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646647877839653.2325317826218; Mon, 7 Mar 2022 02:11:17 -0800 (PST) Received: from localhost ([::1]:45074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAKj-00089Y-HQ for importer@patchew.org; Mon, 07 Mar 2022 05:11:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACM-0001Vw-3R for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43877) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACK-0002mt-Dd for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:37 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-674-c-fkgstjNMiroebUjZGAdw-1; Mon, 07 Mar 2022 05:02:35 -0500 Received: by mail-ed1-f71.google.com with SMTP id i17-20020aa7c711000000b00415ecaefd07so5955557edq.21 for ; Mon, 07 Mar 2022 02:02:34 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id gb2-20020a170907960200b006dac65a914esm3127576ejc.125.2022.03.07.02.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SoEIyJ3M3ZHGIXoolRVwuQOGPFG25A4XAUBq+1r+Ueo=; b=VvhWWZVtOu7l4zAXyE3l2OGZKYNCIzsauuN+YVt5grVn4L3dz8YghR56sM8W4iV5aj9t6k xuIBOtHhNN9Hzbzb0k7WkkZpHRUTOBdrikIVMdfbdFRDvw44e68Fl+K19EG6uoWPMFDDmx trQsaVc4wpQjDUjUQ74ij/L3r8dReD0= X-MC-Unique: c-fkgstjNMiroebUjZGAdw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=SoEIyJ3M3ZHGIXoolRVwuQOGPFG25A4XAUBq+1r+Ueo=; b=qer8GsIzHuvVuHcaQUIlf/8e5QgDjQzF5zNA/Bbk5pD6fC6CjCptKvYrQT5QP5d52t hCsYHeHGLnBPkNGy4pzLtgJ3eN6YqIyH/LGqOQlBbtaujfUXd4aPCelWslfeV0pw6Xgw gDx2ZFHAw71kxRtm4VRCSPlT//p8qKJU/qJcr6w97WVI6p1gPgmVtjmVYdHXASR32PxS ZDh+qGzAfermCsGHnlSq56TPOHRDcKgQGuI3Tu605mEpzEc3rzug/4P3DoWwy+9BEecK Gb1JeqC1ErXZqN6MO2goXqF0j8uhi0En98Ltv0EGFDWlK6xHuBSGRIuVSIgxmSk+5Tc3 xPbg== X-Gm-Message-State: AOAM533RS+Ws/ObmRTnYlBcdMNKiNoz6PXyqcIeyC4hqpMl4BXUJnSrB VsTxxw61sCyguxwIdsd1k/lDybbBFmaJVsTdptha1zw4awOU0a+8Pw33iyZVSkr3jf4+VJzli6n UmAqhjnPAebqQ/8VwoeEyLievkoUxZ85fxMHay3Y6tUCwPrnffAq7JyuGM8Oi X-Received: by 2002:a17:906:689:b0:6da:a1f0:a7a7 with SMTP id u9-20020a170906068900b006daa1f0a7a7mr8682577ejb.189.1646647353471; Mon, 07 Mar 2022 02:02:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJykTiL/xNoGYGJxRsOd8YtsgIuXdUVvVnaJgVsynik+uDIgRhUBHEiPzLApxHZ4DyBwrb85eg== X-Received: by 2002:a17:906:689:b0:6da:a1f0:a7a7 with SMTP id u9-20020a170906068900b006daa1f0a7a7mr8682549ejb.189.1646647353165; Mon, 07 Mar 2022 02:02:33 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:30 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 23/47] virtio-net: Unlimit tx queue size if peer is vdpa Message-ID: <20220307100058.449628-24-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Jason Wang , Eugenio =?utf-8?B?UMOpcmV6?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646647879394100031 From: Eugenio P=C3=A9rez The code used to limit the maximum size of tx queue for others backends than vhost_user since the introduction of configurable tx queue size in 9b02e1618cf2 ("virtio-net: enable configurable tx queue size"). As vhost_user, vhost_vdpa devices should deal with memory region crosses already, so let's use the full tx size. Signed-off-by: Eugenio P=C3=A9rez Message-Id: <20220217175029.2517071-1-eperezma@redhat.com> Acked-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index cf8ab0f8af..b02a0632df 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -628,17 +628,20 @@ static int virtio_net_max_tx_queue_size(VirtIONet *n) NetClientState *peer =3D n->nic_conf.peers.ncs[0]; =20 /* - * Backends other than vhost-user don't support max queue size. + * Backends other than vhost-user or vhost-vdpa don't support max queue + * size. */ if (!peer) { return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE; } =20 - if (peer->info->type !=3D NET_CLIENT_DRIVER_VHOST_USER) { + switch(peer->info->type) { + case NET_CLIENT_DRIVER_VHOST_USER: + case NET_CLIENT_DRIVER_VHOST_VDPA: + return VIRTQUEUE_MAX_SIZE; + default: return VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE; - } - - return VIRTQUEUE_MAX_SIZE; + }; } =20 static int peer_attach(VirtIONet *n, int index) --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648535244528.6068423297614; Mon, 7 Mar 2022 02:22:15 -0800 (PST) Received: from localhost ([::1]:43252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAVK-0000ua-4J for importer@patchew.org; Mon, 07 Mar 2022 05:22:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACR-0001kT-FE for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACO-0002nM-FS for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:43 -0500 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-296-5Inv9xOLNj6ahCWWOuqYvg-1; Mon, 07 Mar 2022 05:02:38 -0500 Received: by mail-ed1-f72.google.com with SMTP id y26-20020a50ce1a000000b00415e9b35c81so6042517edi.9 for ; Mon, 07 Mar 2022 02:02:38 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id y19-20020a1709064b1300b006dabe44a6edsm3322060eju.141.2022.03.07.02.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fQd6WVFr9I1K2svJa1cXoPH2fq/JdR0GG570pqzR9U8=; b=CzGCSjEsuWTfS84eRWJJ/EToHMaIAM1WQHQfcUCj4jvYMxdeveYr4Mf/sYYbpuoDj2KhIT LAelf0RG/3tQmqEOxdi9j8XdHLgRSq7+hBJeF/d+HkZumkaFve5qFjyOqKPmDT+u1ULbOX Wc1D+YEUVOWgFs+Ard1+vHswKxj6uQk= X-MC-Unique: 5Inv9xOLNj6ahCWWOuqYvg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fQd6WVFr9I1K2svJa1cXoPH2fq/JdR0GG570pqzR9U8=; b=0zUuolXOajaSyYkjrrber5FuswL66LOnlTVraayYvTEjnDw3IFQ55jot0LlCypNaRp YA3z96AcBpsNT8yYo3aO4US9t2d24tgw3nt0b0Ejb094+CK1tlKeq5JAHVQydyTkPnRa xXH+hf9mDBqTTaIGPB7ngjfCD2vamI5gUNQ3TtSNWljTDtBTebAX3aqI+Li8mvu6EFgn VAoy2GdOxBrHBjXO9FRs0cXdUwF2W8tH/ZKiDTzRQhFRfTxzQ5KsHw5xvLToIiwRmJuP 1mev7EAEVm3E1+0qQFvO8chxGq1HNdDrvNF8xaVimIVzYezR0U7savke5hach33OIhqs XiDQ== X-Gm-Message-State: AOAM530LUmo6azNDo7n5elm+PdPPx0E8sy2adnEHiXa0JwPMlO0UD3r2 2DBByF/vn5GnOnTr8qyC+t787b2HDApqSn5TpomJHxB7N7JvS17CD8MKTyZLQ9Is37pUrGWp71L LH/prYLlbxH7CqLEekhg8bvOHuxZFsrKwHsBpSPU/OYXDsCLw0F2ZXhTAuu19 X-Received: by 2002:a05:6402:8d5:b0:416:1b20:5090 with SMTP id d21-20020a05640208d500b004161b205090mr9970426edz.393.1646647356735; Mon, 07 Mar 2022 02:02:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJyqe46hrfEtrq12zRCofRgaEzG3kTjorbAgspswoNKtZ8Wtkn3VHkYvlg3SQ5Pp+QA6A63ISQ== X-Received: by 2002:a05:6402:8d5:b0:416:1b20:5090 with SMTP id d21-20020a05640208d500b004161b205090mr9970382edz.393.1646647356060; Mon, 07 Mar 2022 02:02:36 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:33 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 24/47] pcie: Add support for Single Root I/O Virtualization (SR/IOV) Message-ID: <20220307100058.449628-25-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Knut Omang , Knut Omang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648536781100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Knut Omang This patch provides the building blocks for creating an SR/IOV PCIe Extended Capability header and register/unregister SR/IOV Virtual Functions. Signed-off-by: Knut Omang Message-Id: <20220217174504.1051716-2-lukasz.maniak@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci.h | 12 +- include/hw/pci/pcie.h | 6 + include/hw/pci/pcie_sriov.h | 71 +++++++++ include/qemu/typedefs.h | 2 + hw/pci/pci.c | 100 +++++++++--- hw/pci/pcie.c | 5 + hw/pci/pcie_sriov.c | 294 ++++++++++++++++++++++++++++++++++++ hw/pci/meson.build | 1 + hw/pci/trace-events | 5 + 9 files changed, 470 insertions(+), 26 deletions(-) create mode 100644 include/hw/pci/pcie_sriov.h create mode 100644 hw/pci/pcie_sriov.c diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index c3f3c90473..3a32b8dd40 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -7,9 +7,6 @@ /* PCI includes legacy ISA access. */ #include "hw/isa/isa.h" =20 -#include "hw/pci/pcie.h" -#include "qom/object.h" - extern bool pci_available; =20 /* PCI bus */ @@ -157,6 +154,7 @@ enum { #define QEMU_PCI_VGA_IO_HI_SIZE 0x20 =20 #include "hw/pci/pci_regs.h" +#include "hw/pci/pcie.h" =20 /* PCI HEADER_TYPE */ #define PCI_HEADER_TYPE_MULTI_FUNCTION 0x80 @@ -499,6 +497,9 @@ typedef AddressSpace *(*PCIIOMMUFunc)(PCIBus *, void *,= int); AddressSpace *pci_device_iommu_address_space(PCIDevice *dev); void pci_setup_iommu(PCIBus *bus, PCIIOMMUFunc fn, void *opaque); =20 +pcibus_t pci_bar_address(PCIDevice *d, + int reg, uint8_t type, pcibus_t size); + static inline void pci_set_byte(uint8_t *config, uint8_t val) { @@ -779,6 +780,11 @@ static inline int pci_is_express_downstream_port(const= PCIDevice *d) return type =3D=3D PCI_EXP_TYPE_DOWNSTREAM || type =3D=3D PCI_EXP_TYPE= _ROOT_PORT; } =20 +static inline int pci_is_vf(const PCIDevice *d) +{ + return d->exp.sriov_vf.pf !=3D NULL; +} + static inline uint32_t pci_config_size(const PCIDevice *d) { return pci_is_express(d) ? PCIE_CONFIG_SPACE_SIZE : PCI_CONFIG_SPACE_S= IZE; diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index 6063bee0ec..168950a83b 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -24,6 +24,7 @@ #include "hw/pci/pci_regs.h" #include "hw/pci/pcie_regs.h" #include "hw/pci/pcie_aer.h" +#include "hw/pci/pcie_sriov.h" #include "hw/hotplug.h" =20 typedef enum { @@ -81,6 +82,11 @@ struct PCIExpressDevice { =20 /* ACS */ uint16_t acs_cap; + + /* SR/IOV */ + uint16_t sriov_cap; + PCIESriovPF sriov_pf; + PCIESriovVF sriov_vf; }; =20 #define COMPAT_PROP_PCP "power_controller_present" diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h new file mode 100644 index 0000000000..990cff0a1c --- /dev/null +++ b/include/hw/pci/pcie_sriov.h @@ -0,0 +1,71 @@ +/* + * pcie_sriov.h: + * + * Implementation of SR/IOV emulation support. + * + * Copyright (c) 2015 Knut Omang + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#ifndef QEMU_PCIE_SRIOV_H +#define QEMU_PCIE_SRIOV_H + +struct PCIESriovPF { + uint16_t num_vfs; /* Number of virtual functions created */ + uint8_t vf_bar_type[PCI_NUM_REGIONS]; /* Store type for each VF bar = */ + const char *vfname; /* Reference to the device type used for the VFs */ + PCIDevice **vf; /* Pointer to an array of num_vfs VF devices */ +}; + +struct PCIESriovVF { + PCIDevice *pf; /* Pointer back to owner physical function */ + uint16_t vf_number; /* Logical VF number of this function */ +}; + +void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, + const char *vfname, uint16_t vf_dev_id, + uint16_t init_vfs, uint16_t total_vfs, + uint16_t vf_offset, uint16_t vf_stride); +void pcie_sriov_pf_exit(PCIDevice *dev); + +/* Set up a VF bar in the SR/IOV bar area */ +void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, + uint8_t type, dma_addr_t size); + +/* Instantiate a bar for a VF */ +void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, + MemoryRegion *memory); + +/* + * Default (minimal) page size support values + * as required by the SR/IOV standard: + * 0x553 << 12 =3D 0x553000 =3D 4K + 8K + 64K + 256K + 1M + 4M + */ +#define SRIOV_SUP_PGSIZE_MINREQ 0x553 + +/* + * Optionally add supported page sizes to the mask of supported page sizes + * Page size values are interpreted as opt_sup_pgsize << 12. + */ +void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_t opt_sup_pgsize); + +/* SR/IOV capability config write handler */ +void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, + uint32_t val, int len); + +/* Reset SR/IOV VF Enable bit to unregister all VFs */ +void pcie_sriov_pf_disable_vfs(PCIDevice *dev); + +/* Get logical VF number of a VF - only valid for VFs */ +uint16_t pcie_sriov_vf_number(PCIDevice *dev); + +/* + * Get the physical function that owns this VF. + * Returns NULL if dev is not a virtual function + */ +PCIDevice *pcie_sriov_get_pf(PCIDevice *dev); + +#endif /* QEMU_PCIE_SRIOV_H */ diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index ee60eb3de4..5b302cb214 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -86,6 +86,8 @@ typedef struct PCIDevice PCIDevice; typedef struct PCIEAERErr PCIEAERErr; typedef struct PCIEAERLog PCIEAERLog; typedef struct PCIEAERMsg PCIEAERMsg; +typedef struct PCIESriovPF PCIESriovPF; +typedef struct PCIESriovVF PCIESriovVF; typedef struct PCIEPort PCIEPort; typedef struct PCIESlot PCIESlot; typedef struct PCIExpressDevice PCIExpressDevice; diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 5d30f9ca60..ba8fb92efc 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -239,6 +239,9 @@ int pci_bar(PCIDevice *d, int reg) { uint8_t type; =20 + /* PCIe virtual functions do not have their own BARs */ + assert(!pci_is_vf(d)); + if (reg !=3D PCI_ROM_SLOT) return PCI_BASE_ADDRESS_0 + reg * 4; =20 @@ -304,10 +307,30 @@ void pci_device_deassert_intx(PCIDevice *dev) } } =20 -static void pci_do_device_reset(PCIDevice *dev) +static void pci_reset_regions(PCIDevice *dev) { int r; + if (pci_is_vf(dev)) { + return; + } =20 + for (r =3D 0; r < PCI_NUM_REGIONS; ++r) { + PCIIORegion *region =3D &dev->io_regions[r]; + if (!region->size) { + continue; + } + + if (!(region->type & PCI_BASE_ADDRESS_SPACE_IO) && + region->type & PCI_BASE_ADDRESS_MEM_TYPE_64) { + pci_set_quad(dev->config + pci_bar(dev, r), region->type); + } else { + pci_set_long(dev->config + pci_bar(dev, r), region->type); + } + } +} + +static void pci_do_device_reset(PCIDevice *dev) +{ pci_device_deassert_intx(dev); assert(dev->irq_state =3D=3D 0); =20 @@ -323,19 +346,7 @@ static void pci_do_device_reset(PCIDevice *dev) pci_get_word(dev->wmask + PCI_INTERRUPT_LINE= ) | pci_get_word(dev->w1cmask + PCI_INTERRUPT_LI= NE)); dev->config[PCI_CACHE_LINE_SIZE] =3D 0x0; - for (r =3D 0; r < PCI_NUM_REGIONS; ++r) { - PCIIORegion *region =3D &dev->io_regions[r]; - if (!region->size) { - continue; - } - - if (!(region->type & PCI_BASE_ADDRESS_SPACE_IO) && - region->type & PCI_BASE_ADDRESS_MEM_TYPE_64) { - pci_set_quad(dev->config + pci_bar(dev, r), region->type); - } else { - pci_set_long(dev->config + pci_bar(dev, r), region->type); - } - } + pci_reset_regions(dev); pci_update_mappings(dev); =20 msi_reset(dev); @@ -884,6 +895,16 @@ static void pci_init_multifunction(PCIBus *bus, PCIDev= ice *dev, Error **errp) dev->config[PCI_HEADER_TYPE] |=3D PCI_HEADER_TYPE_MULTI_FUNCTION; } =20 + /* + * With SR/IOV and ARI, a device at function 0 need not be a multifunc= tion + * device, as it may just be a VF that ended up with function 0 in + * the legacy PCI interpretation. Avoid failing in such cases: + */ + if (pci_is_vf(dev) && + dev->exp.sriov_vf.pf->cap_present & QEMU_PCI_CAP_MULTIFUNCTION) { + return; + } + /* * multifunction bit is interpreted in two ways as follows. * - all functions must set the bit to 1. @@ -1083,6 +1104,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *p= ci_dev, bus->devices[devfn]->name); return NULL; } else if (dev->hotplugged && + !pci_is_vf(pci_dev) && pci_get_function_0(pci_dev)) { error_setg(errp, "PCI: slot %d function 0 already occupied by %s," " new func %s cannot be exposed to guest.", @@ -1191,6 +1213,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_= num, pcibus_t size =3D memory_region_size(memory); uint8_t hdr_type; =20 + assert(!pci_is_vf(pci_dev)); /* VFs must use pcie_sriov_vf_register_ba= r */ assert(region_num >=3D 0); assert(region_num < PCI_NUM_REGIONS); assert(is_power_of_2(size)); @@ -1294,11 +1317,45 @@ pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int r= egion_num) return pci_dev->io_regions[region_num].addr; } =20 -static pcibus_t pci_bar_address(PCIDevice *d, - int reg, uint8_t type, pcibus_t size) +static pcibus_t pci_config_get_bar_addr(PCIDevice *d, int reg, + uint8_t type, pcibus_t size) +{ + pcibus_t new_addr; + if (!pci_is_vf(d)) { + int bar =3D pci_bar(d, reg); + if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { + new_addr =3D pci_get_quad(d->config + bar); + } else { + new_addr =3D pci_get_long(d->config + bar); + } + } else { + PCIDevice *pf =3D d->exp.sriov_vf.pf; + uint16_t sriov_cap =3D pf->exp.sriov_cap; + int bar =3D sriov_cap + PCI_SRIOV_BAR + reg * 4; + uint16_t vf_offset =3D + pci_get_word(pf->config + sriov_cap + PCI_SRIOV_VF_OFFSET); + uint16_t vf_stride =3D + pci_get_word(pf->config + sriov_cap + PCI_SRIOV_VF_STRIDE); + uint32_t vf_num =3D (d->devfn - (pf->devfn + vf_offset)) / vf_stri= de; + + if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { + new_addr =3D pci_get_quad(pf->config + bar); + } else { + new_addr =3D pci_get_long(pf->config + bar); + } + new_addr +=3D vf_num * size; + } + /* The ROM slot has a specific enable bit, keep it intact */ + if (reg !=3D PCI_ROM_SLOT) { + new_addr &=3D ~(size - 1); + } + return new_addr; +} + +pcibus_t pci_bar_address(PCIDevice *d, + int reg, uint8_t type, pcibus_t size) { pcibus_t new_addr, last_addr; - int bar =3D pci_bar(d, reg); uint16_t cmd =3D pci_get_word(d->config + PCI_COMMAND); Object *machine =3D qdev_get_machine(); ObjectClass *oc =3D object_get_class(machine); @@ -1309,7 +1366,7 @@ static pcibus_t pci_bar_address(PCIDevice *d, if (!(cmd & PCI_COMMAND_IO)) { return PCI_BAR_UNMAPPED; } - new_addr =3D pci_get_long(d->config + bar) & ~(size - 1); + new_addr =3D pci_config_get_bar_addr(d, reg, type, size); last_addr =3D new_addr + size - 1; /* Check if 32 bit BAR wraps around explicitly. * TODO: make priorities correct and remove this work around. @@ -1324,11 +1381,7 @@ static pcibus_t pci_bar_address(PCIDevice *d, if (!(cmd & PCI_COMMAND_MEMORY)) { return PCI_BAR_UNMAPPED; } - if (type & PCI_BASE_ADDRESS_MEM_TYPE_64) { - new_addr =3D pci_get_quad(d->config + bar); - } else { - new_addr =3D pci_get_long(d->config + bar); - } + new_addr =3D pci_config_get_bar_addr(d, reg, type, size); /* the ROM slot has a specific enable bit */ if (reg =3D=3D PCI_ROM_SLOT && !(new_addr & PCI_ROM_ADDRESS_ENABLE)) { return PCI_BAR_UNMAPPED; @@ -1473,6 +1526,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t = addr, uint32_t val_in, int =20 msi_write_config(d, addr, val_in, l); msix_write_config(d, addr, val_in, l); + pcie_sriov_config_write(d, addr, val_in, l); } =20 /***********************************************************/ diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index d7d73a31e4..3c44204cf3 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -446,6 +446,11 @@ void pcie_cap_slot_plug_cb(HotplugHandler *hotplug_dev= , DeviceState *dev, PCIDevice *pci_dev =3D PCI_DEVICE(dev); uint32_t lnkcap =3D pci_get_long(exp_cap + PCI_EXP_LNKCAP); =20 + if (pci_is_vf(pci_dev)) { + /* Virtual function cannot be physically disconnected */ + return; + } + /* Don't send event when device is enabled during qemu machine creatio= n: * it is present on boot, no hotplug event is necessary. We do send an * event when the device is disabled later. */ diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c new file mode 100644 index 0000000000..3f256d483f --- /dev/null +++ b/hw/pci/pcie_sriov.c @@ -0,0 +1,294 @@ +/* + * pcie_sriov.c: + * + * Implementation of SR/IOV emulation support. + * + * Copyright (c) 2015-2017 Knut Omang + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "hw/pci/pci.h" +#include "hw/pci/pcie.h" +#include "hw/pci/pci_bus.h" +#include "hw/qdev-properties.h" +#include "qemu/error-report.h" +#include "qemu/range.h" +#include "qapi/error.h" +#include "trace.h" + +static PCIDevice *register_vf(PCIDevice *pf, int devfn, + const char *name, uint16_t vf_num); +static void unregister_vfs(PCIDevice *dev); + +void pcie_sriov_pf_init(PCIDevice *dev, uint16_t offset, + const char *vfname, uint16_t vf_dev_id, + uint16_t init_vfs, uint16_t total_vfs, + uint16_t vf_offset, uint16_t vf_stride) +{ + uint8_t *cfg =3D dev->config + offset; + uint8_t *wmask; + + pcie_add_capability(dev, PCI_EXT_CAP_ID_SRIOV, 1, + offset, PCI_EXT_CAP_SRIOV_SIZEOF); + dev->exp.sriov_cap =3D offset; + dev->exp.sriov_pf.num_vfs =3D 0; + dev->exp.sriov_pf.vfname =3D g_strdup(vfname); + dev->exp.sriov_pf.vf =3D NULL; + + pci_set_word(cfg + PCI_SRIOV_VF_OFFSET, vf_offset); + pci_set_word(cfg + PCI_SRIOV_VF_STRIDE, vf_stride); + + /* + * Mandatory page sizes to support. + * Device implementations can call pcie_sriov_pf_add_sup_pgsize() + * to set more bits: + */ + pci_set_word(cfg + PCI_SRIOV_SUP_PGSIZE, SRIOV_SUP_PGSIZE_MINREQ); + + /* + * Default is to use 4K pages, software can modify it + * to any of the supported bits + */ + pci_set_word(cfg + PCI_SRIOV_SYS_PGSIZE, 0x1); + + /* Set up device ID and initial/total number of VFs available */ + pci_set_word(cfg + PCI_SRIOV_VF_DID, vf_dev_id); + pci_set_word(cfg + PCI_SRIOV_INITIAL_VF, init_vfs); + pci_set_word(cfg + PCI_SRIOV_TOTAL_VF, total_vfs); + pci_set_word(cfg + PCI_SRIOV_NUM_VF, 0); + + /* Write enable control bits */ + wmask =3D dev->wmask + offset; + pci_set_word(wmask + PCI_SRIOV_CTRL, + PCI_SRIOV_CTRL_VFE | PCI_SRIOV_CTRL_MSE | PCI_SRIOV_CTRL_= ARI); + pci_set_word(wmask + PCI_SRIOV_NUM_VF, 0xffff); + pci_set_word(wmask + PCI_SRIOV_SYS_PGSIZE, 0x553); + + qdev_prop_set_bit(&dev->qdev, "multifunction", true); +} + +void pcie_sriov_pf_exit(PCIDevice *dev) +{ + unregister_vfs(dev); + g_free((char *)dev->exp.sriov_pf.vfname); + dev->exp.sriov_pf.vfname =3D NULL; +} + +void pcie_sriov_pf_init_vf_bar(PCIDevice *dev, int region_num, + uint8_t type, dma_addr_t size) +{ + uint32_t addr; + uint64_t wmask; + uint16_t sriov_cap =3D dev->exp.sriov_cap; + + assert(sriov_cap > 0); + assert(region_num >=3D 0); + assert(region_num < PCI_NUM_REGIONS); + assert(region_num !=3D PCI_ROM_SLOT); + + wmask =3D ~(size - 1); + addr =3D sriov_cap + PCI_SRIOV_BAR + region_num * 4; + + pci_set_long(dev->config + addr, type); + if (!(type & PCI_BASE_ADDRESS_SPACE_IO) && + type & PCI_BASE_ADDRESS_MEM_TYPE_64) { + pci_set_quad(dev->wmask + addr, wmask); + pci_set_quad(dev->cmask + addr, ~0ULL); + } else { + pci_set_long(dev->wmask + addr, wmask & 0xffffffff); + pci_set_long(dev->cmask + addr, 0xffffffff); + } + dev->exp.sriov_pf.vf_bar_type[region_num] =3D type; +} + +void pcie_sriov_vf_register_bar(PCIDevice *dev, int region_num, + MemoryRegion *memory) +{ + PCIIORegion *r; + PCIBus *bus =3D pci_get_bus(dev); + uint8_t type; + pcibus_t size =3D memory_region_size(memory); + + assert(pci_is_vf(dev)); /* PFs must use pci_register_bar */ + assert(region_num >=3D 0); + assert(region_num < PCI_NUM_REGIONS); + type =3D dev->exp.sriov_vf.pf->exp.sriov_pf.vf_bar_type[region_num]; + + if (!is_power_of_2(size)) { + error_report("%s: PCI region size must be a power" + " of two - type=3D0x%x, size=3D0x%"FMT_PCIBUS, + __func__, type, size); + exit(1); + } + + r =3D &dev->io_regions[region_num]; + r->memory =3D memory; + r->address_space =3D + type & PCI_BASE_ADDRESS_SPACE_IO + ? bus->address_space_io + : bus->address_space_mem; + r->size =3D size; + r->type =3D type; + + r->addr =3D pci_bar_address(dev, region_num, r->type, r->size); + if (r->addr !=3D PCI_BAR_UNMAPPED) { + memory_region_add_subregion_overlap(r->address_space, + r->addr, r->memory, 1); + } +} + +static PCIDevice *register_vf(PCIDevice *pf, int devfn, const char *name, + uint16_t vf_num) +{ + PCIDevice *dev =3D pci_new(devfn, name); + dev->exp.sriov_vf.pf =3D pf; + dev->exp.sriov_vf.vf_number =3D vf_num; + PCIBus *bus =3D pci_get_bus(pf); + Error *local_err =3D NULL; + + qdev_realize(&dev->qdev, &bus->qbus, &local_err); + if (local_err) { + error_report_err(local_err); + return NULL; + } + + /* set vid/did according to sr/iov spec - they are not used */ + pci_config_set_vendor_id(dev->config, 0xffff); + pci_config_set_device_id(dev->config, 0xffff); + + return dev; +} + +static void register_vfs(PCIDevice *dev) +{ + uint16_t num_vfs; + uint16_t i; + uint16_t sriov_cap =3D dev->exp.sriov_cap; + uint16_t vf_offset =3D + pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_OFFSET); + uint16_t vf_stride =3D + pci_get_word(dev->config + sriov_cap + PCI_SRIOV_VF_STRIDE); + int32_t devfn =3D dev->devfn + vf_offset; + + assert(sriov_cap > 0); + num_vfs =3D pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF); + + dev->exp.sriov_pf.vf =3D g_malloc(sizeof(PCIDevice *) * num_vfs); + assert(dev->exp.sriov_pf.vf); + + trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn), num_vfs); + for (i =3D 0; i < num_vfs; i++) { + dev->exp.sriov_pf.vf[i] =3D register_vf(dev, devfn, + dev->exp.sriov_pf.vfname, i); + if (!dev->exp.sriov_pf.vf[i]) { + num_vfs =3D i; + break; + } + devfn +=3D vf_stride; + } + dev->exp.sriov_pf.num_vfs =3D num_vfs; +} + +static void unregister_vfs(PCIDevice *dev) +{ + Error *local_err =3D NULL; + uint16_t num_vfs =3D dev->exp.sriov_pf.num_vfs; + uint16_t i; + + trace_sriov_unregister_vfs(dev->name, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn), num_vfs); + for (i =3D 0; i < num_vfs; i++) { + PCIDevice *vf =3D dev->exp.sriov_pf.vf[i]; + object_property_set_bool(OBJECT(vf), "realized", false, &local_err= ); + if (local_err) { + fprintf(stderr, "Failed to unplug: %s\n", + error_get_pretty(local_err)); + error_free(local_err); + } + object_unparent(OBJECT(vf)); + } + g_free(dev->exp.sriov_pf.vf); + dev->exp.sriov_pf.vf =3D NULL; + dev->exp.sriov_pf.num_vfs =3D 0; + pci_set_word(dev->config + dev->exp.sriov_cap + PCI_SRIOV_NUM_VF, 0); +} + +void pcie_sriov_config_write(PCIDevice *dev, uint32_t address, + uint32_t val, int len) +{ + uint32_t off; + uint16_t sriov_cap =3D dev->exp.sriov_cap; + + if (!sriov_cap || address < sriov_cap) { + return; + } + off =3D address - sriov_cap; + if (off >=3D PCI_EXT_CAP_SRIOV_SIZEOF) { + return; + } + + trace_sriov_config_write(dev->name, PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn), off, val, len); + + if (range_covers_byte(off, len, PCI_SRIOV_CTRL)) { + if (dev->exp.sriov_pf.num_vfs) { + if (!(val & PCI_SRIOV_CTRL_VFE)) { + unregister_vfs(dev); + } + } else { + if (val & PCI_SRIOV_CTRL_VFE) { + register_vfs(dev); + } + } + } +} + + +/* Reset SR/IOV VF Enable bit to trigger an unregister of all VFs */ +void pcie_sriov_pf_disable_vfs(PCIDevice *dev) +{ + uint16_t sriov_cap =3D dev->exp.sriov_cap; + if (sriov_cap) { + uint32_t val =3D pci_get_byte(dev->config + sriov_cap + PCI_SRIOV_= CTRL); + if (val & PCI_SRIOV_CTRL_VFE) { + val &=3D ~PCI_SRIOV_CTRL_VFE; + pcie_sriov_config_write(dev, sriov_cap + PCI_SRIOV_CTRL, val, = 1); + } + } +} + +/* Add optional supported page sizes to the mask of supported page sizes */ +void pcie_sriov_pf_add_sup_pgsize(PCIDevice *dev, uint16_t opt_sup_pgsize) +{ + uint8_t *cfg =3D dev->config + dev->exp.sriov_cap; + uint8_t *wmask =3D dev->wmask + dev->exp.sriov_cap; + + uint16_t sup_pgsize =3D pci_get_word(cfg + PCI_SRIOV_SUP_PGSIZE); + + sup_pgsize |=3D opt_sup_pgsize; + + /* + * Make sure the new bits are set, and that system page size + * also can be set to any of the new values according to spec: + */ + pci_set_word(cfg + PCI_SRIOV_SUP_PGSIZE, sup_pgsize); + pci_set_word(wmask + PCI_SRIOV_SYS_PGSIZE, sup_pgsize); +} + + +uint16_t pcie_sriov_vf_number(PCIDevice *dev) +{ + assert(pci_is_vf(dev)); + return dev->exp.sriov_vf.vf_number; +} + + +PCIDevice *pcie_sriov_get_pf(PCIDevice *dev) +{ + return dev->exp.sriov_vf.pf; +} diff --git a/hw/pci/meson.build b/hw/pci/meson.build index 5c4bbac817..bcc9c75919 100644 --- a/hw/pci/meson.build +++ b/hw/pci/meson.build @@ -5,6 +5,7 @@ pci_ss.add(files( 'pci.c', 'pci_bridge.c', 'pci_host.c', + 'pcie_sriov.c', 'shpc.c', 'slotid_cap.c' )) diff --git a/hw/pci/trace-events b/hw/pci/trace-events index 7570752c40..aaf46bc92d 100644 --- a/hw/pci/trace-events +++ b/hw/pci/trace-events @@ -10,3 +10,8 @@ pci_cfg_write(const char *dev, uint32_t bus, uint32_t slo= t, uint32_t func, unsig =20 # msix.c msix_write_config(char *name, bool enabled, bool masked) "dev %s enabled %= d masked %d" + +# hw/pci/pcie_sriov.c +sriov_register_vfs(const char *name, int slot, int function, int num_vfs) = "%s %02x:%x: creating %d vf devs" +sriov_unregister_vfs(const char *name, int slot, int function, int num_vfs= ) "%s %02x:%x: Unregistering %d vf devs" +sriov_config_write(const char *name, int slot, int fun, uint32_t offset, u= int32_t val, uint32_t len) "%s %02x:%x: sriov offset 0x%x val 0x%x len %d" --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164664864418657.26887520047342; Mon, 7 Mar 2022 02:24:04 -0800 (PST) Received: from localhost ([::1]:51960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAX3-0006lI-G0 for importer@patchew.org; Mon, 07 Mar 2022 05:24:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACT-0001pW-5K for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45656) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACR-0002nX-6N for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:44 -0500 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-2nqFuS93MtqbJUwik6mBig-1; Mon, 07 Mar 2022 05:02:41 -0500 Received: by mail-ej1-f70.google.com with SMTP id hx13-20020a170906846d00b006db02e1a307so1673069ejc.2 for ; Mon, 07 Mar 2022 02:02:41 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id qp3-20020a170907206300b006da96b87e9csm4285047ejb.181.2022.03.07.02.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647362; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DkfRe+4XN2ej+2g6vgbi6qb5c1d4eupHyNI5HdgNhQg=; b=R4Cj646itsHHq1xLIcnuUreOLM/0KUkKG1bsi/qLVbD4e0oqJprUuMO4Bb4DeJ9E20qtZ+ eu54SpQI3BYBUF7si99dmAtqmYMAyzYoGu2FwFqI/flsdZYTRPFNvW3xV3kQsvA2/K3/rB EBOmOMFUOgAKtT874zVyrBW3OAG3FLI= X-MC-Unique: 2nqFuS93MtqbJUwik6mBig-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DkfRe+4XN2ej+2g6vgbi6qb5c1d4eupHyNI5HdgNhQg=; b=G2JqlR63H6gh7cEVeNHJ+QkIVcQJE8CmtVi2orY2qPg5czTgjUCU0+E2CYW0Zqu5op XW/yzyXF8Ms0NMb1jwlZPqkogjaYOIfTTxYPNSZoWlIZi/vhSGpzVvjPsRmULw3I3I+K fKBnzEz+n8NrAP78BsPV93aCGB2iKi06eLqYMsP3B7Vrv9iKH3GMVdHZch/AiCIPWZE4 t7QLNy+mTzNo6fcFO9WTRtGB5HIFujt6P7bfHxfaPqT/W5vxhd7IZSNbF7Pi7V9BNR2v 3mwwYNHRuo/tlr+JKGnhvvCZ0rcIOf5tJ9HimmWqrsh6LWv9JwgyE911bz3D3o+s2lUr 8qMw== X-Gm-Message-State: AOAM532v4aerOZJV7tA+m+TBFg6Ym56JmC4lXQQTMvvmuynqBJt+oRbU HfjBhKt5LXoDfviiSDY2P5kiFSfUkJmZ61av8t6eGdQAxNtqGDGE3qGWd7GCxL4bMScoAJcje50 Um3Rq48OE8W2A5N9HMU/9RtZiuPcx8kRl3iOwIxOlLjbQxK399jw5cn7DD2QQ X-Received: by 2002:a17:906:7953:b0:6da:951c:1173 with SMTP id l19-20020a170906795300b006da951c1173mr8559883ejo.465.1646647359460; Mon, 07 Mar 2022 02:02:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAy2ILGDc23s7K6qkIYsoYPK+uSrHTLl6R0eyOTOSSzTl09euAav5sIfRe4X2kKO2d4GMe9g== X-Received: by 2002:a17:906:7953:b0:6da:951c:1173 with SMTP id l19-20020a170906795300b006da951c1173mr8559858ejo.465.1646647359083; Mon, 07 Mar 2022 02:02:39 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:36 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 25/47] pcie: Add some SR/IOV API documentation in docs/pcie_sriov.txt Message-ID: <20220307100058.449628-26-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Knut Omang , Knut Omang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648645223100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Knut Omang Add a small intro + minimal documentation for how to implement SR/IOV support for an emulated device. Signed-off-by: Knut Omang Message-Id: <20220217174504.1051716-3-lukasz.maniak@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/pcie_sriov.txt | 115 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 docs/pcie_sriov.txt diff --git a/docs/pcie_sriov.txt b/docs/pcie_sriov.txt new file mode 100644 index 0000000000..f5e891e1d4 --- /dev/null +++ b/docs/pcie_sriov.txt @@ -0,0 +1,115 @@ +PCI SR/IOV EMULATION SUPPORT +=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 + +Description +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +SR/IOV (Single Root I/O Virtualization) is an optional extended capability +of a PCI Express device. It allows a single physical function (PF) to appe= ar as multiple +virtual functions (VFs) for the main purpose of eliminating software +overhead in I/O from virtual machines. + +Qemu now implements the basic common functionality to enable an emulated d= evice +to support SR/IOV. Yet no fully implemented devices exists in Qemu, but a +proof-of-concept hack of the Intel igb can be found here: + +git://github.com/knuto/qemu.git sriov_patches_v5 + +Implementation +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Implementing emulation of an SR/IOV capable device typically consists of +implementing support for two types of device classes; the "normal" physica= l device +(PF) and the virtual device (VF). From Qemu's perspective, the VFs are just +like other devices, except that some of their properties are derived from +the PF. + +A virtual function is different from a physical function in that the BAR +space for all VFs are defined by the BAR registers in the PFs SR/IOV +capability. All VFs have the same BARs and BAR sizes. + +Accesses to these virtual BARs then is computed as + + + * + + +From our emulation perspective this means that there is a separate call for +setting up a BAR for a VF. + +1) To enable SR/IOV support in the PF, it must be a PCI Express device so + you would need to add a PCI Express capability in the normal PCI + capability list. You might also want to add an ARI (Alternative + Routing-ID Interpretation) capability to indicate that your device + supports functions beyond it's "own" function space (0-7), + which is necessary to support more than 7 functions, or + if functions extends beyond offset 7 because they are placed at an + offset > 1 or have stride > 1. + + ... + #include "hw/pci/pcie.h" + #include "hw/pci/pcie_sriov.h" + + pci_your_pf_dev_realize( ... ) + { + ... + int ret =3D pcie_endpoint_cap_init(d, 0x70); + ... + pcie_ari_init(d, 0x100, 1); + ... + + /* Add and initialize the SR/IOV capability */ + pcie_sriov_pf_init(d, 0x200, "your_virtual_dev", + vf_devid, initial_vfs, total_vfs, + fun_offset, stride); + + /* Set up individual VF BARs (parameters as for normal BARs) */ + pcie_sriov_pf_init_vf_bar( ... ) + ... + } + + For cleanup, you simply call: + + pcie_sriov_pf_exit(device); + + which will delete all the virtual functions and associated resources. + +2) Similarly in the implementation of the virtual function, you need to + make it a PCI Express device and add a similar set of capabilities + except for the SR/IOV capability. Then you need to set up the VF BARs as + subregions of the PFs SR/IOV VF BARs by calling + pcie_sriov_vf_register_bar() instead of the normal pci_register_bar() c= all: + + pci_your_vf_dev_realize( ... ) + { + ... + int ret =3D pcie_endpoint_cap_init(d, 0x60); + ... + pcie_ari_init(d, 0x100, 1); + ... + memory_region_init(mr, ... ) + pcie_sriov_vf_register_bar(d, bar_nr, mr); + ... + } + +Testing on Linux guest +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +The easiest is if your device driver supports sysfs based SR/IOV +enabling. Support for this was added in kernel v.3.8, so not all drivers +support it yet. + +To enable 4 VFs for a device at 01:00.0: + + modprobe yourdriver + echo 4 > /sys/bus/pci/devices/0000:01:00.0/sriov_numvfs + +You should now see 4 VFs with lspci. +To turn SR/IOV off again - the standard requires you to turn it off before= you can enable +another VF count, and the emulation enforces this: + + echo 0 > /sys/bus/pci/devices/0000:01:00.0/sriov_numvfs + +Older drivers typically provide a max_vfs module parameter +to enable it at load time: + + modprobe yourdriver max_vfs=3D4 + +To disable the VFs again then, you simply have to unload the driver: + + rmmod yourdriver --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16466489443244.401295290963958; Mon, 7 Mar 2022 02:29:04 -0800 (PST) Received: from localhost ([::1]:39146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAbv-0000D1-Ha for importer@patchew.org; Mon, 07 Mar 2022 05:29:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACU-0001uZ-T9 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50535) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACT-0002nj-6x for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:46 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-144-lEb58oT1OEqdjU8QbbAamg-1; Mon, 07 Mar 2022 05:02:43 -0500 Received: by mail-ed1-f70.google.com with SMTP id l24-20020a056402231800b00410f19a3103so8322732eda.5 for ; Mon, 07 Mar 2022 02:02:43 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id u10-20020a50d94a000000b004131aa2525esm6031003edj.49.2022.03.07.02.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647364; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Nfa7HHR2REoaTfd34g0WHMW6eNj0XG3k8vtXlnv0J3Q=; b=MzENFFH63QrGh7rxSM9SKM5XHixERQx89faqagMu4Jj476eUUlCRn9AFtFg8TR6aqR8uwg 5aQbZ5wadxkgWxtYSfL2yzizQAVRd4nheiyCrstdzvdkDaSAyBUE/RZSbmv7mh2gBAOshC I2sk+RMywcAkdDVaveQ3FAkQL0jOqaE= X-MC-Unique: lEb58oT1OEqdjU8QbbAamg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Nfa7HHR2REoaTfd34g0WHMW6eNj0XG3k8vtXlnv0J3Q=; b=7dt9RsqJUB+jUt/dyyw0v7c3RFPaEuJFaMdBqgqKChpIe+uD1BrmTj9eUODTbvObl3 vJq5Ex6KkERA0aUL5NycTqTfTsxluHxidQtOrDIxujAeS1xQovr9E8kbOhb0zODywXXJ p0GQNdGD2xSVUFSlnn0zNS+2VzKCBGr3qwkuMU+5EApYlczbInSvUluX+di5W6Bx4Ms5 gGbNQHRXJQUxrQHi7CTGNbzr1IfuaOCTaSgigvLixBJTNiUsvk5fRnctPVBNKOxqZO3Z ZeCiIElDikWSYF4/eQhwwhs92/uu3Pnk+mSiSYukE6w5nvWYSlmnHQCfAzK4+Gl//zpX q+XQ== X-Gm-Message-State: AOAM532KVL32qcjJJFWQiIoNaB+7ado2Uk9tvwiYpt9tprSvuB2qqpPi bjFGheIN+QMRLWpAUIiuhDyDFG8yxBQUbT7LuNLryrQ4eURQPoA7Oc35bQgDTPd/mhzSrwt0ud8 iiJLTVFvCRNcVTzjSST0eUQwVm2+60PRmPKsrUusCXz91IpVnhw4o6/ekL7yV X-Received: by 2002:a17:906:fb1b:b0:6da:9e7d:1390 with SMTP id lz27-20020a170906fb1b00b006da9e7d1390mr8139548ejb.644.1646647362166; Mon, 07 Mar 2022 02:02:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUd24vPcudoC1sglXENnZ0Ntg1GQTMHUT3jECuQGoPC1NyfXRPeUEysJjk5WB0otu/xcaCWw== X-Received: by 2002:a17:906:fb1b:b0:6da:9e7d:1390 with SMTP id lz27-20020a170906fb1b00b006da9e7d1390mr8139530ejb.644.1646647361895; Mon, 07 Mar 2022 02:02:41 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:39 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 26/47] pcie: Add a helper to the SR/IOV API Message-ID: <20220307100058.449628-27-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Knut Omang , =?utf-8?Q?=C5=81ukasz?= Gieryk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648946963100001 From: =C5=81ukasz Gieryk Convenience function for retrieving the PCIDevice object of the N-th VF. Signed-off-by: =C5=81ukasz Gieryk Reviewed-by: Knut Omang Message-Id: <20220217174504.1051716-4-lukasz.maniak@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_sriov.h | 6 ++++++ hw/pci/pcie_sriov.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h index 990cff0a1c..80f5c84e75 100644 --- a/include/hw/pci/pcie_sriov.h +++ b/include/hw/pci/pcie_sriov.h @@ -68,4 +68,10 @@ uint16_t pcie_sriov_vf_number(PCIDevice *dev); */ PCIDevice *pcie_sriov_get_pf(PCIDevice *dev); =20 +/* + * Get the n-th VF of this physical function - only valid for PF. + * Returns NULL if index is invalid + */ +PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n); + #endif /* QEMU_PCIE_SRIOV_H */ diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c index 3f256d483f..87abad6ac8 100644 --- a/hw/pci/pcie_sriov.c +++ b/hw/pci/pcie_sriov.c @@ -287,8 +287,16 @@ uint16_t pcie_sriov_vf_number(PCIDevice *dev) return dev->exp.sriov_vf.vf_number; } =20 - PCIDevice *pcie_sriov_get_pf(PCIDevice *dev) { return dev->exp.sriov_vf.pf; } + +PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n) +{ + assert(!pci_is_vf(dev)); + if (n < dev->exp.sriov_pf.num_vfs) { + return dev->exp.sriov_pf.vf[n]; + } + return NULL; +} --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648938398996.439610531102; Mon, 7 Mar 2022 02:28:58 -0800 (PST) Received: from localhost ([::1]:38642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAbp-0008Jx-NW for importer@patchew.org; Mon, 07 Mar 2022 05:28:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACX-000216-Jd for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACW-0002o9-4D for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:49 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-381-fSwmNMMVN_GjRB3_WgMRew-1; Mon, 07 Mar 2022 05:02:46 -0500 Received: by mail-ed1-f71.google.com with SMTP id r9-20020a05640251c900b00412d54ea618so8269150edd.3 for ; Mon, 07 Mar 2022 02:02:46 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id n6-20020a170906724600b006d4e2f6857dsm4543604ejk.139.2022.03.07.02.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647367; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IjGfq51R1V+EiuJTNpSRpX5c6IUrfGMgpNpMM4jK+NE=; b=NNPQEKn+Ne54JmUVMAMVmtgxfZTevy/f7yaduu+5z/LpMo5Z7C+SkG/LHc50xDA580gZ6Y wHMOc/akIQeHKkLqMOv/2bK40afWtCjlZmjNq9HfNiVQG8ci/zRZcbLFf46ACy6zKIHOoF 53Yg9UW/qkXA+SHULyyeiI9Dp9utOXI= X-MC-Unique: fSwmNMMVN_GjRB3_WgMRew-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=IjGfq51R1V+EiuJTNpSRpX5c6IUrfGMgpNpMM4jK+NE=; b=IwOv2ERjauGG4jw9v5slsx2Wzz84hIeZ6snqgTtNoFf3+ise62NatSA6Rfyt9Zs+sc dhNXXZkibWTsi9jFe7USidD31FRhytYPxZ2MWSR67ArQ3npfEN48bwUrf7r4ZwYb1Uxu 1WUcuaMzwjPltWGiu1MMX2SGkv/LVHTp3Q2lZvBwdvUjoe3EYLegjVYRjbqjJLh4DaVd LMsbw4187zIF/MxvBdJ3upIuxBLtMgj9y/Z5XExYVOxgpqm1GTbEGVjQijnrDzxS6TAc jmyWVNEfn32QUTtqjjQYeo1Ddb1pY8OEDodXI7wp/UI6I/c+WGRCieVsELUGcu3Bmjkg w8VA== X-Gm-Message-State: AOAM531etFTzPhJhTbtvanqRanWW1foVruVQWcez8DdTrFbu11AeMQua OeVhI/R/3H4B2/WjwMq0GS1axAno+YDNgfRlUhW7bZqFoHLg8y2PV+JAjwPvU0b0YXU6KQCvXCa OE49GVpmg+VDOvJtnHRqhR0xTJ+0x6oPGuDpDn31tm0ou43Ckbx3kBf0QyzPx X-Received: by 2002:a17:906:4793:b0:6db:4bd:95f1 with SMTP id cw19-20020a170906479300b006db04bd95f1mr7221598ejc.165.1646647364881; Mon, 07 Mar 2022 02:02:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxeZSOGOqpqzI3vOuo9CJW/LepmOOnsZhWbAUyti4eJE/Ydxv6uETjsSHRg4PAxL5/efapmSQ== X-Received: by 2002:a17:906:4793:b0:6db:4bd:95f1 with SMTP id cw19-20020a170906479300b006db04bd95f1mr7221576ejc.165.1646647364600; Mon, 07 Mar 2022 02:02:44 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:42 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 27/47] pcie: Add 1.2 version token for the Power Management Capability Message-ID: <20220307100058.449628-28-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , =?utf-8?Q?=C5=81ukasz?= Gieryk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648940974100001 From: =C5=81ukasz Gieryk Signed-off-by: =C5=81ukasz Gieryk Message-Id: <20220217174504.1051716-5-lukasz.maniak@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci_regs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/hw/pci/pci_regs.h b/include/hw/pci/pci_regs.h index 77ba64b931..a590140962 100644 --- a/include/hw/pci/pci_regs.h +++ b/include/hw/pci/pci_regs.h @@ -4,5 +4,6 @@ #include "standard-headers/linux/pci_regs.h" =20 #define PCI_PM_CAP_VER_1_1 0x0002 /* PCI PM spec ver. 1.1 */ +#define PCI_PM_CAP_VER_1_2 0x0003 /* PCI PM spec ver. 1.2 */ =20 #endif --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649173926934.5952144302382; Mon, 7 Mar 2022 02:32:53 -0800 (PST) Received: from localhost ([::1]:47176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAfd-0005cQ-7l for importer@patchew.org; Mon, 07 Mar 2022 05:32:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACZ-00026J-Pt for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACY-0002oK-C0 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:51 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-skvz22tENwmJhuGQx8jbkA-1; Mon, 07 Mar 2022 05:02:48 -0500 Received: by mail-ej1-f71.google.com with SMTP id hq34-20020a1709073f2200b006d677c94909so6777664ejc.8 for ; Mon, 07 Mar 2022 02:02:48 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id y18-20020a170906471200b006da8a883b5fsm4529019ejq.54.2022.03.07.02.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647369; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5b8reuTHyuhMIH4vmrxET5yF+Z8FE8Jp8knp1f17Abw=; b=cxeJaIJ/4v6PoMSym/JYVQUtZu70XPszVuHlUQAcquUo5clzyCnXxOBmmBN5ZYGZy4MLRo nfu1xIDpJ8JKVXY4nleeZmiNlDrabWYMBOo9PVOr62eQ4GTvLYQSdeHM+ryXzlndi5FOMF FptZ+AwS43ynMFwEwF91+cOhUGxIUeg= X-MC-Unique: skvz22tENwmJhuGQx8jbkA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5b8reuTHyuhMIH4vmrxET5yF+Z8FE8Jp8knp1f17Abw=; b=sjhTqv3cIFWzSJH1IN3it9hVinb4+bMdTKdQN8KrZRMDUkJZRVXRZ45kXSypNjMclt s1AWZzycEa1SVgAY/6YCNlHkOu6mKKm1dqdIvp3Ximyw2WBIBB2k/xgcVAJeCtPOyXVO h5/TrodE955tb5CUEd0uM2T0ch9nnSsruyB1HG53DOMhwg67o44IsnY8W0t06TgHq1lV UX4A9SO9jrbhKMInN+cCwiuoLUper8UTuhXywtSUCyzuLKJ9hMXGkeSsvmR3rA2xRwtS gCaaF+6SgoDClF5m713g8B99utxIAakKwnt2cUMBL1PsAwPdSJvfxdhKcTMHSYaQy0AO Xrkw== X-Gm-Message-State: AOAM530ZM1gcdjgO7xPFGw6IHGGHnGzDbM8lQE0nYDtYV7NRuN8eQGNz U1K8tLoODsYufT8Q0XBFUDSwUs3YWM7X6hwSxHXLdRMvwibvq/nKJc3y7cGA8m29ZQlT9RSlsfd 3y+jxXhwkgOQNKEGCGd2lg8oQqjWnQU2cet8p0LNKgmROYER20k24APPwoIoh X-Received: by 2002:a17:906:1ec3:b0:6cf:d118:59e2 with SMTP id m3-20020a1709061ec300b006cfd11859e2mr8430350ejj.767.1646647367355; Mon, 07 Mar 2022 02:02:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyQTVh94iv2oxK47Oun1dhpg4LVENgF0MkePsmgamdSsSThTkLdsYo3q0akMzcrVMHM/ULJQ== X-Received: by 2002:a17:906:1ec3:b0:6cf:d118:59e2 with SMTP id m3-20020a1709061ec300b006cfd11859e2mr8430323ejj.767.1646647367080; Mon, 07 Mar 2022 02:02:47 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:44 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 28/47] pci-bridge/xio3130_upstream: Fix error handling Message-ID: <20220307100058.449628-29-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Jonathan Cameron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649176072100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron Goto label is incorrect so msi cleanup would not occur if there is an error in the ssvid initialization. Signed-off-by: Jonathan Cameron Message-Id: <20220218102303.7061-1-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-bridge/xio3130_upstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstr= eam.c index 5cd3af4fbc..5ff46ef050 100644 --- a/hw/pci-bridge/xio3130_upstream.c +++ b/hw/pci-bridge/xio3130_upstream.c @@ -75,7 +75,7 @@ static void xio3130_upstream_realize(PCIDevice *d, Error = **errp) XIO3130_SSVID_SVID, XIO3130_SSVID_SSID, errp); if (rc < 0) { - goto err_bridge; + goto err_msi; } =20 rc =3D pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_UPSTREAM, --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649298732615.1736017349351; Mon, 7 Mar 2022 02:34:58 -0800 (PST) Received: from localhost ([::1]:55704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAhd-0002tG-Nh for importer@patchew.org; Mon, 07 Mar 2022 05:34:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACc-0002AC-PK for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACb-0002og-B8 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:54 -0500 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-321-R-0Dltu1Mcqx-VKK1LBkrA-1; Mon, 07 Mar 2022 05:02:52 -0500 Received: by mail-ej1-f69.google.com with SMTP id ga31-20020a1709070c1f00b006cec400422fso6734718ejc.22 for ; Mon, 07 Mar 2022 02:02:51 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id s8-20020a170906354800b006da9dec91f2sm4220011eja.163.2022.03.07.02.02.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0SLrr2pzwbz8DMCaGa52u4y7YRyNCIg4T/EysVR8B14=; b=ZRibq/mIYhnLUQeOqqptE6cuhhxu+XbplGd3W5OPVHg51SloIfuo+X0/YDLyihmJWITbA5 H5Tx0uBHmfhQoVw39WJCkhBvdZy7QF6YEZnPlWSfsEfPG4Z4ofvZyY6PhVZMOZXJ3kmQem bTNdCbY1RswDmMb/UpauHr1Ef6IYleQ= X-MC-Unique: R-0Dltu1Mcqx-VKK1LBkrA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0SLrr2pzwbz8DMCaGa52u4y7YRyNCIg4T/EysVR8B14=; b=lB9FdEJcDa+WmYVG5Ko3u2GRGT31BS2zfxQiYBSP+40AeOMA6Ykr8r6XDZC56JpTOA MW6ObXWeVa3998TmqC00SpFD+l2CF2LyQHx7TeXGZuCQPm5yyvELOf0khfsA5qdPqQTE CcZkogU9xBCMwuHjbQoG71RRDSmAx+izR5zcqhSXZnFpSuuGga//PWbUv804Y4OheQho pXAM+NJLxR6Kxn9icWrg+SciO1wTnVlWW/KnZ6Lt1ELRYXCmLbh/pHngy0rNGmjJQ2HO X3GTldX+CJYcHPDiiQiIut+DVoddca082KuCMIQNlmXmBy3SwsypG7FJckqGnDItNGuP FyeQ== X-Gm-Message-State: AOAM5337pxuWq3nJaGdP5Dxg+bf+A+pwd7t+tYwiiI7GAU5ehqqaJy6O 6pIpco9wAWuUJqLI4wiZ6ZQQD+yiQbBUpKxXLf9+wVOtsjmd71RYd7HCJ6MGWlgszUsjCAhyTMu ywNXfd1HXn1nwCbGb6VH10hKOyCThUTyXIPDsedD8ZhuFrmogMri42GlUz546 X-Received: by 2002:aa7:d384:0:b0:415:e2f0:1a21 with SMTP id x4-20020aa7d384000000b00415e2f01a21mr10055045edq.230.1646647370450; Mon, 07 Mar 2022 02:02:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVJoFdF82Adi3X17h4w7ETJQ1acUzE/5WOLG2IJLWFaJ2guWeAgRTTGd8GKaVRu9ZaUQqCMQ== X-Received: by 2002:aa7:d384:0:b0:415:e2f0:1a21 with SMTP id x4-20020aa7d384000000b00415e2f01a21mr10055022edq.230.1646647370235; Mon, 07 Mar 2022 02:02:50 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:47 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 29/47] pci-bridge/xio3130_downstream: Fix error handling Message-ID: <20220307100058.449628-30-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Jonathan Cameron Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649300236100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Jonathan Cameron Wrong goto label, so msi cleanup would not occur if there is an error in the ssvid initialization. Signed-off-by: Jonathan Cameron Message-Id: <20220218102303.7061-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-bridge/xio3130_downstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_dow= nstream.c index 04aae72cd6..080a6613fe 100644 --- a/hw/pci-bridge/xio3130_downstream.c +++ b/hw/pci-bridge/xio3130_downstream.c @@ -84,7 +84,7 @@ static void xio3130_downstream_realize(PCIDevice *d, Erro= r **errp) XIO3130_SSVID_SVID, XIO3130_SSVID_SSID, errp); if (rc < 0) { - goto err_bridge; + goto err_msi; } =20 rc =3D pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM, --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649178302656.8806825047486; Mon, 7 Mar 2022 02:32:58 -0800 (PST) Received: from localhost ([::1]:47662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAfh-0005zO-JO for importer@patchew.org; Mon, 07 Mar 2022 05:32:57 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACf-0002C7-L0 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:20607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACe-0002ov-5I for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:02:57 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-8BnFHsPmNrWOR5q4Te1iGA-1; Mon, 07 Mar 2022 05:02:54 -0500 Received: by mail-ej1-f71.google.com with SMTP id r18-20020a17090609d200b006a6e943d09eso6721731eje.20 for ; Mon, 07 Mar 2022 02:02:54 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id g9-20020aa7c849000000b00412fc6bf26dsm6085028edt.80.2022.03.07.02.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KRo1oLzj8z655SYF1zAVR80J4AJJ+nuqJ/mStJU6s7s=; b=QyUksxJGoHuAYMvivcW1j89NJep/5JlUUwq6ObgI+1cfyM7rWPNc/7jmyWLQBVnQw7Afv1 Urp+j4KuxsRgTV8b1Bw8wxOjdaQ4JU/6lgdGrlSRcGtVxdSK0BViqyU5M+mVk+qQqUlQDt QgjyXLY/OiV9d7ZGYgtsNkbT8A1z6fI= X-MC-Unique: 8BnFHsPmNrWOR5q4Te1iGA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=KRo1oLzj8z655SYF1zAVR80J4AJJ+nuqJ/mStJU6s7s=; b=1sZqj7jTL2o9bMe4fqzVA+2iswGUhsixJOcSQwAvTECH3mjUy1xCOAwyaAc3aycnzm 9j6BcmLsW/i8IsPTvqHPckVkqIEgISN5S1cHgOCkEBixWp/z5xDgJpZ+mua25ZnXsyAe MxI+/1vYImnMPTMhJr4L3sAY3NQsYejvfTqNZ+Rwt67iWcTr2gJXpPaPcwMEOppZpgVq YOcrSg8teSFuQW3oXhtgsWmOgVCDcmBkIywlxCukF1twU+8CJ2fisNXyZIKI6AEQ3S1e v3AQgx0MWKw3v7SV/GugNWEiddR5SkuPlj5fh6CV9GtZHsx4FaYQj3kS5Jmy4gIjeKur B1XQ== X-Gm-Message-State: AOAM5312D+hW/rEaqDU5U044gXIQ+Ad9Na58m+drwVx5G4s2BWMudusP GdpeV2KxDfUb8gNSSyTm3tnpsBCtAuoX/WaJu1OATHmF6REIH/Bv6CRaA6U/yNNIUiwkbVn7+ju TBNDEVIjSphxrlzWzEBnc4lNpWgRvFEhhirUOPxvG2VYRS1dh+OR/dGk+eyRE X-Received: by 2002:a05:6402:2812:b0:416:46ab:818c with SMTP id h18-20020a056402281200b0041646ab818cmr4168773ede.258.1646647373098; Mon, 07 Mar 2022 02:02:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK7B3A+t8TLlNl1Df5emhjr4z3xFoczQx1eJDyOMCoUTn5tvLqJbR1JcAmBq0Hene1EXZX6w== X-Received: by 2002:a05:6402:2812:b0:416:46ab:818c with SMTP id h18-20020a056402281200b0041646ab818cmr4168751ede.258.1646647372901; Mon, 07 Mar 2022 02:02:52 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:50 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 30/47] headers: Add pvpanic.h Message-ID: <20220307100058.449628-31-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Cornelia Huck , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , zhenwei pi , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649179835100001 From: zhenwei pi Since 2020, linux kernel started to export pvpanic.h. Import the latest version from linux into QEMU. Signed-off-by: zhenwei pi Message-Id: <20220221122717.1371010-1-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/standard-headers/linux/pvpanic.h | 9 +++++++++ scripts/update-linux-headers.sh | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 include/standard-headers/linux/pvpanic.h diff --git a/include/standard-headers/linux/pvpanic.h b/include/standard-he= aders/linux/pvpanic.h new file mode 100644 index 0000000000..54b7485390 --- /dev/null +++ b/include/standard-headers/linux/pvpanic.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ + +#ifndef __PVPANIC_H__ +#define __PVPANIC_H__ + +#define PVPANIC_PANICKED (1 << 0) +#define PVPANIC_CRASH_LOADED (1 << 1) + +#endif /* __PVPANIC_H__ */ diff --git a/scripts/update-linux-headers.sh b/scripts/update-linux-headers= .sh index fe850763c5..839a5ec614 100755 --- a/scripts/update-linux-headers.sh +++ b/scripts/update-linux-headers.sh @@ -214,7 +214,8 @@ for i in "$tmpdir"/include/linux/*virtio*.h \ "$tmpdir/include/linux/const.h" \ "$tmpdir/include/linux/kernel.h" \ "$tmpdir/include/linux/vhost_types.h" \ - "$tmpdir/include/linux/sysinfo.h"; do + "$tmpdir/include/linux/sysinfo.h" \ + "$tmpdir/include/misc/pvpanic.h"; do cp_portable "$i" "$output/include/standard-headers/linux" done mkdir -p "$output/include/standard-headers/drm" --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649603520938.2196159626181; Mon, 7 Mar 2022 02:40:03 -0800 (PST) Received: from localhost ([::1]:36252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAmY-0000hu-GL for importer@patchew.org; Mon, 07 Mar 2022 05:40:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACj-0002DJ-2s for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45874) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACh-0002pD-Bm for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:00 -0500 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-sAGiyKuFNP64hrzgAwD-Bg-1; Mon, 07 Mar 2022 05:02:57 -0500 Received: by mail-ej1-f72.google.com with SMTP id hx13-20020a170906846d00b006db02e1a307so1673379ejc.2 for ; Mon, 07 Mar 2022 02:02:57 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id bq23-20020a170906d0d700b006db0372d3a2sm2305642ejb.20.2022.03.07.02.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647378; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k3FB3bferdbl03k+KFKWByjScfRpd+RvVcbGHdUp8Wc=; b=Aa4UcxvQzaIAkivpJ8fCgeT6DwFKjgDXQR86pdPuR27foYLgL2UikjGSonyT/vu0efqvNI 9iUV6x1Z11lNPDxOrpOwRS7/vowzLuCMJzyPk4UnEBxon5LssjcmJkp/3KX1bpp33FhweQ KwF1yBvPE1T2wRwbqqjHwBan+t/kpaM= X-MC-Unique: sAGiyKuFNP64hrzgAwD-Bg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=k3FB3bferdbl03k+KFKWByjScfRpd+RvVcbGHdUp8Wc=; b=VuATkBoiir/pc4Q4P1XMzTFhhPkJ/NrJPFEvkfLk0HssYQn8oLbTok5YGztwBLOBle 5Io6WC72ZaJDJ6NBZ2WsMdInS/io5unNcz+AB3hnS7dVRkPWSzFvNlFWipPlZHFK3/2b IO2wpxx8XaEKD8Zi59Ip/HebUZ/Ns7K1WjllYmyswji8sE1KFqitCkbzeaYLEX67czmi ghvpqxdLEIeBI0j4VqtxiysXAhMe9jjvWFmIX04uvMbnbzL0oXjh7UWJxRV+LSgJml92 vYy0toPH7GNHTEB9CWFeQsKLOcE6nLxF+3mgmdKt/BeEXQTUBqvJXsyfgG2OYSwcvjNQ vUmQ== X-Gm-Message-State: AOAM531k3nRv5aM06p5WyuD9KrmVYWWZzASAqJONQvCe6cGc5BkxF1KA QVY3hGRcvTtk5Rjp0DDg8SUxlj6bQ3ubiSFVuxNKd6sg5xHc/L1Erw+Ylr/+U9ZLGvg+T/nLXtQ 1WmrpRarTwZZ3V+Mvgk4/2iDJDWgMGV7h3q2t37QZZTpUhRUVjSDHMdcPihqH X-Received: by 2002:aa7:cc82:0:b0:410:d2b0:1a07 with SMTP id p2-20020aa7cc82000000b00410d2b01a07mr10493322edt.359.1646647375935; Mon, 07 Mar 2022 02:02:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0+kGLiTtefV0KoJhYWcK4hcmXt1foiFStFh3OjV6G5YAfquOHPh+sS/BzM80BbqwR2W798A== X-Received: by 2002:aa7:cc82:0:b0:410:d2b0:1a07 with SMTP id p2-20020aa7cc82000000b00410d2b01a07mr10493291edt.359.1646647375620; Mon, 07 Mar 2022 02:02:55 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:53 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 31/47] hw/misc/pvpanic: Use standard headers instead Message-ID: <20220307100058.449628-32-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Thomas Huth , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , zhenwei pi , Alistair Francis , Bernhard Beschow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649605366100003 From: zhenwei pi QEMU side has already imported pvpanic.h from linux, remove bit definitions from include/hw/misc/pvpanic.h, and use include/standard-headers/linux/pvpanic.h instead. Also minor changes for PVPANIC_CRASHLOADED -> PVPANIC_CRASH_LOADED. Signed-off-by: zhenwei pi Message-Id: <20220221122717.1371010-2-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/misc/pvpanic.h | 8 -------- hw/misc/pvpanic-isa.c | 4 +++- hw/misc/pvpanic-pci.c | 4 +++- hw/misc/pvpanic.c | 5 +++-- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/include/hw/misc/pvpanic.h b/include/hw/misc/pvpanic.h index ca3c5bb533..7f16cc9b16 100644 --- a/include/hw/misc/pvpanic.h +++ b/include/hw/misc/pvpanic.h @@ -22,14 +22,6 @@ =20 #define PVPANIC_IOPORT_PROP "ioport" =20 -/* The bit of supported pv event, TODO: include uapi header and remove thi= s */ -#define PVPANIC_F_PANICKED 0 -#define PVPANIC_F_CRASHLOADED 1 - -/* The pv event value */ -#define PVPANIC_PANICKED (1 << PVPANIC_F_PANICKED) -#define PVPANIC_CRASHLOADED (1 << PVPANIC_F_CRASHLOADED) - /* * PVPanicState for any device type */ diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c index a39fcdd1fc..b84d4d458d 100644 --- a/hw/misc/pvpanic-isa.c +++ b/hw/misc/pvpanic-isa.c @@ -21,6 +21,7 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" #include "hw/isa/isa.h" +#include "standard-headers/linux/pvpanic.h" =20 OBJECT_DECLARE_SIMPLE_TYPE(PVPanicISAState, PVPANIC_ISA_DEVICE) =20 @@ -64,7 +65,8 @@ static void pvpanic_isa_realizefn(DeviceState *dev, Error= **errp) =20 static Property pvpanic_isa_properties[] =3D { DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicISAState, ioport, 0x505= ), - DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, PVPANIC_P= ANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_UINT8("events", PVPanicISAState, pvpanic.events, + PVPANIC_PANICKED | PVPANIC_CRASH_LOADED), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c index 62e1be68c1..99cf7e2041 100644 --- a/hw/misc/pvpanic-pci.c +++ b/hw/misc/pvpanic-pci.c @@ -21,6 +21,7 @@ #include "hw/misc/pvpanic.h" #include "qom/object.h" #include "hw/pci/pci.h" +#include "standard-headers/linux/pvpanic.h" =20 OBJECT_DECLARE_SIMPLE_TYPE(PVPanicPCIState, PVPANIC_PCI_DEVICE) =20 @@ -53,7 +54,8 @@ static void pvpanic_pci_realizefn(PCIDevice *dev, Error *= *errp) } =20 static Property pvpanic_pci_properties[] =3D { - DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, PVPANIC_P= ANICKED | PVPANIC_CRASHLOADED), + DEFINE_PROP_UINT8("events", PVPanicPCIState, pvpanic.events, + PVPANIC_PANICKED | PVPANIC_CRASH_LOADED), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c index e2cb4a5d28..1540e9091a 100644 --- a/hw/misc/pvpanic.c +++ b/hw/misc/pvpanic.c @@ -21,12 +21,13 @@ #include "hw/qdev-properties.h" #include "hw/misc/pvpanic.h" #include "qom/object.h" +#include "standard-headers/linux/pvpanic.h" =20 static void handle_event(int event) { static bool logged; =20 - if (event & ~(PVPANIC_PANICKED | PVPANIC_CRASHLOADED) && !logged) { + if (event & ~(PVPANIC_PANICKED | PVPANIC_CRASH_LOADED) && !logged) { qemu_log_mask(LOG_GUEST_ERROR, "pvpanic: unknown event %#x.\n", ev= ent); logged =3D true; } @@ -36,7 +37,7 @@ static void handle_event(int event) return; } =20 - if (event & PVPANIC_CRASHLOADED) { + if (event & PVPANIC_CRASH_LOADED) { qemu_system_guest_crashloaded(NULL); return; } --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646650013334582.255177616068; Mon, 7 Mar 2022 02:46:53 -0800 (PST) Received: from localhost ([::1]:53434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAtA-0003mW-BG for importer@patchew.org; Mon, 07 Mar 2022 05:46:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACo-0002ER-KE for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32834) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACk-0002pO-Gx for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:04 -0500 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-202-hkUWZ8t4O26CvRWYwcdDPQ-1; Mon, 07 Mar 2022 05:02:59 -0500 Received: by mail-ej1-f70.google.com with SMTP id ga31-20020a1709070c1f00b006cec400422fso6734920ejc.22 for ; Mon, 07 Mar 2022 02:02:59 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id l20-20020a1709062a9400b006ce71a88bf5sm4548642eje.183.2022.03.07.02.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:02:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647381; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q5Qs0Ta30Dp0mubfWgDTgHCOBS4dk+VOqy8LKgXc+bc=; b=QLQ86wGB0+Xnhg8yNqDvnR24Pe9goyCvU1DY8hhDRqIIQtST7TMYjubkvGBZd22eU5f0M9 5CywlKMBNEt6ZXWYyFE5/J2/XSgXGcKBCuIGB1ViWTKt0zGzbu6+AhKuLxJPrVKuUpqlWb i8SmSXZrN7r4dxyrS/X/ni1TrG48hI0= X-MC-Unique: hkUWZ8t4O26CvRWYwcdDPQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q5Qs0Ta30Dp0mubfWgDTgHCOBS4dk+VOqy8LKgXc+bc=; b=leULnf1i19SPGq4GoFD7gA+PSgQQOqOgHWNJxb+HPbn0kaLKSeF6E+y13IvIeCypde oaRgMS1US8aouETDiDrOIjvukAez5EMwU1/wvvyeGEZMYHdqfHpvRKX4cm4//sgceT1S uvVeLpWX4za8fql9a46wOEVJfeCUeUWmPxEv7FRGSTg/PbkhqHFU2rQRMOulPvxM4azH GYDvkVm2L+l8goP2/ueYE/oqbn3Yawiou7LSgDF85hmNTYnetltGRlivlAx0mZcu6QRW NJa5tJgymydalWyRGUFPkOAR+ONGdPBX4AZx0JaxRFIDOTNQ/Zd7v1txQoJYTgV6OD69 qaNw== X-Gm-Message-State: AOAM533jDAIOC7LW5eDTOOYO+IAzmyLt9AOTxHCj/gtpIwRu+n8vBJUM 3YBKHgKFZh3K02tCQANN5Sgme/dxjAQ4k+qj38lvKVPhTvc7ymXnsNcvCebwRCI4JleQzvPz2SE k3QvDGRwTBLaj/KTocER/TZaq6ZfsJ173ZVQKA5RuycYi8o8+H3R8t4O3E/9V X-Received: by 2002:a17:906:4cd2:b0:6c8:7a90:9c7 with SMTP id q18-20020a1709064cd200b006c87a9009c7mr8482469ejt.439.1646647378315; Mon, 07 Mar 2022 02:02:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxd28O8GJxOAdYTANmi1+yJ2Dwv/YDNKoNrCsrJMv65ZfFu2xdATT2j77j/oF1cxQzb1rsNCg== X-Received: by 2002:a17:906:4cd2:b0:6c8:7a90:9c7 with SMTP id q18-20020a1709064cd200b006c87a9009c7mr8482449ejt.439.1646647378063; Mon, 07 Mar 2022 02:02:58 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:55 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 32/47] pci: show id info when pci BDF conflict Message-ID: <20220307100058.449628-33-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Zhenzhong Duan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646650015059100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhenzhong Duan During qemu init stage, when there is pci BDF conflicts, qemu print a warning but not showing which device the BDF is occupied by. E.x: "PCI: slot 2 function 0 not available for virtio-scsi-pci, in use by virtio= -scsi-pci" To facilitate user knowing the offending device and fixing it, showing the id info in the warning. Signed-off-by: Zhenzhong Duan Message-Id: <20220223094435.64495-1-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index ba8fb92efc..5cb1232e27 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1099,9 +1099,9 @@ static PCIDevice *do_pci_register_device(PCIDevice *p= ci_dev, return NULL; } else if (!pci_bus_devfn_available(bus, devfn)) { error_setg(errp, "PCI: slot %d function %d not available for %s," - " in use by %s", + " in use by %s,id=3D%s", PCI_SLOT(devfn), PCI_FUNC(devfn), name, - bus->devices[devfn]->name); + bus->devices[devfn]->name, bus->devices[devfn]->qdev.id= ); return NULL; } else if (dev->hotplugged && !pci_is_vf(pci_dev) && --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649800054306.4359191662886; Mon, 7 Mar 2022 02:43:20 -0800 (PST) Received: from localhost ([::1]:44804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRApi-0006UK-RD for importer@patchew.org; Mon, 07 Mar 2022 05:43:18 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACo-0002EX-Ku for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACl-0002pU-Qf for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:05 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-539-vleeYp5rPWa4cRWtG-q_fA-1; Mon, 07 Mar 2022 05:03:02 -0500 Received: by mail-ed1-f69.google.com with SMTP id da28-20020a056402177c00b00415ce4b20baso7408307edb.17 for ; Mon, 07 Mar 2022 02:03:02 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id d4-20020a1709067a0400b006d6e3ca9f71sm4604327ejo.198.2022.03.07.02.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2BxKih/Yy0qiS5QUDi7wjAqw2GnHJ/nwONeXDCjAw2o=; b=B1KGexiqeJO0NHprEyrQFNN8Nb2kMKkUN86/3wArQu3rdDTYTJ1UmnJQX44MczsivkR0tV ad4pmrF6D0p2a3qoPnY5NzaZvy03ORYWG0a+fIn/VCodi6iU4qDRvY6QEb2UsuQeltCK+g 7uz+aomns9a/c8tAv4t9LutoA3sBYaQ= X-MC-Unique: vleeYp5rPWa4cRWtG-q_fA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2BxKih/Yy0qiS5QUDi7wjAqw2GnHJ/nwONeXDCjAw2o=; b=rbbYnWOIK8T+DTyXXoZE+U/Ii4vc5ArVEftIwkiL1fJR8xyBSrSlZ6AWmtjWszjRjZ jBg51Am68vWtQ/YE5xLR/fngvc48yIFSzPOs4dT6wGqueADeAuF/KrQJHXCm4rA9SeaJ xBPC4u2fnxvs58AgnKS0Nj7owyKO1mXOnTubbNkwSDqiLy/r/ZzMEQvc3rOEeO6IBTVn nTzs9UpnEqExws07h60lCHUX6cPZbd+9FoBcd2ayoBNOzu2EspZaBy76xXp5poy7eKa8 cMzmLKvuC+ZUIbnjg/fKWRye5UWE/IJaafmIDjh2qWcN81oLSSWfgJYKYotBaYfJYnOM lV0A== X-Gm-Message-State: AOAM532n00Zl0vLpmfYfvu6WdnMZmT4jRO5qxhvZpP59hLVOoIV3lMlv jGpfDRrCBlk4kdepHJ5X2NBUkC0sFJ8vP5rvc9qYW5dgZjtdl0M/e+2Tb8CtK/WSaUyJhTKlWtj yMGsh8joE0KmCuzaB/nBh92XGGccSO1M8+jAWZYcMEo25f6PFqXstCwCQi54E X-Received: by 2002:a05:6402:4406:b0:415:c310:8e4b with SMTP id y6-20020a056402440600b00415c3108e4bmr10441472eda.249.1646647380758; Mon, 07 Mar 2022 02:03:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj01XrcEo3kk5AP0OvsTuKGcqwHBuK86kZb7aQTA32zUlh+nO0t6I5GcZz7/rkcuQaxmNRbw== X-Received: by 2002:a05:6402:4406:b0:415:c310:8e4b with SMTP id y6-20020a056402440600b00415c3108e4bmr10441454eda.249.1646647380550; Mon, 07 Mar 2022 02:03:00 -0800 (PST) Date: Mon, 7 Mar 2022 05:02:58 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 33/47] pci: expose TYPE_XIO3130_DOWNSTREAM name Message-ID: <20220307100058.449628-34-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649801757100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Type name will be used in followup patch for cast check in pcihp code. Signed-off-by: Igor Mammedov Message-Id: <20220301151200.3507298-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci-bridge/xio3130_downstream.h | 15 +++++++++++++++ hw/pci-bridge/xio3130_downstream.c | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 include/hw/pci-bridge/xio3130_downstream.h diff --git a/include/hw/pci-bridge/xio3130_downstream.h b/include/hw/pci-br= idge/xio3130_downstream.h new file mode 100644 index 0000000000..1d10139aea --- /dev/null +++ b/include/hw/pci-bridge/xio3130_downstream.h @@ -0,0 +1,15 @@ +/* + * TI X3130 pci express downstream port switch + * + * Copyright (C) 2022 Igor Mammedov + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HW_PCI_BRIDGE_XIO3130_DOWNSTREAM_H +#define HW_PCI_BRIDGE_XIO3130_DOWNSTREAM_H + +#define TYPE_XIO3130_DOWNSTREAM "xio3130-downstream" + +#endif + diff --git a/hw/pci-bridge/xio3130_downstream.c b/hw/pci-bridge/xio3130_dow= nstream.c index 080a6613fe..05e2b06c0c 100644 --- a/hw/pci-bridge/xio3130_downstream.c +++ b/hw/pci-bridge/xio3130_downstream.c @@ -28,6 +28,7 @@ #include "migration/vmstate.h" #include "qapi/error.h" #include "qemu/module.h" +#include "hw/pci-bridge/xio3130_downstream.h" =20 #define PCI_DEVICE_ID_TI_XIO3130D 0x8233 /* downstream port */ #define XIO3130_REVISION 0x1 @@ -173,7 +174,7 @@ static void xio3130_downstream_class_init(ObjectClass *= klass, void *data) } =20 static const TypeInfo xio3130_downstream_info =3D { - .name =3D "xio3130-downstream", + .name =3D TYPE_XIO3130_DOWNSTREAM, .parent =3D TYPE_PCIE_SLOT, .class_init =3D xio3130_downstream_class_init, .interfaces =3D (InterfaceInfo[]) { --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648346093172.5662780622216; Mon, 7 Mar 2022 02:19:06 -0800 (PST) Received: from localhost ([::1]:36734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRASG-0004qh-Tq for importer@patchew.org; Mon, 07 Mar 2022 05:19:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACq-0002Em-T1 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACp-0002pj-0j for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:08 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-26-cL6cKT9POPyQDvcS4ir0sA-1; Mon, 07 Mar 2022 05:03:05 -0500 Received: by mail-ej1-f71.google.com with SMTP id hr26-20020a1709073f9a00b006d6d1ee8cf8so6681968ejc.19 for ; Mon, 07 Mar 2022 02:03:05 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id z2-20020a05640235c200b00415cec386a5sm6099651edc.16.2022.03.07.02.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647386; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SQth6lOfktpVOUsr0klqFIRbAjmvm/XtYoxQErUCb0c=; b=Y+SaMaQ73BBmlbDFTPDu/KbVyB4g1rf0L2L3MR6zj/MEDpAmy0DPeoF8EjHqG3tNQ1AYMa Q+oDiPSMufSRTO2/jLN/wPc0WBA6AUaI4orlH1Y/yRplrhEOZpJD6AruTmO9DckyGNE9/C W8wwONLkfLPX2WBePyQMR6SxWWrTGiU= X-MC-Unique: cL6cKT9POPyQDvcS4ir0sA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SQth6lOfktpVOUsr0klqFIRbAjmvm/XtYoxQErUCb0c=; b=Bu+wuekUvE2g7358Q0JD246nrCX0RQAVqutG47z8dfeySNPGn8bBOCveHtuCk3pabV ML7Isu1yETIyGEEsS9N5i0zZnLWfL6eiG0IjhFF8vk6O07vU93mfDA7YeQaPPaeuuDMT xCfM8kBMEGdCZiCMjaf2d4rIurr2Skgfj14zm2jta5KO4pJgEg3N9RAFfEdoLz1uvz+q gbmmVpMMrgHMnO7c76DziDMqU0hZOLgHwBc0qMVh5ymJ9yb/ck5CWoxHc2TY4OYiVLzO 1Rvznk+J5sS/3czaB3KUQhZhfC7LdemnGTYJncjSFHZV/cFemY+uo4sK4EpoXS39ZMfg H7uQ== X-Gm-Message-State: AOAM532/xCK4t2p9HklPU40ELGPSoRug2oHtZ117OyjYUmnxea95BAdG Os/3iZyZsnLgc3iL8ESh9XQAVq7Je3/Baal316yPdbaB9VMT/vCaLyc640zxESAe4eY+1byw0FP xlnz1PY+jFGFuULgRz11VQwXU0S34JUSVqXDNazKTLijfjDwv5GiByPpH7Qhy X-Received: by 2002:a05:6402:3492:b0:416:3846:c1a6 with SMTP id v18-20020a056402349200b004163846c1a6mr5757352edc.221.1646647383755; Mon, 07 Mar 2022 02:03:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIqQtGtxhhhdxKQ4W/Ft95AY9Rvdx1+Ykt+n/Y6gK23xVt6kBnijwljb6XcaB9LX+QQC3xgg== X-Received: by 2002:a05:6402:3492:b0:416:3846:c1a6 with SMTP id v18-20020a056402349200b004163846c1a6mr5757329edc.221.1646647383437; Mon, 07 Mar 2022 02:03:03 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:00 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 34/47] acpi: pcihp: pcie: set power on cap on parent slot Message-ID: <20220307100058.449628-35-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648347092100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov on creation a PCIDevice has power turned on at the end of pci_qdev_realize() however later on if PCIe slot isn't populated with any children it's power is turned off. It's fine if native hotplug is used as plug callback will power slot on among other things. However when ACPI hotplug is enabled it replaces native PCIe plug callbacks with ACPI specific ones (acpi_pcihp_device_*plug_cb) and as result slot stays powered off. It works fine as ACPI hotplug on guest side takes care of enumerating/initializing hotplugged device. But when later guest is migrated, call chain introduced by] commit d5daff7d312 (pcie: implement slot power control for pcie root ports) pcie_cap_slot_post_load() -> pcie_cap_update_power() -> pcie_set_power_device() -> pci_set_power() -> pci_update_mappings() will disable earlier initialized BARs for the hotplugged device in powered off slot due to commit 23786d13441 (pci: implement power state) which disables BARs if power is off. Fix it by setting PCI_EXP_SLTCTL_PCC to PCI_EXP_SLTCTL_PWR_ON on slot (root port/downstream port) at the time a device hotplugged into it. As result PCI_EXP_SLTCTL_PWR_ON is migrated to target and above call chain keeps device plugged into it powered on. Fixes: d5daff7d312 ("pcie: implement slot power control for pcie root ports= ") Fixes: 23786d13441 ("pci: implement power state") Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D2053584 Suggested-by: "Michael S. Tsirkin" Signed-off-by: Igor Mammedov Message-Id: <20220301151200.3507298-3-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie.h | 1 + hw/acpi/pcihp.c | 12 +++++++++++- hw/pci/pcie.c | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pcie.h b/include/hw/pci/pcie.h index 168950a83b..798a262a0a 100644 --- a/include/hw/pci/pcie.h +++ b/include/hw/pci/pcie.h @@ -118,6 +118,7 @@ void pcie_cap_slot_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len); int pcie_cap_slot_post_load(void *opaque, int version_id); void pcie_cap_slot_push_attention_button(PCIDevice *dev); +void pcie_cap_slot_enable_power(PCIDevice *dev); =20 void pcie_cap_root_init(PCIDevice *dev); void pcie_cap_root_reset(PCIDevice *dev); diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 6befd23e16..6351bd3424 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -32,6 +32,7 @@ #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" #include "hw/pci/pcie_port.h" +#include "hw/pci-bridge/xio3130_downstream.h" #include "hw/i386/acpi-build.h" #include "hw/acpi/acpi.h" #include "hw/pci/pci_bus.h" @@ -336,6 +337,8 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_= dev, AcpiPciHpState *s, { PCIDevice *pdev =3D PCI_DEVICE(dev); int slot =3D PCI_SLOT(pdev->devfn); + PCIDevice *bridge; + PCIBus *bus; int bsel; =20 /* Don't send event when device is enabled during qemu machine creatio= n: @@ -365,7 +368,14 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug= _dev, AcpiPciHpState *s, return; } =20 - bsel =3D acpi_pcihp_get_bsel(pci_get_bus(pdev)); + bus =3D pci_get_bus(pdev); + bridge =3D pci_bridge_get_device(bus); + if (object_dynamic_cast(OBJECT(bridge), TYPE_PCIE_ROOT_PORT) || + object_dynamic_cast(OBJECT(bridge), TYPE_XIO3130_DOWNSTREAM)) { + pcie_cap_slot_enable_power(bridge); + } + + bsel =3D acpi_pcihp_get_bsel(bus); g_assert(bsel >=3D 0); s->acpi_pcihp_pci_status[bsel].up |=3D (1U << slot); acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 3c44204cf3..67a5d67372 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -366,6 +366,17 @@ static void hotplug_event_clear(PCIDevice *dev) } } =20 +void pcie_cap_slot_enable_power(PCIDevice *dev) +{ + uint8_t *exp_cap =3D dev->config + dev->exp.exp_cap; + uint32_t sltcap =3D pci_get_long(exp_cap + PCI_EXP_SLTCAP); + + if (sltcap & PCI_EXP_SLTCAP_PCP) { + pci_set_word_by_mask(exp_cap + PCI_EXP_SLTCTL, + PCI_EXP_SLTCTL_PCC, PCI_EXP_SLTCTL_PWR_ON); + } +} + static void pcie_set_power_device(PCIBus *bus, PCIDevice *dev, void *opaqu= e) { bool *power =3D opaque; --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648557757697.5462075962132; Mon, 7 Mar 2022 02:22:37 -0800 (PST) Received: from localhost ([::1]:45292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAVh-0002HU-FW for importer@patchew.org; Mon, 07 Mar 2022 05:22:37 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACv-0002FO-Mi for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACt-0002q7-VJ for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:13 -0500 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-253-maKqiCQzOW-fEHXc9k_-bA-1; Mon, 07 Mar 2022 05:03:08 -0500 Received: by mail-ed1-f69.google.com with SMTP id x5-20020a50ba85000000b004161d68ace6so3204083ede.15 for ; Mon, 07 Mar 2022 02:03:08 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id gb25-20020a170907961900b006ce423d43e1sm4620041ejc.13.2022.03.07.02.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=C+16yrqZp55TwfaBLxhPraAA/6nWa+yRsPNvd15Z0zY=; b=LcmpF/quPU/DxYNctmh57Pg0Ur99WhG/11bH5zQNRs4NNnme8jsRRHBw9l5omv2geoKX66 P1Jh83v0TXT2q1qxLC4mRo/oJPQ9Nbq1EovG5GCCCNTzm6UP1aAgmJ81WPfjd5MWZ+cv7K iYguHcgMp+iUvOCJwLjo3ZUi7PtirUc= X-MC-Unique: maKqiCQzOW-fEHXc9k_-bA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=C+16yrqZp55TwfaBLxhPraAA/6nWa+yRsPNvd15Z0zY=; b=eArBV4MA4XUCjq5zZrHZttxAYTQKZ69aD94KDUAXRaWezmEfjU7tXeGOEQKBCBvKPY gPjtOIkuMHM8MN9xqDu/7pHEyG+nsoVfxSpttY4cRj+rBLxNLHiBbB5q2Podhx+3DSnY YW8Zz7inEqr4CT5u7jex5pDgX3AuR2ElqBPvwchwVALqmjWbU+Qn9Wicoa14Ih3itCP7 B3kPjFTc/kN6NpU7DUVzKZoownb7/d7kmnFznuhRMI+6MByt5tBVOLA2JASHXcTMXhQH SAw98u+3+Hlk/YFlvcmpuw0eNNmSmEcTUVkr+PbYr4MiSj9B4GX1wKl1mdvct2PnuGO7 sIDw== X-Gm-Message-State: AOAM532ZJ6iSL9e3mzW0z6VbFqss9tZs8qbQKtr/Jw372Pp/PqdD+3lG qXsk6ZfAcYJp1XjTYKBOd89BszUbRS4gbi7EL05Gg6ztnVG01VzSjQ203gzovbAZgrXsmo+iVlg TXgA1pEoC89zZrHria13Ijh2nIzFycsHngAv8eDnKvZDwBiAORnJTzwHabA/B X-Received: by 2002:a05:6402:278f:b0:410:d242:465e with SMTP id b15-20020a056402278f00b00410d242465emr10292879ede.292.1646647387098; Mon, 07 Mar 2022 02:03:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1xyFXDiil++4dcYXMc2v3iNQBg9eQ5369l6BmaivwcH9L07B+cr10GSg1kL0a27vseMnp0A== X-Received: by 2002:a05:6402:278f:b0:410:d242:465e with SMTP id b15-20020a056402278f00b00410d242465emr10292856ede.292.1646647386795; Mon, 07 Mar 2022 02:03:06 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:03 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 35/47] pc: add option to disable PS/2 mouse/keyboard Message-ID: <20220307100058.449628-36-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Richard Henderson , Joelle van Dyne , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648578831100023 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Joelle van Dyne On some older software like Windows 7 installer, having both a PS/2 mouse and USB mouse results in only one device working property (which might be a different device each boot). While the workaround to not use a USB mouse with such software is valid, it creates an inconsistent experience if the user wishes to always use a USB mouse. This introduces a new machine property to inhibit the creation of the i8042 PS/2 controller. Signed-off-by: Joelle van Dyne Message-Id: <20220227210655.45592-1-j@getutm.app> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 2 ++ hw/i386/pc.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 9c9f4ac748..1a27de9c8b 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -48,6 +48,7 @@ typedef struct PCMachineState { bool sata_enabled; bool pit_enabled; bool hpet_enabled; + bool i8042_enabled; bool default_bus_bypass_iommu; uint64_t max_fw_size; =20 @@ -64,6 +65,7 @@ typedef struct PCMachineState { #define PC_MACHINE_SMBUS "smbus" #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIT "pit" +#define PC_MACHINE_I8042 "i8042" #define PC_MACHINE_MAX_FW_SIZE "max-fw-size" #define PC_MACHINE_SMBIOS_EP "smbios-entry-point-type" =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c8696ac01e..32bf12421e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1014,7 +1014,8 @@ static const MemoryRegionOps ioportF0_io_ops =3D { }, }; =20 -static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_v= mport) +static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, + bool create_i8042, bool no_vmport) { int i; DriveInfo *fd[MAX_FD]; @@ -1036,6 +1037,10 @@ static void pc_superio_init(ISABus *isa_bus, bool cr= eate_fdctrl, bool no_vmport) } } =20 + if (!create_i8042) { + return; + } + i8042 =3D isa_create_simple(isa_bus, "i8042"); if (!no_vmport) { isa_create_simple(isa_bus, TYPE_VMPORT); @@ -1131,7 +1136,8 @@ void pc_basic_device_init(struct PCMachineState *pcms, i8257_dma_init(isa_bus, 0); =20 /* Super I/O */ - pc_superio_init(isa_bus, create_fdctrl, pcms->vmport !=3D ON_OFF_AUTO_= ON); + pc_superio_init(isa_bus, create_fdctrl, pcms->i8042_enabled, + pcms->vmport !=3D ON_OFF_AUTO_ON); } =20 void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) @@ -1512,6 +1518,20 @@ static void pc_machine_set_hpet(Object *obj, bool va= lue, Error **errp) pcms->hpet_enabled =3D value; } =20 +static bool pc_machine_get_i8042(Object *obj, Error **errp) +{ + PCMachineState *pcms =3D PC_MACHINE(obj); + + return pcms->i8042_enabled; +} + +static void pc_machine_set_i8042(Object *obj, bool value, Error **errp) +{ + PCMachineState *pcms =3D PC_MACHINE(obj); + + pcms->i8042_enabled =3D value; +} + static bool pc_machine_get_default_bus_bypass_iommu(Object *obj, Error **e= rrp) { PCMachineState *pcms =3D PC_MACHINE(obj); @@ -1641,6 +1661,7 @@ static void pc_machine_initfn(Object *obj) pcms->smbus_enabled =3D true; pcms->sata_enabled =3D true; pcms->pit_enabled =3D true; + pcms->i8042_enabled =3D true; pcms->max_fw_size =3D 8 * MiB; #ifdef CONFIG_HPET pcms->hpet_enabled =3D true; @@ -1777,6 +1798,9 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) object_class_property_set_description(oc, "hpet", "Enable/disable high precision event timer emulation"); =20 + object_class_property_add_bool(oc, PC_MACHINE_I8042, + pc_machine_get_i8042, pc_machine_set_i8042); + object_class_property_add_bool(oc, "default-bus-bypass-iommu", pc_machine_get_default_bus_bypass_iommu, pc_machine_set_default_bus_bypass_iommu); --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646650562552975.0543348267174; Mon, 7 Mar 2022 02:56:02 -0800 (PST) Received: from localhost ([::1]:54070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRB21-0006Jo-Hm for importer@patchew.org; Mon, 07 Mar 2022 05:56:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD8-0002QG-GE for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:48510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD3-0002tQ-6b for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:26 -0500 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-213-AP_MZkliNcCeoQxwMW_pEA-1; Mon, 07 Mar 2022 05:03:11 -0500 Received: by mail-ej1-f72.google.com with SMTP id m12-20020a1709062acc00b006cfc98179e2so6770449eje.6 for ; Mon, 07 Mar 2022 02:03:11 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id l9-20020a170906078900b006dac5f336f8sm3147357ejc.124.2022.03.07.02.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9/XoSsKmPEouICygtljc84b9npXxSXtesafLfFcgh0k=; b=Ze9+3ZcgXvJ3KCQDeAK5b+3UXHZwh3hxJLRuqPamuttgWFL/Lstm6325cdYKJPFRaJWEEC wwnWq6dUxKXJDrc30t0JJBiuoH6YFTDJi6CLneEY304mytXdFm6YdTi1gRpBPrtRyT1Wu2 +/CmF0IHRPZKt5C2FBW4fn4hciUn2fI= X-MC-Unique: AP_MZkliNcCeoQxwMW_pEA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9/XoSsKmPEouICygtljc84b9npXxSXtesafLfFcgh0k=; b=daQSzCc4jI5V/CYscRb/IZhN/62QUzbj7N4Qo8sSijeMA1m0AfYNZW2f1x+zTrv6GP KyFWCoZQkxeHj/r6gCCi1JS8+RqFubEijHabBupFO4c4IsHLQ0q5tWLjh0/+JBK5Jv48 gnGVgL6NA9R9ExdGlKR9c6vBY/MCmWf+2U2hFJpmXFBUtvx+JGuUoLxK2KdH8SssGwU4 3/jwDYkWCUY0VCBN91sxLvZCIR8OEabsIQzhsmiNTL/oR0CqdwqZGBEvEOsrhmK0+YSx SQkYiRhkrJFgpebNPZOl3X7m9Tx8UtMIFU1vr/vxl2xAXMs7QfTn5Pob6NB/BRIL0hGB X5Rw== X-Gm-Message-State: AOAM531NpIYtZS0cEMqSZsjM72C/jBhes5HqNbwtkfPJZNUpk3q7FJ8u DeFEFrpsF44grtzgiP5EvML4CEKP65O4U0k3KxubAqyJv8OLxUo4AiCV27Rsw1X824poaA+lXaO 8WwnQEe30pnc3RhHSdmJ1GibRNU61027ubUXm3NJa5GX/9slBDMRTr+2RaeSh X-Received: by 2002:a17:906:1645:b0:6ce:de9:6eb1 with SMTP id n5-20020a170906164500b006ce0de96eb1mr8299570ejd.616.1646647389874; Mon, 07 Mar 2022 02:03:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxvFFwXtPYBkKRtgWyxtAe1DOU/fL7yQAyThq1OkVJ6bvlo2LS6u+34S8PwPY38SPFIYy7GOw== X-Received: by 2002:a17:906:1645:b0:6ce:de9:6eb1 with SMTP id n5-20020a170906164500b006ce0de96eb1mr8299546ejd.616.1646647389584; Mon, 07 Mar 2022 02:03:09 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:06 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 36/47] vhost-vsock: detach the virqueue element in case of error Message-ID: <20220307100058.449628-37-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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: , Cc: VictorV , Peter Maydell , qemu-stable@nongnu.org, Stefan Hajnoczi , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646650562876100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella In vhost_vsock_common_send_transport_reset(), if an element popped from the virtqueue is invalid, we should call virtqueue_detach_element() to detach it from the virtqueue before freeing its memory. Fixes: fc0b9b0e1c ("vhost-vsock: add virtio sockets device") Fixes: CVE-2022-26354 Cc: qemu-stable@nongnu.org Reported-by: VictorV Signed-off-by: Stefano Garzarella Message-Id: <20220228095058.27899-1-sgarzare@redhat.com> Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vsock-common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c index 3f3771274e..ed706681ac 100644 --- a/hw/virtio/vhost-vsock-common.c +++ b/hw/virtio/vhost-vsock-common.c @@ -153,19 +153,23 @@ static void vhost_vsock_common_send_transport_reset(V= HostVSockCommon *vvc) if (elem->out_num) { error_report("invalid vhost-vsock event virtqueue element with " "out buffers"); - goto out; + goto err; } =20 if (iov_from_buf(elem->in_sg, elem->in_num, 0, &event, sizeof(event)) !=3D sizeof(event)) { error_report("vhost-vsock event virtqueue element is too short"); - goto out; + goto err; } =20 virtqueue_push(vq, elem, sizeof(event)); virtio_notify(VIRTIO_DEVICE(vvc), vq); =20 -out: + g_free(elem); + return; + +err: + virtqueue_detach_element(vq, elem, 0); g_free(elem); } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649641990494.78713666657166; Mon, 7 Mar 2022 02:40:41 -0800 (PST) Received: from localhost ([::1]:37892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAnB-0001my-1M for importer@patchew.org; Mon, 07 Mar 2022 05:40:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD0-0002JM-D7 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33350) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRACy-0002qt-NN for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:18 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-XH5Rp1jlO8WbtNpvV84R0Q-1; Mon, 07 Mar 2022 05:03:15 -0500 Received: by mail-ed1-f70.google.com with SMTP id r9-20020a05640251c900b00412d54ea618so8269835edd.3 for ; Mon, 07 Mar 2022 02:03:15 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id fy1-20020a1709069f0100b006d229ed7f30sm4685996ejc.39.2022.03.07.02.03.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pYeaIUsJ9p0JJMezYpclW6q507JeS1XFz2MM26g4c9M=; b=E3F7g3s4e0Wdsm2ZVwizDStxof9CgkNaRMEaSyszmdjAWzaNSjymlh/VTVgVp2vohh9JsT 2Os1IEtoEnUy+3QgukKlb+a9WDY0M498vawtb1snIMcJzbFIpm8m7bCeAfsa8kpr5AMNaE AkzWMueHcN735XLVikQSjAmIpBxmMis= X-MC-Unique: XH5Rp1jlO8WbtNpvV84R0Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=pYeaIUsJ9p0JJMezYpclW6q507JeS1XFz2MM26g4c9M=; b=3Ccfo1RBj0a45VpOGw1OIXRZZMQx4ww3lA15Z5xRVy9i7jwLvSobdOsyKvkSt0Y594 CHkB+aV0iI9mtJyj2w7ceCOkj36cjI0aEkVyRg7fpQOhiy5aJx0TdhygyjGwaHJUxOcH axA7dfapG/zSlQf5GuFgoURuSoT098SWvsBw6cG0HdNz8iwZGTU2sm2FcpEj+tajOPSd fft6huqpBIPd3JnRqxcIYef3sQMkRrhCUanJAf8qaSTs0WYAL9oSyUEKV2wNxhNvROTU wQoQayBmhh3dgmFxD+rX+X3MYUdnGwUDD7UbALhxCi26v69NZneEY5rArbcPICRDOQA5 zpSA== X-Gm-Message-State: AOAM532mDWyY5RVcjT2DNTohCbm9FL1DFN+bhdnVH29T8nlnWa5pco1Z dYCLoigdbT12SXatswLAEp476A87yEEc6Ry7RzSDSO4UETx5GRjWyg91ycskHgOsI6Nrasep/C3 vi92cxSE79B3E5rwRFEPJ/4o0Qw6dCcLZ1FADn6fEbinWqcCHVaY6vWH+hi9p X-Received: by 2002:a17:907:1b15:b0:6d7:13bd:dd62 with SMTP id mp21-20020a1709071b1500b006d713bddd62mr8453235ejc.673.1646647393677; Mon, 07 Mar 2022 02:03:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbNpgud0wYD8pnN09BEMNsJY3vlhf7quxUV1otvgYTEcHOAvDt3TErYm6xV5lxXNXBzvPZ0g== X-Received: by 2002:a17:907:1b15:b0:6d7:13bd:dd62 with SMTP id mp21-20020a1709071b1500b006d713bddd62mr8453201ejc.673.1646647393297; Mon, 07 Mar 2022 02:03:13 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:09 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 37/47] x86: cleanup unused compat_apic_id_mode Message-ID: <20220307100058.449628-38-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Thomas Huth , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649643563100002 From: Igor Mammedov commit f862ddbb1a4 (hw/i386: Remove the deprecated pc-1.x machine types) removed the last user of broken APIC ID compat knob, but compat_apic_id_mode itself was forgotten. Clean it up and simplify x86_cpu_apic_id_from_index() Signed-off-by: Igor Mammedov Message-Id: <20220228131634.3389805-1-imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/x86.h | 2 -- hw/i386/x86.c | 16 +--------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index a145a30370..916cc325ee 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -35,8 +35,6 @@ struct X86MachineClass { =20 /* TSC rate migration: */ bool save_tsc_khz; - /* Enables contiguous-apic-ID mode */ - bool compat_apic_id_mode; /* use DMA capable linuxboot option rom */ bool fwcfg_dma_enabled; }; diff --git a/hw/i386/x86.c b/hw/i386/x86.c index b84840a1bb..4cf107baea 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -83,24 +83,11 @@ inline void init_topo_info(X86CPUTopoInfo *topo_info, uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86ms, unsigned int cpu_index) { - X86MachineClass *x86mc =3D X86_MACHINE_GET_CLASS(x86ms); X86CPUTopoInfo topo_info; - uint32_t correct_id; - static bool warned; =20 init_topo_info(&topo_info, x86ms); =20 - correct_id =3D x86_apicid_from_cpu_idx(&topo_info, cpu_index); - if (x86mc->compat_apic_id_mode) { - if (cpu_index !=3D correct_id && !warned && !qtest_enabled()) { - error_report("APIC IDs set in compatibility mode, " - "CPU topology won't match the configuration"); - warned =3D true; - } - return cpu_index; - } else { - return correct_id; - } + return x86_apicid_from_cpu_idx(&topo_info, cpu_index); } =20 =20 @@ -1330,7 +1317,6 @@ static void x86_machine_class_init(ObjectClass *oc, v= oid *data) mc->cpu_index_to_instance_props =3D x86_cpu_index_to_props; mc->get_default_cpu_node_id =3D x86_get_default_cpu_node_id; mc->possible_cpu_arch_ids =3D x86_possible_cpu_arch_ids; - x86mc->compat_apic_id_mode =3D false; x86mc->save_tsc_khz =3D true; x86mc->fwcfg_dma_enabled =3D true; nc->nmi_monitor_handler =3D x86_nmi; --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646650174601146.14982365582; Mon, 7 Mar 2022 02:49:34 -0800 (PST) Received: from localhost ([::1]:33804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAvm-00018l-CG for importer@patchew.org; Mon, 07 Mar 2022 05:49:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD4-0002Nu-Lp for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD2-0002tG-OK for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:22 -0500 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-388-AQgf7U94MFGkg0z8cPhvGg-1; Mon, 07 Mar 2022 05:03:18 -0500 Received: by mail-ej1-f72.google.com with SMTP id hr26-20020a1709073f9a00b006d6d1ee8cf8so6682218ejc.19 for ; Mon, 07 Mar 2022 02:03:17 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id c1-20020a170906762100b006d00ae72b0csm4506501ejn.221.2022.03.07.02.03.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WM8DbqbTKSLQVyBrsakCaCO02eOzlZ2Ph3Cq4l91luQ=; b=Fk7L1xsuoFABnrVbdckvJDWgUGzno+EXJkviE3t3FymWxUwwrPB9hCGEbpVapB/T6ZF1i0 EpFKbHvTB/trqgaIRzKjWh9e74s3c6FGk9Xd/MWiEQSk0DOvoZe0Ce8HnKOjsMQzb0fNUW ImDvgrvkg9el5ZkNNF/ogKZu67G0RjI= X-MC-Unique: AQgf7U94MFGkg0z8cPhvGg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=WM8DbqbTKSLQVyBrsakCaCO02eOzlZ2Ph3Cq4l91luQ=; b=TdcHLUav1POQpPN/7f8rKlpSPhkSDudxQdN3LnzvbnLtmhwcHf4HssanY1ETywdBTN NBjxOkoTZ+lSNIYwLPzWHzsIhDESVM1RGgS205FBL6bT5TmFMbgQFexUW6lCm1mpyj6z dhZiWhr+lpT8SkjHPGFdVgXgO+dx5hivwF+JVbl0qkDsHLSCy8JpQBJrC99KOTYBnWS8 MYhh0We/Ltq1TZdC92MaMVx1xAJQvqo6pg38W936K1kQRbuUGJ06wvs0MFIuSGDWjYg3 ZYwk083wbvSF0RRAcY50knff6FsZvEAalNYRvX2DJd7G7qjTswSyvOJEufUd1PjwEtA5 /qcQ== X-Gm-Message-State: AOAM533D8DPxjd7mowaR/oMWWlMTXwo85aFNVmVEkK/z3Cap0VRRu0lw Xj2STiKapWGmQQqgHWk/22gSB1LiL7yrRQxTCtyZFwHFVKsXdWEJUa6SMexRnrP9ergtGDR7sB+ 6a0rU1hRv0/LvFlR4roe3gPUZIofajkIs3jG0ujsavJxkSngflfCd3MRh4Hum X-Received: by 2002:a17:907:3f95:b0:6d3:feb2:ef88 with SMTP id hr21-20020a1709073f9500b006d3feb2ef88mr8631282ejc.480.1646647396496; Mon, 07 Mar 2022 02:03:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG9SGHzriGbKcfGLF7857rC+AsQ8yrnEBnDQ1yQpvQrPGtA3Smhd8lmItzGXaMNlh4BDG4eA== X-Received: by 2002:a17:907:3f95:b0:6d3:feb2:ef88 with SMTP id hr21-20020a1709073f9500b006d3feb2ef88mr8631255ejc.480.1646647396138; Mon, 07 Mar 2022 02:03:16 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:13 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 38/47] hw/smbios: Add table 4 parameter, "processor-id" Message-ID: <20220307100058.449628-39-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Titus Rwantare , Patrick Venture , Ani Sinha , Igor Mammedov , Peter Foley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646650176067100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Patrick Venture This parameter is to be used in the processor_id entry in the type 4 table. This parameter is set as optional and if left will use the values from the CPU model. This enables hiding the host information from the guest and allowing AMD VMs to run pretending to be Intel for some userspace software concerns. Reviewed-by: Peter Foley Reviewed-by: Titus Rwantare Signed-off-by: Patrick Venture Reviewed-by: Igor Mammedov Message-Id: <20220125163118.1011809-1-venture@google.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 19 ++++++++++++++++--- qemu-options.hx | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 1f8d5c252f..60349ee402 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -104,9 +104,11 @@ static struct { const char *sock_pfx, *manufacturer, *version, *serial, *asset, *part; uint64_t max_speed; uint64_t current_speed; + uint64_t processor_id; } type4 =3D { .max_speed =3D DEFAULT_CPU_SPEED, - .current_speed =3D DEFAULT_CPU_SPEED + .current_speed =3D DEFAULT_CPU_SPEED, + .processor_id =3D 0, }; =20 static struct { @@ -327,6 +329,10 @@ static const QemuOptDesc qemu_smbios_type4_opts[] =3D { .name =3D "part", .type =3D QEMU_OPT_STRING, .help =3D "part number", + }, { + .name =3D "processor-id", + .type =3D QEMU_OPT_NUMBER, + .help =3D "processor id", }, { /* end of list */ } }; @@ -683,8 +689,13 @@ static void smbios_build_type_4_table(MachineState *ms= , unsigned instance) t->processor_type =3D 0x03; /* CPU */ t->processor_family =3D 0x01; /* Other */ SMBIOS_TABLE_SET_STR(4, processor_manufacturer_str, type4.manufacturer= ); - t->processor_id[0] =3D cpu_to_le32(smbios_cpuid_version); - t->processor_id[1] =3D cpu_to_le32(smbios_cpuid_features); + if (type4.processor_id =3D=3D 0) { + t->processor_id[0] =3D cpu_to_le32(smbios_cpuid_version); + t->processor_id[1] =3D cpu_to_le32(smbios_cpuid_features); + } else { + t->processor_id[0] =3D cpu_to_le32((uint32_t)type4.processor_id); + t->processor_id[1] =3D cpu_to_le32(type4.processor_id >> 32); + } SMBIOS_TABLE_SET_STR(4, processor_version_str, type4.version); t->voltage =3D 0; t->external_clock =3D cpu_to_le16(0); /* Unknown */ @@ -1323,6 +1334,8 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) save_opt(&type4.serial, opts, "serial"); save_opt(&type4.asset, opts, "asset"); save_opt(&type4.part, opts, "part"); + /* If the value is 0, it will take the value from the CPU mode= l. */ + type4.processor_id =3D qemu_opt_get_number(opts, "processor-id= ", 0); type4.max_speed =3D qemu_opt_get_number(opts, "max-speed", DEFAULT_CPU_SPEED); type4.current_speed =3D qemu_opt_get_number(opts, "current-spe= ed", diff --git a/qemu-options.hx b/qemu-options.hx index 094a6c1d7c..5ce0ada75e 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2537,6 +2537,7 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, " specify SMBIOS type 3 fields\n" "-smbios type=3D4[,sock_pfx=3Dstr][,manufacturer=3Dstr][,version=3Dstr= ][,serial=3Dstr]\n" " [,asset=3Dstr][,part=3Dstr][,max-speed=3D%d][,current-s= peed=3D%d]\n" + " [,processor-id=3D%d]\n" " specify SMBIOS type 4 fields\n" "-smbios type=3D11[,value=3Dstr][,path=3Dfilename]\n" " specify SMBIOS type 11 fields\n" @@ -2562,7 +2563,7 @@ SRST ``-smbios type=3D3[,manufacturer=3Dstr][,version=3Dstr][,serial=3Dstr][,as= set=3Dstr][,sku=3Dstr]`` Specify SMBIOS type 3 fields =20 -``-smbios type=3D4[,sock_pfx=3Dstr][,manufacturer=3Dstr][,version=3Dstr][,= serial=3Dstr][,asset=3Dstr][,part=3Dstr]`` +``-smbios type=3D4[,sock_pfx=3Dstr][,manufacturer=3Dstr][,version=3Dstr][,= serial=3Dstr][,asset=3Dstr][,part=3Dstr][,processor-id=3D%d]`` Specify SMBIOS type 4 fields =20 ``-smbios type=3D11[,value=3Dstr][,path=3Dfilename]`` --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648680735438.4937242030419; Mon, 7 Mar 2022 02:24:40 -0800 (PST) Received: from localhost ([::1]:53866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAXf-0007zy-1M for importer@patchew.org; Mon, 07 Mar 2022 05:24:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35322) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD7-0002Q1-0v for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:39536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD5-0002uO-FU for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:24 -0500 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-135-9uuAo95COo-4N14iNnuh0g-1; Mon, 07 Mar 2022 05:03:20 -0500 Received: by mail-ej1-f72.google.com with SMTP id x2-20020a1709065ac200b006d9b316257fso6773560ejs.12 for ; Mon, 07 Mar 2022 02:03:20 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id gb11-20020a170907960b00b006d20acf7e36sm4810736ejc.144.2022.03.07.02.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s3tpCVjYIOk1B/dIJbNsw4y7BbXatFeQMGgCwwa4oeU=; b=eR3U4xIEWH/kofdHBFW8FSNfJsX/4y6AxsYv0VBpyCvVuufVe+ja9dGz49iZDqtMmogWsv UjfWQNmHaBdMzjiyLQSo6XC/xtboNG2s1X2qAvYvPIOKYTJ3HdlK91Ki84+xic4A0GK2m/ fGglPmnbJsyTkMoszeqmmrhw4shc6QA= X-MC-Unique: 9uuAo95COo-4N14iNnuh0g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=s3tpCVjYIOk1B/dIJbNsw4y7BbXatFeQMGgCwwa4oeU=; b=l/VTl4cNoAwxAB5uwWjpTg/FkesvDxtq07RI0ptQ+QzAGh4gRNGGMtq2+dndt05q/r +VOq3IxAk4Jpd8lPS/ZjpXMn6nGyVOcdOlUT7TakqLqTixNasHE6gyWlddKVSnuNYn9I 2Nkw7rfTeu7SuuhP2gE0VvKXtJMglGWPJmZzsg9je7x5w8R3IgzRn6otQ0cPmRbxsQNa w/K5fCsu3cRhTznC0o/VujgH1tLER4mkLHl4hmZkmscJbCgJ8SL5cwTMpoXstTXtYs/v h8cTMw8VYnMdH2mAQScoMPqgtHSrrRiRF/qa/942SKk5+fwBD8ERMda0ZhimsoPgJljZ RVXQ== X-Gm-Message-State: AOAM532YVyPJqQKgrp1CEf/2dOF5i3onniaD82sRtQgsh6uu8Ntas/tS GgvBrfla+/1nMIM4m23n9rRy5tjbdDkM418YayNVc+xOI06EsHKexc8YF5sn/KAJdgxaYHoPvMj qpd/nIrdmOFzOIlMQEDcqwTz/Z7rZDVOATYcx7mPTPD7m7IRlms2Io2qrQfxX X-Received: by 2002:aa7:de0e:0:b0:416:607c:6d45 with SMTP id h14-20020aa7de0e000000b00416607c6d45mr346622edv.127.1646647399424; Mon, 07 Mar 2022 02:03:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJAHcorC74goI+OM5/OJsjRIULHpmBLOLAd8Dh8Uu22SKfL4/S4s68onsQbTd6h/dIQMXnvw== X-Received: by 2002:aa7:de0e:0:b0:416:607c:6d45 with SMTP id h14-20020aa7de0e000000b00416607c6d45mr346600edv.127.1646647399166; Mon, 07 Mar 2022 02:03:19 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:16 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 39/47] pci: drop COMPAT_PROP_PCP for 2.0 machine types Message-ID: <20220307100058.449628-40-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Richard Henderson , Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648683711100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov COMPAT_PROP_PCP is 'on' by default and it's used for turning off PCP capability on PCIe slots for 2.0 machine types using compat machinery. Drop not needed compat glue as Q35 supports migration starting from 2.4 machine types. Signed-off-by: Igor Mammedov Message-Id: <20220222102504.3080104-1-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 32bf12421e..fd55fc725c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -318,8 +318,6 @@ GlobalProperty pc_compat_2_0[] =3D { { "pci-serial-4x", "prog_if", "0" }, { "virtio-net-pci", "guest_announce", "off" }, { "ICH9-LPC", "memory-hotplug-support", "off" }, - { "xio3130-downstream", COMPAT_PROP_PCP, "off" }, - { "ioh3420", COMPAT_PROP_PCP, "off" }, }; const size_t pc_compat_2_0_len =3D G_N_ELEMENTS(pc_compat_2_0); =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646650408940654.2409671456493; Mon, 7 Mar 2022 02:53:28 -0800 (PST) Received: from localhost ([::1]:45488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAzY-0000Wt-IO for importer@patchew.org; Mon, 07 Mar 2022 05:53:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD8-0002QH-Np for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:39223) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD7-0002v6-6t for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:26 -0500 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-397-Xwni9VuePJqWhGCF8Qx7xw-1; Mon, 07 Mar 2022 05:03:23 -0500 Received: by mail-ed1-f72.google.com with SMTP id i5-20020a056402054500b00415ce7443f4so7385626edx.12 for ; Mon, 07 Mar 2022 02:03:23 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id da23-20020a056402177700b0041394d8173csm5914341edb.31.2022.03.07.02.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZuOy/7+HfqjI4TvmqHPnqx0Q0KWAobCs5iZB1N1AGuw=; b=TlCWDVNLK2DvG4DK2BjberWCCh7EMy00nHbpgk0uhIDoccvYF9eemXf4Lxbs9GnID3aiCH FuqrAK0LEF/zjSISzbU8Hq7eGVznO0rU/rRpZCKRqPNjGYLXCaNMT0t186qgHyNRsPHZJb vXnnQo/Wx+Yh+XLr0n9ia9Cqfkstn/I= X-MC-Unique: Xwni9VuePJqWhGCF8Qx7xw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZuOy/7+HfqjI4TvmqHPnqx0Q0KWAobCs5iZB1N1AGuw=; b=Cu4pfNkgyIzdKS1xJOKVs8gXL+Gh3w2YpXJKqGYRaRY1mr03G2xBJRR6WsghMi8dIP V5IDfyC6IhHifrqSCPyYKVlE7auaAkOFn73u4EjBtk9uIuXAKxl5Dam+d2dB0T5zBhSA sLe19oOnBkIP0yDrO8xa5my22wB+rcdmQDfEIzKkaLKiBdMWJnv21hI+dCRsJVO8mZId m6J/tBXszd7ZqtR5bbrT8Nnx8BdWNOY2JwJeMzaf0A6qnVJxbLMXvEJbNVkBhgixZueD xQryg9ghupAaWOGkdpp8HiiygaBYgItkMsFSyrkABC2TqLUrSKuNNI4f50CcNvDz7Oxy SrlA== X-Gm-Message-State: AOAM533S0zN+/Wea9ydmn5ohlTAmbXg1JxRjlhA18gFqtE+UUxfrzZ3U sUINLMNjoPCeYiiJedFbaOHo/yRK2i6hvye5HOHKk5zKDiDyAvKrXiWlxH17L8Cua8Sv+ZzaZaQ pdcZ+KX5bHIsk5P70G337Nz6WTycbxAS1dPdxHCjH7Rasangt7EcRrvWxJ5sP X-Received: by 2002:a17:906:1e94:b0:6b9:6fcc:53fd with SMTP id e20-20020a1709061e9400b006b96fcc53fdmr8364009ejj.450.1646647402068; Mon, 07 Mar 2022 02:03:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyY6Mab7A0Gj8mQf0ZdX9ZFZL5UllDCQGaFrdQqUzz7E0JQ3K/qkMjIU8nw/DzAfZOKaNg+pw== X-Received: by 2002:a17:906:1e94:b0:6b9:6fcc:53fd with SMTP id e20-20020a1709061e9400b006b96fcc53fdmr8363982ejj.450.1646647401722; Mon, 07 Mar 2022 02:03:21 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:19 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 40/47] event_notifier: add event_notifier_get_wfd() Message-ID: <20220307100058.449628-41-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Stefan Hajnoczi , Sergio Lopez , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646650416508100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sergio Lopez event_notifier_get_fd(const EventNotifier *e) always returns EventNotifier's read file descriptor (rfd). This is not a problem when the EventNotifier is backed by a an eventfd, as a single file descriptor is used both for reading and triggering events (rfd =3D=3D wfd). But, when EventNotifier is backed by a pipe pair, we have two file descriptors, one that can only be used for reads (rfd), and the other only for writes (wfd). There's, at least, one known situation in which we need to obtain wfd instead of rfd, which is when setting up the file that's going to be sent to the peer in vhost's SET_VRING_CALL. Add a new event_notifier_get_wfd(const EventNotifier *e) that can be used to obtain wfd where needed. Signed-off-by: Sergio Lopez Reviewed-by: Stefan Hajnoczi Message-Id: <20220304100854.14829-2-slp@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/qemu/event_notifier.h | 1 + util/event_notifier-posix.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/qemu/event_notifier.h b/include/qemu/event_notifier.h index b79add035d..8a4ff308e1 100644 --- a/include/qemu/event_notifier.h +++ b/include/qemu/event_notifier.h @@ -38,6 +38,7 @@ int event_notifier_test_and_clear(EventNotifier *); #ifdef CONFIG_POSIX void event_notifier_init_fd(EventNotifier *, int fd); int event_notifier_get_fd(const EventNotifier *); +int event_notifier_get_wfd(const EventNotifier *); #else HANDLE event_notifier_get_handle(EventNotifier *); #endif diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 8307013c5d..16294e98d4 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -99,6 +99,11 @@ int event_notifier_get_fd(const EventNotifier *e) return e->rfd; } =20 +int event_notifier_get_wfd(const EventNotifier *e) +{ + return e->wfd; +} + int event_notifier_set(EventNotifier *e) { static const uint64_t value =3D 1; --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164664984776438.818935610563585; Mon, 7 Mar 2022 02:44:07 -0800 (PST) Received: from localhost ([::1]:46452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAqV-0007aC-H8 for importer@patchew.org; Mon, 07 Mar 2022 05:44:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADB-0002T5-Lz for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:29 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRAD9-0002w1-9W for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:28 -0500 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-460-e_teZHFkP4SG2Beyq6pm2w-1; Mon, 07 Mar 2022 05:03:25 -0500 Received: by mail-ej1-f70.google.com with SMTP id hq34-20020a1709073f2200b006d677c94909so6778465ejc.8 for ; Mon, 07 Mar 2022 02:03:25 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id u9-20020aa7db89000000b0041372781e69sm5848913edt.52.2022.03.07.02.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=quAC4k9MEA5Bl9esxGjIJ3kbUgMyXwbno7leI74drOM=; b=YBfV6WmEE+B/kg5iGOpPfXrtJFmEY6mpYuBG20whJDqfn5CaCGbMt0nmKEIZG9g7jC/Kbs uQS7+4Myo/jGgFV/wkJZdAiJdzHZHXBdw07VEf3wM/vMX4Kp17lIK6FfTMni4QbuFDbsip x/cBJaXqdh2HO5pwIeWS5JGALVA4mRA= X-MC-Unique: e_teZHFkP4SG2Beyq6pm2w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=quAC4k9MEA5Bl9esxGjIJ3kbUgMyXwbno7leI74drOM=; b=3GoV+O4IzDYu1PQ1M8fv81byk8VUbU6dFbYZ6bvRCxD6ZHJUhUEF49T53KwBTCd3ET C7N5iY6LtoVgoBiZcmW+1vuhU5/P949UIZkjukhnWF4KQurMJXnIxfAbLgcl7Wpij1LQ xVG1EVRq4ViXnnXaTfQtDHZfcZMKbpqTuj2/eQMANVIsHJtaQgiaEAzrACI9ChqlTQXX bJDLV0QmMEy2UMGKqR+BiDVy2YXzRhLpAQVWOlHiAIC0IPzaP2ZAFXyJe2tjbYIU44GG 0dS8wI68X+SYR+pxBDCux2Y6SWaQrDNtQr/GMUfREQpeMHJ1qEhpXF5oM1OJLOeqp1ZT LGVg== X-Gm-Message-State: AOAM532JeZCqBwhC8yUrtW3vn7IpC4ydWYMtSL4tATEgMrFJqpjBBWHX N+MhHvs8JsFFwEWrDOlbkNrvnXVZsi/3Bot70ibM+URXr2YXN0z+zv3y1gTx5DKYq1mXZNU36XX NEdA0wkWR0gBxBgAMMxo7akzI1Cv9dkZpo3ZUr1fN3FAIOWkg21SgIYD7Ex2c X-Received: by 2002:a17:906:3283:b0:6ce:78f9:fafd with SMTP id 3-20020a170906328300b006ce78f9fafdmr8522170ejw.534.1646647404382; Mon, 07 Mar 2022 02:03:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJybey7SN3gP5fsyXSJEediyVplpIDiSflhDyuOubfU7aeNh0+GfsiukBIwrbQ00qgx8gQDdzA== X-Received: by 2002:a17:906:3283:b0:6ce:78f9:fafd with SMTP id 3-20020a170906328300b006ce78f9fafdmr8522155ejw.534.1646647404125; Mon, 07 Mar 2022 02:03:24 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:21 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 41/47] vhost: use wfd on functions setting vring call fd Message-ID: <20220307100058.449628-42-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Stefan Hajnoczi , Sergio Lopez Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649849122100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sergio Lopez When ioeventfd is emulated using qemu_pipe(), only EventNotifier's wfd can be used for writing. Use the recently introduced event_notifier_get_wfd() function to obtain the fd that our peer must use to signal the vring. Signed-off-by: Sergio Lopez Reviewed-by: Stefan Hajnoczi Message-Id: <20220304100854.14829-3-slp@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 7b03efccec..b643f42ea4 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1287,7 +1287,7 @@ static int vhost_virtqueue_init(struct vhost_dev *dev, return r; } =20 - file.fd =3D event_notifier_get_fd(&vq->masked_notifier); + file.fd =3D event_notifier_get_wfd(&vq->masked_notifier); r =3D dev->vhost_ops->vhost_set_vring_call(dev, &file); if (r) { VHOST_OPS_DEBUG(r, "vhost_set_vring_call failed"); @@ -1542,9 +1542,9 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, Vir= tIODevice *vdev, int n, =20 if (mask) { assert(vdev->use_guest_notifier_mask); - file.fd =3D event_notifier_get_fd(&hdev->vqs[index].masked_notifie= r); + file.fd =3D event_notifier_get_wfd(&hdev->vqs[index].masked_notifi= er); } else { - file.fd =3D event_notifier_get_fd(virtio_queue_get_guest_notifier(= vvq)); + file.fd =3D event_notifier_get_wfd(virtio_queue_get_guest_notifier= (vvq)); } =20 file.index =3D hdev->vhost_ops->vhost_get_vq_index(hdev, n); --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 164665086289659.88994572207457; Mon, 7 Mar 2022 03:01:02 -0800 (PST) Received: from localhost ([::1]:34496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRB6r-0003kR-DF for importer@patchew.org; Mon, 07 Mar 2022 06:01:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADE-0002ZB-AN for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:32 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADC-0002wg-Hl for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:31 -0500 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-252-qozns2zwOa-r2M094Rjpkg-1; Mon, 07 Mar 2022 05:03:28 -0500 Received: by mail-ej1-f69.google.com with SMTP id le4-20020a170907170400b006dab546bc40so3494138ejc.15 for ; Mon, 07 Mar 2022 02:03:28 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id t19-20020a1709060c5300b006d582121f99sm4502229ejf.36.2022.03.07.02.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647410; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JLZkqE9CMO9Jo/gLiHOXhp5k4vbHvwWLStgWAFhWUt4=; b=BfR9dc8yt86M0ZA6v4Oo4Th8PJ4W37p7AkXcCCm8fmqc4pEiD8S/GHsGAToLlkqobW16/H qKjZ4XKN9KBqg73QnwerGZk96/4nML3Asi1oDxtTfVpKIPtI0/yfakBxrox6G3b3ixkfNF UcdVJQNZL/eTNIiFpSPR34iSQAmx1og= X-MC-Unique: qozns2zwOa-r2M094Rjpkg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JLZkqE9CMO9Jo/gLiHOXhp5k4vbHvwWLStgWAFhWUt4=; b=pyNSCU05EwedDgJIzLQ9cTfAmIRZgbJdPX2Ae9tmAEt1VMyts7dJnnX/HMx2ZmXjdh zhKI4Iqvp89KgFnDO/YxdGxNgzCLPK+On21kC8RJ+reT2ManRy1G65qj9nOk/C9nOxUX Ogyv69hP8SE66QEaZ6CF7SrG75wpuZ/H9UrA0w+OF6kqM3aaNNS4kxnyeCMqsgG9LF4s 0wh0p9b3om1EiE/vAq9y5I2C7rUPl36z+/kLkpOc7+FV0ULhasMnqyDefjpr5EYzhyFU A9C7GNTr6S8qXs4t1i/+DGimphiRnGmJE+XxrSJASfeqWsWZ80vVkuv+L/jUrwhpZlNL oZhQ== X-Gm-Message-State: AOAM5317+DqzkxWm9yPRm0g+0Lm0e0thYF4xcz62KLQwLz9x6yoJeJ95 PM8HTA4DgjiNnHEdlSchxhQMxw4xdzYsHaUUUP6EBLBhvYiwjMI/FBcnDijBHS6RFA9Noxn7Vte crOB9oSqL1Ht9ubTAnCFlnq4SgqHja33Iv3Wv55ph/PVEkEoE238GeF+wI06w X-Received: by 2002:a17:907:3e12:b0:6da:f8d9:efeb with SMTP id hp18-20020a1709073e1200b006daf8d9efebmr8453979ejc.634.1646647407464; Mon, 07 Mar 2022 02:03:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFOEjDB2cg8iQvp3MBqEC3Q6s4CCi1Z9u3LIvj5svOerORjrWDK5ddzodl/ulDalWDKfm8Jg== X-Received: by 2002:a17:907:3e12:b0:6da:f8d9:efeb with SMTP id hp18-20020a1709073e1200b006daf8d9efebmr8453959ejc.634.1646647407169; Mon, 07 Mar 2022 02:03:27 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:24 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 42/47] configure, meson: allow enabling vhost-user on all POSIX systems Message-ID: <20220307100058.449628-43-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Thomas Huth , Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= , Sergio Lopez , Richard Henderson , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646650865209100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sergio Lopez With the possibility of using a pipe pair via qemu_pipe() as a replacement on operating systems that doesn't support eventfd, vhost-user can also work on all POSIX systems. This change allows enabling vhost-user on all non-Windows platforms and makes libvhost_user (which still depends on eventfd) a linux-only feature. Signed-off-by: Sergio Lopez Reviewed-by: Stefan Hajnoczi Message-Id: <20220304100854.14829-4-slp@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- configure | 4 ++-- meson.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index c56ed53ee3..daccf4be7c 100755 --- a/configure +++ b/configure @@ -1659,8 +1659,8 @@ fi # vhost interdependencies and host support =20 # vhost backends -if test "$vhost_user" =3D "yes" && test "$linux" !=3D "yes"; then - error_exit "vhost-user is only available on Linux" +if test "$vhost_user" =3D "yes" && test "$mingw32" =3D "yes"; then + error_exit "vhost-user is not available on Windows" fi test "$vhost_vdpa" =3D "" && vhost_vdpa=3D$linux if test "$vhost_vdpa" =3D "yes" && test "$linux" !=3D "yes"; then diff --git a/meson.build b/meson.build index a5b63e62cd..28612fca36 100644 --- a/meson.build +++ b/meson.build @@ -2714,7 +2714,7 @@ if have_system or have_user endif =20 vhost_user =3D not_found -if 'CONFIG_VHOST_USER' in config_host +if targetos =3D=3D 'linux' and 'CONFIG_VHOST_USER' in config_host libvhost_user =3D subproject('libvhost-user') vhost_user =3D libvhost_user.get_variable('vhost_user_dep') endif --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646648860794502.18712701109325; Mon, 7 Mar 2022 02:27:40 -0800 (PST) Received: from localhost ([::1]:34262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAaa-0005OB-3n for importer@patchew.org; Mon, 07 Mar 2022 05:27:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADH-0002jW-GM for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADF-0002x5-CK for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:35 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-110-r_vZKkk7MOiGl_vw9Vy3tA-1; Mon, 07 Mar 2022 05:03:31 -0500 Received: by mail-ed1-f71.google.com with SMTP id h17-20020a05640250d100b004133863d836so8344711edb.0 for ; Mon, 07 Mar 2022 02:03:31 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id n19-20020a170906165300b006a625c583b9sm4617709ejd.155.2022.03.07.02.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=07QDxIPMafAaF6WsUgGU20pp0SPQclmS77EMgRXJWQo=; b=AqqYmUQyRAbxFN6/beUr64ItU7tN++IFmBcN6F3MFQXT8pcts+ILZqkjQQEv8pAH5Xf/3Z kvx06ULNPM3idOXjEqbiEcPMuvp6+PsNHYswsscxO4jNahGrRSeHPvX1gJo/0Rt9Ig7uAA cBBZ6FTZWG5Togr4BQsSsl/Gd3FDw40= X-MC-Unique: r_vZKkk7MOiGl_vw9Vy3tA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=07QDxIPMafAaF6WsUgGU20pp0SPQclmS77EMgRXJWQo=; b=putRaojv0XNBlrLhQWWswrOuoZby5yiR24HMpcKLvyHg91/Vgz0EWjFT/IWgG0SmQT 08WxoXxr7WHrwVfTtWT5TnS06gvtu3r6ebUhJyjPctdMBpF8915MwugKnqzNHbHkm81S zAp14JZ9sLOiJtlKp+m6E1d4VjX1tkP3GWWfdn8UcHAV4wgbg7gFJDdRCkbRg3wg+cXm h4lOB0C1dof2wRCK494yEVcPmYr2m+GYTAVv822bwCtxJxrg+nzXjypQyvg+EPqWs2eD BLSPpoZ8ol/6i0j86FcjWidHdQN+V/C66SRD8jUjhjdvw/2O9usLPjS2JoDr6F+PxdWU LvPw== X-Gm-Message-State: AOAM530c8bri/nx7Ou/GAAZFL7+I6s3erGlZ3IY7TlEqD0MOMyg37N+g C7qrawvlTUDLQMr/8msQKwsTydxi0c65z8x1vDB6kj3hK/qLtwfHbzQfLR8yXMWJbkHphIfWJeV 9Vh+b4/RfWm1f0FaHfgrzhnxM+QKna30K+y9ELPamROQRkh1Ne0OGeM1PluFr X-Received: by 2002:a50:baa8:0:b0:415:b0bc:6353 with SMTP id x37-20020a50baa8000000b00415b0bc6353mr10393512ede.220.1646647409995; Mon, 07 Mar 2022 02:03:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5wZ7PjzI9fjktQNoDo5p4Os8on78q0y0B599KfC++B6R5H0qHvKtUpRGTm/p/Jev6nRmuoQ== X-Received: by 2002:a50:baa8:0:b0:415:b0bc:6353 with SMTP id x37-20020a50baa8000000b00415b0bc6353mr10393485ede.220.1646647409732; Mon, 07 Mar 2022 02:03:29 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:27 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 43/47] docs: vhost-user: add subsection for non-Linux platforms Message-ID: <20220307100058.449628-44-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Peter Maydell , Stefan Hajnoczi , Sergio Lopez Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648862015100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sergio Lopez Add a section explaining how vhost-user is supported on platforms other than Linux. Signed-off-by: Sergio Lopez Reviewed-by: Stefan Hajnoczi Message-Id: <20220304100854.14829-5-slp@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/interop/vhost-user.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index edc3ad84a3..4dbc84fd00 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -38,6 +38,26 @@ conventions `. *Master* and *slave* can be either a client (i.e. connecting) or server (listening) in the socket communication. =20 +Support for platforms other than Linux +-------------------------------------- + +While vhost-user was initially developed targeting Linux, nowadays it +is supported on any platform that provides the following features: + +- A way for requesting shared memory represented by a file descriptor + so it can be passed over a UNIX domain socket and then mapped by the + other process. + +- AF_UNIX sockets with SCM_RIGHTS, so QEMU and the other process can + exchange messages through it, including ancillary data when needed. + +- Either eventfd or pipe/pipe2. On platforms where eventfd is not + available, QEMU will automatically fall back to pipe2 or, as a last + resort, pipe. Each file descriptor will be used for receiving or + sending events by reading or writing (respectively) an 8-byte value + to the corresponding it. The 8-value itself has no meaning and + should not be interpreted. + Message Specification =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16466489692251001.983112842266; Mon, 7 Mar 2022 02:29:29 -0800 (PST) Received: from localhost ([::1]:41068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAcJ-0001UI-KD for importer@patchew.org; Mon, 07 Mar 2022 05:29:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADM-0002zQ-UF for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27022) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADH-0002xq-Mb for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:40 -0500 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-KSA5j78xOr6vJwPO7VtnKQ-1; Mon, 07 Mar 2022 05:03:34 -0500 Received: by mail-ed1-f70.google.com with SMTP id l14-20020aa7cace000000b003f7f8e1cbbdso8293466edt.20 for ; Mon, 07 Mar 2022 02:03:34 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id m7-20020aa7c487000000b00413a99bf3a3sm6141958edq.56.2022.03.07.02.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mfut9rC7QohOum5PUWB9hEyCkgjB7g4mFdlV9wDnfyg=; b=iWcHjFthOBWeq9QojI00bRLMIIKCGB+szaT9WxPYRUaQqfS9xhIt3cfi6u44Q0z/j3dlxv yYbACkbJL+HiFeL9pDHdHKVx0wMDfDO8iyJRuVx48wwJ/7KgX28VEUgtx+gcv23bkwyHdM FZZXIKqg+wjPax2HAqxs1w40MZrcWbE= X-MC-Unique: KSA5j78xOr6vJwPO7VtnKQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mfut9rC7QohOum5PUWB9hEyCkgjB7g4mFdlV9wDnfyg=; b=avpYeufPy6ACNx10S3JLABzaTJ+EaMFyE8wXT8Lu+WsU2esGKt07PQGx409y9Nj/Cb rGrBrx5OWG8Ho7BF5udEUv7fTqXVf58pYmWj9KnqozyV1kwv6N14yid825DhTqobvSrE aIe/EG/S/+cx+X5MOPyrYzVtXsmfy4CYIQjJm+043vVE0pNtk7pS2pyNwm3U0ZH0DJgs d9kwxZA0mXQSNMuTRVsV/jVZE6smYBSuaw+IRcxb066MPNCMohxehiANutzpLaozHa2C hbm0eHPDJIF3JI8A05YaORS4Yh3ENb5Hz1gWhyFthopUnKYZtvntuVjf0CKQ5gmLzNcI zS6A== X-Gm-Message-State: AOAM532T0hNOAXXYaA5wF3624T9HzOckDxwdKAP1rPSYTY+Nk5FQftr/ gDa+ZZZGXMHK0E90Y4KKjkB3LrYop9e41EwZzmo4pz0z6elTT0Yt1uSIbpz4kvqB96fSthK1pi4 ZBZxaqUTQ6wC1Mtsz/6ml4WWXEXM5g2eYv9RhG+PVj9IZnZC6Xqz9kMlB2JXH X-Received: by 2002:a17:907:168a:b0:6da:9177:9fdd with SMTP id hc10-20020a170907168a00b006da91779fddmr8464709ejc.757.1646647412628; Mon, 07 Mar 2022 02:03:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXBsVqcLXfllFfltaNNsB3P0ZdvHCkNbiFGQrSpRY7zr9v5/uNxdZnsUlPlZknyMwHzTGyuw== X-Received: by 2002:a17:907:168a:b0:6da:9177:9fdd with SMTP id hc10-20020a170907168a00b006da91779fddmr8464696ejc.757.1646647412325; Mon, 07 Mar 2022 02:03:32 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:29 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 44/47] tests/acpi: i386: allow FACP acpi table changes Message-ID: <20220307100058.449628-45-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Liav Albani , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646648970985100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Liav Albani The FACP table is going to be changed for x86/q35 machines. To be sure the following changes are not breaking any QEMU test this change follows step 2 from the bios-tables-test.c guide on changes that affect ACPI tables. Signed-off-by: Liav Albani Acked-by: Ani Sinha Message-Id: <20220304154032.2071585-2-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..7570e39369 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,5 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/FACP", +"tests/data/acpi/q35/FACP.nosmm", +"tests/data/acpi/q35/FACP.slic", +"tests/data/acpi/q35/FACP.xapic", --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646651108747939.566574679035; Mon, 7 Mar 2022 03:05:08 -0800 (PST) Received: from localhost ([::1]:43228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRBAp-0001Ha-DX for importer@patchew.org; Mon, 07 Mar 2022 06:05:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADT-00031D-Mh for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:53 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25058) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADS-0002yz-01 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:47 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-538-g6F-PLDIN-qHT7o3vw7gqA-1; Mon, 07 Mar 2022 05:03:37 -0500 Received: by mail-ej1-f71.google.com with SMTP id go11-20020a1709070d8b00b006cf0d933739so6748045ejc.5 for ; Mon, 07 Mar 2022 02:03:37 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id z10-20020aa7cf8a000000b004160af67840sm4171791edx.66.2022.03.07.02.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647425; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fzFjMVjkMR0anaC3SFegEYUQ/LQ+fdsLfF/TQ60MTl8=; b=Lbg2QWA+VGT3F/RQwuCGBKmcOr9iyxOTKXgDZ7h1fwZt8P3gVH4mWsnrbg7OxvThdgdbzp cqbtT0ZIDnMMlrukPi8dwL0SfQ5l8Lk1ssA9YOwDGJsfLHwitS/Rac4qAjp7Ofo9zAMp3n xC00W/Qj4LEHPIg0PlVaGT5qA0UkS5U= X-MC-Unique: g6F-PLDIN-qHT7o3vw7gqA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fzFjMVjkMR0anaC3SFegEYUQ/LQ+fdsLfF/TQ60MTl8=; b=Uh1+YIp/IOjBUfY06zlYYPxAkRyxispxW7YknxOQJjmxPDtcxbs+AHeSyPdJgWIaOs Sj5VXgnb+fEUTW6oWvoxkrLBjfJfui4BpVqeYOncT7kBI7NgkW5fVaNtxXoyxlipzwaQ fkAUpjqhC1BKdXEAl3tTZ0qBWGsO0sMoaXdLeYQXxMaAhmKSeH/yMKA9Uk+hOtuf+cZr JRrGqU/t77l6L5+9Nyw8v2OlNZHZrXwr+nfx2+VCvV8n9w7TpGomTcfx9Z54Evaahbh5 BgZeS6na92BJctH+epQ/eA8IoIyWvos2MnA4lEeO61dVKHXMZCGuckcpHGiakbotEX7Y d/TQ== X-Gm-Message-State: AOAM533iml80gzCzUxWXhZqtS19MGkIVn2sCkKMm/IZ1BIBa188Oy5N6 NQN9og7LV0PA6MnraeuFJSwjx8wxs4NZE9hWl59H+oMkTOBeYM0vJG1hM+YXT/2t3irLR7eRpbr BVyaSwT+2nbS62H3NNz95E3L150RTzxBAOyFH5AuifW1caxnKLxbYfor6//gn X-Received: by 2002:a17:906:bc9b:b0:6da:9f90:a56a with SMTP id lv27-20020a170906bc9b00b006da9f90a56amr8633697ejb.575.1646647415920; Mon, 07 Mar 2022 02:03:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj/jLuoLpuCFTAWQ3+haD4Mq0g9r1i0iv42q4D11OctjxAJqwyi2NVJ82CRvw37Y1mNukFeA== X-Received: by 2002:a17:906:bc9b:b0:6da:9f90:a56a with SMTP id lv27-20020a170906bc9b00b006da9f90a56amr8633670ejb.575.1646647415536; Mon, 07 Mar 2022 02:03:35 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:32 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 45/47] hw/acpi: add indication for i8042 in IA-PC boot flags of the FADT table Message-ID: <20220307100058.449628-46-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Richard Henderson , Liav Albani , Igor Mammedov , Ani Sinha , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646651110951100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Liav Albani This can allow the guest OS to determine more easily if i8042 controller is present in the system or not, so it doesn't need to do probing of the controller, but just initialize it immediately, before enumerating the ACPI AML namespace. The 8042 bit in IAPC_BOOT_ARCH was introduced from ACPI spec v2 (FADT revision 2 and above). Therefore, in this change, we only enable this bit f= or x86/q35 machine types since x86/i440fx machines use FADT ACPI table with revision 1. Signed-off-by: Liav Albani Signed-off-by: Ani Sinha Message-Id: <20220304154032.2071585-3-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/acpi-defs.h | 1 + include/hw/input/i8042.h | 15 +++++++++++++++ hw/acpi/aml-build.c | 8 +++++++- hw/i386/acpi-build.c | 8 ++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index c97e8633ad..2b42e4192b 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -77,6 +77,7 @@ typedef struct AcpiFadtData { uint16_t plvl2_lat; /* P_LVL2_LAT */ uint16_t plvl3_lat; /* P_LVL3_LAT */ uint16_t arm_boot_arch; /* ARM_BOOT_ARCH */ + uint16_t iapc_boot_arch; /* IAPC_BOOT_ARCH */ uint8_t minor_ver; /* FADT Minor Version */ =20 /* diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h index 1d90432dae..e070f546e4 100644 --- a/include/hw/input/i8042.h +++ b/include/hw/input/i8042.h @@ -23,4 +23,19 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, void i8042_isa_mouse_fake_event(ISAKBDState *isa); void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); =20 +static inline bool i8042_present(void) +{ + bool amb =3D false; + return object_resolve_path_type("", TYPE_I8042, &amb) || amb; +} + +/* + * ACPI v2, Table 5-10 - Fixed ACPI Description Table Boot Architecture + * Flags, bit offset 1 - 8042. + */ +static inline uint16_t iapc_boot_arch_8042(void) +{ + return i8042_present() ? 0x1 << 1 : 0x0 ; +} + #endif /* HW_INPUT_I8042_H */ diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 8966e16320..1773cf55f1 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -2152,7 +2152,13 @@ void build_fadt(GArray *tbl, BIOSLinker *linker, con= st AcpiFadtData *f, build_append_int_noprefix(tbl, 0, 1); /* DAY_ALRM */ build_append_int_noprefix(tbl, 0, 1); /* MON_ALRM */ build_append_int_noprefix(tbl, f->rtc_century, 1); /* CENTURY */ - build_append_int_noprefix(tbl, 0, 2); /* IAPC_BOOT_ARCH */ + /* IAPC_BOOT_ARCH */ + if (f->rev =3D=3D 1) { + build_append_int_noprefix(tbl, 0, 2); + } else { + /* since ACPI v2.0 */ + build_append_int_noprefix(tbl, f->iapc_boot_arch, 2); + } build_append_int_noprefix(tbl, 0, 1); /* Reserved */ build_append_int_noprefix(tbl, f->flags, 4); /* Flags */ =20 diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ebd47aa26f..4ad4d7286c 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -38,6 +38,7 @@ #include "hw/nvram/fw_cfg.h" #include "hw/acpi/bios-linker-loader.h" #include "hw/isa/isa.h" +#include "hw/input/i8042.h" #include "hw/block/fdc.h" #include "hw/acpi/memory_hotplug.h" #include "sysemu/tpm.h" @@ -192,6 +193,13 @@ static void init_common_fadt_data(MachineState *ms, Ob= ject *o, .address =3D object_property_get_uint(o, ACPI_PM_PROP_GPE0_BLK= , NULL) }, }; + + /* + * ACPI v2, Table 5-10 - Fixed ACPI Description Table Boot Architecture + * Flags, bit offset 1 - 8042. + */ + fadt.iapc_boot_arch =3D iapc_boot_arch_8042(); + *data =3D fadt; } =20 --=20 MST From nobody Sat May 18 16:46:52 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646649045521983.8952179545541; Mon, 7 Mar 2022 02:30:45 -0800 (PST) Received: from localhost ([::1]:42942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAdY-0002ip-Js for importer@patchew.org; Mon, 07 Mar 2022 05:30:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADQ-00030I-4N for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:34819) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADO-0002yX-H4 for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:43 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-75-Ub1fh2HhNbiBmycQF1QaDg-1; Mon, 07 Mar 2022 05:03:40 -0500 Received: by mail-ej1-f71.google.com with SMTP id i14-20020a17090639ce00b006dabe6a112fso3006761eje.13 for ; Mon, 07 Mar 2022 02:03:40 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id s15-20020a056402520f00b00415e50f8ce1sm5702479edd.54.2022.03.07.02.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647421; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=odDd977IILxM571sNSlSsG8vIH/vMjvB2fzKvFQoxXM=; b=gRTeGZkN+t6fQ0tB6EncsTxdl6NQE987RJM5LlKkr11o+g0Lcf5IZKZH3dYd0/EncnVIAc DqmOP5O3RJkvQl4h5Fa9Ln6/djQM770f5ZQ4b1wjeNexnGO4EH3U55SqHV+cPqqjyKCRby RMAzoAVXFsqvv9ZOCPA2KZhmf2UaU2o= X-MC-Unique: Ub1fh2HhNbiBmycQF1QaDg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=odDd977IILxM571sNSlSsG8vIH/vMjvB2fzKvFQoxXM=; b=6FxT0Svpq9d/2StlSyNSbqWcyHwMXCju6PJzuQJ7W/IUfiVlhNsK6F16ejaHXFZanf Hzkmsp+Zaxj5QPTO0g5qG5DIc1NH0HQzHsbSfJ3l7LexXVZkzuydekdnpi9H1d7NwOb/ r3JJiwD+EY02wgWEWKHfQNeMmu/4Pe/fhmDkvvdU1kmUxNCQqt/jdOqVGsfpe/hPKVEu 30bPKSNFw5tQ18Cq0DfjF82+SjmmN1LrK6ATDYnFDCiAP8nbuwdh3tl+EWCiYrXOtrDP ts8v1o64VC7miDpKFh7mfYnAMfzl529Cp9tPSbV+6l5aI92/xhs/aEW473gW8Q5MQMxJ JNQQ== X-Gm-Message-State: AOAM5314TTMtELMirfPzbKjxWBD/TOQ+G+KbEe0v9IE1LBVnyJhbXVv1 NKuO+M4aZNkdgtDbzFxTvMwyM3S1r6L1TLq/dCZq4LWGQ9bTxkyPUnspuEo4J1cGdwapSn3Q4ao FkzrK2kDTBkOBX4GJt0XhgjZoSloF7HPGTK4qd/jr9eX9WvcpdME64rxbCXGA X-Received: by 2002:a17:907:94cd:b0:6d9:89e1:3036 with SMTP id dn13-20020a17090794cd00b006d989e13036mr8846785ejc.231.1646647418709; Mon, 07 Mar 2022 02:03:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE/kdc+fCaJvOr94euzhySTfI7DczRtWzZj/P342lcDm0XrRW4vj/dTSV62cXa4CW421b08Q== X-Received: by 2002:a17:907:94cd:b0:6d9:89e1:3036 with SMTP id dn13-20020a17090794cd00b006d989e13036mr8846753ejc.231.1646647418365; Mon, 07 Mar 2022 02:03:38 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:35 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 46/47] tests/acpi: i386: update FACP table differences Message-ID: <20220307100058.449628-47-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Ani Sinha , Peter Maydell , Liav Albani , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646649047374100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Liav Albani After changing the IAPC boot flags register to indicate support of i8042 in the machine chipset to help the guest OS to determine its existence "faster", we need to have the updated FACP ACPI binary images in tree. The ASL changes introduced are shown by the following diff: @@ -42,35 +42,35 @@ [059h 0089 1] PM1 Control Block Length : 02 [05Ah 0090 1] PM2 Control Block Length : 00 [05Bh 0091 1] PM Timer Block Length : 04 [05Ch 0092 1] GPE0 Block Length : 10 [05Dh 0093 1] GPE1 Block Length : 00 [05Eh 0094 1] GPE1 Base Offset : 00 [05Fh 0095 1] _CST Support : 00 [060h 0096 2] C2 Latency : 0FFF [062h 0098 2] C3 Latency : 0FFF [064h 0100 2] CPU Cache Size : 0000 [066h 0102 2] Cache Flush Stride : 0000 [068h 0104 1] Duty Cycle Offset : 00 [069h 0105 1] Duty Cycle Width : 00 [06Ah 0106 1] RTC Day Alarm Index : 00 [06Bh 0107 1] RTC Month Alarm Index : 00 [06Ch 0108 1] RTC Century Index : 32 -[06Dh 0109 2] Boot Flags (decoded below) : 0000 +[06Dh 0109 2] Boot Flags (decoded below) : 0002 Legacy Devices Supported (V2) : 0 - 8042 Present on ports 60/64 (V2) : 0 + 8042 Present on ports 60/64 (V2) : 1 VGA Not Present (V4) : 0 MSI Not Supported (V4) : 0 PCIe ASPM Not Supported (V4) : 0 CMOS RTC Not Present (V5) : 0 [06Fh 0111 1] Reserved : 00 [070h 0112 4] Flags (decoded below) : 000084A5 WBINVD instruction is operational (V1) : 1 WBINVD flushes all caches (V1) : 0 All CPUs support C1 (V1) : 1 C2 works on MP system (V1) : 0 Control Method Power Button (V1) : 0 Control Method Sleep Button (V1) : 1 RTC wake not in fixed reg space (V1) : 0 RTC can wake system from S4 (V1) : 1 32-bit PM Timer (V1) : 0 Docking Supported (V1) : 0 Signed-off-by: Liav Albani Acked-by: Ani Sinha Message-Id: <20220304154032.2071585-4-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- tests/data/acpi/q35/FACP | Bin 244 -> 244 bytes tests/data/acpi/q35/FACP.nosmm | Bin 244 -> 244 bytes tests/data/acpi/q35/FACP.slic | Bin 244 -> 244 bytes tests/data/acpi/q35/FACP.xapic | Bin 244 -> 244 bytes 5 files changed, 4 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index 7570e39369..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,5 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/FACP", -"tests/data/acpi/q35/FACP.nosmm", -"tests/data/acpi/q35/FACP.slic", -"tests/data/acpi/q35/FACP.xapic", diff --git a/tests/data/acpi/q35/FACP b/tests/data/acpi/q35/FACP index f6a864cc863c7763f6c09d3814ad184a658fa0a0..a8f6a8961109d01059aceef9f18= 69cde09a2f10c 100644 GIT binary patch delta 23 ecmeyu_=3DS Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646650061315141.385043492455; Mon, 7 Mar 2022 02:47:41 -0800 (PST) Received: from localhost ([::1]:55058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRAtw-0004xb-2a for importer@patchew.org; Mon, 07 Mar 2022 05:47:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADT-00030l-4e for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24194) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRADR-0002yr-LZ for qemu-devel@nongnu.org; Mon, 07 Mar 2022 05:03:46 -0500 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-522-0klbdFUQNK6nF47VwcJ4GA-1; Mon, 07 Mar 2022 05:03:43 -0500 Received: by mail-ed1-f71.google.com with SMTP id l24-20020a056402231800b00410f19a3103so8324208eda.5 for ; Mon, 07 Mar 2022 02:03:43 -0800 (PST) Received: from redhat.com ([2.55.138.228]) by smtp.gmail.com with ESMTPSA id cc21-20020a0564021b9500b00403bc1dfd5csm6091350edb.85.2022.03.07.02.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 02:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646647424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9q47EVnAVXFpNQycZMOXWyjMc83xadubGO4Go9bg1gU=; b=Uy5z5Jef+1bts4NBXSQXgsy2UlAcokHtfzP//phRA57O2IQWSAILezsUI4tarw/4+KfuxG Uc2xCdLx3Xnw4KuqbJ2EkJrWYiEFfjZB82gIEpt+5jdRl9PpMOLWS7SSCAvVWNHAF8rFlG o/efi5ctsptfIT+xtCIuzuQle5c8aEo= X-MC-Unique: 0klbdFUQNK6nF47VwcJ4GA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9q47EVnAVXFpNQycZMOXWyjMc83xadubGO4Go9bg1gU=; b=m+duToe/elmJTsQb/YYQyVAiiPRqmg5o6AjHriPT+CTA0ChyRjvLOTKuH97LRJ3hEB VFpf9oRMjbyWsA21A/WRAU1PrzN7m7IkYyMXpsGrOa6YRP6fLc8mQk/vCJKHe7nRfLiS Nxf0TXy3Dk5qgdtHTAwzBrTEQl3nqrj+YbpMGn165cNHz25NfU9TbTxxw2VO7R8Ju9cZ xJzrdSeQmOxB/cxgfbeb36IXgVTgvQq9k19rzXXl5Opb9Hj4XIRZtxJ3e1wWaJ/WgwY/ HCRj2wUoXhjcGAgLyFbURQwJmVB8JEmKdHcJhRVItLkxWEMBgJKBZWR0freMV7wCyOyK 1yfw== X-Gm-Message-State: AOAM530LdECZ2ao6xdUAD09HbHmDUT90x01+wdrunsoxRmXcPSNpDAoD dtuD9ThJFspcB2tbBz9rXJDcJS1v8dQF3mepOyfErgf/Zy5uX0I1YdR5a7DqFS5iuiT3kOZIfAU pO0WbduFqO0Soxi1C5+CmfCmbenEbuSKxzXppB3pygSTKonjlmprIs14OUaY9 X-Received: by 2002:a17:906:31c1:b0:6c9:cfb3:4dd3 with SMTP id f1-20020a17090631c100b006c9cfb34dd3mr8303395ejf.392.1646647421577; Mon, 07 Mar 2022 02:03:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzp6tI5vmwtKp929IK1DTxhDAOL2T86R31jihOAE+aTagv34vpCUaHfsKhO/iw2gsAit5Ml7w== X-Received: by 2002:a17:906:31c1:b0:6c9:cfb3:4dd3 with SMTP id f1-20020a17090631c100b006c9cfb34dd3mr8303377ejf.392.1646647421349; Mon, 07 Mar 2022 02:03:41 -0800 (PST) Date: Mon, 7 Mar 2022 05:03:38 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 47/47] hw/acpi/microvm: turn on 8042 bit in FADT boot architecture flags if present Message-ID: <20220307100058.449628-48-mst@redhat.com> References: <20220307100058.449628-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220307100058.449628-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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=mst@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, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: , Cc: Eduardo Habkost , Peter Maydell , Richard Henderson , Ani Sinha , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646650063418100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ani Sinha The second bit of IAPC_BOOT_ARCH in FADT table indicates the presence of keyboard controller implemented as 8042 or equivalent micro controller. This change enables this flag for microvms if such a device exists (for example, when added explicitly from the QEMU commandline). Change 654701e292d98b308b0 ("hw/acpi: add indication for i8042 in IA-PC boot flags= of the FADT table") enabled this flag for i386 q35 based machines. The reason for doing the same for micro-vms is to make sure we provide the correct tables to the guest OS uniformly in all cases when an i8042 device is present. When this bit is not enabled, guest OSes has to find other indirect methods to detect the device which we would like to avoid. Signed-off-by: Ani Sinha Message-Id: <20220304154032.2071585-5-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-microvm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/i386/acpi-microvm.c b/hw/i386/acpi-microvm.c index 68ca7e7fc2..fb09185cbd 100644 --- a/hw/i386/acpi-microvm.c +++ b/hw/i386/acpi-microvm.c @@ -37,6 +37,7 @@ #include "hw/pci/pcie_host.h" #include "hw/usb/xhci.h" #include "hw/virtio/virtio-mmio.h" +#include "hw/input/i8042.h" =20 #include "acpi-common.h" #include "acpi-microvm.h" @@ -187,6 +188,11 @@ static void acpi_build_microvm(AcpiBuildTables *tables, .address =3D GED_MMIO_BASE_REGS + ACPI_GED_REG_RESET, }, .reset_val =3D ACPI_GED_RESET_VALUE, + /* + * ACPI v2, Table 5-10 - Fixed ACPI Description Table Boot Archite= cture + * Flags, bit offset 1 - 8042. + */ + .iapc_boot_arch =3D iapc_boot_arch_8042(), }; =20 table_offsets =3D g_array_new(false, true /* clear */, --=20 MST