Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4703475ybf; Wed, 4 Mar 2020 09:02:46 -0800 (PST) X-Google-Smtp-Source: ADFU+vtZqei+4x1R2Feg2/VCJhjd1krP/OAwjZum/s+orQLAzE9/G7TQdhE7DF6CBOeCkdccVxan X-Received: by 2002:a05:6808:7dd:: with SMTP id f29mr2480228oij.67.1583341366344; Wed, 04 Mar 2020 09:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583341366; cv=none; d=google.com; s=arc-20160816; b=UsnajJj/aM4rhWgfu/4aouAjL7qvUIMNXTOJQLUAHoNbCppkMkuDrdG+KwpsaIWCfh X5bMW5a8KTKMTrCLunHrd0+MTboXli0c9lyLW5vQL50n+HdQw+t46RsH8WkWhV1IfQKZ 8Qeil/IIhepvQKBzBrIY5UiGEK1QYsL6GSVVFivZQkDTgd4vRt7BxYR4B13NnNzA5Be8 Pe3iiZNKsYs6HUo2oalD9GhvopkPAuU3pOXtmeOJqRPdF6XYwqUaP0T+eJGDtn1MATlZ sZ6NBYFtMnNb0toxjuUCKuLFWzWBu4JQ7O3Fs9oo062rXD/v+rh5io30xLIQDHjmy239 k9ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yNJScXKPSu34/afg2dYxwu2AJJv0EUhtGNAZFgv6Rso=; b=TxgyarOhI24W6dJN3RmpOjpZ1MJm+3B7y8VDlsM3tfa/X9V9Lw36Yg1fvg7sB9eQQP Umm5uG9+d2r19e1VlIb5Ufh3VK2IbTl68WtI12StAkcot5rw56UcSyEBXtgcgj1sJ/TE rNcmk9tVjxTFVlrSoCM6oZQviWyesS9+c5nQ0kKJZLvEWhPmKZ9VevnQYoOfKnc5o+Ls ExPaAHlExM2vpxIuUfEfx/EJGiY5btK79cABILEJWYm/MorvF8ORyLYaF4n5IAG/PHjb fLM6+9xHsmv1q2Nqi08e40QnejAuZD29Rm7ggJdMKSCu/RXj5opLJx+XNMOHMFicAmCg XhAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FvPXh0yR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 48si1649168otv.320.2020.03.04.09.02.25; Wed, 04 Mar 2020 09:02:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FvPXh0yR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729762AbgCDQ7Q (ORCPT + 99 others); Wed, 4 Mar 2020 11:59:16 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:38691 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729766AbgCDQ7P (ORCPT ); Wed, 4 Mar 2020 11:59:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583341154; 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=yNJScXKPSu34/afg2dYxwu2AJJv0EUhtGNAZFgv6Rso=; b=FvPXh0yR4vXkB4Yx7qQUA7I1tXcn0xMrSZPZj3Z7tab79KCFSVAIHIWpq08JDPu+HZvcFd x8oLfkvW4YfR2ExNr/oCdKVCDpj/xGaxP1kjPX5F74Nf8kkPKZwOUNolGRPp5ZTQV/GPUY B0qBMMXMDO4p8VYu6Ih19muJDvpeHMw= 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-429-_MIWAM0ZOIan349uUKUBcA-1; Wed, 04 Mar 2020 11:59:13 -0500 X-MC-Unique: _MIWAM0ZOIan349uUKUBcA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD1C9800D50; Wed, 4 Mar 2020 16:59:11 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D38D90779; Wed, 4 Mar 2020 16:59:03 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 40DEE2257D5; Wed, 4 Mar 2020 11:59:03 -0500 (EST) From: Vivek Goyal To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, virtio-fs@redhat.com, miklos@szeredi.hu Cc: vgoyal@redhat.com, stefanha@redhat.com, dgilbert@redhat.com, mst@redhat.com, Sebastien Boeuf Subject: [PATCH 03/20] virtio: Add get_shm_region method Date: Wed, 4 Mar 2020 11:58:28 -0500 Message-Id: <20200304165845.3081-4-vgoyal@redhat.com> In-Reply-To: <20200304165845.3081-1-vgoyal@redhat.com> References: <20200304165845.3081-1-vgoyal@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sebastien Boeuf Virtio defines 'shared memory regions' that provide a continuously shared region between the host and guest. Provide a method to find a particular region on a device. Signed-off-by: Sebastien Boeuf Signed-off-by: Dr. David Alan Gilbert --- include/linux/virtio_config.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.= h index bb4cc4910750..c859f000a751 100644 --- a/include/linux/virtio_config.h +++ b/include/linux/virtio_config.h @@ -10,6 +10,11 @@ =20 struct irq_affinity; =20 +struct virtio_shm_region { + u64 addr; + u64 len; +}; + /** * virtio_config_ops - operations for configuring a virtio device * Note: Do not assume that a transport implements all of the operations @@ -65,6 +70,7 @@ struct irq_affinity; * the caller can then copy. * @set_vq_affinity: set the affinity for a virtqueue (optional). * @get_vq_affinity: get the affinity for a virtqueue (optional). + * @get_shm_region: get a shared memory region based on the index. */ typedef void vq_callback_t(struct virtqueue *); struct virtio_config_ops { @@ -88,6 +94,8 @@ struct virtio_config_ops { const struct cpumask *cpu_mask); const struct cpumask *(*get_vq_affinity)(struct virtio_device *vdev, int index); + bool (*get_shm_region)(struct virtio_device *vdev, + struct virtio_shm_region *region, u8 id); }; =20 /* If driver didn't advertise the feature, it will never appear. */ @@ -250,6 +258,15 @@ int virtqueue_set_affinity(struct virtqueue *vq, con= st struct cpumask *cpu_mask) return 0; } =20 +static inline +bool virtio_get_shm_region(struct virtio_device *vdev, + struct virtio_shm_region *region, u8 id) +{ + if (!vdev->config->get_shm_region) + return false; + return vdev->config->get_shm_region(vdev, region, id); +} + static inline bool virtio_is_little_endian(struct virtio_device *vdev) { return virtio_has_feature(vdev, VIRTIO_F_VERSION_1) || --=20 2.20.1