VMCI: dma dg: detect DMA datagram capability
authorJorgen Hansen <jhansen@vmware.com>
Mon, 7 Feb 2022 10:27:20 +0000 (02:27 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 11:15:58 +0000 (12:15 +0100)
Detect the VMCI DMA datagram capability, and if present, ack it
to the device.

Reviewed-by: Vishnu Dasa <vdasa@vmware.com>
Signed-off-by: Jorgen Hansen <jhansen@vmware.com>
Link: https://lore.kernel.org/r/20220207102725.2742-4-jhansen@vmware.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_guest.c
include/linux/vmw_vmci_defs.h

index d30d66258e52a8b512c9191f7af60d98bb85015e..b93afe7f7119cd324c185214e2f718ea1507225c 100644 (file)
@@ -562,6 +562,17 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
                }
        }
 
+       if (mmio_base != NULL) {
+               if (capabilities & VMCI_CAPS_DMA_DATAGRAM) {
+                       caps_in_use |= VMCI_CAPS_DMA_DATAGRAM;
+               } else {
+                       dev_err(&pdev->dev,
+                               "Missing capability: VMCI_CAPS_DMA_DATAGRAM\n");
+                       error = -ENXIO;
+                       goto err_free_data_buffer;
+               }
+       }
+
        dev_info(&pdev->dev, "Using capabilities 0x%x\n", caps_in_use);
 
        /* Let the host know which capabilities we intend to use. */
index 8fc00e2685cfdd152dce317d86837044a23b1e7d..1ce2cffdc3ae1c805653a9817d49cabe50a562f5 100644 (file)
@@ -39,6 +39,7 @@
 #define VMCI_CAPS_DATAGRAM      BIT(2)
 #define VMCI_CAPS_NOTIFICATIONS BIT(3)
 #define VMCI_CAPS_PPN64         BIT(4)
+#define VMCI_CAPS_DMA_DATAGRAM  BIT(5)
 
 /* Interrupt Cause register bits. */
 #define VMCI_ICR_DATAGRAM      BIT(0)