Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13624662pxu; Sun, 3 Jan 2021 23:01:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJycvpmGnjbU5KX8K6SUIWmPqiQVrZxAeE0PgfxB5MR/H3CjZdRt75Jzl3GEg/7GuUxYo+yd X-Received: by 2002:a17:906:2e85:: with SMTP id o5mr65091628eji.521.1609743703677; Sun, 03 Jan 2021 23:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609743703; cv=none; d=google.com; s=arc-20160816; b=AtGDmhH8xYioyq/wUs1+NJewaG35XB1wAmG0GaV2A1KPGO3HFJirzqClHgKyQeM2Sy 28GC+uxHrb9wW9p4OUkuyttdlAVISfqoLJsN/5GbvbW2acqsN0QwRsci6SJCArx/KT9o Q084IZdK64cu3ojNdhnP9O2tX243B+zN4Z4OIkWxQWwaf7Uhywq1oCfVtaIlxeV47rAJ xm9O30U7dTDx4+m1ubDrGhNFoDq08ZfJV/WdpeZ6lqI/6ADiVkW5HQZgzCSIXgRz70uQ srAPuwUzpfm6mlMKc5lZDk7Zxi4tJker+hh8dmLeDOw/EWotsJ/3u7C6+9rfP5CffwQJ s7ew== 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=jWQOtPyifN/PjEn3xTBf4iGLE1QrxjMiv/aT+1c7dfI=; b=lYOttcqJ1PpL9uF5VE/D+pvBicemgxWxX2HZ6eV+bfptrMfP+c4wMVxDPtJw6dYIDC pBzlqw2BP5+RgEqlhVdDOdXhiR1fhGrMBENXjX4uOhJMufKPsRzpx4m2YfzGQuY1c1yd 3zt2UlXe0b4I68SJtamWM0dSH+0aAao4RVAJj47s/qSgUpFvp9ls1xTkLEeDdDln8xP9 dXBobjitsxCt288IkGsdd7kbW91ESjIziqPzOI340wAyswxt4OM9zQTKq5M2DL4xixza MRqwhqowdkdMGpTz6Z7l2ks/d5MaKrX6X2hqfPYdSYwMfcBL1upAYv9YyxTsbnQqlKZ0 12Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="YKhsf/Zc"; 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 e10si31895830edk.554.2021.01.03.23.01.20; Sun, 03 Jan 2021 23:01:43 -0800 (PST) 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="YKhsf/Zc"; 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 S1728193AbhADG5M (ORCPT + 99 others); Mon, 4 Jan 2021 01:57:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59221 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728180AbhADG5L (ORCPT ); Mon, 4 Jan 2021 01:57:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609743345; 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=jWQOtPyifN/PjEn3xTBf4iGLE1QrxjMiv/aT+1c7dfI=; b=YKhsf/ZcA16yIMao/trj85+4/K5Fl2Yp9FSASG18chmDLBmUSLxYabcgqYaublow8es34l bJA6Og6s4mdHD3ywQlQaw41dEJ1ACCbDqHh8ql7N73QSZkyHeN2hpmdNb3x2yQle6M5Xdm 0x9YgAD3X8x8uqouyo4nK0QSx3S1EfE= 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-71-PR6Oina1Mji3ezzOKe1c0w-1; Mon, 04 Jan 2021 01:55:42 -0500 X-MC-Unique: PR6Oina1Mji3ezzOKe1c0w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5095E800D55; Mon, 4 Jan 2021 06:55:41 +0000 (UTC) Received: from jason-ThinkPad-X1-Carbon-6th.redhat.com (ovpn-13-91.pek2.redhat.com [10.72.13.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AD5D1002388; Mon, 4 Jan 2021 06:55:38 +0000 (UTC) From: Jason Wang To: mst@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Cc: shahafs@mellanox.com, lulu@redhat.com, sgarzare@redhat.com, rdunlap@infradead.org, Jason Wang Subject: [PATCH V3 08/19] virtio-pci-modern: introduce vp_modern_generation() Date: Mon, 4 Jan 2021 14:54:52 +0800 Message-Id: <20210104065503.199631-9-jasowang@redhat.com> In-Reply-To: <20210104065503.199631-1-jasowang@redhat.com> References: <20210104065503.199631-1-jasowang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces vp_modern_generation() to get device generation. Signed-off-by: Jason Wang --- drivers/virtio/virtio_pci_modern.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index cb14fc334a9c..a128e5814045 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -289,15 +289,26 @@ static void vp_set(struct virtio_device *vdev, unsigned offset, } } -static u32 vp_generation(struct virtio_device *vdev) +/* + * vp_modern_generation - get the device genreation + * @mdev: the modern virtio-pci device + * + * Returns the genreation read from device + */ +static u32 vp_modern_generation(struct virtio_pci_modern_device *mdev) { - struct virtio_pci_device *vp_dev = to_vp_device(vdev); - struct virtio_pci_modern_device *mdev = &vp_dev->mdev; struct virtio_pci_common_cfg __iomem *cfg = mdev->common; return vp_ioread8(&cfg->config_generation); } +static u32 vp_generation(struct virtio_device *vdev) +{ + struct virtio_pci_device *vp_dev = to_vp_device(vdev); + + return vp_modern_generation(&vp_dev->mdev); +} + /* * vp_modern_get_status - get the device status * @mdev: the modern virtio-pci device -- 2.25.1