2 * Copyright 2008 Jerome Glisse.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Jerome Glisse <glisse@freedesktop.org>
28 #include <drm/radeon_drm.h>
29 #include "radeon_reg.h"
31 #include "radeon_trace.h"
33 static int radeon_cs_parser_relocs(struct radeon_cs_parser
*p
)
35 struct drm_device
*ddev
= p
->rdev
->ddev
;
36 struct radeon_cs_chunk
*chunk
;
40 if (p
->chunk_relocs_idx
== -1) {
43 chunk
= &p
->chunks
[p
->chunk_relocs_idx
];
45 /* FIXME: we assume that each relocs use 4 dwords */
46 p
->nrelocs
= chunk
->length_dw
/ 4;
47 p
->relocs_ptr
= kcalloc(p
->nrelocs
, sizeof(void *), GFP_KERNEL
);
48 if (p
->relocs_ptr
== NULL
) {
51 p
->relocs
= kcalloc(p
->nrelocs
, sizeof(struct radeon_cs_reloc
), GFP_KERNEL
);
52 if (p
->relocs
== NULL
) {
55 for (i
= 0; i
< p
->nrelocs
; i
++) {
56 struct drm_radeon_cs_reloc
*r
;
59 r
= (struct drm_radeon_cs_reloc
*)&chunk
->kdata
[i
*4];
60 for (j
= 0; j
< i
; j
++) {
61 if (r
->handle
== p
->relocs
[j
].handle
) {
62 p
->relocs_ptr
[i
] = &p
->relocs
[j
];
68 p
->relocs
[i
].handle
= 0;
72 p
->relocs
[i
].gobj
= drm_gem_object_lookup(ddev
, p
->filp
,
74 if (p
->relocs
[i
].gobj
== NULL
) {
75 DRM_ERROR("gem object lookup failed 0x%x\n",
79 p
->relocs_ptr
[i
] = &p
->relocs
[i
];
80 p
->relocs
[i
].robj
= gem_to_radeon_bo(p
->relocs
[i
].gobj
);
81 p
->relocs
[i
].lobj
.bo
= p
->relocs
[i
].robj
;
82 p
->relocs
[i
].lobj
.written
= !!r
->write_domain
;
84 /* the first reloc of an UVD job is the msg and that must be in
85 VRAM, also but everything into VRAM on AGP cards to avoid
87 if (p
->ring
== R600_RING_TYPE_UVD_INDEX
&&
88 (i
== 0 || drm_pci_device_is_agp(p
->rdev
->ddev
))) {
89 /* TODO: is this still needed for NI+ ? */
90 p
->relocs
[i
].lobj
.domain
=
91 RADEON_GEM_DOMAIN_VRAM
;
93 p
->relocs
[i
].lobj
.alt_domain
=
94 RADEON_GEM_DOMAIN_VRAM
;
97 uint32_t domain
= r
->write_domain
?
98 r
->write_domain
: r
->read_domains
;
100 p
->relocs
[i
].lobj
.domain
= domain
;
101 if (domain
== RADEON_GEM_DOMAIN_VRAM
)
102 domain
|= RADEON_GEM_DOMAIN_GTT
;
103 p
->relocs
[i
].lobj
.alt_domain
= domain
;
106 p
->relocs
[i
].lobj
.tv
.bo
= &p
->relocs
[i
].robj
->tbo
;
107 p
->relocs
[i
].handle
= r
->handle
;
109 radeon_bo_list_add_object(&p
->relocs
[i
].lobj
,
112 return radeon_bo_list_validate(&p
->ticket
, &p
->validated
, p
->ring
);
115 static int radeon_cs_get_ring(struct radeon_cs_parser
*p
, u32 ring
, s32 priority
)
117 p
->priority
= priority
;
121 DRM_ERROR("unknown ring id: %d\n", ring
);
123 case RADEON_CS_RING_GFX
:
124 p
->ring
= RADEON_RING_TYPE_GFX_INDEX
;
126 case RADEON_CS_RING_COMPUTE
:
127 if (p
->rdev
->family
>= CHIP_TAHITI
) {
129 p
->ring
= CAYMAN_RING_TYPE_CP1_INDEX
;
131 p
->ring
= CAYMAN_RING_TYPE_CP2_INDEX
;
133 p
->ring
= RADEON_RING_TYPE_GFX_INDEX
;
135 case RADEON_CS_RING_DMA
:
136 if (p
->rdev
->family
>= CHIP_CAYMAN
) {
138 p
->ring
= R600_RING_TYPE_DMA_INDEX
;
140 p
->ring
= CAYMAN_RING_TYPE_DMA1_INDEX
;
141 } else if (p
->rdev
->family
>= CHIP_RV770
) {
142 p
->ring
= R600_RING_TYPE_DMA_INDEX
;
147 case RADEON_CS_RING_UVD
:
148 p
->ring
= R600_RING_TYPE_UVD_INDEX
;
154 static void radeon_cs_sync_rings(struct radeon_cs_parser
*p
)
158 for (i
= 0; i
< p
->nrelocs
; i
++) {
159 if (!p
->relocs
[i
].robj
)
162 radeon_semaphore_sync_to(p
->ib
.semaphore
,
163 p
->relocs
[i
].robj
->tbo
.sync_obj
);
167 /* XXX: note that this is called from the legacy UMS CS ioctl as well */
168 int radeon_cs_parser_init(struct radeon_cs_parser
*p
, void *data
)
170 struct drm_radeon_cs
*cs
= data
;
171 uint64_t *chunk_array_ptr
;
173 u32 ring
= RADEON_CS_RING_GFX
;
176 if (!cs
->num_chunks
) {
180 INIT_LIST_HEAD(&p
->validated
);
183 p
->ib
.semaphore
= NULL
;
184 p
->const_ib
.sa_bo
= NULL
;
185 p
->const_ib
.semaphore
= NULL
;
186 p
->chunk_ib_idx
= -1;
187 p
->chunk_relocs_idx
= -1;
188 p
->chunk_flags_idx
= -1;
189 p
->chunk_const_ib_idx
= -1;
190 p
->chunks_array
= kcalloc(cs
->num_chunks
, sizeof(uint64_t), GFP_KERNEL
);
191 if (p
->chunks_array
== NULL
) {
194 chunk_array_ptr
= (uint64_t *)(unsigned long)(cs
->chunks
);
195 if (copy_from_user(p
->chunks_array
, chunk_array_ptr
,
196 sizeof(uint64_t)*cs
->num_chunks
)) {
200 p
->nchunks
= cs
->num_chunks
;
201 p
->chunks
= kcalloc(p
->nchunks
, sizeof(struct radeon_cs_chunk
), GFP_KERNEL
);
202 if (p
->chunks
== NULL
) {
205 for (i
= 0; i
< p
->nchunks
; i
++) {
206 struct drm_radeon_cs_chunk __user
**chunk_ptr
= NULL
;
207 struct drm_radeon_cs_chunk user_chunk
;
208 uint32_t __user
*cdata
;
210 chunk_ptr
= (void __user
*)(unsigned long)p
->chunks_array
[i
];
211 if (copy_from_user(&user_chunk
, chunk_ptr
,
212 sizeof(struct drm_radeon_cs_chunk
))) {
215 p
->chunks
[i
].length_dw
= user_chunk
.length_dw
;
216 p
->chunks
[i
].chunk_id
= user_chunk
.chunk_id
;
217 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_RELOCS
) {
218 p
->chunk_relocs_idx
= i
;
220 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_IB
) {
222 /* zero length IB isn't useful */
223 if (p
->chunks
[i
].length_dw
== 0)
226 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_CONST_IB
) {
227 p
->chunk_const_ib_idx
= i
;
228 /* zero length CONST IB isn't useful */
229 if (p
->chunks
[i
].length_dw
== 0)
232 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_FLAGS
) {
233 p
->chunk_flags_idx
= i
;
234 /* zero length flags aren't useful */
235 if (p
->chunks
[i
].length_dw
== 0)
239 size
= p
->chunks
[i
].length_dw
;
240 cdata
= (void __user
*)(unsigned long)user_chunk
.chunk_data
;
241 p
->chunks
[i
].user_ptr
= cdata
;
242 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_CONST_IB
)
245 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_IB
) {
246 if (!p
->rdev
|| !(p
->rdev
->flags
& RADEON_IS_AGP
))
250 p
->chunks
[i
].kdata
= drm_malloc_ab(size
, sizeof(uint32_t));
251 size
*= sizeof(uint32_t);
252 if (p
->chunks
[i
].kdata
== NULL
) {
255 if (copy_from_user(p
->chunks
[i
].kdata
, cdata
, size
)) {
258 if (p
->chunks
[i
].chunk_id
== RADEON_CHUNK_ID_FLAGS
) {
259 p
->cs_flags
= p
->chunks
[i
].kdata
[0];
260 if (p
->chunks
[i
].length_dw
> 1)
261 ring
= p
->chunks
[i
].kdata
[1];
262 if (p
->chunks
[i
].length_dw
> 2)
263 priority
= (s32
)p
->chunks
[i
].kdata
[2];
267 /* these are KMS only */
269 if ((p
->cs_flags
& RADEON_CS_USE_VM
) &&
270 !p
->rdev
->vm_manager
.enabled
) {
271 DRM_ERROR("VM not active on asic!\n");
275 if (radeon_cs_get_ring(p
, ring
, priority
))
278 /* we only support VM on some SI+ rings */
279 if ((p
->rdev
->asic
->ring
[p
->ring
]->cs_parse
== NULL
) &&
280 ((p
->cs_flags
& RADEON_CS_USE_VM
) == 0)) {
281 DRM_ERROR("Ring %d requires VM!\n", p
->ring
);
290 * cs_parser_fini() - clean parser states
291 * @parser: parser structure holding parsing context.
292 * @error: error number
294 * If error is set than unvalidate buffer, otherwise just free memory
295 * used by parsing context.
297 static void radeon_cs_parser_fini(struct radeon_cs_parser
*parser
, int error
, bool backoff
)
302 ttm_eu_fence_buffer_objects(&parser
->ticket
,
305 } else if (backoff
) {
306 ttm_eu_backoff_reservation(&parser
->ticket
,
310 if (parser
->relocs
!= NULL
) {
311 for (i
= 0; i
< parser
->nrelocs
; i
++) {
312 if (parser
->relocs
[i
].gobj
)
313 drm_gem_object_unreference_unlocked(parser
->relocs
[i
].gobj
);
316 kfree(parser
->track
);
317 kfree(parser
->relocs
);
318 kfree(parser
->relocs_ptr
);
319 for (i
= 0; i
< parser
->nchunks
; i
++)
320 drm_free_large(parser
->chunks
[i
].kdata
);
321 kfree(parser
->chunks
);
322 kfree(parser
->chunks_array
);
323 radeon_ib_free(parser
->rdev
, &parser
->ib
);
324 radeon_ib_free(parser
->rdev
, &parser
->const_ib
);
327 static int radeon_cs_ib_chunk(struct radeon_device
*rdev
,
328 struct radeon_cs_parser
*parser
)
332 if (parser
->chunk_ib_idx
== -1)
335 if (parser
->cs_flags
& RADEON_CS_USE_VM
)
338 r
= radeon_cs_parse(rdev
, parser
->ring
, parser
);
339 if (r
|| parser
->parser_error
) {
340 DRM_ERROR("Invalid command stream !\n");
344 if (parser
->ring
== R600_RING_TYPE_UVD_INDEX
)
345 radeon_uvd_note_usage(rdev
);
347 radeon_cs_sync_rings(parser
);
348 r
= radeon_ib_schedule(rdev
, &parser
->ib
, NULL
);
350 DRM_ERROR("Failed to schedule IB !\n");
355 static int radeon_bo_vm_update_pte(struct radeon_cs_parser
*parser
,
356 struct radeon_vm
*vm
)
358 struct radeon_device
*rdev
= parser
->rdev
;
359 struct radeon_bo_list
*lobj
;
360 struct radeon_bo
*bo
;
363 r
= radeon_vm_bo_update(rdev
, vm
, rdev
->ring_tmp_bo
.bo
, &rdev
->ring_tmp_bo
.bo
->tbo
.mem
);
367 list_for_each_entry(lobj
, &parser
->validated
, tv
.head
) {
369 r
= radeon_vm_bo_update(parser
->rdev
, vm
, bo
, &bo
->tbo
.mem
);
377 static int radeon_cs_ib_vm_chunk(struct radeon_device
*rdev
,
378 struct radeon_cs_parser
*parser
)
380 struct radeon_fpriv
*fpriv
= parser
->filp
->driver_priv
;
381 struct radeon_vm
*vm
= &fpriv
->vm
;
384 if (parser
->chunk_ib_idx
== -1)
386 if ((parser
->cs_flags
& RADEON_CS_USE_VM
) == 0)
389 if (parser
->const_ib
.length_dw
) {
390 r
= radeon_ring_ib_parse(rdev
, parser
->ring
, &parser
->const_ib
);
396 r
= radeon_ring_ib_parse(rdev
, parser
->ring
, &parser
->ib
);
401 if (parser
->ring
== R600_RING_TYPE_UVD_INDEX
)
402 radeon_uvd_note_usage(rdev
);
404 mutex_lock(&rdev
->vm_manager
.lock
);
405 mutex_lock(&vm
->mutex
);
406 r
= radeon_vm_alloc_pt(rdev
, vm
);
410 r
= radeon_bo_vm_update_pte(parser
, vm
);
414 radeon_cs_sync_rings(parser
);
415 radeon_semaphore_sync_to(parser
->ib
.semaphore
, vm
->fence
);
416 radeon_semaphore_sync_to(parser
->ib
.semaphore
,
417 radeon_vm_grab_id(rdev
, vm
, parser
->ring
));
419 if ((rdev
->family
>= CHIP_TAHITI
) &&
420 (parser
->chunk_const_ib_idx
!= -1)) {
421 r
= radeon_ib_schedule(rdev
, &parser
->ib
, &parser
->const_ib
);
423 r
= radeon_ib_schedule(rdev
, &parser
->ib
, NULL
);
427 radeon_vm_fence(rdev
, vm
, parser
->ib
.fence
);
431 radeon_vm_add_to_lru(rdev
, vm
);
432 mutex_unlock(&vm
->mutex
);
433 mutex_unlock(&rdev
->vm_manager
.lock
);
437 static int radeon_cs_handle_lockup(struct radeon_device
*rdev
, int r
)
440 r
= radeon_gpu_reset(rdev
);
447 static int radeon_cs_ib_fill(struct radeon_device
*rdev
, struct radeon_cs_parser
*parser
)
449 struct radeon_cs_chunk
*ib_chunk
;
450 struct radeon_vm
*vm
= NULL
;
453 if (parser
->chunk_ib_idx
== -1)
456 if (parser
->cs_flags
& RADEON_CS_USE_VM
) {
457 struct radeon_fpriv
*fpriv
= parser
->filp
->driver_priv
;
460 if ((rdev
->family
>= CHIP_TAHITI
) &&
461 (parser
->chunk_const_ib_idx
!= -1)) {
462 ib_chunk
= &parser
->chunks
[parser
->chunk_const_ib_idx
];
463 if (ib_chunk
->length_dw
> RADEON_IB_VM_MAX_SIZE
) {
464 DRM_ERROR("cs IB CONST too big: %d\n", ib_chunk
->length_dw
);
467 r
= radeon_ib_get(rdev
, parser
->ring
, &parser
->const_ib
,
468 vm
, ib_chunk
->length_dw
* 4);
470 DRM_ERROR("Failed to get const ib !\n");
473 parser
->const_ib
.is_const_ib
= true;
474 parser
->const_ib
.length_dw
= ib_chunk
->length_dw
;
475 if (copy_from_user(parser
->const_ib
.ptr
,
477 ib_chunk
->length_dw
* 4))
481 ib_chunk
= &parser
->chunks
[parser
->chunk_ib_idx
];
482 if (ib_chunk
->length_dw
> RADEON_IB_VM_MAX_SIZE
) {
483 DRM_ERROR("cs IB too big: %d\n", ib_chunk
->length_dw
);
487 ib_chunk
= &parser
->chunks
[parser
->chunk_ib_idx
];
489 r
= radeon_ib_get(rdev
, parser
->ring
, &parser
->ib
,
490 vm
, ib_chunk
->length_dw
* 4);
492 DRM_ERROR("Failed to get ib !\n");
495 parser
->ib
.length_dw
= ib_chunk
->length_dw
;
497 memcpy(parser
->ib
.ptr
, ib_chunk
->kdata
, ib_chunk
->length_dw
* 4);
498 else if (copy_from_user(parser
->ib
.ptr
, ib_chunk
->user_ptr
, ib_chunk
->length_dw
* 4))
503 int radeon_cs_ioctl(struct drm_device
*dev
, void *data
, struct drm_file
*filp
)
505 struct radeon_device
*rdev
= dev
->dev_private
;
506 struct radeon_cs_parser parser
;
509 down_read(&rdev
->exclusive_lock
);
510 if (!rdev
->accel_working
) {
511 up_read(&rdev
->exclusive_lock
);
514 /* initialize parser */
515 memset(&parser
, 0, sizeof(struct radeon_cs_parser
));
518 parser
.dev
= rdev
->dev
;
519 parser
.family
= rdev
->family
;
520 r
= radeon_cs_parser_init(&parser
, data
);
522 DRM_ERROR("Failed to initialize parser !\n");
523 radeon_cs_parser_fini(&parser
, r
, false);
524 up_read(&rdev
->exclusive_lock
);
525 r
= radeon_cs_handle_lockup(rdev
, r
);
529 r
= radeon_cs_ib_fill(rdev
, &parser
);
531 r
= radeon_cs_parser_relocs(&parser
);
532 if (r
&& r
!= -ERESTARTSYS
)
533 DRM_ERROR("Failed to parse relocation %d!\n", r
);
537 radeon_cs_parser_fini(&parser
, r
, false);
538 up_read(&rdev
->exclusive_lock
);
539 r
= radeon_cs_handle_lockup(rdev
, r
);
543 trace_radeon_cs(&parser
);
545 r
= radeon_cs_ib_chunk(rdev
, &parser
);
549 r
= radeon_cs_ib_vm_chunk(rdev
, &parser
);
554 radeon_cs_parser_fini(&parser
, r
, true);
555 up_read(&rdev
->exclusive_lock
);
556 r
= radeon_cs_handle_lockup(rdev
, r
);
561 * radeon_cs_packet_parse() - parse cp packet and point ib index to next packet
562 * @parser: parser structure holding parsing context.
563 * @pkt: where to store packet information
565 * Assume that chunk_ib_index is properly set. Will return -EINVAL
566 * if packet is bigger than remaining ib size. or if packets is unknown.
568 int radeon_cs_packet_parse(struct radeon_cs_parser
*p
,
569 struct radeon_cs_packet
*pkt
,
572 struct radeon_cs_chunk
*ib_chunk
= &p
->chunks
[p
->chunk_ib_idx
];
573 struct radeon_device
*rdev
= p
->rdev
;
576 if (idx
>= ib_chunk
->length_dw
) {
577 DRM_ERROR("Can not parse packet at %d after CS end %d !\n",
578 idx
, ib_chunk
->length_dw
);
581 header
= radeon_get_ib_value(p
, idx
);
583 pkt
->type
= RADEON_CP_PACKET_GET_TYPE(header
);
584 pkt
->count
= RADEON_CP_PACKET_GET_COUNT(header
);
587 case RADEON_PACKET_TYPE0
:
588 if (rdev
->family
< CHIP_R600
) {
589 pkt
->reg
= R100_CP_PACKET0_GET_REG(header
);
591 RADEON_CP_PACKET0_GET_ONE_REG_WR(header
);
593 pkt
->reg
= R600_CP_PACKET0_GET_REG(header
);
595 case RADEON_PACKET_TYPE3
:
596 pkt
->opcode
= RADEON_CP_PACKET3_GET_OPCODE(header
);
598 case RADEON_PACKET_TYPE2
:
602 DRM_ERROR("Unknown packet type %d at %d !\n", pkt
->type
, idx
);
605 if ((pkt
->count
+ 1 + pkt
->idx
) >= ib_chunk
->length_dw
) {
606 DRM_ERROR("Packet (%d:%d:%d) end after CS buffer (%d) !\n",
607 pkt
->idx
, pkt
->type
, pkt
->count
, ib_chunk
->length_dw
);
614 * radeon_cs_packet_next_is_pkt3_nop() - test if the next packet is P3 NOP
615 * @p: structure holding the parser context.
617 * Check if the next packet is NOP relocation packet3.
619 bool radeon_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser
*p
)
621 struct radeon_cs_packet p3reloc
;
624 r
= radeon_cs_packet_parse(p
, &p3reloc
, p
->idx
);
627 if (p3reloc
.type
!= RADEON_PACKET_TYPE3
)
629 if (p3reloc
.opcode
!= RADEON_PACKET3_NOP
)
635 * radeon_cs_dump_packet() - dump raw packet context
636 * @p: structure holding the parser context.
637 * @pkt: structure holding the packet.
639 * Used mostly for debugging and error reporting.
641 void radeon_cs_dump_packet(struct radeon_cs_parser
*p
,
642 struct radeon_cs_packet
*pkt
)
644 volatile uint32_t *ib
;
650 for (i
= 0; i
<= (pkt
->count
+ 1); i
++, idx
++)
651 DRM_INFO("ib[%d]=0x%08X\n", idx
, ib
[idx
]);
655 * radeon_cs_packet_next_reloc() - parse next (should be reloc) packet
656 * @parser: parser structure holding parsing context.
657 * @data: pointer to relocation data
658 * @offset_start: starting offset
659 * @offset_mask: offset mask (to align start offset on)
660 * @reloc: reloc informations
662 * Check if next packet is relocation packet3, do bo validation and compute
663 * GPU offset using the provided start.
665 int radeon_cs_packet_next_reloc(struct radeon_cs_parser
*p
,
666 struct radeon_cs_reloc
**cs_reloc
,
669 struct radeon_cs_chunk
*relocs_chunk
;
670 struct radeon_cs_packet p3reloc
;
674 if (p
->chunk_relocs_idx
== -1) {
675 DRM_ERROR("No relocation chunk !\n");
679 relocs_chunk
= &p
->chunks
[p
->chunk_relocs_idx
];
680 r
= radeon_cs_packet_parse(p
, &p3reloc
, p
->idx
);
683 p
->idx
+= p3reloc
.count
+ 2;
684 if (p3reloc
.type
!= RADEON_PACKET_TYPE3
||
685 p3reloc
.opcode
!= RADEON_PACKET3_NOP
) {
686 DRM_ERROR("No packet3 for relocation for packet at %d.\n",
688 radeon_cs_dump_packet(p
, &p3reloc
);
691 idx
= radeon_get_ib_value(p
, p3reloc
.idx
+ 1);
692 if (idx
>= relocs_chunk
->length_dw
) {
693 DRM_ERROR("Relocs at %d after relocations chunk end %d !\n",
694 idx
, relocs_chunk
->length_dw
);
695 radeon_cs_dump_packet(p
, &p3reloc
);
698 /* FIXME: we assume reloc size is 4 dwords */
700 *cs_reloc
= p
->relocs
;
701 (*cs_reloc
)->lobj
.gpu_offset
=
702 (u64
)relocs_chunk
->kdata
[idx
+ 3] << 32;
703 (*cs_reloc
)->lobj
.gpu_offset
|= relocs_chunk
->kdata
[idx
+ 0];
705 *cs_reloc
= p
->relocs_ptr
[(idx
/ 4)];