drm/radeon: Add init interrupt kfd->kgd interface
authorOded Gabbay <oded.gabbay@gmail.com>
Thu, 5 Mar 2015 13:13:18 +0000 (15:13 +0200)
committerOded Gabbay <oded.gabbay@gmail.com>
Tue, 19 May 2015 09:13:39 +0000 (12:13 +0300)
This patch adds a new interface function to the kfd->kgd interface.
The function is kgd_init_interrupts() and its function is to
initialize a pipe's interrupts.

The function currently enables the timestamp interrupt and the
bad opcode interrupt.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
drivers/gpu/drm/amd/include/kgd_kfd_interface.h
drivers/gpu/drm/radeon/cik_reg.h
drivers/gpu/drm/radeon/cikd.h
drivers/gpu/drm/radeon/radeon_kfd.c

index dabd94446b7b2a5d771cd7a2cc704d73cddff087..4ea21ae88b07f81babb01725ae8545e94ec131c3 100644 (file)
@@ -144,6 +144,8 @@ struct kfd2kgd_calls {
        int (*init_pipeline)(struct kgd_dev *kgd, uint32_t pipe_id,
                                uint32_t hpd_size, uint64_t hpd_gpu_addr);
 
+       int (*init_interrupts)(struct kgd_dev *kgd, uint32_t pipe_id);
+
        int (*hqd_load)(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
                        uint32_t queue_id, uint32_t __user *wptr);
 
index f667347d8157ce81374ca7b91ec20b72be675028..0ec5d53eb6fb2bbd69c9c21ae5a65028d3c818af 100644 (file)
 
 #define KFD_CIK_SDMA_QUEUE_OFFSET              0x200
 
+#define CPC_INT_CNTL                                   0xC2D0
+
 #define CP_HQD_IQ_RPTR                                 0xC970u
 #define AQL_ENABLE                                     (1U << 0)
 #define SDMA0_RLC0_RB_CNTL                             0xD400u
index 0089d837a8e39c4990cb0fa865a56e250dc2c859..b33ba3b0808bbd9b1755f14310a95cff150bffe1 100644 (file)
 #       define CNTX_EMPTY_INT_ENABLE                    (1 << 20)
 #       define PRIV_INSTR_INT_ENABLE                    (1 << 22)
 #       define PRIV_REG_INT_ENABLE                      (1 << 23)
+#       define OPCODE_ERROR_INT_ENABLE                  (1 << 24)
 #       define TIME_STAMP_INT_ENABLE                    (1 << 26)
 #       define CP_RINGID2_INT_ENABLE                    (1 << 29)
 #       define CP_RINGID1_INT_ENABLE                    (1 << 30)
index 3db23007cdf469c8ee9271d23b25a4bbd078d2e6..813a416db5386121dc55c006eb7a215f7e1f8c7f 100644 (file)
@@ -66,7 +66,7 @@ static int kgd_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned int pasid,
 
 static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id,
                                uint32_t hpd_size, uint64_t hpd_gpu_addr);
-
+static int kgd_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id);
 static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
                        uint32_t queue_id, uint32_t __user *wptr);
 static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd);
@@ -89,6 +89,7 @@ static const struct kfd2kgd_calls kfd2kgd = {
        .program_sh_mem_settings = kgd_program_sh_mem_settings,
        .set_pasid_vmid_mapping = kgd_set_pasid_vmid_mapping,
        .init_pipeline = kgd_init_pipeline,
+       .init_interrupts = kgd_init_interrupts,
        .hqd_load = kgd_hqd_load,
        .hqd_sdma_load = kgd_hqd_sdma_load,
        .hqd_is_occupied = kgd_hqd_is_occupied,
@@ -407,6 +408,24 @@ static int kgd_init_pipeline(struct kgd_dev *kgd, uint32_t pipe_id,
        return 0;
 }
 
+static int kgd_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)
+{
+       uint32_t mec;
+       uint32_t pipe;
+
+       mec = (pipe_id / CIK_PIPE_PER_MEC) + 1;
+       pipe = (pipe_id % CIK_PIPE_PER_MEC);
+
+       lock_srbm(kgd, mec, pipe, 0, 0);
+
+       write_register(kgd, CPC_INT_CNTL,
+                       TIME_STAMP_INT_ENABLE | OPCODE_ERROR_INT_ENABLE);
+
+       unlock_srbm(kgd);
+
+       return 0;
+}
+
 static inline uint32_t get_sdma_base_addr(struct cik_sdma_rlc_registers *m)
 {
        uint32_t retval;