From nobody Tue Feb 10 01:34:58 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655369328; cv=none; d=zohomail.com; s=zohoarc; b=eyJdUWKaFOouW1F0xdtqVfpMpC+Qgz3j3eL20tw8vOCoL5Q+qKYXxS6b/Qp7GLvtfy9GYv9XYi2V/NmlsGL1Kxdx9rG4rU7/PfbHNAcm7lx7r75I8uSUQ2Tx90vD3C8zM74YRMOMfCTNBhLCy29SEQ9JJV8oGBABk+0uI4GZgmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655369328; h=Content-Type:Content-Transfer-Encoding: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=UhU5hIpnBhngBCDdQdspoAO2R7ca5GkL0HNZN9gkK3Q=; b=hcS3EBPdh9vG7hWpNq0ARFsoydIgTwHgZIK9hsvplGrI89nxgC4bcyDPsQWCUlOhRVfX0hUQ4RdAtTvPMrEyCymS0e4ZhdxGrGGwgMAcnBkqCFuRPKZFeNqhVmaPSKfz1ZiFJW0zyc6T6mo7nfsiqce1Hy0M73ZYdPIWJNFy0+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655369328823887.6609281694349; Thu, 16 Jun 2022 01:48:48 -0700 (PDT) Received: from localhost ([::1]:47380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1lBH-0002c3-Kb for importer@patchew.org; Thu, 16 Jun 2022 04:48:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1kvo-0001q7-FZ for qemu-devel@nongnu.org; Thu, 16 Jun 2022 04:32:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1kvm-0002tm-EA for qemu-devel@nongnu.org; Thu, 16 Jun 2022 04:32:47 -0400 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-102-kfnJdMFGPSq1HzdBzMMtDw-1; Thu, 16 Jun 2022 04:32:44 -0400 Received: by mail-ed1-f70.google.com with SMTP id a4-20020a056402168400b0042dc5b94da6so767130edv.10 for ; Thu, 16 Jun 2022 01:32:44 -0700 (PDT) Received: from goa-sendmail ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id y3-20020a056402358300b0042dc25fdf5bsm1331136edc.29.2022.06.16.01.32.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 01:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655368365; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UhU5hIpnBhngBCDdQdspoAO2R7ca5GkL0HNZN9gkK3Q=; b=aESSVmxPFU6sOWN8ZMBYzvFoRBCrOzP3npay+aDU5GclUjfmWt9THdq70mIVjT+BwMprBT Euy7kYEV9FZ9j7RFXibyrcKqtynpPMkcvf4jNxfUt9e3Hx9+GKglrQ1Vm7c/Gzkc7c8wHu 5tl9mzrFE8Cv8HKwMYIIynYCarIlr9Y= X-MC-Unique: kfnJdMFGPSq1HzdBzMMtDw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UhU5hIpnBhngBCDdQdspoAO2R7ca5GkL0HNZN9gkK3Q=; b=G6wAKqWz2JIn+tlh9j1vT4gggSUDyT9PN7jn/kT1qEkwE3igI+ZoTgVjvpfhuOKp9n OKz6f3mKEVhjKeG5L7yVkvVtpAS1vzoXyfX9ueQlziiC8fDpl+kq313hPccvy00jpe3/ lSsf/C+ksjX1tAO3bsUNY0HXC4Szywrx2A8ozVSdz0XlsZo23US9AGMYex3yUpThsFZz mVwj49X376JR7vvAD5xK+YrcjALih9FO5x8TFitQX1ZVLkxeQhIg6ZityxZ2J40FzC1/ RaHWAVen7+Hze1WEbsdXGQuxksACFAwz7lPFC4IWRQmr9Px5PtN5tXnbS40FzlETJkp+ hudA== X-Gm-Message-State: AJIora8FkzbhbLfFD7PoBFgIXkbM+1FNYiEJSFXkauHpZLyXml5B2YjW KKh/3uoNVpoSLaj1yoxuxtiaBiWRktCcm2nWLnfccEwkDaFWc5X5TbRwAOJCL+Wkfll5fvr9CYE LHOMa139c6CWhJyuAsFdz75ndSiwYnyY6DvaVbHzygrsIxROGEa0N2ttER4dpxxbo4Ng= X-Received: by 2002:a05:6402:24a4:b0:434:e43e:2462 with SMTP id q36-20020a05640224a400b00434e43e2462mr4957199eda.312.1655368362983; Thu, 16 Jun 2022 01:32:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uyvpTfJA3nq7ylZ8SlcJpBxFrFoOdoKeNzn39/4fOxYAH6/YoM07I6uxGqj1CX//ztQkeAgg== X-Received: by 2002:a05:6402:24a4:b0:434:e43e:2462 with SMTP id q36-20020a05640224a400b00434e43e2462mr4957176eda.312.1655368362641; Thu, 16 Jun 2022 01:32:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/21] virtio-mmio: cleanup reset Date: Thu, 16 Jun 2022 10:32:02 +0200 Message-Id: <20220616083209.117397-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220616083209.117397-1-pbonzini@redhat.com> References: <20220616083209.117397-1-pbonzini@redhat.com> MIME-Version: 1.0 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=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655369331052100001 Content-Type: text/plain; charset="utf-8" Make virtio_mmio_soft_reset reset the virtio device, which is performed by both the "soft" and the "hard" reset; and then call virtio_mmio_soft_reset from virtio_mmio_reset to emphasize that the latter is a superset of the former. Signed-off-by: Paolo Bonzini --- hw/virtio/virtio-mmio.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 6d81a26473..d240efef97 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -72,12 +72,12 @@ static void virtio_mmio_soft_reset(VirtIOMMIOProxy *pro= xy) { int i; =20 - if (proxy->legacy) { - return; - } + virtio_bus_reset(&proxy->bus); =20 - for (i =3D 0; i < VIRTIO_QUEUE_MAX; i++) { - proxy->vqs[i].enabled =3D 0; + if (!proxy->legacy) { + for (i =3D 0; i < VIRTIO_QUEUE_MAX; i++) { + proxy->vqs[i].enabled =3D 0; + } } } =20 @@ -376,7 +376,7 @@ static void virtio_mmio_write(void *opaque, hwaddr offs= et, uint64_t value, return; } if (value =3D=3D 0) { - virtio_bus_reset(&vdev->bus); + virtio_mmio_soft_reset(proxy); } else { virtio_queue_set_addr(vdev, vdev->queue_sel, value << proxy->guest_page_shift); @@ -432,7 +432,6 @@ static void virtio_mmio_write(void *opaque, hwaddr offs= et, uint64_t value, } =20 if (vdev->status =3D=3D 0) { - virtio_reset(vdev); virtio_mmio_soft_reset(proxy); } break; @@ -627,7 +626,8 @@ static void virtio_mmio_reset(DeviceState *d) VirtIOMMIOProxy *proxy =3D VIRTIO_MMIO(d); int i; =20 - virtio_bus_reset(&proxy->bus); + virtio_mmio_soft_reset(proxy); + proxy->host_features_sel =3D 0; proxy->guest_features_sel =3D 0; proxy->guest_page_shift =3D 0; @@ -636,7 +636,6 @@ static void virtio_mmio_reset(DeviceState *d) proxy->guest_features[0] =3D proxy->guest_features[1] =3D 0; =20 for (i =3D 0; i < VIRTIO_QUEUE_MAX; i++) { - proxy->vqs[i].enabled =3D 0; proxy->vqs[i].num =3D 0; proxy->vqs[i].desc[0] =3D proxy->vqs[i].desc[1] =3D 0; proxy->vqs[i].avail[0] =3D proxy->vqs[i].avail[1] =3D 0; --=20 2.36.1