Signed-off-by: Fotis Xenakis <[email protected]>
---
 drivers/virtio-fs.cc | 12 ++++++++++++
 drivers/virtio-fs.hh | 10 ++++++++++
 2 files changed, 22 insertions(+)

diff --git a/drivers/virtio-fs.cc b/drivers/virtio-fs.cc
index d95f7740..b7363040 100644
--- 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
index 626bd906..d1c116de 100644
--- a/drivers/virtio-fs.hh
+++ b/drivers/virtio-fs.hh
@@ -28,6 +28,12 @@ public:
         u32 num_queues;
     } __attribute__((packed));
 
+    struct dax_window {
+        mmioaddr_t addr;
+        u64 len;
+        mutex lock;
+    };
+
     explicit fs(virtio_device& dev);
     virtual ~fs();
 
@@ -35,6 +41,9 @@ public:
     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;
-- 
2.26.1

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/VI1PR03MB4383C53D7C93788438E054B6A6D40%40VI1PR03MB4383.eurprd03.prod.outlook.com.

Reply via email to