interrupt.c (c8fe6a6811a7186656379d0c27e85325a966077a) | interrupt.c (04d348ae3f0aea6523bc3b0688b5fc90c1c60d0e) |
---|---|
1/* 2 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the --- 653 unchanged lines hidden (view full) --- 662 int i; 663 664 for (i = 0; i < INTEL_GVT_EVENT_MAX; i++) { 665 irq->events[i].info = NULL; 666 irq->events[i].v_handler = handle_default_event_virt; 667 } 668} 669 | 1/* 2 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the --- 653 unchanged lines hidden (view full) --- 662 int i; 663 664 for (i = 0; i < INTEL_GVT_EVENT_MAX; i++) { 665 irq->events[i].info = NULL; 666 irq->events[i].v_handler = handle_default_event_virt; 667 } 668} 669 |
670static enum hrtimer_restart vblank_timer_fn(struct hrtimer *data) 671{ 672 struct intel_gvt_vblank_timer *vblank_timer; 673 struct intel_gvt_irq *irq; 674 struct intel_gvt *gvt; 675 676 vblank_timer = container_of(data, struct intel_gvt_vblank_timer, timer); 677 irq = container_of(vblank_timer, struct intel_gvt_irq, vblank_timer); 678 gvt = container_of(irq, struct intel_gvt, irq); 679 680 intel_gvt_request_service(gvt, INTEL_GVT_REQUEST_EMULATE_VBLANK); 681 hrtimer_add_expires_ns(&vblank_timer->timer, vblank_timer->period); 682 return HRTIMER_RESTART; 683} 684 |
|
670/** 671 * intel_gvt_clean_irq - clean up GVT-g IRQ emulation subsystem 672 * @gvt: a GVT device 673 * 674 * This function is called at driver unloading stage, to clean up GVT-g IRQ 675 * emulation subsystem. 676 * 677 */ 678void intel_gvt_clean_irq(struct intel_gvt *gvt) 679{ | 685/** 686 * intel_gvt_clean_irq - clean up GVT-g IRQ emulation subsystem 687 * @gvt: a GVT device 688 * 689 * This function is called at driver unloading stage, to clean up GVT-g IRQ 690 * emulation subsystem. 691 * 692 */ 693void intel_gvt_clean_irq(struct intel_gvt *gvt) 694{ |
695 struct intel_gvt_irq *irq = &gvt->irq; 696 697 hrtimer_cancel(&irq->vblank_timer.timer); |
|
680} 681 | 698} 699 |
700#define VBLNAK_TIMER_PERIOD 16000000 701 |
|
682/** 683 * intel_gvt_init_irq - initialize GVT-g IRQ emulation subsystem 684 * @gvt: a GVT device 685 * 686 * This function is called at driver loading stage, to initialize the GVT-g IRQ 687 * emulation subsystem. 688 * 689 * Returns: 690 * Zero on success, negative error code if failed. 691 */ 692int intel_gvt_init_irq(struct intel_gvt *gvt) 693{ 694 struct intel_gvt_irq *irq = &gvt->irq; | 702/** 703 * intel_gvt_init_irq - initialize GVT-g IRQ emulation subsystem 704 * @gvt: a GVT device 705 * 706 * This function is called at driver loading stage, to initialize the GVT-g IRQ 707 * emulation subsystem. 708 * 709 * Returns: 710 * Zero on success, negative error code if failed. 711 */ 712int intel_gvt_init_irq(struct intel_gvt *gvt) 713{ 714 struct intel_gvt_irq *irq = &gvt->irq; |
715 struct intel_gvt_vblank_timer *vblank_timer = &irq->vblank_timer; |
|
695 696 gvt_dbg_core("init irq framework\n"); 697 698 if (IS_BROADWELL(gvt->dev_priv) || IS_SKYLAKE(gvt->dev_priv)) { 699 irq->ops = &gen8_irq_ops; 700 irq->irq_map = gen8_irq_map; 701 } else { 702 WARN_ON(1); 703 return -ENODEV; 704 } 705 706 /* common event initialization */ 707 init_events(irq); 708 709 /* gen specific initialization */ 710 irq->ops->init_irq(irq); 711 712 init_irq_map(irq); | 716 717 gvt_dbg_core("init irq framework\n"); 718 719 if (IS_BROADWELL(gvt->dev_priv) || IS_SKYLAKE(gvt->dev_priv)) { 720 irq->ops = &gen8_irq_ops; 721 irq->irq_map = gen8_irq_map; 722 } else { 723 WARN_ON(1); 724 return -ENODEV; 725 } 726 727 /* common event initialization */ 728 init_events(irq); 729 730 /* gen specific initialization */ 731 irq->ops->init_irq(irq); 732 733 init_irq_map(irq); |
734 735 hrtimer_init(&vblank_timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 736 vblank_timer->timer.function = vblank_timer_fn; 737 vblank_timer->period = VBLNAK_TIMER_PERIOD; 738 |
|
713 return 0; 714} | 739 return 0; 740} |