Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7644604imu; Tue, 22 Jan 2019 09:11:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN7vCY244YIabmKPRHgCNsAICOltAAJLL/tSzYyzCg3Aw90/EFPhaJVQKHD4KSOTpD0VVq9q X-Received: by 2002:a63:2109:: with SMTP id h9mr32419795pgh.277.1548177086242; Tue, 22 Jan 2019 09:11:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548177086; cv=none; d=google.com; s=arc-20160816; b=ixDTMD51fHZwtV/C9IMrzlAnnWsoVt72UkJ0SsVvZv4AYLAFwrADMKs7UF7Fa2qCSJ XfsgUwgR/Or5VbyF8mke/LKEeA2aSClvqX3UQkTC3uDFJqUaGAv03NR1gUtv079JQvJ+ Go3mUOpEHJls00W19IK/Sye7Z6YWbmKi+ccpxrQwipv3lHkLdMVlHV5a80TEu3oF//im VpWoCaDFgOvDV2XPp2zicdFex4w8ftL/ImM07acFR/HKyYkqYWbQ/DXfcs3l8wPJX1ql vN293vajr6ZSikkY7V4bIL/sB4MjreWkeL599jf1/1V7vaEYwTqtWIVpzQ0jizZTD61x WXOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=/z9DQE3S7xMKxmEsmvlwsVVad+Ka4md3+HbshllNg34=; b=nNdSVlDoBq8UP7v3MgiTMLNMIU33HTamQwTzfoj3TeP3GZq+gemo7qGU8cb01xGcJP FnJAF5jC+zVK3m+gEuv2e5ZGktJ2XxOMyk+nb21KGtnD+Ml0i6NSSLCOzmE/a5gsbQ4F GYsd8a2wC/dWzCv1bM7TikB6qT5pWDMtwV9l8xlbfQNWJXUYvB+2axHlvO5k+zoIdq1o c8S1bDEWAesjDsXrDJDyvg3cjvoIp6D9OC0J1WKisxsaqcZEW/fMq7AKDmPK+YocDEm/ Zej4IrHWYyhHvLzCTFZr11jhqYYVk6SuhWjacWiOMvaiW/PgeY15KXG3kljtKjXyFSnp RUtQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si17219032pgn.451.2019.01.22.09.10.47; Tue, 22 Jan 2019 09:11:26 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729504AbfAVRHA (ORCPT + 99 others); Tue, 22 Jan 2019 12:07:00 -0500 Received: from mga07.intel.com ([134.134.136.100]:37126 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729400AbfAVRHA (ORCPT ); Tue, 22 Jan 2019 12:07:00 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2019 09:06:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,507,1539673200"; d="scan'208";a="137787027" Received: from unknown (HELO dpdk-tbie.sh.intel.com) ([10.67.104.173]) by fmsmga004.fm.intel.com with ESMTP; 22 Jan 2019 09:06:56 -0800 From: Tiwei Bie To: mst@redhat.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, virtio-dev@lists.oasis-open.org Subject: [PATCH] virtio: support VIRTIO_F_ORDER_PLATFORM Date: Wed, 23 Jan 2019 01:03:46 +0800 Message-Id: <20190122170346.6279-1-tiwei.bie@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces the support for VIRTIO_F_ORDER_PLATFORM. When this feature is negotiated, driver will use the barriers suitable for hardware devices. Signed-off-by: Tiwei Bie --- drivers/virtio/virtio_ring.c | 8 ++++++++ include/uapi/linux/virtio_config.h | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cd7e755484e3..27d3f057493e 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1609,6 +1609,9 @@ static struct virtqueue *vring_create_virtqueue_packed( !context; vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); + if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM)) + vq->weak_barriers = false; + vq->packed.ring_dma_addr = ring_dma_addr; vq->packed.driver_event_dma_addr = driver_event_dma_addr; vq->packed.device_event_dma_addr = device_event_dma_addr; @@ -2079,6 +2082,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, !context; vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); + if (virtio_has_feature(vdev, VIRTIO_F_ORDER_PLATFORM)) + vq->weak_barriers = false; + vq->split.queue_dma_addr = 0; vq->split.queue_size_in_bytes = 0; @@ -2213,6 +2219,8 @@ void vring_transport_features(struct virtio_device *vdev) break; case VIRTIO_F_RING_PACKED: break; + case VIRTIO_F_ORDER_PLATFORM: + break; default: /* We don't understand this bit. */ __virtio_clear_bit(vdev, i); diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h index 1196e1c1d4f6..ff8e7dc9d4dd 100644 --- a/include/uapi/linux/virtio_config.h +++ b/include/uapi/linux/virtio_config.h @@ -78,6 +78,12 @@ /* This feature indicates support for the packed virtqueue layout. */ #define VIRTIO_F_RING_PACKED 34 +/* + * This feature indicates that memory accesses by the driver and the + * device are ordered in a way described by the platform. + */ +#define VIRTIO_F_ORDER_PLATFORM 36 + /* * Does the device support Single Root I/O Virtualization? */ -- 2.17.1