hmm.h (f32471e2cf87112b8f5dc10469b27c39c1a41722) | hmm.h (1f961807925032daa90267d8a23ff730e7ede07a) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Copyright 2013 Red Hat Inc. 4 * 5 * Authors: Jérôme Glisse <jglisse@redhat.com> 6 */ 7/* 8 * Heterogeneous Memory Management (HMM) --- 327 unchanged lines hidden (view full) --- 336 * // Other device driver specific cleanup, and now das can be freed 337 * ... 338 * } 339 */ 340 341struct hmm_mirror; 342 343/* | 1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Copyright 2013 Red Hat Inc. 4 * 5 * Authors: Jérôme Glisse <jglisse@redhat.com> 6 */ 7/* 8 * Heterogeneous Memory Management (HMM) --- 327 unchanged lines hidden (view full) --- 336 * // Other device driver specific cleanup, and now das can be freed 337 * ... 338 * } 339 */ 340 341struct hmm_mirror; 342 343/* |
344 * enum hmm_update_event - type of update 345 * @HMM_UPDATE_INVALIDATE: invalidate range (no indication as to why) 346 */ 347enum hmm_update_event { 348 HMM_UPDATE_INVALIDATE, 349}; 350 351/* 352 * struct hmm_update - HMM update information for callback 353 * 354 * @start: virtual start address of the range to update 355 * @end: virtual end address of the range to update 356 * @event: event triggering the update (what is happening) 357 * @blockable: can the callback block/sleep ? 358 */ 359struct hmm_update { 360 unsigned long start; 361 unsigned long end; 362 enum hmm_update_event event; 363 bool blockable; 364}; 365 366/* | |
367 * struct hmm_mirror_ops - HMM mirror device operations callback 368 * 369 * @update: callback to update range on a device 370 */ 371struct hmm_mirror_ops { 372 /* release() - release hmm_mirror 373 * 374 * @mirror: pointer to struct hmm_mirror 375 * 376 * This is called when the mm_struct is being released. The callback 377 * must ensure that all access to any pages obtained from this mirror 378 * is halted before the callback returns. All future access should 379 * fault. 380 */ 381 void (*release)(struct hmm_mirror *mirror); 382 383 /* sync_cpu_device_pagetables() - synchronize page tables 384 * 385 * @mirror: pointer to struct hmm_mirror | 344 * struct hmm_mirror_ops - HMM mirror device operations callback 345 * 346 * @update: callback to update range on a device 347 */ 348struct hmm_mirror_ops { 349 /* release() - release hmm_mirror 350 * 351 * @mirror: pointer to struct hmm_mirror 352 * 353 * This is called when the mm_struct is being released. The callback 354 * must ensure that all access to any pages obtained from this mirror 355 * is halted before the callback returns. All future access should 356 * fault. 357 */ 358 void (*release)(struct hmm_mirror *mirror); 359 360 /* sync_cpu_device_pagetables() - synchronize page tables 361 * 362 * @mirror: pointer to struct hmm_mirror |
386 * @update: update information (see struct hmm_update) 387 * Return: -EAGAIN if update.blockable false and callback need to 388 * block, 0 otherwise. | 363 * @update: update information (see struct mmu_notifier_range) 364 * Return: -EAGAIN if mmu_notifier_range_blockable(update) is false 365 * and callback needs to block, 0 otherwise. |
389 * 390 * This callback ultimately originates from mmu_notifiers when the CPU 391 * page table is updated. The device driver must update its page table 392 * in response to this callback. The update argument tells what action 393 * to perform. 394 * 395 * The device driver must not return from this callback until the device 396 * page tables are completely updated (TLBs flushed, etc); this is a 397 * synchronous call. 398 */ | 366 * 367 * This callback ultimately originates from mmu_notifiers when the CPU 368 * page table is updated. The device driver must update its page table 369 * in response to this callback. The update argument tells what action 370 * to perform. 371 * 372 * The device driver must not return from this callback until the device 373 * page tables are completely updated (TLBs flushed, etc); this is a 374 * synchronous call. 375 */ |
399 int (*sync_cpu_device_pagetables)(struct hmm_mirror *mirror, 400 const struct hmm_update *update); | 376 int (*sync_cpu_device_pagetables)( 377 struct hmm_mirror *mirror, 378 const struct mmu_notifier_range *update); |
401}; 402 403/* 404 * struct hmm_mirror - mirror struct for a device driver 405 * 406 * @hmm: pointer to struct hmm (which is unique per mm_struct) 407 * @ops: device driver callback for HMM mirror operations 408 * @list: for list of mirrors of a given mm --- 54 unchanged lines hidden --- | 379}; 380 381/* 382 * struct hmm_mirror - mirror struct for a device driver 383 * 384 * @hmm: pointer to struct hmm (which is unique per mm_struct) 385 * @ops: device driver callback for HMM mirror operations 386 * @list: for list of mirrors of a given mm --- 54 unchanged lines hidden --- |