interrupt.c (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) interrupt.c (b01739fb865a268aec617f6bb5d2ef498da72697)
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

--- 633 unchanged lines hidden (view full) ---

642 int i;
643
644 for (i = 0; i < INTEL_GVT_EVENT_MAX; i++) {
645 irq->events[i].info = NULL;
646 irq->events[i].v_handler = handle_default_event_virt;
647 }
648}
649
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

--- 633 unchanged lines hidden (view full) ---

642 int i;
643
644 for (i = 0; i < INTEL_GVT_EVENT_MAX; i++) {
645 irq->events[i].info = NULL;
646 irq->events[i].v_handler = handle_default_event_virt;
647 }
648}
649
650static enum hrtimer_restart vblank_timer_fn(struct hrtimer *data)
651{
652 struct intel_gvt_vblank_timer *vblank_timer;
653 struct intel_gvt_irq *irq;
654 struct intel_gvt *gvt;
655
656 vblank_timer = container_of(data, struct intel_gvt_vblank_timer, timer);
657 irq = container_of(vblank_timer, struct intel_gvt_irq, vblank_timer);
658 gvt = container_of(irq, struct intel_gvt, irq);
659
660 intel_gvt_request_service(gvt, INTEL_GVT_REQUEST_EMULATE_VBLANK);
661 hrtimer_add_expires_ns(&vblank_timer->timer, vblank_timer->period);
662 return HRTIMER_RESTART;
663}
664
665/**
650/**
666 * intel_gvt_clean_irq - clean up GVT-g IRQ emulation subsystem
667 * @gvt: a GVT device
668 *
669 * This function is called at driver unloading stage, to clean up GVT-g IRQ
670 * emulation subsystem.
671 *
672 */
673void intel_gvt_clean_irq(struct intel_gvt *gvt)
674{
675 struct intel_gvt_irq *irq = &gvt->irq;
676
677 hrtimer_cancel(&irq->vblank_timer.timer);
678}
679
680#define VBLANK_TIMER_PERIOD 16000000
681
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;
651 * intel_gvt_init_irq - initialize GVT-g IRQ emulation subsystem
652 * @gvt: a GVT device
653 *
654 * This function is called at driver loading stage, to initialize the GVT-g IRQ
655 * emulation subsystem.
656 *
657 * Returns:
658 * Zero on success, negative error code if failed.
659 */
660int intel_gvt_init_irq(struct intel_gvt *gvt)
661{
662 struct intel_gvt_irq *irq = &gvt->irq;
695 struct intel_gvt_vblank_timer *vblank_timer = &irq->vblank_timer;
696
697 gvt_dbg_core("init irq framework\n");
698
699 irq->ops = &gen8_irq_ops;
700 irq->irq_map = gen8_irq_map;
701
702 /* common event initialization */
703 init_events(irq);
704
705 /* gen specific initialization */
706 irq->ops->init_irq(irq);
707
708 init_irq_map(irq);
709
663
664 gvt_dbg_core("init irq framework\n");
665
666 irq->ops = &gen8_irq_ops;
667 irq->irq_map = gen8_irq_map;
668
669 /* common event initialization */
670 init_events(irq);
671
672 /* gen specific initialization */
673 irq->ops->init_irq(irq);
674
675 init_irq_map(irq);
676
710 hrtimer_init(&vblank_timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
711 vblank_timer->timer.function = vblank_timer_fn;
712 vblank_timer->period = VBLANK_TIMER_PERIOD;
713
714 return 0;
715}
677 return 0;
678}