From: Fotis Xenakis <fo...@windowslive.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

virtio-fs: add driver support for the DAX window

Signed-off-by: Fotis Xenakis <fo...@windowslive.com>
Message-Id: 
<vi1pr03mb4383c53d7c93788438e054b6a6...@vi1pr03mb4383.eurprd03.prod.outlook.com>

---
diff --git a/drivers/virtio-fs.cc b/drivers/virtio-fs.cc
--- a/drivers/virtio-fs.cc
+++ b/drivers/virtio-fs.cc
@@ -180,6 +180,18 @@ void fs::read_config()
     virtio_conf_read(0, &_config, sizeof(_config));
     debugf("virtio-fs: Detected device with tag: [%s] and num_queues: %d\n",
         _config.tag, _config.num_queues);
+
+    // Query for DAX window
+    mmioaddr_t dax_addr;
+    u64 dax_len;
+    if (_dev.get_shm(0, dax_addr, dax_len)) {
+        _dax.addr = dax_addr;
+        _dax.len = dax_len;
+        debugf("virtio-fs: Detected DAX window with length %lld\n", dax_len);
+    } else {
+        _dax.addr = mmio_nullptr;
+        _dax.len = 0;
+    }
 }
 
 void fs::req_done()
diff --git a/drivers/virtio-fs.hh b/drivers/virtio-fs.hh
--- a/drivers/virtio-fs.hh
+++ b/drivers/virtio-fs.hh
@@ -28,13 +28,22 @@ public:
         u32 num_queues;
     } __attribute__((packed));
 
+    struct dax_window {
+        mmioaddr_t addr;
+        u64 len;
+        mutex lock;
+    };
+
     explicit fs(virtio_device& dev);
     virtual ~fs();
 
     virtual std::string get_name() const { return _driver_name; }
     void read_config();
 
     int make_request(fuse_request*);
+    dax_window* get_dax() {
+        return (_dax.addr != mmio_nullptr) ? &_dax : nullptr;
+    }
 
     void req_done();
     int64_t size();
@@ -53,6 +62,7 @@ private:
 
     std::string _driver_name;
     fs_config _config;
+    dax_window _dax;
 
     // maintains the virtio instance number for multiple drives
     static int _instance;

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000082438b05a4668566%40google.com.

Reply via email to