/* A hardwired and constant ABI value between the GPU FW and VFIO driver. */
 #define MEMBLK_SIZE SZ_512M
 
+#define DVSEC_BITMAP_OFFSET 0xA
+#define MIG_SUPPORTED_WITH_CACHED_RESMEM BIT(0)
+
+#define GPU_CAP_DVSEC_REGISTER 3
+
 /*
  * The state of the two device memory region - resmem and usemem - is
  * saved as struct mem_region.
        struct mem_region resmem;
        /* Lock to control device memory kernel mapping */
        struct mutex remap_lock;
+       bool has_mig_hw_bug;
 };
 
 static void nvgrace_gpu_init_fake_bar_emu_regs(struct vfio_device *core_vdev)
        return ret;
 }
 
+static bool nvgrace_gpu_has_mig_hw_bug(struct pci_dev *pdev)
+{
+       int pcie_dvsec;
+       u16 dvsec_ctrl16;
+
+       pcie_dvsec = pci_find_dvsec_capability(pdev, PCI_VENDOR_ID_NVIDIA,
+                                              GPU_CAP_DVSEC_REGISTER);
+
+       if (pcie_dvsec) {
+               pci_read_config_word(pdev,
+                                    pcie_dvsec + DVSEC_BITMAP_OFFSET,
+                                    &dvsec_ctrl16);
+
+               if (dvsec_ctrl16 & MIG_SUPPORTED_WITH_CACHED_RESMEM)
+                       return false;
+       }
+
+       return true;
+}
+
 static int nvgrace_gpu_probe(struct pci_dev *pdev,
                             const struct pci_device_id *id)
 {
        dev_set_drvdata(&pdev->dev, &nvdev->core_device);
 
        if (ops == &nvgrace_gpu_pci_ops) {
+               nvdev->has_mig_hw_bug = nvgrace_gpu_has_mig_hw_bug(pdev);
+
                /*
                 * Device memory properties are identified in the host ACPI
                 * table. Set the nvgrace_gpu_pci_core_device structure.