Received: by 10.213.65.68 with SMTP id h4csp1783580imn; Thu, 5 Apr 2018 03:51:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49VTAeMDQCkKlG+pxCslX5XM1lkEhExQTf2bm+G8EERhorYZHQPhdZE65fQFXmhZJ/9bTdq X-Received: by 10.101.98.196 with SMTP id m4mr3140953pgv.329.1522925464467; Thu, 05 Apr 2018 03:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522925464; cv=none; d=google.com; s=arc-20160816; b=nrCodIT0bV1r6/oxxjoS2K0pOeq0xZaxx0AAYbFGuu51MSlJ0fl+gl5sBQNDMkLfYO jrnshyV3TEteiix7YQxSTyYq8dfBAR00EPcnjVqn81qZrdG3rXzfprYMootwNRuQgJjV vFfvUDdfjgmFOGngf0xDHKwwAE8+sAOH/eoRsSpH5l07pzIa/b494AxT6SaC6YBN7EZL r3r7epKh0STMLEuKf5JNJXELiGNy0mr5f35MTsHRY+1dthSyACtbEtyNI5w02vNz1b87 BY+bY+gvdbOOt4w9s0P1EDAXnWBuYH5J8T6vEkWZp26CStOAlvvM8234Dv+Nnj+jEJPD VkIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=9/emRgcRIUcTuI//9pQEBDb8/aB2fGG/ZfSIO4kil+g=; b=hLGYbUZ9uEOIF6XINtDTlU9XavRl99wOsOr0f+3RjEsWvVk4RUbcDnv41fLlAa7eiY sAtSWWAqPTlS8ab3rRnyUK0NZrPNAMid8OH3S0fNCCTAYbuaZLGyzfOVgqoNJWjyV8UH W9+50yRXwUpghgcN2gLWtHsv7r2Y1feSfJIaH+Qe0Kf2X1KYcLO/+49uPwKqLeW/ItAp Ee/piIILnkWst6J2NcIwQYIDRhGyOEmO8jZWB616CAkjwB+n47MQdpwdHu3f15G4aLco WFz4NBy7G3HIBW3nxDPhmlfnaM2mTNSl8wnb6nIDUbw8d3DQdNiRoAu3ee47GwhLEE9b kc+Q== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e92-v6si1277126pld.16.2018.04.05.03.50.50; Thu, 05 Apr 2018 03:51:04 -0700 (PDT) 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751510AbeDEKtZ (ORCPT + 99 others); Thu, 5 Apr 2018 06:49:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44492 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751312AbeDEKtX (ORCPT ); Thu, 5 Apr 2018 06:49:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21D758160F98; Thu, 5 Apr 2018 10:49:23 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (dhcp193-127.pnq.redhat.com [10.65.193.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CAB163537; Thu, 5 Apr 2018 10:49:07 +0000 (UTC) From: Pankaj Gupta To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, qemu-devel@nongnu.org, linux-nvdimm@ml01.01.org Cc: jack@suse.cz, stefanha@redhat.com, dan.j.williams@intel.com, riel@surriel.com, haozhong.zhang@intel.com, nilal@redhat.com, kwolf@redhat.com, pbonzini@redhat.com, ross.zwisler@intel.com, david@redhat.com, xiaoguangrong.eric@gmail.com, hch@infradead.org, marcel@redhat.com, mst@redhat.com, niteshnarayanlal@hotmail.com, imammedo@redhat.com, pagupta@redhat.com Subject: [RFC 2/2] pmem: device flush over VIRTIO Date: Thu, 5 Apr 2018 16:18:33 +0530 Message-Id: <20180405104834.10457-3-pagupta@redhat.com> In-Reply-To: <20180405104834.10457-1-pagupta@redhat.com> References: <20180405104834.10457-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 05 Apr 2018 10:49:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 05 Apr 2018 10:49:23 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pagupta@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds functionality to perform flush from guest to host over VIRTIO when 'ND_REGION_VIRTIO' flag is set on nd_negion. This flag is set by 'virtio-pmem' driver for virtio flush operation. Signed-off-by: Pankaj Gupta --- drivers/nvdimm/region_devs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index abaf38c..1c6cd2a 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -20,6 +20,7 @@ #include #include "nd-core.h" #include "nd.h" +#include /* * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is @@ -1043,6 +1044,12 @@ void nvdimm_flush(struct nd_region *nd_region) struct nd_region_data *ndrd = dev_get_drvdata(&nd_region->dev); int i, idx; + /* call PV device flush */ + if (test_bit(ND_REGION_VIRTIO, &nd_region->flags)) { + virtio_pmem_flush(&nd_region->dev); + return; + } + /* * Try to encourage some diversity in flush hint addresses * across cpus assuming a limited number of flush hints. -- 2.9.3