drm/amdkfd: Enable over-subscription with >1 GWS queue
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdkfd / kfd_priv.h
index 6af1b58..d48b334 100644 (file)
@@ -41,6 +41,7 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_device.h>
 #include <kgd_kfd_interface.h>
+#include <linux/swap.h>
 
 #include "amd_shared.h"
 
@@ -281,6 +282,7 @@ struct kfd_dev {
 
        /* Firmware versions */
        uint16_t mec_fw_version;
+       uint16_t mec2_fw_version;
        uint16_t sdma_fw_version;
 
        /* Maximum process number mapped to HW scheduler */
@@ -293,6 +295,9 @@ struct kfd_dev {
 
        /* xGMI */
        uint64_t hive_id;
+    
+       /* UUID */
+       uint64_t unique_id;
 
        bool pci_atomic_requested;
 
@@ -406,6 +411,10 @@ enum KFD_QUEUE_PRIORITY {
  * @is_active: Defines if the queue is active or not. @is_active and
  * @is_evicted are protected by the DQM lock.
  *
+ * @is_gws: Defines if the queue has been updated to be GWS-capable or not.
+ * @is_gws should be protected by the DQM lock, since changing it can yield the
+ * possibility of updating DQM state on number of GWS queues.
+ *
  * @vmid: If the scheduling mode is no cp scheduling the field defines the vmid
  * of the queue.
  *
@@ -428,6 +437,7 @@ struct queue_properties {
        bool is_interop;
        bool is_evicted;
        bool is_active;
+       bool is_gws;
        /* Not relevant for user mode queues in cp scheduling */
        unsigned int vmid;
        /* Relevant only for sdma queues*/
@@ -502,6 +512,9 @@ struct queue {
        struct kfd_process      *process;
        struct kfd_dev          *device;
        void *gws;
+
+       /* procfs */
+       struct kobject kobj;
 };
 
 /*
@@ -556,6 +569,14 @@ struct qcm_process_device {
         */
        bool reset_wavefronts;
 
+       /* This flag tells us if this process has a GWS-capable
+        * queue that will be mapped into the runlist. It's
+        * possible to request a GWS BO, but not have the queue
+        * currently mapped, and this changes how the MAP_PROCESS
+        * PM4 packet is configured.
+        */
+       bool mapped_gws_queue;
+
        /*
         * All the memory management data should be here too
         */
@@ -646,6 +667,7 @@ struct kfd_process_device {
         * function.
         */
        bool already_dequeued;
+       bool runtime_inuse;
 
        /* Is this process/pasid bound to this device? (amd_iommu_bind_pasid) */
        enum kfd_pdd_bound bound;
@@ -729,6 +751,7 @@ struct kfd_process {
 
        /* Kobj for our procfs */
        struct kobject *kobj;
+       struct kobject *kobj_queues;
        struct attribute attr_pasid;
 };
 
@@ -835,6 +858,8 @@ extern struct device *kfd_device;
 /* KFD's procfs */
 void kfd_procfs_init(void);
 void kfd_procfs_shutdown(void);
+int kfd_procfs_add_queue(struct queue *q);
+void kfd_procfs_del_queue(struct queue *q);
 
 /* Topology */
 int kfd_topology_init(void);
@@ -912,6 +937,8 @@ int pqm_set_gws(struct process_queue_manager *pqm, unsigned int qid,
                        void *gws);
 struct kernel_queue *pqm_get_kernel_queue(struct process_queue_manager *pqm,
                                                unsigned int qid);
+struct queue *pqm_get_user_queue(struct process_queue_manager *pqm,
+                                               unsigned int qid);
 int pqm_get_wave_state(struct process_queue_manager *pqm,
                       unsigned int qid,
                       void __user *ctl_stack,