From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595419862; cv=none; d=zohomail.com; s=zohoarc; b=P+rWoqAvaQpPYIwqNiH06f+0dYHTP4M6J2ixpAbc4F/v55C16i/dxadcRyzNGozELOnT7mNa6omEHBtEPXZ09kX20lOI2OmIF7DORrLayBSt/Snvx4elDO9pJIdqVOuTodvrY1QjSdYsghyoEXaWBX1NY6eLyW2Pn3bI7QylKCY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595419862; 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=/9YW6K8+jtBdnSbdO+Q9oFDtvItrtur2iZwhghw1mqc=; b=M2PbXVNAgV5HJg3yhgAad7E4jHL1OZ7e68yvEHKXvqkPwgEvmaNzL32Pbh4SRAW46/IxBz2Hj8fv6Akr5YfLzLA1OJn043/3V3oHBjz+SP3M6hTfhP5obGIrlP9UgPWt/DLqS9TrP6cFzR3xkZZ9GvIWs0rvpFIvJfS1xinIfls= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595419862426824.2825951983106; Wed, 22 Jul 2020 05:11:02 -0700 (PDT) Received: from localhost ([::1]:53214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDaP-0007CB-9O for importer@patchew.org; Wed, 22 Jul 2020 08:11:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDYk-0005OV-3b for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:18 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:51912 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDYi-0006ZE-Bm for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:17 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-GJoeoM3MNVmnpsfBSB7EUw-1; Wed, 22 Jul 2020 08:09:12 -0400 Received: by mail-wr1-f70.google.com with SMTP id t12so555289wrp.0 for ; Wed, 22 Jul 2020 05:09:11 -0700 (PDT) Received: from redhat.com (bzq-79-182-82-99.red.bezeqint.net. [79.182.82.99]) by smtp.gmail.com with ESMTPSA id k14sm39983301wrn.76.2020.07.22.05.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419755; 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=/9YW6K8+jtBdnSbdO+Q9oFDtvItrtur2iZwhghw1mqc=; b=Xeb/gik5m7PQ2gbf/c2vOOOwmg3qqce8hr+lJgTUfgLp5EguAAwo4M7Jji2/ajgc3otI8c 0V4tmqjw42ILAolv4683zqjy5Wne2T9yxken8mPC9Go8OesmN8wyo93Z/hhkdgyv1lOyMB DH3DKmgzHAnniGOVXfO1iHQEbSe7760= X-MC-Unique: GJoeoM3MNVmnpsfBSB7EUw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/9YW6K8+jtBdnSbdO+Q9oFDtvItrtur2iZwhghw1mqc=; b=W9ZkgYUuonxPpuRypP8JNPEBJcLtb0qNQ73o34NTRu1UeU9ZXWzV7MaWpXMF2xawHO +/wxJxbu/kY8e0p5+6zU/2qcGgdixjn1NSbvsWPo+YCYHUFIl5LRS+2rewR/3a9F2etC DOuFvFm/id6vyEdq337m2B6nOC6UbGn0iWoifwGitjW94nMawRDhsNWh/6JrzW+DavBu KR/wfRJjC1sAGlmpTn/a/rIp+HdkxSqC6APrIkUkGESaPPtN9iSNwMhCYhfIVLqlm05G yA4MLmy/sKXh/btgVZb/y9+Gg/mBqqZNjFSDbPYClC/pDVHEQqkWo8EO04NwGEBW5oRo JT8Q== X-Gm-Message-State: AOAM533udXqQMK+1BtLL/+qWbjc9oEsqQ8K9CS492J7Jgo2fPMrXRIp/ eFHhyjFqVrmVsmH9LOLPndzaSP1iwRATD0lSMXRKB2zMpraWs3Vm+/3gMBLe+UCWrj8JBDmsulE z9m+hRXZUSRbws+Y= X-Received: by 2002:a1c:27c1:: with SMTP id n184mr8741907wmn.6.1595419750760; Wed, 22 Jul 2020 05:09:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfJnsv60NWLAY6CpOwKF2nDjeLmGeyF0puGnN737dNdp1aGisd8T8TjzAYIVhDY+sDvfhy/g== X-Received: by 2002:a1c:27c1:: with SMTP id n184mr8741885wmn.6.1595419750484; Wed, 22 Jul 2020 05:09:10 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 1/9] acpi: accept byte and word access to core ACPI registers Message-ID: <20200722120853.9144-2-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 00:40:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Simon John , Peter Maydell , Michael Tokarev , qemu-stable@nongnu.org, Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Michael Tokarev All ISA registers should be accessible as bytes, words or dwords (if wide enough). Fix the access constraints for acpi-pm-evt, acpi-pm-tmr & acpi-cnt registers. Fixes: 5d971f9e67 (memory: Revert "memory: accept mismatching sizes in memo= ry_region_access_valid") Fixes: afafe4bbe0 (apci: switch cnt to memory api) Fixes: 77d58b1e47 (apci: switch timer to memory api) Fixes: b5a7c024d2 (apci: switch evt to memory api) Buglink: https://lore.kernel.org/xen-devel/20200630170913.123646-1-anthony.= perard@citrix.com/T/ Buglink: https://bugs.debian.org/964793 BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D964247 BugLink: https://bugs.launchpad.net/bugs/1886318 Reported-By: Simon John Signed-off-by: Michael Tokarev Message-Id: <20200720160627.15491-1-mjt@msgid.tls.msk.ru> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/acpi/core.c b/hw/acpi/core.c index f6d9ec4f13..ac06db3450 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -458,7 +458,8 @@ static void acpi_pm_evt_write(void *opaque, hwaddr addr= , uint64_t val, static const MemoryRegionOps acpi_pm_evt_ops =3D { .read =3D acpi_pm_evt_read, .write =3D acpi_pm_evt_write, - .valid.min_access_size =3D 2, + .impl.min_access_size =3D 2, + .valid.min_access_size =3D 1, .valid.max_access_size =3D 2, .endianness =3D DEVICE_LITTLE_ENDIAN, }; @@ -527,7 +528,8 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr= , uint64_t val, static const MemoryRegionOps acpi_pm_tmr_ops =3D { .read =3D acpi_pm_tmr_read, .write =3D acpi_pm_tmr_write, - .valid.min_access_size =3D 4, + .impl.min_access_size =3D 4, + .valid.min_access_size =3D 1, .valid.max_access_size =3D 4, .endianness =3D DEVICE_LITTLE_ENDIAN, }; @@ -599,7 +601,8 @@ static void acpi_pm_cnt_write(void *opaque, hwaddr addr= , uint64_t val, static const MemoryRegionOps acpi_pm_cnt_ops =3D { .read =3D acpi_pm_cnt_read, .write =3D acpi_pm_cnt_write, - .valid.min_access_size =3D 2, + .impl.min_access_size =3D 2, + .valid.min_access_size =3D 1, .valid.max_access_size =3D 2, .endianness =3D DEVICE_LITTLE_ENDIAN, }; --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595419863; cv=none; d=zohomail.com; s=zohoarc; b=Ptzx8zvzpYe8kE/dtWlh8OdBNXKRMmUqAFcJxHZyJk4r9bHdSwBS7iuWpO51RCWxtJOjwOEwLmfymt4MPm+/i95A29qTZhk8qALQTYr1JCZ+ag471gPyhAzfJLfJ7TE7oqPowho15cZG/hQcfIyxuPQIlSYot8tqkzlVGcrPpso= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595419863; 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=ge/NPs5maQ977E98YNqRK3OYZ1LGaZWTbEL2f1Ol8j0=; b=ZucjSggoWUeX0YUqKrRAgxmHt7pfuUu8ao+42aQ1rabJxNeauqXIa7oFZiiP5SkXoDBslcI+LIq3cB2059re+/PNKiS1pNtDxlKFHLLtijJi8VeCwZkEHgDeQ+wc9wsdRSwGrnwzKDmRUghsc8x6ZyB0rsel7xdNUobt8xp1dKg= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595419863024444.3795286376162; Wed, 22 Jul 2020 05:11:03 -0700 (PDT) Received: from localhost ([::1]:53276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDaP-0007De-Pj for importer@patchew.org; Wed, 22 Jul 2020 08:11:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDYl-0005RS-Rn for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:19 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:33029 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDYk-0006ZN-6A for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:19 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-245-d22p-4qbOAyr2rw4qsrhdQ-1; Wed, 22 Jul 2020 08:09:15 -0400 Received: by mail-wm1-f72.google.com with SMTP id a5so1022440wmj.5 for ; Wed, 22 Jul 2020 05:09:15 -0700 (PDT) Received: from redhat.com (bzq-79-182-82-99.red.bezeqint.net. [79.182.82.99]) by smtp.gmail.com with ESMTPSA id i14sm12093235wrc.19.2020.07.22.05.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419757; 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=ge/NPs5maQ977E98YNqRK3OYZ1LGaZWTbEL2f1Ol8j0=; b=HOi7aE30E4UMJat3Rv30kAtCKY79T9B4ssNFLMnLrcGRpF3XQiFQNM5qt5SgZYA0/6N9wn 8T3PxrmPSGIkQNsqoNSgJXNZVxlR94a9oGxvKvk6rQTSvjUyA2ENoPwrDD7xLjbZHzeaKD 38bFeL57HN7Yy7yDzel2JW6pgGCnDX4= X-MC-Unique: d22p-4qbOAyr2rw4qsrhdQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ge/NPs5maQ977E98YNqRK3OYZ1LGaZWTbEL2f1Ol8j0=; b=UTaUAZOkY/QEjQSi2iJjrT9bLJBwwhCzK0CZ2KJCn9fRu3ckFCLrXOV/+z04wyChfl wErHdYNtXZfawKU9XK0vPazd5qf2I7HwPn7ltUNZ+P6QhTympABOTBacnpRAY0LMhjWb 9wJAWYV39ENxzPBXWLqN4kgmbCv+r4DOMJol+TJ58ptrSBYc6OzVihxkJaoHusyHeUyf XtGNgHSKnrmIYlPBomSfyQr0fU5UkXv/qyurMcKG1jsH4bP1XzWsHKZygJMupWNdlwUR hwonP7+qDzUCwSYM9yA0x/mLkxX7Jsx/EPvX9zJtLNddwx4SWj8F3W8N6vkjWwNihRF4 3P2w== X-Gm-Message-State: AOAM532Q9Wut4gc1y6dXzu9h1pjVAzz6pHIVZEGAvWezOlknB6l1mFjn 7Tu8+ShQ4Q30tJD9jW0xgggonWu8PZfvMQ45KzwA61mrUoW49HHeUI4/569JBbKrEpYtsbQ825b Kij+RJlodRQPOTbI= X-Received: by 2002:adf:df06:: with SMTP id y6mr720630wrl.89.1595419753843; Wed, 22 Jul 2020 05:09:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRgydDziEav8BWoQhl0kLNhM4wH0dqxINccHL8yd8WIbYEkEXBXDRN+03csXZoJUgyMA4szg== X-Received: by 2002:adf:df06:: with SMTP id y6mr720614wrl.89.1595419753608; Wed, 22 Jul 2020 05:09:13 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 2/9] virtio: Drop broken and superfluous object_property_set_link() Message-ID: <20200722120853.9144-3-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 23:34:34 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , David Hildenbrand , Cornelia Huck , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, "Gonglei \(Arei\)" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Markus Armbruster virtio_crypto_pci_realize() and copies the value of vcrypto->vdev's property "cryptodev" to vcrypto's property: object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.rn= g), NULL); Since it does so only after realize, this always fails, but the error is ignored. It's actually superfluous: vcrypto's property is an alias of vcrypto->vdev's property, created by virtio_instance_init_common(). Drop the call. Same for virtio_ccw_crypto_realize(), virtio_rng_pci_realize(), virtio_ccw_rng_realize(). Signed-off-by: Markus Armbruster Message-Id: <20200721121153.1128844-1-armbru@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/s390x/virtio-ccw-crypto.c | 3 --- hw/s390x/virtio-ccw-rng.c | 3 --- hw/virtio/virtio-crypto-pci.c | 2 -- hw/virtio/virtio-rng-pci.c | 3 --- 4 files changed, 11 deletions(-) diff --git a/hw/s390x/virtio-ccw-crypto.c b/hw/s390x/virtio-ccw-crypto.c index 570c0333fc..358c74fb4b 100644 --- a/hw/s390x/virtio-ccw-crypto.c +++ b/hw/s390x/virtio-ccw-crypto.c @@ -23,9 +23,6 @@ static void virtio_ccw_crypto_realize(VirtioCcwDevice *cc= w_dev, Error **errp) if (!qdev_realize(vdev, BUS(&ccw_dev->bus), errp)) { return; } - - object_property_set_link(OBJECT(vdev), "cryptodev", - OBJECT(dev->vdev.conf.cryptodev), NULL); } =20 static void virtio_ccw_crypto_instance_init(Object *obj) diff --git a/hw/s390x/virtio-ccw-rng.c b/hw/s390x/virtio-ccw-rng.c index 4bb8c16d79..2e3a9da5e8 100644 --- a/hw/s390x/virtio-ccw-rng.c +++ b/hw/s390x/virtio-ccw-rng.c @@ -24,9 +24,6 @@ static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_d= ev, Error **errp) if (!qdev_realize(vdev, BUS(&ccw_dev->bus), errp)) { return; } - - object_property_set_link(OBJECT(dev), "rng", OBJECT(dev->vdev.conf.rng= ), - NULL); } =20 static void virtio_ccw_rng_instance_init(Object *obj) diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c index f1cc979d33..198f86e08c 100644 --- a/hw/virtio/virtio-crypto-pci.c +++ b/hw/virtio/virtio-crypto-pci.c @@ -57,8 +57,6 @@ static void virtio_crypto_pci_realize(VirtIOPCIProxy *vpc= i_dev, Error **errp) if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) { return; } - object_property_set_link(OBJECT(vcrypto), "cryptodev", - OBJECT(vcrypto->vdev.conf.cryptodev), NULL); } =20 static void virtio_crypto_pci_class_init(ObjectClass *klass, void *data) diff --git a/hw/virtio/virtio-rng-pci.c b/hw/virtio/virtio-rng-pci.c index 2f0b529b62..8afbb4c209 100644 --- a/hw/virtio/virtio-rng-pci.c +++ b/hw/virtio/virtio-rng-pci.c @@ -38,9 +38,6 @@ static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_d= ev, Error **errp) if (!qdev_realize(vdev, BUS(&vpci_dev->bus), errp)) { return; } - - object_property_set_link(OBJECT(vrng), "rng", OBJECT(vrng->vdev.conf.r= ng), - NULL); } =20 static void virtio_rng_pci_class_init(ObjectClass *klass, void *data) --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595419979; cv=none; d=zohomail.com; s=zohoarc; b=Gg71v1B29fTKdw/cWV965Gc9YMO9o4SB0Tb9R+5GzMFjnYhP0DTYWmmTILa0CFrGRhMLiKAwa0uxMqP8m/nwM/aJnehBGpeN5qixuXqI/DifLE1wm1m+MFObwYoriNEM6vyV+SYcHk+N0NUDXKTbA+IzAVXL5u539nOC28Ykqoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595419979; 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=Ir1mQoDZtpCFjemMlgBAUOy/k9rxHtJelilQmy3Q970=; b=Mb3SWWVrk7l9yecEZeRP4JH+YtesL7Acz/a9+CsgHdYddfRlbTH3OXhOugjcLrcZYba2Uz5wbZglOwakHjkbc+DQDZ97Icp790HU0Ev8b4r2+AweU3/p/Bcpt3Oe+8VDVp+SfecKNgjGluLbCvH4dkWuF59YdaLorwj42aQxvvo= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159541997953817.339568679223703; Wed, 22 Jul 2020 05:12:59 -0700 (PDT) Received: from localhost ([::1]:33604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDcI-0002MZ-6O for importer@patchew.org; Wed, 22 Jul 2020 08:12:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDYt-0005mn-Py for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:27 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29068 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDYs-0006Zq-6H for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:27 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-362-qJhZDVm0OUeX_JBPBfcIEQ-1; Wed, 22 Jul 2020 08:09:23 -0400 Received: by mail-wr1-f70.google.com with SMTP id w7so549766wrt.9 for ; Wed, 22 Jul 2020 05:09:22 -0700 (PDT) Received: from redhat.com (bzq-79-182-82-99.red.bezeqint.net. [79.182.82.99]) by smtp.gmail.com with ESMTPSA id u17sm41322377wrp.70.2020.07.22.05.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419765; 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=Ir1mQoDZtpCFjemMlgBAUOy/k9rxHtJelilQmy3Q970=; b=RAomasegoyjdtXJfDmRNS38qOg0LNPTvAipJLutRNEDCeAtt6cLMtkHGyAghozi7UUUEPq VYqsJEHT+bdJaHP9yKBU6DHRMfWhE3V7aoyOTNtr/naul4g0qSGmgPpIf+Yo1mKRMy0N94 c+EAW84JKH/Qv8Lc+9HRZFaqk8OBn+Y= X-MC-Unique: qJhZDVm0OUeX_JBPBfcIEQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ir1mQoDZtpCFjemMlgBAUOy/k9rxHtJelilQmy3Q970=; b=Mr1bKiZkiJu7WYfV6LOfdLpzQdfmw7ckYYKk03gZ2w7laYQacv8iUr7iT5I3naepsR Q+PmlFV3XuUqgozvR7UsIOSGX328jJmPha6iZtiLcaPpNCxK7lXoiLQnh5zZ8Rq37lex nBtUOhIGuTqk4NRB+kaC1RD4ndvgWtgxK6Ej257LAuqs/5oxu10CzllIv5AHzRX/3sXO gUkAx8ftSZs4ZAqFnxrn5XLf1kOj40cN2MaV4IjMatOTjwYYV5dDuyU94dvK3fYAGPKR 0tqvpM26Vwz5rpwOvl5eoZGwE0LsCDNGyO+ttTtuiRugRMTL9kkVeWaj45gIuqYVBmHC AN6w== X-Gm-Message-State: AOAM530UvQ+SkEdeAuGE90izyuF5VUAs+N4fQwWVC/og7p2GM+9G+Nu8 l/Pu5aXPZ/iy0UBZy3QthMeXZNjNxqqzwgUvMByYZ0BdhmxIqGdsiQGGDOzBU+arR6anAOpo9Vf Y776phpA0x4joRf4= X-Received: by 2002:a05:600c:2907:: with SMTP id i7mr8035514wmd.40.1595419761630; Wed, 22 Jul 2020 05:09:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHYfJo3ILHK3pe9Ds7U7OQuEX9nm9YVgEFeh9KCfcXuJ7ardN7LFIOYjqRWumZw4wxoRoAwg== X-Received: by 2002:a05:600c:2907:: with SMTP id i7mr8035500wmd.40.1595419761451; Wed, 22 Jul 2020 05:09:21 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:19 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 3/9] virtio-balloon: Prevent guest from starting a report when we didn't request one Message-ID: <20200722120853.9144-4-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 21:28:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alexander Duyck , qemu-stable@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Duyck Based on code review it appears possible for the driver to force the device out of a stopped state when hinting by repeating the last ID it was provided. Prevent this by only allowing a transition to the start state when we are in the requested state. This way the driver is only allowed to send one descriptor that will transition the device into the start state. All others will leave it in the stop state once it has finished. Fixes: c13c4153f76d ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT") Acked-by: David Hildenbrand Signed-off-by: Alexander Duyck Message-Id: <20200720175115.21935.99563.stgit@localhost.localdomain> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-balloon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index e670f1e595..ce70adcc69 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -526,7 +526,8 @@ static bool get_free_page_hints(VirtIOBalloon *dev) ret =3D false; goto out; } - if (id =3D=3D dev->free_page_report_cmd_id) { + if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_REQUEST= ED && + id =3D=3D dev->free_page_report_cmd_id) { dev->free_page_report_status =3D FREE_PAGE_REPORT_S_START; } else { /* --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595419978; cv=none; d=zohomail.com; s=zohoarc; b=T7ALr7IGiTrd512hXGE/XIo4oMSwozaJqPCF8eH9dlufnPe2YsPutSMw6TWkeRapyPqbT8l0BWySX6PE6jT7SdV0jgPhMzXp/kIJqVvLqna1p0iSfhust20qubKOKd9P2MPzpufg4aW5Wq87A3OSvv0WeOgSoMXdLyUk8MT8nUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595419978; 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=NUjKfU8xPyPB+FtStfFVhRssHx17cxqyTATNtRp+vz4=; b=JnX3Yis5kIo+8JGL16qnBAGUf/X7zv41FfgwbThfCuHxgTCD/pjqi3+K514d4CzX8xsX69VqNvLJerKmKRhxf8B5jUNY5zIH6Mip0E1iXPTTgKdJqrLoxuTR1l/gqUCac/sN9OpuwetIoz8yZrd/EwEbkAsRw2MrVmfwJomRMpU= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15954199782221022.3421200743435; Wed, 22 Jul 2020 05:12:58 -0700 (PDT) Received: from localhost ([::1]:33558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDcG-0002Kl-B0 for importer@patchew.org; Wed, 22 Jul 2020 08:12:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDYw-0005tb-5I for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:30 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:33856 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDYu-0006b5-HU for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:29 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-3oi3DBhcM5uXede-ro2VkQ-1; Wed, 22 Jul 2020 08:09:25 -0400 Received: by mail-wr1-f71.google.com with SMTP id f7so548017wrs.8 for ; Wed, 22 Jul 2020 05:09:25 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id c15sm7030290wme.23.2020.07.22.05.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419767; 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=NUjKfU8xPyPB+FtStfFVhRssHx17cxqyTATNtRp+vz4=; b=PCWzggehhV14DZpxZxcf/0h6ye+3/43JwbrYa5YexRsVKr57b+ACPeWvsMjVEITW+GRPA7 ucxDGk94KNs6SFWdT1ygv4gA/gw/KClt4fS9+mkwurdIWdNWNbTbl3WiwGcaxXR8fNNz8V qemMVq/yjuluK1KcWEtgBJEZdXZU7IM= X-MC-Unique: 3oi3DBhcM5uXede-ro2VkQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NUjKfU8xPyPB+FtStfFVhRssHx17cxqyTATNtRp+vz4=; b=Ovno1iCvVW+/oldduIn70gwxE93BC5RE3zxGV48tIsTlFusxD7JfLhcgDpfCJ+675W 08RL1GyB3+re3R5VKJkxCdkpM7h6uCFgYNDhbBsd787gwsVJkDws623NuOjfjGGttJV4 uMjbDRnlPnAetuB/J7IUWEUo9GQko45V8pqkL4NAXdD+coPsG5ORPl/qvACt0htW/FTk LjtcMHU7S75Flc0ntzXb+ghTcQ+rZaH6iY/TWmhdqQGvFZg/Q0PTjx2DddG0Sd5vcVcp raYLTTfKrtkRU4Yz9rdLCTJvl/pJF/lxq8SUGlu7MNBeo+HPJAa0LNcRk+AvIpdraJSP IINA== X-Gm-Message-State: AOAM530b6lP+1IvG5dfTd0qYgqryjFQ98KBsOpzlz7xGAY9OwNsxFGvd gELLgbwLZfBXVV3IGhrrmiHoHCzlZwK1Zpg92I5HRr18PWLzbSlI5b4W1TK8aULfEYbgFBMVI81 O3nOOInIMiYzbfs8= X-Received: by 2002:a5d:6452:: with SMTP id d18mr30214148wrw.284.1595419764451; Wed, 22 Jul 2020 05:09:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywLvE/HpaJUjLAnM/Buzt27JVDJOexcCH/TOfLWPum0pulI5tfRhbdYFN6f4VH0laKb/SwyQ== X-Received: by 2002:a5d:6452:: with SMTP id d18mr30214130wrw.284.1595419764269; Wed, 22 Jul 2020 05:09:24 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 4/9] virtio-balloon: Add locking to prevent possible race when starting hinting Message-ID: <20200722120853.9144-5-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 00:40:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alexander Duyck , qemu-stable@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Duyck There is already locking in place when we are stopping free page hinting but there is not similar protections in place when we start. I can only assume this was overlooked as in most cases the page hinting should not be occurring when we are starting the hinting, however there is still a chance we could be processing hints by the time we get back around to restarting the hinting so we are better off making sure to protect the state with the mutex lock rather than just updating the value with no protections. Based on feedback from Peter Maydell this issue had also been spotted by Coverity: CID 1430269 Acked-by: David Hildenbrand Signed-off-by: Alexander Duyck Message-Id: <20200720175122.21935.78013.stgit@localhost.localdomain> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-balloon.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index ce70adcc69..6e2d129340 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -592,6 +592,8 @@ static void virtio_balloon_free_page_start(VirtIOBalloo= n *s) return; } =20 + qemu_mutex_lock(&s->free_page_lock); + if (s->free_page_report_cmd_id =3D=3D UINT_MAX) { s->free_page_report_cmd_id =3D VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_MIN; @@ -600,6 +602,8 @@ static void virtio_balloon_free_page_start(VirtIOBalloo= n *s) } =20 s->free_page_report_status =3D FREE_PAGE_REPORT_S_REQUESTED; + qemu_mutex_unlock(&s->free_page_lock); + virtio_notify_config(vdev); } =20 --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595420069; cv=none; d=zohomail.com; s=zohoarc; b=gpCezAMPgujgkJ+deNO2I/qOL3SSeBnzE9C7pKFtwvC1R3uEesC6OKDMItQ6U9NKrmX4aWPGMJRJmcYmn1jvuGS6IsnRwGOrwpU2W7Z3Xp+XSUB4OyV9LhGjb0RutQ3uBeLzSDI3WjR3TjahwRj1F6OsgNo7CLvt2dVnoJEf4Wg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595420069; 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=bs9U4hN5LSg+hi0OgxYHSZVVHSVgqOpBXsAdJksJ8EE=; b=LbQ1nOPCiYYcBFpyy6Z4kp3+uqZdQH1qEgJ74qq/NUPf5JanMGNgZ6tUejBk4DkPR3zbYF5ruiKJG98zBKqk8Bie5hJAo5M81EzAXtGYgI7Q1hOcTP/TaQxbedFJKW4Ln645EbdAouUctfDLAalmJpTazxJp3r5Abiah3AA5mD8= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15954200699301001.0179124125045; Wed, 22 Jul 2020 05:14:29 -0700 (PDT) Received: from localhost ([::1]:40174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDdk-00058H-Gi for importer@patchew.org; Wed, 22 Jul 2020 08:14:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDZ1-00063a-2z for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:35 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53210 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDYx-0006ba-VF for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:34 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-342-pgEWp5JGMFGYzmXlqOffxg-1; Wed, 22 Jul 2020 08:09:29 -0400 Received: by mail-wr1-f72.google.com with SMTP id m7so542769wrb.20 for ; Wed, 22 Jul 2020 05:09:29 -0700 (PDT) Received: from redhat.com (bzq-79-182-82-99.red.bezeqint.net. [79.182.82.99]) by smtp.gmail.com with ESMTPSA id n3sm31650879wre.29.2020.07.22.05.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419771; 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=bs9U4hN5LSg+hi0OgxYHSZVVHSVgqOpBXsAdJksJ8EE=; b=Grsmpuex2sE40bkKaiUjVlSLrTdpRtPeN2g9VQlTsJnQ4dEk6M4l3f9LmyoELVEBhFPpJx nJRmmQMfbTdTcgXWbEBkXEqoedEf2sgCzLn3F3myAoOUlucRWRyE2y8HcDagVQaD17Hp8p +yHbTq+nYnB3UjnAv3a++W0dmDyjki4= X-MC-Unique: pgEWp5JGMFGYzmXlqOffxg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=bs9U4hN5LSg+hi0OgxYHSZVVHSVgqOpBXsAdJksJ8EE=; b=svgWXCigkZM85iQVYTYpavfcYaImbeKKIMIbRIuHOu4nDFX2LEkwdeCYZP9ih9Z0IS fGe5yHrAXQe8gdkSzARuC3pl3glIW0TfYBrXAJGgflNPoYVvNuCYdZzBPTv9+Bz5uxf3 sYJsgVQewpBnqsyd9WOIUn8Wa5k5N833ec4n+Vq4gWzf6oedyr8+J1+MrWn75V7V+WMn pgZwAFOiw47ffO+KpLIiojbvBe0nVWrSnGr7oTVvT9dm9n1qy2DJkh2dS3cQT/PEbFQT 0LKqmAZf9x1lZ5aWDTgU0dGkYSjz2QidRV+LVTcnHsqd02zi5W53nhMp7vvTapLYfvhZ 18kw== X-Gm-Message-State: AOAM530S5tpetS3n68SDNbmPU5G/S3yydJujvPmQkHnxFJl2GRt5xiqz dxYJH2jq/B7nzPxwIZxPT9/oKN65oWSD2JR3fqOpLJfNXW+EF+8kDoF3Rre8t70BSCbt/UeuZTq 10mlHrwPyXF7rRbk= X-Received: by 2002:a5d:544f:: with SMTP id w15mr22055143wrv.208.1595419767825; Wed, 22 Jul 2020 05:09:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIutnvsjbzzgXH8Ge010I4iR38v+pBYGFL+CAZnc0/QOcy3S7NIu8S/zi8Zocj9s4aDkK8wg== X-Received: by 2002:a5d:544f:: with SMTP id w15mr22055116wrv.208.1595419767515; Wed, 22 Jul 2020 05:09:27 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 5/9] virtio-balloon: Replace free page hinting references to 'report' with 'hint' Message-ID: <20200722120853.9144-6-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 23:27:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alexander Duyck , qemu-stable@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Alexander Duyck Recently a feature named Free Page Reporting was added to the virtio balloon. In order to avoid any confusion we should drop the use of the word 'report' when referring to Free Page Hinting. So what this patch does is go through and replace all instances of 'report' with 'hint" when we are referring to free page hinting. Acked-by: David Hildenbrand Signed-off-by: Alexander Duyck Message-Id: <20200720175128.21935.93927.stgit@localhost.localdomain> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-balloon.h | 20 ++++---- hw/virtio/virtio-balloon.c | 76 +++++++++++++++--------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-= balloon.h index d49fef00ce..28fd2b3960 100644 --- a/include/hw/virtio/virtio-balloon.h +++ b/include/hw/virtio/virtio-balloon.h @@ -23,7 +23,7 @@ #define VIRTIO_BALLOON(obj) \ OBJECT_CHECK(VirtIOBalloon, (obj), TYPE_VIRTIO_BALLOON) =20 -#define VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_MIN 0x80000000 +#define VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN 0x80000000 =20 typedef struct virtio_balloon_stat VirtIOBalloonStat; =20 @@ -33,20 +33,20 @@ typedef struct virtio_balloon_stat_modern { uint64_t val; } VirtIOBalloonStatModern; =20 -enum virtio_balloon_free_page_report_status { - FREE_PAGE_REPORT_S_STOP =3D 0, - FREE_PAGE_REPORT_S_REQUESTED =3D 1, - FREE_PAGE_REPORT_S_START =3D 2, - FREE_PAGE_REPORT_S_DONE =3D 3, +enum virtio_balloon_free_page_hint_status { + FREE_PAGE_HINT_S_STOP =3D 0, + FREE_PAGE_HINT_S_REQUESTED =3D 1, + FREE_PAGE_HINT_S_START =3D 2, + FREE_PAGE_HINT_S_DONE =3D 3, }; =20 typedef struct VirtIOBalloon { VirtIODevice parent_obj; VirtQueue *ivq, *dvq, *svq, *free_page_vq, *reporting_vq; - uint32_t free_page_report_status; + uint32_t free_page_hint_status; uint32_t num_pages; uint32_t actual; - uint32_t free_page_report_cmd_id; + uint32_t free_page_hint_cmd_id; uint64_t stats[VIRTIO_BALLOON_S_NR]; VirtQueueElement *stats_vq_elem; size_t stats_vq_offset; @@ -55,7 +55,7 @@ typedef struct VirtIOBalloon { QEMUBH *free_page_bh; /* * Lock to synchronize threads to access the free page reporting relat= ed - * fields (e.g. free_page_report_status). + * fields (e.g. free_page_hint_status). */ QemuMutex free_page_lock; QemuCond free_page_cond; @@ -64,7 +64,7 @@ typedef struct VirtIOBalloon { * stopped. */ bool block_iothread; - NotifierWithReturn free_page_report_notify; + NotifierWithReturn free_page_hint_notify; int64_t stats_last_update; int64_t stats_poll_interval; uint32_t host_features; diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 6e2d129340..22cb5df717 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -526,22 +526,22 @@ static bool get_free_page_hints(VirtIOBalloon *dev) ret =3D false; goto out; } - if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_REQUEST= ED && - id =3D=3D dev->free_page_report_cmd_id) { - dev->free_page_report_status =3D FREE_PAGE_REPORT_S_START; + if (dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_REQUESTED && + id =3D=3D dev->free_page_hint_cmd_id) { + dev->free_page_hint_status =3D FREE_PAGE_HINT_S_START; } else { /* * Stop the optimization only when it has started. This * avoids a stale stop sign for the previous command. */ - if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_STA= RT) { - dev->free_page_report_status =3D FREE_PAGE_REPORT_S_STOP; + if (dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_START) { + dev->free_page_hint_status =3D FREE_PAGE_HINT_S_STOP; } } } =20 if (elem->in_num) { - if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_START) { + if (dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_START) { qemu_guest_free_page_hint(elem->in_sg[0].iov_base, elem->in_sg[0].iov_len); } @@ -567,11 +567,11 @@ static void virtio_ballloon_get_free_page_hints(void = *opaque) qemu_mutex_unlock(&dev->free_page_lock); virtio_notify(vdev, vq); /* - * Start to poll the vq once the reporting started. Otherwise, conti= nue + * Start to poll the vq once the hinting started. Otherwise, continue * only when there are entries on the vq, which need to be given bac= k. */ } while (continue_to_get_hints || - dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_START); + dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_START); virtio_queue_set_notification(vq, 1); } =20 @@ -594,14 +594,14 @@ static void virtio_balloon_free_page_start(VirtIOBall= oon *s) =20 qemu_mutex_lock(&s->free_page_lock); =20 - if (s->free_page_report_cmd_id =3D=3D UINT_MAX) { - s->free_page_report_cmd_id =3D - VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_MIN; + if (s->free_page_hint_cmd_id =3D=3D UINT_MAX) { + s->free_page_hint_cmd_id =3D + VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN; } else { - s->free_page_report_cmd_id++; + s->free_page_hint_cmd_id++; } =20 - s->free_page_report_status =3D FREE_PAGE_REPORT_S_REQUESTED; + s->free_page_hint_status =3D FREE_PAGE_HINT_S_REQUESTED; qemu_mutex_unlock(&s->free_page_lock); =20 virtio_notify_config(vdev); @@ -611,18 +611,18 @@ static void virtio_balloon_free_page_stop(VirtIOBallo= on *s) { VirtIODevice *vdev =3D VIRTIO_DEVICE(s); =20 - if (s->free_page_report_status !=3D FREE_PAGE_REPORT_S_STOP) { + if (s->free_page_hint_status !=3D FREE_PAGE_HINT_S_STOP) { /* * The lock also guarantees us that the * virtio_ballloon_get_free_page_hints exits after the - * free_page_report_status is set to S_STOP. + * free_page_hint_status is set to S_STOP. */ qemu_mutex_lock(&s->free_page_lock); /* - * The guest hasn't done the reporting, so host sends a notificati= on - * to the guest to actively stop the reporting. + * The guest isn't done hinting, so send a notification + * to the guest to actively stop the hinting. */ - s->free_page_report_status =3D FREE_PAGE_REPORT_S_STOP; + s->free_page_hint_status =3D FREE_PAGE_HINT_S_STOP; qemu_mutex_unlock(&s->free_page_lock); virtio_notify_config(vdev); } @@ -632,20 +632,20 @@ static void virtio_balloon_free_page_done(VirtIOBallo= on *s) { VirtIODevice *vdev =3D VIRTIO_DEVICE(s); =20 - if (s->free_page_report_status !=3D FREE_PAGE_REPORT_S_DONE) { + if (s->free_page_hint_status !=3D FREE_PAGE_HINT_S_DONE) { /* See virtio_balloon_free_page_stop() */ qemu_mutex_lock(&s->free_page_lock); - s->free_page_report_status =3D FREE_PAGE_REPORT_S_DONE; + s->free_page_hint_status =3D FREE_PAGE_HINT_S_DONE; qemu_mutex_unlock(&s->free_page_lock); virtio_notify_config(vdev); } } =20 static int -virtio_balloon_free_page_report_notify(NotifierWithReturn *n, void *data) +virtio_balloon_free_page_hint_notify(NotifierWithReturn *n, void *data) { VirtIOBalloon *dev =3D container_of(n, VirtIOBalloon, - free_page_report_notify); + free_page_hint_notify); VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); PrecopyNotifyData *pnd =3D data; =20 @@ -703,7 +703,7 @@ static size_t virtio_balloon_config_size(VirtIOBalloon = *s) if (virtio_has_feature(features, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { return offsetof(struct virtio_balloon_config, poison_val); } - return offsetof(struct virtio_balloon_config, free_page_report_cmd_id); + return offsetof(struct virtio_balloon_config, free_page_hint_cmd_id); } =20 static void virtio_balloon_get_config(VirtIODevice *vdev, uint8_t *config_= data) @@ -715,14 +715,14 @@ static void virtio_balloon_get_config(VirtIODevice *v= dev, uint8_t *config_data) config.actual =3D cpu_to_le32(dev->actual); config.poison_val =3D cpu_to_le32(dev->poison_val); =20 - if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_REQUESTED) { - config.free_page_report_cmd_id =3D - cpu_to_le32(dev->free_page_report_cmd_id); - } else if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_STOP= ) { - config.free_page_report_cmd_id =3D + if (dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_REQUESTED) { + config.free_page_hint_cmd_id =3D + cpu_to_le32(dev->free_page_hint_cmd_id); + } else if (dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_STOP) { + config.free_page_hint_cmd_id =3D cpu_to_le32(VIRTIO_BALLOON_CMD_ID_STOP); - } else if (dev->free_page_report_status =3D=3D FREE_PAGE_REPORT_S_DONE= ) { - config.free_page_report_cmd_id =3D + } else if (dev->free_page_hint_status =3D=3D FREE_PAGE_HINT_S_DONE) { + config.free_page_hint_cmd_id =3D cpu_to_le32(VIRTIO_BALLOON_CMD_ID_DONE); } =20 @@ -835,14 +835,14 @@ static int virtio_balloon_post_load_device(void *opaq= ue, int version_id) return 0; } =20 -static const VMStateDescription vmstate_virtio_balloon_free_page_report = =3D { +static const VMStateDescription vmstate_virtio_balloon_free_page_hint =3D { .name =3D "virtio-balloon-device/free-page-report", .version_id =3D 1, .minimum_version_id =3D 1, .needed =3D virtio_balloon_free_page_support, .fields =3D (VMStateField[]) { - VMSTATE_UINT32(free_page_report_cmd_id, VirtIOBalloon), - VMSTATE_UINT32(free_page_report_status, VirtIOBalloon), + VMSTATE_UINT32(free_page_hint_cmd_id, VirtIOBalloon), + VMSTATE_UINT32(free_page_hint_status, VirtIOBalloon), VMSTATE_END_OF_LIST() } }; @@ -869,7 +869,7 @@ static const VMStateDescription vmstate_virtio_balloon_= device =3D { VMSTATE_END_OF_LIST() }, .subsections =3D (const VMStateDescription * []) { - &vmstate_virtio_balloon_free_page_report, + &vmstate_virtio_balloon_free_page_hint, &vmstate_virtio_balloon_page_poison, NULL } @@ -908,7 +908,7 @@ static void virtio_balloon_device_realize(DeviceState *= dev, Error **errp) VIRTIO_BALLOON_F_FREE_PAGE_HINT)) { s->free_page_vq =3D virtio_add_queue(vdev, VIRTQUEUE_MAX_SIZE, virtio_balloon_handle_free_page= _vq); - precopy_add_notifier(&s->free_page_report_notify); + precopy_add_notifier(&s->free_page_hint_notify); =20 object_ref(OBJECT(s->iothread)); s->free_page_bh =3D aio_bh_new(iothread_get_aio_context(s->iothrea= d), @@ -932,7 +932,7 @@ static void virtio_balloon_device_unrealize(DeviceState= *dev) qemu_bh_delete(s->free_page_bh); object_unref(OBJECT(s->iothread)); virtio_balloon_free_page_stop(s); - precopy_remove_notifier(&s->free_page_report_notify); + precopy_remove_notifier(&s->free_page_hint_notify); } balloon_stats_destroy_timer(s); qemu_remove_balloon_handler(s); @@ -1004,8 +1004,8 @@ static void virtio_balloon_instance_init(Object *obj) =20 qemu_mutex_init(&s->free_page_lock); qemu_cond_init(&s->free_page_cond); - s->free_page_report_cmd_id =3D VIRTIO_BALLOON_FREE_PAGE_REPORT_CMD_ID_= MIN; - s->free_page_report_notify.notify =3D virtio_balloon_free_page_report_= notify; + s->free_page_hint_cmd_id =3D VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN; + s->free_page_hint_notify.notify =3D virtio_balloon_free_page_hint_noti= fy; =20 object_property_add(obj, "guest-stats", "guest statistics", balloon_stats_get_all, NULL, NULL, s); --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595420178; cv=none; d=zohomail.com; s=zohoarc; b=cnBllatUB5bAyAi+EB5bETtUSAO/B2HLfOlyzs3rnW5nBj/5sRLFRCB2/qk/bCvubR360YUrzzst/fBAwF/id/0m3lQ6tI7VZOTlK8NkWYVGhX+Ts2NXz7e5ICZzi8wfw+NL+Az+q9w3HpfsbQ6q5B+sUHdgI+ITMzz5UIQulLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595420178; 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=nCEOZP6B1lWOOd8FiK7LTx/qy5GESWgBrYMgTCL8coc=; b=IbTTnfUmXKInmsX8PDTt6c8mOtee3u7EwMepIX6JWQ8B+KVRCVHpoNaj5AsRzS/3u3j8mdlLAn6Nf19475w6RfOJPoJnZv6JSyTKj9T5icPX0Dlzikd0a3qpjTtbFYF4Ri5aFadawiz6xed5/7OKP81pyJX736KexyLhwU1xroQ= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595420178918960.8878722406602; Wed, 22 Jul 2020 05:16:18 -0700 (PDT) Received: from localhost ([::1]:45324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDfV-0007Ob-NH for importer@patchew.org; Wed, 22 Jul 2020 08:16:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDZ2-00065I-So for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32957 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDZ1-0006bu-C1 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:36 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-463-zKtS2YTBO3SBLALWwTxmsA-1; Wed, 22 Jul 2020 08:09:32 -0400 Received: by mail-wr1-f70.google.com with SMTP id a18so548264wrm.14 for ; Wed, 22 Jul 2020 05:09:32 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id f186sm6997734wmf.29.2020.07.22.05.09.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419774; 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=nCEOZP6B1lWOOd8FiK7LTx/qy5GESWgBrYMgTCL8coc=; b=PX3L34onG1uMprc00GRXCeSABPFLJ4nh/lfxZHp8jW5A5fK90kUD6saN1LMiz159Zr6Zl7 +9cSQdq+uGh0cLo/TtYF2R/c7OUiyDB79bV/gylbOpWRMi7Y/TNSeqcIckJXeKOLAaOptv mpMnQ4qNVS7smwtFywxfFiuKocN7ze0= X-MC-Unique: zKtS2YTBO3SBLALWwTxmsA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nCEOZP6B1lWOOd8FiK7LTx/qy5GESWgBrYMgTCL8coc=; b=q4a0jhJClUXACeKfHhXkA7w2eDZkcROBPck5ynkT7se6ISvLq3hIzYWASjBNXhDquK x4AVUr/qgRSrLW9fjZWWhUf66bSDgxUE5enG8ipFO30bh45q+AaF9KFS5uRch8PB2Uut FLjwC+/uuI9pvclYeaHo9bBoAPDSNeucVPlJMBo7xMpFKDkX0QS8Q5ZMTZZVYjW30yXI FN8i8NfG/lNGo05KnYIc98jpeSvTC859xRz4AmjcRKzeYPWFTgVnIF4Xb+bKUSYcN1CP 1/A6HGJq6Hf7zyOH2qUAaOe41tVp3yI9TDhJMyKwhWIIsetqgJ3pEYHAPrPI68JpZjDL 5wrg== X-Gm-Message-State: AOAM532yIE5EcPm2SCqWOTJWPCQOu/o8ktivlMnmstilRlhu6L2Jz8R7 PtL1Kyod+Z9M0kbQ0pQ40KUqo5FiOg/g7hwEk/kVS4naYtNx7OIuHD1PAtM7l2HFebN1s7nRkG1 56Yl2g5qYviX1/6c= X-Received: by 2002:adf:a351:: with SMTP id d17mr5346391wrb.111.1595419770797; Wed, 22 Jul 2020 05:09:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs2RXXrkj1wCwHt7f7ieiuuMd88rSEUw6c7z5Gixub12VESK+W10JpwmjC/Nt2e0Bc1Kwzeg== X-Received: by 2002:adf:a351:: with SMTP id d17mr5346378wrb.111.1595419770542; Wed, 22 Jul 2020 05:09:30 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 6/9] virtio: list legacy-capable devices Message-ID: <20200722120853.9144-7-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 00:40:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Halil Pasic , Peter Maydell , Cornelia Huck , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cornelia Huck Several types of virtio devices had already been around before the virtio standard was specified. These devices support virtio in legacy (and transitional) mode. Devices that have been added in the virtio standard are considered non-transitional (i.e. with no support for legacy virtio). Provide a helper function so virtio transports can figure that out easily. Signed-off-by: Cornelia Huck Message-Id: <20200707105446.677966-2-cohuck@redhat.com> Cc: qemu-stable@nongnu.org Acked-by: Halil Pasic Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio.h | 2 ++ hw/virtio/virtio.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b69d517496..198ffc7626 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -396,4 +396,6 @@ static inline bool virtio_device_disabled(VirtIODevice = *vdev) return unlikely(vdev->disabled || vdev->broken); } =20 +bool virtio_legacy_allowed(VirtIODevice *vdev); + #endif diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 5bd2a2f621..546a198e79 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -27,6 +27,7 @@ #include "hw/virtio/virtio-access.h" #include "sysemu/dma.h" #include "sysemu/runstate.h" +#include "standard-headers/linux/virtio_ids.h" =20 /* * The alignment to use between consumer and producer parts of vring. @@ -3279,6 +3280,30 @@ void virtio_init(VirtIODevice *vdev, const char *nam= e, vdev->use_guest_notifier_mask =3D true; } =20 +/* + * Only devices that have already been around prior to defining the virtio + * standard support legacy mode; this includes devices not specified in the + * standard. All newer devices conform to the virtio standard only. + */ +bool virtio_legacy_allowed(VirtIODevice *vdev) +{ + switch (vdev->device_id) { + case VIRTIO_ID_NET: + case VIRTIO_ID_BLOCK: + case VIRTIO_ID_CONSOLE: + case VIRTIO_ID_RNG: + case VIRTIO_ID_BALLOON: + case VIRTIO_ID_RPMSG: + case VIRTIO_ID_SCSI: + case VIRTIO_ID_9P: + case VIRTIO_ID_RPROC_SERIAL: + case VIRTIO_ID_CAIF: + return true; + default: + return false; + } +} + hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n) { return vdev->vq[n].vring.desc; --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595419935; cv=none; d=zohomail.com; s=zohoarc; b=hrfUTEDab6/4gimTLrsYPRgAJc/OFo8tlb/yE+lsyYpq0zspeB81p6nCqxDJQElzaVKoz6fbJZs6HfmNlWaoqV/4U//KxC1aXYBZNyT6JQS/tVAPbA7fAbs9rJdoqGO+2U6zjk7yr0AIXULyJtmVsMc1uzOcS/8+X5UNA/cMn90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595419935; 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=zJUEiAuh/w0ZZykpZGg+27nY/rwRTIsctuEMd8wdLQg=; b=Af8R11YDPtJqdwvQL5RyS/i2mbxkzmNEh7smTEuoCtQ0+785O/3I+QZzgUSPZamMt3AzufyXBjG2Iis4tv/SjqzkdeNtGohKb1r872pX30sW3efsiiNjIydfJyJoCLHokJ0BDKIMBjL1va+QrDCSocntrxkxouoa606Xc6FdyQ0= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595419935689509.6467736386362; Wed, 22 Jul 2020 05:12:15 -0700 (PDT) Received: from localhost ([::1]:58774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDba-00017M-Cu for importer@patchew.org; Wed, 22 Jul 2020 08:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDZ8-0006El-H7 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:26712 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDZ6-0006cD-3I for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:42 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-eHtGRuo_MWmZvR0KB1OS7Q-1; Wed, 22 Jul 2020 08:09:35 -0400 Received: by mail-wr1-f70.google.com with SMTP id a18so548328wrm.14 for ; Wed, 22 Jul 2020 05:09:35 -0700 (PDT) Received: from redhat.com (bzq-79-182-82-99.red.bezeqint.net. [79.182.82.99]) by smtp.gmail.com with ESMTPSA id o9sm41165104wrs.1.2020.07.22.05.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419779; 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=zJUEiAuh/w0ZZykpZGg+27nY/rwRTIsctuEMd8wdLQg=; b=ic/Kpffp8cchdWG9ZtHyK7Xo9FjaGZFuuIY19MCIsAqWZMnY3ay5gkE5S4aPng+UVagnXC VDKrwNYvN81T29YgKxzQ7VdoIja4q3ckuHRrBrhchR0PdEScDDli/LHIyfDio4+z2WwFAX U9kOI/GHcKrqPRaAMZzm1h9TVmkezZ0= X-MC-Unique: eHtGRuo_MWmZvR0KB1OS7Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zJUEiAuh/w0ZZykpZGg+27nY/rwRTIsctuEMd8wdLQg=; b=nFz/+zbAvvDex3VLOj129+MDCUXAI1ipjETiB7+nL5YYzOyyYSKooaV9Hz8A37vfrn OhKYWwxBuSjCxXHvEofKTM1FCvbhtiaq+1k1Isqlm2W+mlkQZDij42xvwVMDPrlph6GG NIjkzMqbSr9DLn4HceO/wh/wBRNKyEVu31Tvku7gnyPlZ6Rlb1f/jVsRSbMpQ9xw+0Ku S/TQCVSXUK86UIn5+Ir5R0e7M6ntaSVGsVawfLXvKymE79zBM0Chh9KUUUfu0pL1NDxZ 5yuSDfUXeb7s9KljqTkTjnnrFvSZh+PtQFjpMDtDFdPDOtPpb1i2BaDTKFBxa6wk4dOF jauw== X-Gm-Message-State: AOAM532VGFA+jRAaYFp9mP+DpjKpuIAcdVWxHNPYA14Xe1aNnLzuOhIP t46hat50nT/7kXIuXIWuCnJ321mO+LG4zSsfcYeBk1SKPcD/R11t0DwoDEi1e0cTF+AZvnQD6ai me93n/BBOAqyTFpM= X-Received: by 2002:adf:de07:: with SMTP id b7mr33042586wrm.302.1595419773970; Wed, 22 Jul 2020 05:09:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwChp1o5boBbHmbfF2ipGhhGhnTkDBfTg1D8qRCAGKUDHbPGSqs+g7m/OgYBJfGe1IiAQSiBQ== X-Received: by 2002:adf:de07:: with SMTP id b7mr33042570wrm.302.1595419773809; Wed, 22 Jul 2020 05:09:33 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 7/9] virtio: verify that legacy support is not accidentally on Message-ID: <20200722120853.9144-8-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/22 00:40:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , David Hildenbrand , Cornelia Huck , qemu-stable@nongnu.org, Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Cornelia Huck If a virtio device does not have legacy support, make sure that it is actually off, and bail out if not. For virtio-pci, this means that any device without legacy support that has been specified to modern-only (or that has been forced to it) will work. For virtio-ccw, this duplicates the check that is currently done prior to realization for any device that explicitly specified no support for legacy. This catches devices that have not been fenced properly. Signed-off-by: Cornelia Huck Message-Id: <20200707105446.677966-3-cohuck@redhat.com> Cc: qemu-stable@nongnu.org Acked-by: Halil Pasic Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/s390x/virtio-ccw.c | 6 ++++++ hw/virtio/virtio-pci.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 3c988a000b..0e60270297 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -1121,6 +1121,12 @@ static void virtio_ccw_device_plugged(DeviceState *d= , Error **errp) dev->max_rev =3D 0; } =20 + if (!virtio_ccw_rev_max(dev) && !virtio_legacy_allowed(vdev)) { + error_setg(errp, "Invalid value of property max_rev " + "(is %d expected >=3D 1)", virtio_ccw_rev_max(dev)); + return; + } + if (virtio_get_num_queues(vdev) > VIRTIO_QUEUE_MAX) { error_setg(errp, "The number of virtqueues %d " "exceeds virtio limit %d", n, diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 8554cf2a03..db8b711b35 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1581,6 +1581,10 @@ static void virtio_pci_device_plugged(DeviceState *d= , Error **errp) } =20 if (legacy) { + if (!virtio_legacy_allowed(vdev)) { + error_setg(errp, "device is modern-only, use disable-legacy=3D= on"); + return; + } if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) { error_setg(errp, "VIRTIO_F_IOMMU_PLATFORM was supported by" " neither legacy nor transitional device"); --=20 MST From nobody Sat Nov 15 14:07:28 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1595420047; cv=none; d=zohomail.com; s=zohoarc; b=Hvlh4uXqFFiyGCrRyzMCYlSfZu0ttJPTqQRvrboXhqUUnargCDu86XIf+RVpI0mPM2bPUP+E6JPdmZ1woQ054KySnqnWCC7PVz6g19tKzszzu8hXrLILC9/m17I0OALce1BBPgSqhaUdJ1/ayMegqwy4NEBEzw/jc9+dXY5E57w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595420047; 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=wDvsvCaBwdrJqf7RMuYB7bfyjGAb+lmSiWDQNBJSIR8=; b=LUwBD8QyzdNFtCKGJHtYQGBLBHMuxluJrUN+SDz3y2FynB7nYucQPRkDaJIN/m3WOUc+kxWYYbpYpKASJIBLHjT0dbK1PLKBsVpXUQ/ZAINImRv1nQhlG/DBIicdu0moaQA9SVX1R3SgRow8iA2WN85zE/RZ4M2yp8dq4x8M1l4= ARC-Authentication-Results: i=1; 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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595420047970151.27650366002763; Wed, 22 Jul 2020 05:14:07 -0700 (PDT) Received: from localhost ([::1]:38576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDdO-0004Ta-P1 for importer@patchew.org; Wed, 22 Jul 2020 08:14:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45082) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDZB-0006MH-A1 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:45 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59258 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDZ9-0006ce-Ry for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:45 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-Y8-vRl4jPlmDiAoEUVskbQ-1; Wed, 22 Jul 2020 08:09:39 -0400 Received: by mail-wm1-f71.google.com with SMTP id h205so1036631wmf.0 for ; Wed, 22 Jul 2020 05:09:39 -0700 (PDT) Received: from redhat.com (bzq-79-182-82-99.red.bezeqint.net. [79.182.82.99]) by smtp.gmail.com with ESMTPSA id g70sm3536676wmg.24.2020.07.22.05.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419783; 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=wDvsvCaBwdrJqf7RMuYB7bfyjGAb+lmSiWDQNBJSIR8=; b=PXs8/TB4DYsUoKV3rSPQEjWdTgx9JsyOhrl5whKfp4ffN/EOKdIEkZBu73kFxALXyeovsn oBCWS6NrndHySC1kc936AJ7zqf+L3be9NjXuxvsf7J00cvWHoAHsSnxNBeVvAOxCnQ+6Sa MZhLZR9JtIjyH6Jgn7qpbIYHjGv6pg4= X-MC-Unique: Y8-vRl4jPlmDiAoEUVskbQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wDvsvCaBwdrJqf7RMuYB7bfyjGAb+lmSiWDQNBJSIR8=; b=YpAimnGkC39cF3hRBERpWMLuwvVWfd/fre0obuCeSaF3GHJPmFp1Gx9w9CjH/9YZx9 aig3w7i/3c6MOoeede7CupMDP7ShTFqwKcopzIJmcTEc5vml6tAa+viD7Qsx4F63Rksf nn8l/BVUWHGhGkCcPSccIgdgaVI77lKoLD/MIKzOElGAxYO8eCRNR8Qq7byy/I6ZrEuM 17sRwEp8OWE+fOfZTXUmJDlahY7EgopboN5Wxfzyb3LN/pf/f1pOSHEa4VhaNkv5zPAR 6SjOlp/kzxQFPpwz9cuQ15GuQeS2HXnQhDVMhLOth2/f7mLIP4xzGmHOIUe9+hHCOD+B y7CQ== X-Gm-Message-State: AOAM533UVn3UJBEx8LKp3f8g9HDLrWx2t48JCKxyl4v9TpoNlqdUMx7o iOv0tC3+FTrLIJ2FNGIovoZBIeFvjZKjyDDuQIeHD5q+3lIMQICBE4SgY9Qj3fS66GTEnFAUXFM hWz2F/IvXzzZnzJg= X-Received: by 2002:a1c:2e57:: with SMTP id u84mr8982783wmu.52.1595419777539; Wed, 22 Jul 2020 05:09:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfjiv2qzEtvxdvbc0PJy56jVOUotyFmi5wj1bub3BrnKfvHXPoPxA93ToknS61/3IqpcGsvg== X-Received: by 2002:a1c:2e57:: with SMTP id u84mr8982765wmu.52.1595419777272; Wed, 22 Jul 2020 05:09:37 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 8/9] intel_iommu: Use correct shift for 256 bits qi descriptor Message-ID: <20200722120853.9144-9-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-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=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 23:27:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Liu Yi L , Eduardo Habkost , Jason Wang , qemu-stable@nongnu.org, Peter Xu , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Liu Yi L In chapter 10.4.23 of VT-d spec 3.0, Descriptor Width bit was introduced in VTD_IQA_REG. Software could set this bit to tell VT-d the QI descriptor from software would be 256 bits. Accordingly, the VTD_IQH_QH_SHIFT should be 5 when descriptor size is 256 bits. This patch adds the DW bit check when deciding the shift used to update VTD_IQH_REG. Signed-off-by: Liu Yi L Message-Id: <1593850035-35483-1-git-send-email-yi.l.liu@intel.com> Reviewed-by: Peter Xu Acked-by: Jason Wang Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 3 ++- hw/i386/intel_iommu.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 862033ebe6..3d5487fe2c 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -230,7 +230,8 @@ #define VTD_IQA_DW_MASK 0x800 =20 /* IQH_REG */ -#define VTD_IQH_QH_SHIFT 4 +#define VTD_IQH_QH_SHIFT_4 4 +#define VTD_IQH_QH_SHIFT_5 5 #define VTD_IQH_QH_MASK 0x7fff0ULL =20 /* ICS_REG */ diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index c56398e991..0c286635cf 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2549,6 +2549,11 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) /* Try to fetch and process more Invalidation Descriptors */ static void vtd_fetch_inv_desc(IntelIOMMUState *s) { + int qi_shift; + + /* Refer to 10.4.23 of VT-d spec 3.0 */ + qi_shift =3D s->iq_dw ? VTD_IQH_QH_SHIFT_5 : VTD_IQH_QH_SHIFT_4; + trace_vtd_inv_qi_fetch(); =20 if (s->iq_tail >=3D s->iq_size) { @@ -2567,7 +2572,7 @@ static void vtd_fetch_inv_desc(IntelIOMMUState *s) } /* Must update the IQH_REG in time */ vtd_set_quad_raw(s, DMAR_IQH_REG, - (((uint64_t)(s->iq_head)) << VTD_IQH_QH_SHIFT) & + (((uint64_t)(s->iq_head)) << qi_shift) & VTD_IQH_QH_MASK); } } --=20 MST From nobody Sat Nov 15 14:07:28 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1595420159; cv=none; d=zohomail.com; s=zohoarc; b=LUSzeAS7PneaVYBUwm5CNToRLWJIvOTCRw6m4Jv4aPXGkapBdJLPWym11ofHJT7kMTNVbj763WaQ+m9KAtJYqbyZltpDABAdNpamuNYbXvfQk1dDQFLx/PIUVs3uUT2Q4LxTIGY4URmfP6uP6olKKJq1rKAdoho0qSFFBM8F1fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595420159; 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=sKanYFWXSB03AjZNgkORhhOD5JvmJAPTustMtaCVuJo=; b=DJi8uRLtHGLBlSum2sUyF3BwgCpZxq0zwC+OEalj2AJ8S2ZXycxSj/pF015/di5t5aGC0IbScJ/vRFREUszwT71M9/DMgdMFOlrxrQS+fzvO3XTVzWATMxggwhlKa8fYYGl6q3TjTl93UjVqjxO8ZMGv/DW+3HBrcItsY6nU8sM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1595420159010441.5976178153071; Wed, 22 Jul 2020 05:15:59 -0700 (PDT) Received: from localhost ([::1]:44058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyDfB-0006si-Mn for importer@patchew.org; Wed, 22 Jul 2020 08:15:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyDZE-0006VQ-KQ for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:48 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46273 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jyDZC-0006d4-V4 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 08:09:48 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-cT7gs42IPS6W-CDqViQdCA-1; Wed, 22 Jul 2020 08:09:42 -0400 Received: by mail-wr1-f70.google.com with SMTP id f7so548266wrs.8 for ; Wed, 22 Jul 2020 05:09:42 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id b63sm1358879wme.41.2020.07.22.05.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2020 05:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595419786; 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=sKanYFWXSB03AjZNgkORhhOD5JvmJAPTustMtaCVuJo=; b=T5pYSbLKU4xjC+2Ejh8syLH9WBWn+KXS6WYaYZ5VeBKjxaJ6mm+rLJRH4iORL2r0R1YxSq PYC/La9N6HpPqLMqlLqYpOtuVJcrp69JSpISwPNtiLCHbetlPHu5/KzWDrYn0BKqRabWwN g38pMjh6MrgcdkmYtprc+81XZv0Cgdc= X-MC-Unique: cT7gs42IPS6W-CDqViQdCA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=sKanYFWXSB03AjZNgkORhhOD5JvmJAPTustMtaCVuJo=; b=KYMSYo1TE+eP5b2r6V6Z9ZJl06jBMEHCR/55F2bLYrfu6RLtnJfpo2dsvMY9+aT7a9 Voko6PI0ZT16gdVRyyVd12LHk+fJVt107a1CRQFvBnmQ9kOfrF86u8j4SDNhhtWqnhZV rUIZ3SHWcQIDIV2cqhfyOYyNNwgE5s48//IpluIoV0khCzplUPcrl4p+0ONfuNdosOmT gR6TtPRZG8Ye2EP2Fcm9HNYY31UYxitXwDcN8ySNe73bZggu9A7CWMMxMpl+FMmkk9U4 Y3k3zJLG0QCm5/Upa5BbRkKbuD6CPeCaziB6UN/tPPd6d9nWII90JWA/J6ozrMIyCdiP qpDw== X-Gm-Message-State: AOAM5318IbcpuYwhE1bKhNZnGy95B0nA5hCgAbObep8I3dJwFJp8P069 RA6w8nnkyeALjyYcS2ufWF05ndNnJcrHQ5M+Z1dSk9t61G9un3BIoihIrRpzKSJpmYTrLB1l+tM x5+DpZpfeg/U2N+g= X-Received: by 2002:a1c:7f0e:: with SMTP id a14mr8776526wmd.21.1595419781079; Wed, 22 Jul 2020 05:09:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4PSOT4BA7QdGrYIwxe7HLjyaQ4K04fm+ljxiTNnhO1qdLUypgNf4YotQtZwdbIcm5FlrpJg== X-Received: by 2002:a1c:7f0e:: with SMTP id a14mr8776509wmd.21.1595419780842; Wed, 22 Jul 2020 05:09:40 -0700 (PDT) Date: Wed, 22 Jul 2020 08:09:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 9/9] virtio-pci: Changed vdev to proxy for VirtIO PCI BAR callbacks. Message-ID: <20200722120853.9144-10-mst@redhat.com> References: <20200722120853.9144-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200722120853.9144-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent 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=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/21 21:28:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Melnychenko , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Andrew Melnychenko There is an issue when callback may be called with invalid vdev. It happens on unplug when vdev already deleted and VirtIOPciProxy is not. So now, callbacks accept proxy device, and vdev retrieved from it. Technically memio callbacks should be removed during the flatview update, but memoryregions remain til PCI device(and it's address space) completely = deleted. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1716352 Signed-off-by: Andrew Melnychenko Message-Id: <20200706112123.971087-1-andrew@daynix.com> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index db8b711b35..ada1101d07 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1333,11 +1333,12 @@ static uint64_t virtio_pci_notify_read(void *opaque= , hwaddr addr, static void virtio_pci_notify_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - VirtIODevice *vdev =3D opaque; - VirtIOPCIProxy *proxy =3D VIRTIO_PCI(DEVICE(vdev)->parent_bus->parent); + VirtIOPCIProxy *proxy =3D opaque; + VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); + unsigned queue =3D addr / virtio_pci_queue_mem_mult(proxy); =20 - if (queue < VIRTIO_QUEUE_MAX) { + if (vdev !=3D NULL && queue < VIRTIO_QUEUE_MAX) { virtio_queue_notify(vdev, queue); } } @@ -1345,10 +1346,12 @@ static void virtio_pci_notify_write(void *opaque, h= waddr addr, static void virtio_pci_notify_write_pio(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - VirtIODevice *vdev =3D opaque; + VirtIOPCIProxy *proxy =3D opaque; + VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); + unsigned queue =3D val; =20 - if (queue < VIRTIO_QUEUE_MAX) { + if (vdev !=3D NULL && queue < VIRTIO_QUEUE_MAX) { virtio_queue_notify(vdev, queue); } } @@ -1372,9 +1375,14 @@ static void virtio_pci_isr_write(void *opaque, hwadd= r addr, static uint64_t virtio_pci_device_read(void *opaque, hwaddr addr, unsigned size) { - VirtIODevice *vdev =3D opaque; + VirtIOPCIProxy *proxy =3D opaque; + VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); uint64_t val =3D 0; =20 + if (vdev =3D=3D NULL) { + return val; + } + switch (size) { case 1: val =3D virtio_config_modern_readb(vdev, addr); @@ -1392,7 +1400,13 @@ static uint64_t virtio_pci_device_read(void *opaque,= hwaddr addr, static void virtio_pci_device_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { - VirtIODevice *vdev =3D opaque; + VirtIOPCIProxy *proxy =3D opaque; + VirtIODevice *vdev =3D virtio_bus_get_device(&proxy->bus); + + if (vdev =3D=3D NULL) { + return; + } + switch (size) { case 1: virtio_config_modern_writeb(vdev, addr, val); @@ -1469,19 +1483,19 @@ static void virtio_pci_modern_regions_init(VirtIOPC= IProxy *proxy) =20 memory_region_init_io(&proxy->device.mr, OBJECT(proxy), &device_ops, - virtio_bus_get_device(&proxy->bus), + proxy, "virtio-pci-device", proxy->device.size); =20 memory_region_init_io(&proxy->notify.mr, OBJECT(proxy), ¬ify_ops, - virtio_bus_get_device(&proxy->bus), + proxy, "virtio-pci-notify", proxy->notify.size); =20 memory_region_init_io(&proxy->notify_pio.mr, OBJECT(proxy), ¬ify_pio_ops, - virtio_bus_get_device(&proxy->bus), + proxy, "virtio-pci-notify-pio", proxy->notify_pio.size); } --=20 MST