Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1531634pxb; Sun, 12 Sep 2021 22:59:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhaWaRVmc/gb446NPFbttdVNY9nAw2mbFuk530NbTA4f54T/8Kcrv/YUIkvQgHfQldRoEV X-Received: by 2002:a17:907:76e7:: with SMTP id kg7mr9564909ejc.344.1631512763717; Sun, 12 Sep 2021 22:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631512763; cv=none; d=google.com; s=arc-20160816; b=G8hT9kjoiU5qqy6FW554GOFuf18IoYyKB41u0RHtNfX5Q8EyGUy3nhKq7pJAj4eQES CA7eFHWpc6le3PCiW0VEcdHKPoBe/mZYR1YSFxq05U36ZMB0ORVzA97DnLLAknL80Y46 IDKVFJKJd+ITm3hz7vAL3hlUM7Z4qs7yMXa8p/QGh9RKnX7YUkfXCmBo8ynyRqKVr0Jg yDUsFfXJytwB5iXd5j1HTloYl4wS2tUWO4vecMWv0LjxSGqc1unJBVdFjrasoivC0bXt /rGwoa6Hu9o3fYLMUoCxSL7uAa1ouJUszZHMehbKP/XwE/rfyf/B6OQRL67G1i+/8YNf zuTA== 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=XtqcK8OBOXRr6ZBw1JH6UfUdpU3S//kleHWjxjhJDLY=; b=HfsqvPET2nsfUCOFvXyVeku+WSB+BYCIMRahWZNf/MyP5VvDRBHRoc5zwu2w04uxu0 wC++S+Cg/bpQIsPKr0itYbuwOA2sHrG59NxD7lUqLJvoTThXMXZuLSGBAuQGFryKiOk9 A9Uwfvy9Dd8832mo0G5a4ztpHJfGujKXoLJytCg6SmksTWPweRQFtZKZF/8McNC/HJLe SKIx7gXNTNShU0lmhdSxcgiDEuZlaVioYz819PlX0NGBt/zIk/cGElpgSqE5Vw6pZa5n FX8wvKR7jaYY8uSi82QW2ADtjxbDgEm96kZpOj5jnwZPRiiXRCWUj/KSzD0Z307ANmxb 12gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E13gedwA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si6015648edv.335.2021.09.12.22.59.00; Sun, 12 Sep 2021 22:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E13gedwA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237184AbhIMF4F (ORCPT + 99 others); Mon, 13 Sep 2021 01:56:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53401 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237249AbhIMF4E (ORCPT ); Mon, 13 Sep 2021 01:56:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631512488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XtqcK8OBOXRr6ZBw1JH6UfUdpU3S//kleHWjxjhJDLY=; b=E13gedwAcvXGPDy7HUOq8mgeAzSxRj+RkHlfalmXSzhRTOeVJVNkVVVwxmxUJbwlupqX1h NLg0Pn1uhFAOJRNSQePt3Y5NAaUSNJSjqrQ7xiOcmjZM6OUEngg+IuLtiqbE7FPNDCWA5c zg1ke8/csDdIcbjGP6J74jM9OC3srpY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-7-eqVKmdeqNLGOQlI_rUhG-g-1; Mon, 13 Sep 2021 01:54:43 -0400 X-MC-Unique: eqVKmdeqNLGOQlI_rUhG-g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D3C7800FF3; Mon, 13 Sep 2021 05:54:42 +0000 (UTC) Received: from localhost.localdomain (ovpn-13-146.pek2.redhat.com [10.72.13.146]) by smtp.corp.redhat.com (Postfix) with ESMTP id 180445C3E0; Mon, 13 Sep 2021 05:54:39 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, f.hetzelt@tu-berlin.de, david.kaplan@amd.com, konrad.wilk@oracle.com Subject: [PATCH 5/9] virtio_config: introduce a new ready method Date: Mon, 13 Sep 2021 13:53:49 +0800 Message-Id: <20210913055353.35219-6-jasowang@redhat.com> In-Reply-To: <20210913055353.35219-1-jasowang@redhat.com> References: <20210913055353.35219-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Jason Wang --- include/linux/virtio_config.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h index 8519b3ae5d52..f2891c6221a1 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -23,6 +23,8 @@ struct virtio_shm_region { * any of @get/@set, @get_status/@set_status, or @get_features/ * @finalize_features are NOT safe to be called from an atomic * context. + * @ready: make the device ready + * vdev: the virtio_device * @get: read the value of a configuration field * vdev: the virtio_device * offset: the offset of the configuration field @@ -75,6 +77,7 @@ struct virtio_shm_region { */ typedef void vq_callback_t(struct virtqueue *); struct virtio_config_ops { + void (*ready)(struct virtio_device *vdev); void (*get)(struct virtio_device *vdev, unsigned offset, void *buf, unsigned len); void (*set)(struct virtio_device *vdev, unsigned offset, @@ -229,6 +232,9 @@ void virtio_device_ready(struct virtio_device *dev) { unsigned status = dev->config->get_status(dev); + if (dev->config->ready) + dev->config->ready(dev); + BUG_ON(status & VIRTIO_CONFIG_S_DRIVER_OK); dev->config->set_status(dev, status | VIRTIO_CONFIG_S_DRIVER_OK); } -- 2.25.1