Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4903507rwl; Mon, 10 Apr 2023 19:46:24 -0700 (PDT) X-Google-Smtp-Source: AKy350ars4nuTr3xyH6YSb8KN+kIBSU1okgG5osE0aGjnHaQ9or06eCRWl0z0DJK8pEsuIIl0MNi X-Received: by 2002:a17:906:1057:b0:94a:921b:c805 with SMTP id j23-20020a170906105700b0094a921bc805mr5186584ejj.45.1681181184460; Mon, 10 Apr 2023 19:46:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681181184; cv=none; d=google.com; s=arc-20160816; b=ATgVYMp/ESnWxyMmEFQoUnYyrQ0a/me7xBD3YOlaCBajxJQK1//iP6PWRSuU44EKhC FvbldcLbb5qui59JwDdYvrEFD1pkwwctRQUPVjdt3HKd6q3PIxW/luPMXlh3IxPCTctu a78vX0D7U9Ex8IfSrZOBHLfWYQ0nRR1Dhxh7c3iA6crARFjKGJNRbUJpcnVQ/dOV+IRn eCyHS1dM0rUISnZB9t8d7ARLpFUq2GcDM/CunCxB5xYm/rge9HB2DHKB43PkMFiZiPkh GjuFQBfNVuZLyNWYStZYYVn0y8ZNgZmIBoao+ty6tGU2Am+KaWVBfttKMmCrzD/ZUrS9 Av+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:cc:to:from:date:subject :message-id; bh=Znh1k15iY3usb9dViJ/rgBZ0dZZjjOxS1FsedVdxOEA=; b=Sh2Hd659Lhf7nKAxR9pJ/QWJ525t/1zlik0bt1dhGr+T4xFiOn1gg5iPuONeWkxgis yK0JxFUbk2ph4U6oUMIx1q34OR7kA3jPjAsr7sMkDIPy6Un+gBMkp2Rly5qfvnhzAYdr Laat44CfUv9nRgjt+l407ECbg5bsMMdW5IRAGt9SpZaXMmggbasvZ/D7Q8ZwnkFJ0Yov gxAQXvdlKLtXDFrCfBD06bC9lyCvw3Vz/ByR8e76zpLW2hy2vSLHxj3lY0sZca7ldpps buZd8VIVeS6oBjqLLbFpslVKUyeRXq12jQzqDXMAEB3JW9BROQNi2TZ96ifXYXzhjBL+ ZUlQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id tb22-20020a1709078b9600b0094a9c08aa24si2565854ejc.916.2023.04.10.19.45.58; Mon, 10 Apr 2023 19:46:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229721AbjDKCmK (ORCPT + 99 others); Mon, 10 Apr 2023 22:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229507AbjDKCmJ (ORCPT ); Mon, 10 Apr 2023 22:42:09 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A338226AE for ; Mon, 10 Apr 2023 19:42:07 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R911e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0Vfq6ma2_1681180924; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0Vfq6ma2_1681180924) by smtp.aliyun-inc.com; Tue, 11 Apr 2023 10:42:05 +0800 Message-ID: <1681180912.9817035-2-xuanzhuo@linux.alibaba.com> Subject: Re: [PATCH] virtio_pci: Wait for legacy device to be reset Date: Tue, 11 Apr 2023 10:41:52 +0800 From: Xuan Zhuo To: Angus Chen Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Angus Chen , mst@redhat.com, jasowang@redhat.com References: <20230411013833.1305-1-angus.chen@jaguarmicro.com> In-Reply-To: <20230411013833.1305-1-angus.chen@jaguarmicro.com> X-Spam-Status: No, score=-8.0 required=5.0 tests=ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Apr 2023 09:38:32 +0800, Angus Chen wrote: > We read the status of device after reset, > It is not guaranteed that the device be reseted successfully. > We can use a while loop to make sure that,like the modern device did. > The spec is not request it ,but it work. > > Signed-off-by: Angus Chen LGTM Reviewed-by: Xuan Zhuo > --- > drivers/virtio/virtio_pci_legacy.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c > index 2257f1b3d8ae..f2d241563e4f 100644 > --- a/drivers/virtio/virtio_pci_legacy.c > +++ b/drivers/virtio/virtio_pci_legacy.c > @@ -14,6 +14,7 @@ > * Michael S. Tsirkin > */ > > +#include > #include "linux/virtio_pci_legacy.h" > #include "virtio_pci_common.h" > > @@ -97,7 +98,8 @@ static void vp_reset(struct virtio_device *vdev) > vp_legacy_set_status(&vp_dev->ldev, 0); > /* Flush out the status write, and flush in device writes, > * including MSi-X interrupts, if any. */ > - vp_legacy_get_status(&vp_dev->ldev); > + while (vp_legacy_get_status(&vp_dev->ldev)) > + msleep(1); > /* Flush pending VQ/configuration callbacks. */ > vp_synchronize_vectors(vdev); > } > -- > 2.25.1 >