Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4665542iob; Sun, 8 May 2022 21:10:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvvtDJ/2WiovM85x7fQf+nYI1hsuJTY3SgIEYoVhKKmsSFPhMieMMRIjhGG55nBDm/POMS X-Received: by 2002:a05:6a00:1784:b0:50d:d8cb:7a4f with SMTP id s4-20020a056a00178400b0050dd8cb7a4fmr14114044pfg.23.1652069441601; Sun, 08 May 2022 21:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652069441; cv=none; d=google.com; s=arc-20160816; b=mkCmocnB++ohjJ19HWbhUUfSSDTNSn4C8cWr53FM/n6XNSVdrV5w0JZC4Lv5cMBdcp foK+BACzwqF1IMlMIhoRUJ8vqNHYzFK7GBM6obK8LESXqyLaLQETaeWgezXuM6kWlFJx ZlWDKJRGTRl43/gZJZTZTxbj9xKT20XA4uvL1xnVd8khghxVimP9BU86/CfkmEMXMvac GIlv8H8wCUFz/Pj92Om8OdbtFtNvKOY7TW+n42HSnBrouqzsDAyME8nqN5BQ3SuLcBJA 0jgAXlowG/jpjVHGh64rTKhq65v3vSmiQ5L7NelErAtkF9Yhqjgn0J6dyjRs6PTkGL5h a+MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fz/K5MVrwYQcCpHC+g2ETqDjMuMbroKDJr5qSpPTTD4=; b=jyEA7i7JQ9sMN0HpYQm0pmfRLdjhxfIZYqQzkP766N9/HU7Zac8/+PLYpqnb8u9GJS WcJ9epj0NMkvmhOvNC+Th78NuXvDAYJGMTGkouARJpGajH/5nC7w6Lm/dY3hLXgmO/u0 3qHihMzH6dPMfaA6kVLNBKnuEoZR9W0PNbuAXV+bh7TeET17LxH2S9vzE9k88CsruKiT zUF7SHtxjXQEO3iIZ/mmDm9EkH6HA+dagU2ePbiRBJ3lYDGlB7S8Cw7cLqkAQdo7dM97 ooAWJRhLCzrxYiP6lD9wVhLlziIAg1ajyKoQEOWXiqcBuvRSEHInIUxilXDBqgf/ouVh 3oCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S3Z3yJob; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ob9-20020a17090b390900b001dc681e0252si15958896pjb.5.2022.05.08.21.10.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:10:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S3Z3yJob; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5CD0B10DD31; Sun, 8 May 2022 21:09:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445775AbiEGHYH (ORCPT + 99 others); Sat, 7 May 2022 03:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358496AbiEGHYA (ORCPT ); Sat, 7 May 2022 03:24:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5A1435711D for ; Sat, 7 May 2022 00:20:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651908014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fz/K5MVrwYQcCpHC+g2ETqDjMuMbroKDJr5qSpPTTD4=; b=S3Z3yJob7CMU/16SHqRVdWn/wjkSHZBuTbLGle0wNR5rx6Wz2Ut5ZZDXIuAtsEckQi16i3 hOAQFXsqVFBBG1d6mtDlu4ShihJsEpu0VZPh919n6iYYRsalZmu4YwtNUgHeibgckZDyWL QOYwIBpiU41eTLuTdsKDURFaIMKHxMg= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-396--ljZt3rsNTWRrWqLfVcW0Q-1; Sat, 07 May 2022 03:20:11 -0400 X-MC-Unique: -ljZt3rsNTWRrWqLfVcW0Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B255A8002B2; Sat, 7 May 2022 07:20:10 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-216.pek2.redhat.com [10.72.13.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A3FD40D2971; Sat, 7 May 2022 07:20:04 +0000 (UTC) From: Jason Wang To: jasowang@redhat.com, mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, peterz@infradead.org, paulmck@kernel.org, maz@kernel.org, pasic@linux.ibm.com, cohuck@redhat.com, eperezma@redhat.com, lulu@redhat.com, sgarzare@redhat.com, xuanzhuo@linux.alibaba.com Subject: [PATCH V4 1/9] virtio: use virtio_device_ready() in virtio_device_restore() Date: Sat, 7 May 2022 15:19:46 +0800 Message-Id: <20220507071954.14455-2-jasowang@redhat.com> In-Reply-To: <20220507071954.14455-1-jasowang@redhat.com> References: <20220507071954.14455-1-jasowang@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Stefano Garzarella It will allow us to do extension on virtio_device_ready() without duplicating code. Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: "Paul E. McKenney" Cc: Marc Zyngier Cc: Halil Pasic Cc: Cornelia Huck Signed-off-by: Stefano Garzarella Signed-off-by: Jason Wang --- drivers/virtio/virtio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 22f15f444f75..75c8d560bbd3 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -526,8 +526,9 @@ int virtio_device_restore(struct virtio_device *dev) goto err; } - /* Finally, tell the device we're all set */ - virtio_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); + /* If restore didn't do it, mark device DRIVER_OK ourselves. */ + if (!(dev->config->get_status(dev) & VIRTIO_CONFIG_S_DRIVER_OK)) + virtio_device_ready(dev); virtio_config_enable(dev); -- 2.25.1