Message ID | 20230102161757.v5.5.I9e10545c6a448d5eb1b734839b871d1b3146dac3@changeid (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Improve GPU reset sequence for Adreno GPU | expand |
Hi Akhil, Thank you for the patch! Yet something to improve: [auto build test ERROR on rafael-pm/linux-next] [also build test ERROR on drm/drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.2-rc2 next-20221226] [cannot apply to drm-misc/drm-misc-next clk/clk-next drm-exynos/exynos-drm-next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Akhil-P-Oommen/PM-domains-Allow-a-genpd-consumer-to-require-a-synced-power-off/20230102-185027 base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next patch link: https://lore.kernel.org/r/20230102161757.v5.5.I9e10545c6a448d5eb1b734839b871d1b3146dac3%40changeid patch subject: [PATCH v5 5/5] drm/msm/a6xx: Use genpd notifier to ensure cx-gdsc collapse config: ia64-randconfig-r004-20230102 compiler: ia64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/c9b6ea9d206842b4117757b53c1bf66363090e1d git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Akhil-P-Oommen/PM-domains-Allow-a-genpd-consumer-to-require-a-synced-power-off/20230102-185027 git checkout c9b6ea9d206842b4117757b53c1bf66363090e1d # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/base/power/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): drivers/base/power/domain.c: In function 'genpd_queue_power_off_work': >> drivers/base/power/domain.c:657:20: error: 'pm_wq' undeclared (first use in this function) 657 | queue_work(pm_wq, &genpd->power_off_work); | ^~~~~ drivers/base/power/domain.c:657:20: note: each undeclared identifier is reported only once for each function it appears in drivers/base/power/domain.c: In function 'genpd_dev_pm_qos_notifier': >> drivers/base/power/domain.c:856:39: error: 'struct dev_pm_info' has no member named 'ignore_children' 856 | if (!dev || dev->power.ignore_children) | ^ drivers/base/power/domain.c: In function 'rtpm_status_str': >> drivers/base/power/domain.c:3093:23: error: 'struct dev_pm_info' has no member named 'runtime_error' 3093 | if (dev->power.runtime_error) | ^ >> drivers/base/power/domain.c:3095:28: error: 'struct dev_pm_info' has no member named 'disable_depth' 3095 | else if (dev->power.disable_depth) | ^ >> drivers/base/power/domain.c:3097:28: error: 'struct dev_pm_info' has no member named 'runtime_status' 3097 | else if (dev->power.runtime_status < ARRAY_SIZE(status_lookup)) | ^ drivers/base/power/domain.c:3098:45: error: 'struct dev_pm_info' has no member named 'runtime_status' 3098 | p = status_lookup[dev->power.runtime_status]; | ^ -- drivers/base/power/domain_governor.c: In function 'default_suspend_ok': >> drivers/base/power/domain_governor.c:85:24: error: 'struct dev_pm_info' has no member named 'ignore_children' 85 | if (!dev->power.ignore_children) | ^ Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS Depends on [n]: PM [=n] Selected by [y]: - DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM || SOC_IMX5 || COMPILE_TEST [=y]) && COMMON_CLK [=y] && IOMMU_SUPPORT [=y] && (QCOM_OCMEM [=n] || QCOM_OCMEM [=n]=n) && (QCOM_LLCC [=y] || QCOM_LLCC [=y]=n) && (QCOM_COMMAND_DB [=n] || QCOM_COMMAND_DB [=n]=n) vim +/pm_wq +657 drivers/base/power/domain.c c8f0ea45169c57 Geert Uytterhoeven 2014-11-10 647 29e47e2173349e Ulf Hansson 2015-09-02 648 /** 86e12eac1f7f84 Ulf Hansson 2016-12-08 649 * genpd_queue_power_off_work - Queue up the execution of genpd_power_off(). a3d09c73492e57 Moritz Fischer 2016-01-27 650 * @genpd: PM domain to power off. 29e47e2173349e Ulf Hansson 2015-09-02 651 * 86e12eac1f7f84 Ulf Hansson 2016-12-08 652 * Queue up the execution of genpd_power_off() unless it's already been done 29e47e2173349e Ulf Hansson 2015-09-02 653 * before. 29e47e2173349e Ulf Hansson 2015-09-02 654 */ 29e47e2173349e Ulf Hansson 2015-09-02 655 static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) 29e47e2173349e Ulf Hansson 2015-09-02 656 { 29e47e2173349e Ulf Hansson 2015-09-02 @657 queue_work(pm_wq, &genpd->power_off_work); 29e47e2173349e Ulf Hansson 2015-09-02 658 } 29e47e2173349e Ulf Hansson 2015-09-02 659 1f8728b7adc4c2 Ulf Hansson 2017-02-17 660 /** 1f8728b7adc4c2 Ulf Hansson 2017-02-17 661 * genpd_power_off - Remove power from a given PM domain. 1f8728b7adc4c2 Ulf Hansson 2017-02-17 662 * @genpd: PM domain to power down. 3c64649d1cf9f3 Ulf Hansson 2017-02-17 663 * @one_dev_on: If invoked from genpd's ->runtime_suspend|resume() callback, the 3c64649d1cf9f3 Ulf Hansson 2017-02-17 664 * RPM status of the releated device is in an intermediate state, not yet turned 3c64649d1cf9f3 Ulf Hansson 2017-02-17 665 * into RPM_SUSPENDED. This means genpd_power_off() must allow one device to not 3c64649d1cf9f3 Ulf Hansson 2017-02-17 666 * be RPM_SUSPENDED, while it tries to power off the PM domain. 763663c9715f5f Yang Yingliang 2021-05-12 667 * @depth: nesting count for lockdep. 1f8728b7adc4c2 Ulf Hansson 2017-02-17 668 * 1f8728b7adc4c2 Ulf Hansson 2017-02-17 669 * If all of the @genpd's devices have been suspended and all of its subdomains 1f8728b7adc4c2 Ulf Hansson 2017-02-17 670 * have been powered down, remove power from @genpd. 1f8728b7adc4c2 Ulf Hansson 2017-02-17 671 */ 2da835452a0875 Ulf Hansson 2017-02-17 672 static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, 2da835452a0875 Ulf Hansson 2017-02-17 673 unsigned int depth) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 674 { 1f8728b7adc4c2 Ulf Hansson 2017-02-17 675 struct pm_domain_data *pdd; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 676 struct gpd_link *link; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 677 unsigned int not_suspended = 0; f63816e43d9044 Ulf Hansson 2020-09-24 678 int ret; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 679 1f8728b7adc4c2 Ulf Hansson 2017-02-17 680 /* 1f8728b7adc4c2 Ulf Hansson 2017-02-17 681 * Do not try to power off the domain in the following situations: 1f8728b7adc4c2 Ulf Hansson 2017-02-17 682 * (1) The domain is already in the "power off" state. 1f8728b7adc4c2 Ulf Hansson 2017-02-17 683 * (2) System suspend is in progress. 1f8728b7adc4c2 Ulf Hansson 2017-02-17 684 */ 41e2c8e0060db2 Ulf Hansson 2017-03-20 685 if (!genpd_status_on(genpd) || genpd->prepared_count > 0) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 686 return 0; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 687 ffaa42e8a40b7f Ulf Hansson 2017-03-20 688 /* ffaa42e8a40b7f Ulf Hansson 2017-03-20 689 * Abort power off for the PM domain in the following situations: ffaa42e8a40b7f Ulf Hansson 2017-03-20 690 * (1) The domain is configured as always on. ffaa42e8a40b7f Ulf Hansson 2017-03-20 691 * (2) When the domain has a subdomain being powered on. ffaa42e8a40b7f Ulf Hansson 2017-03-20 692 */ ed61e18a4b4e44 Leonard Crestez 2019-04-30 693 if (genpd_is_always_on(genpd) || ed61e18a4b4e44 Leonard Crestez 2019-04-30 694 genpd_is_rpm_always_on(genpd) || ed61e18a4b4e44 Leonard Crestez 2019-04-30 695 atomic_read(&genpd->sd_count) > 0) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 696 return -EBUSY; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 697 e7d90cfac5510f Ulf Hansson 2022-02-17 698 /* e7d90cfac5510f Ulf Hansson 2022-02-17 699 * The children must be in their deepest (powered-off) states to allow e7d90cfac5510f Ulf Hansson 2022-02-17 700 * the parent to be powered off. Note that, there's no need for e7d90cfac5510f Ulf Hansson 2022-02-17 701 * additional locking, as powering on a child, requires the parent's e7d90cfac5510f Ulf Hansson 2022-02-17 702 * lock to be acquired first. e7d90cfac5510f Ulf Hansson 2022-02-17 703 */ e7d90cfac5510f Ulf Hansson 2022-02-17 704 list_for_each_entry(link, &genpd->parent_links, parent_node) { e7d90cfac5510f Ulf Hansson 2022-02-17 705 struct generic_pm_domain *child = link->child; e7d90cfac5510f Ulf Hansson 2022-02-17 706 if (child->state_idx < child->state_count - 1) e7d90cfac5510f Ulf Hansson 2022-02-17 707 return -EBUSY; e7d90cfac5510f Ulf Hansson 2022-02-17 708 } e7d90cfac5510f Ulf Hansson 2022-02-17 709 1f8728b7adc4c2 Ulf Hansson 2017-02-17 710 list_for_each_entry(pdd, &genpd->dev_list, list_node) { 1f8728b7adc4c2 Ulf Hansson 2017-02-17 711 /* 1f8728b7adc4c2 Ulf Hansson 2017-02-17 712 * Do not allow PM domain to be powered off, when an IRQ safe 1f8728b7adc4c2 Ulf Hansson 2017-02-17 713 * device is part of a non-IRQ safe domain. 1f8728b7adc4c2 Ulf Hansson 2017-02-17 714 */ 1f8728b7adc4c2 Ulf Hansson 2017-02-17 715 if (!pm_runtime_suspended(pdd->dev) || 7a02444b8fc25a Ulf Hansson 2022-05-11 716 irq_safe_dev_in_sleep_domain(pdd->dev, genpd)) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 717 not_suspended++; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 718 } 1f8728b7adc4c2 Ulf Hansson 2017-02-17 719 3c64649d1cf9f3 Ulf Hansson 2017-02-17 720 if (not_suspended > 1 || (not_suspended == 1 && !one_dev_on)) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 721 return -EBUSY; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 722 1f8728b7adc4c2 Ulf Hansson 2017-02-17 723 if (genpd->gov && genpd->gov->power_down_ok) { 1f8728b7adc4c2 Ulf Hansson 2017-02-17 724 if (!genpd->gov->power_down_ok(&genpd->domain)) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 725 return -EAGAIN; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 726 } 1f8728b7adc4c2 Ulf Hansson 2017-02-17 727 2c9b7f8772033c Ulf Hansson 2018-10-03 728 /* Default to shallowest state. */ 2c9b7f8772033c Ulf Hansson 2018-10-03 729 if (!genpd->gov) 2c9b7f8772033c Ulf Hansson 2018-10-03 730 genpd->state_idx = 0; 2c9b7f8772033c Ulf Hansson 2018-10-03 731 f63816e43d9044 Ulf Hansson 2020-09-24 732 /* Don't power off, if a child domain is waiting to power on. */ 1f8728b7adc4c2 Ulf Hansson 2017-02-17 733 if (atomic_read(&genpd->sd_count) > 0) 1f8728b7adc4c2 Ulf Hansson 2017-02-17 734 return -EBUSY; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 735 1f8728b7adc4c2 Ulf Hansson 2017-02-17 736 ret = _genpd_power_off(genpd, true); c6a113b52302ad Lina Iyer 2020-10-15 737 if (ret) { c6a113b52302ad Lina Iyer 2020-10-15 738 genpd->states[genpd->state_idx].rejected++; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 739 return ret; c6a113b52302ad Lina Iyer 2020-10-15 740 } 1f8728b7adc4c2 Ulf Hansson 2017-02-17 741 49f618e1b669ef Ulf Hansson 2020-09-24 742 genpd->status = GENPD_STATE_OFF; afece3ab9a3640 Thara Gopinath 2017-07-14 743 genpd_update_accounting(genpd); c6a113b52302ad Lina Iyer 2020-10-15 744 genpd->states[genpd->state_idx].usage++; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 745 8d87ae48ced2df Kees Cook 2020-07-08 746 list_for_each_entry(link, &genpd->child_links, child_node) { 8d87ae48ced2df Kees Cook 2020-07-08 747 genpd_sd_counter_dec(link->parent); 8d87ae48ced2df Kees Cook 2020-07-08 748 genpd_lock_nested(link->parent, depth + 1); 8d87ae48ced2df Kees Cook 2020-07-08 749 genpd_power_off(link->parent, false, depth + 1); 8d87ae48ced2df Kees Cook 2020-07-08 750 genpd_unlock(link->parent); 1f8728b7adc4c2 Ulf Hansson 2017-02-17 751 } 1f8728b7adc4c2 Ulf Hansson 2017-02-17 752 1f8728b7adc4c2 Ulf Hansson 2017-02-17 753 return 0; 1f8728b7adc4c2 Ulf Hansson 2017-02-17 754 } 1f8728b7adc4c2 Ulf Hansson 2017-02-17 755 5248051b9afb66 Rafael J. Wysocki 2011-07-01 756 /** 8d87ae48ced2df Kees Cook 2020-07-08 757 * genpd_power_on - Restore power to a given PM domain and its parents. 5248051b9afb66 Rafael J. Wysocki 2011-07-01 758 * @genpd: PM domain to power up. 0106ef5146f9e8 Marek Szyprowski 2016-01-20 759 * @depth: nesting count for lockdep. 5248051b9afb66 Rafael J. Wysocki 2011-07-01 760 * 8d87ae48ced2df Kees Cook 2020-07-08 761 * Restore power to @genpd and all of its parents so that it is possible to 5248051b9afb66 Rafael J. Wysocki 2011-07-01 762 * resume a device belonging to it. 5248051b9afb66 Rafael J. Wysocki 2011-07-01 763 */ 86e12eac1f7f84 Ulf Hansson 2016-12-08 764 static int genpd_power_on(struct generic_pm_domain *genpd, unsigned int depth) 5248051b9afb66 Rafael J. Wysocki 2011-07-01 765 { 5063ce1571b738 Rafael J. Wysocki 2011-08-08 766 struct gpd_link *link; 5248051b9afb66 Rafael J. Wysocki 2011-07-01 767 int ret = 0; 5248051b9afb66 Rafael J. Wysocki 2011-07-01 768 41e2c8e0060db2 Ulf Hansson 2017-03-20 769 if (genpd_status_on(genpd)) 3f241775c30365 Rafael J. Wysocki 2011-08-08 770 return 0; 5248051b9afb66 Rafael J. Wysocki 2011-07-01 771 5063ce1571b738 Rafael J. Wysocki 2011-08-08 772 /* 5063ce1571b738 Rafael J. Wysocki 2011-08-08 773 * The list is guaranteed not to change while the loop below is being 8d87ae48ced2df Kees Cook 2020-07-08 774 * executed, unless one of the parents' .power_on() callbacks fiddles 5063ce1571b738 Rafael J. Wysocki 2011-08-08 775 * with it. 5063ce1571b738 Rafael J. Wysocki 2011-08-08 776 */ 8d87ae48ced2df Kees Cook 2020-07-08 777 list_for_each_entry(link, &genpd->child_links, child_node) { 8d87ae48ced2df Kees Cook 2020-07-08 778 struct generic_pm_domain *parent = link->parent; 0106ef5146f9e8 Marek Szyprowski 2016-01-20 779 8d87ae48ced2df Kees Cook 2020-07-08 780 genpd_sd_counter_inc(parent); 0106ef5146f9e8 Marek Szyprowski 2016-01-20 781 8d87ae48ced2df Kees Cook 2020-07-08 782 genpd_lock_nested(parent, depth + 1); 8d87ae48ced2df Kees Cook 2020-07-08 783 ret = genpd_power_on(parent, depth + 1); 8d87ae48ced2df Kees Cook 2020-07-08 784 genpd_unlock(parent); 5248051b9afb66 Rafael J. Wysocki 2011-07-01 785 5063ce1571b738 Rafael J. Wysocki 2011-08-08 786 if (ret) { 8d87ae48ced2df Kees Cook 2020-07-08 787 genpd_sd_counter_dec(parent); 9e08cf42969709 Rafael J. Wysocki 2011-08-08 788 goto err; 5248051b9afb66 Rafael J. Wysocki 2011-07-01 789 } 5063ce1571b738 Rafael J. Wysocki 2011-08-08 790 } 5248051b9afb66 Rafael J. Wysocki 2011-07-01 791 86e12eac1f7f84 Ulf Hansson 2016-12-08 792 ret = _genpd_power_on(genpd, true); 9e08cf42969709 Rafael J. Wysocki 2011-08-08 793 if (ret) 9e08cf42969709 Rafael J. Wysocki 2011-08-08 794 goto err; 0140d8bd47f798 Rafael J. Wysocki 2011-12-01 795 49f618e1b669ef Ulf Hansson 2020-09-24 796 genpd->status = GENPD_STATE_ON; afece3ab9a3640 Thara Gopinath 2017-07-14 797 genpd_update_accounting(genpd); afece3ab9a3640 Thara Gopinath 2017-07-14 798 3f241775c30365 Rafael J. Wysocki 2011-08-08 799 return 0; 9e08cf42969709 Rafael J. Wysocki 2011-08-08 800 9e08cf42969709 Rafael J. Wysocki 2011-08-08 801 err: 29e47e2173349e Ulf Hansson 2015-09-02 802 list_for_each_entry_continue_reverse(link, 8d87ae48ced2df Kees Cook 2020-07-08 803 &genpd->child_links, 8d87ae48ced2df Kees Cook 2020-07-08 804 child_node) { 8d87ae48ced2df Kees Cook 2020-07-08 805 genpd_sd_counter_dec(link->parent); 8d87ae48ced2df Kees Cook 2020-07-08 806 genpd_lock_nested(link->parent, depth + 1); 8d87ae48ced2df Kees Cook 2020-07-08 807 genpd_power_off(link->parent, false, depth + 1); 8d87ae48ced2df Kees Cook 2020-07-08 808 genpd_unlock(link->parent); 29e47e2173349e Ulf Hansson 2015-09-02 809 } 9e08cf42969709 Rafael J. Wysocki 2011-08-08 810 3f241775c30365 Rafael J. Wysocki 2011-08-08 811 return ret; 3f241775c30365 Rafael J. Wysocki 2011-08-08 812 } 3f241775c30365 Rafael J. Wysocki 2011-08-08 813 ea71c59669f17d Ulf Hansson 2019-10-16 814 static int genpd_dev_pm_start(struct device *dev) ea71c59669f17d Ulf Hansson 2019-10-16 815 { ea71c59669f17d Ulf Hansson 2019-10-16 816 struct generic_pm_domain *genpd = dev_to_genpd(dev); ea71c59669f17d Ulf Hansson 2019-10-16 817 ea71c59669f17d Ulf Hansson 2019-10-16 818 return genpd_start_dev(genpd, dev); ea71c59669f17d Ulf Hansson 2019-10-16 819 } ea71c59669f17d Ulf Hansson 2019-10-16 820 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 821 static int genpd_dev_pm_qos_notifier(struct notifier_block *nb, 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 822 unsigned long val, void *ptr) 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 823 { 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 824 struct generic_pm_domain_data *gpd_data; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 825 struct device *dev; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 826 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 827 gpd_data = container_of(nb, struct generic_pm_domain_data, nb); 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 828 dev = gpd_data->base.dev; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 829 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 830 for (;;) { f38d1a6d002526 Ulf Hansson 2022-05-11 831 struct generic_pm_domain *genpd = ERR_PTR(-ENODATA); 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 832 struct pm_domain_data *pdd; 66d29d802ef3bf Ulf Hansson 2022-05-11 833 struct gpd_timing_data *td; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 834 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 835 spin_lock_irq(&dev->power.lock); 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 836 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 837 pdd = dev->power.subsys_data ? 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 838 dev->power.subsys_data->domain_data : NULL; b4883ca449473e Viresh Kumar 2017-05-16 839 if (pdd) { 66d29d802ef3bf Ulf Hansson 2022-05-11 840 td = to_gpd_data(pdd)->td; f38d1a6d002526 Ulf Hansson 2022-05-11 841 if (td) { 66d29d802ef3bf Ulf Hansson 2022-05-11 842 td->constraint_changed = true; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 843 genpd = dev_to_genpd(dev); f38d1a6d002526 Ulf Hansson 2022-05-11 844 } 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 845 } 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 846 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 847 spin_unlock_irq(&dev->power.lock); 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 848 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 849 if (!IS_ERR(genpd)) { 35241d12f750d2 Lina Iyer 2016-10-14 850 genpd_lock(genpd); f38d1a6d002526 Ulf Hansson 2022-05-11 851 genpd->gd->max_off_time_changed = true; 35241d12f750d2 Lina Iyer 2016-10-14 852 genpd_unlock(genpd); 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 853 } 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 854 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 855 dev = dev->parent; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 @856 if (!dev || dev->power.ignore_children) 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 857 break; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 858 } 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 859 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 860 return NOTIFY_DONE; 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 861 } 6ff7bb0d02f829 Rafael J. Wysocki 2012-05-01 862
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig index 3c9dfdb0b328..74f5916f5ca5 100644 --- a/drivers/gpu/drm/msm/Kconfig +++ b/drivers/gpu/drm/msm/Kconfig @@ -28,6 +28,7 @@ config DRM_MSM select SYNC_FILE select PM_OPP select NVMEM + select PM_GENERIC_DOMAINS help DRM/KMS driver for MSM/snapdragon. diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 1580d0090f35..c03830957c26 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1507,6 +1507,17 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) gmu->initialized = false; } +static int cxpd_notifier_cb(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct a6xx_gmu *gmu = container_of(nb, struct a6xx_gmu, pd_nb); + + if (action == GENPD_NOTIFY_OFF) + complete_all(&gmu->pd_gate); + + return 0; +} + int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) { struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; @@ -1640,6 +1651,10 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) goto detach_cxpd; } + init_completion(&gmu->pd_gate); + complete_all(&gmu->pd_gate); + gmu->pd_nb.notifier_call = cxpd_notifier_cb; + /* * Get a link to the GX power domain to reset the GPU in case of GMU * crash diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h index 5a42dd4dd31f..0bc3eb443fec 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h @@ -4,8 +4,10 @@ #ifndef _A6XX_GMU_H_ #define _A6XX_GMU_H_ +#include <linux/completion.h> #include <linux/iopoll.h> #include <linux/interrupt.h> +#include <linux/notifier.h> #include "msm_drv.h" #include "a6xx_hfi.h" @@ -90,6 +92,10 @@ struct a6xx_gmu { bool initialized; bool hung; bool legacy; /* a618 or a630 */ + + /* For power domain callback */ + struct notifier_block pd_nb; + struct completion pd_gate; }; static inline u32 gmu_read(struct a6xx_gmu *gmu, u32 offset) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 4b16e75dfa50..dd618b099110 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -10,6 +10,7 @@ #include <linux/bitfield.h> #include <linux/devfreq.h> +#include <linux/pm_domain.h> #include <linux/soc/qcom/llcc-qcom.h> #define GPU_PAS_ID 13 @@ -1258,6 +1259,7 @@ static void a6xx_recover(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + struct a6xx_gmu *gmu = &a6xx_gpu->gmu; int i, active_submits; adreno_dump_info(gpu); @@ -1290,6 +1292,10 @@ static void a6xx_recover(struct msm_gpu *gpu) */ gpu->active_submits = 0; + reinit_completion(&gmu->pd_gate); + dev_pm_genpd_add_notifier(gmu->cxpd, &gmu->pd_nb); + dev_pm_genpd_synced_poweroff(gmu->cxpd); + /* Drop the rpm refcount from active submits */ if (active_submits) pm_runtime_put(&gpu->pdev->dev); @@ -1297,6 +1303,11 @@ static void a6xx_recover(struct msm_gpu *gpu) /* And the final one from recover worker */ pm_runtime_put_sync(&gpu->pdev->dev); + if (!wait_for_completion_timeout(&gmu->pd_gate, msecs_to_jiffies(1000))) + DRM_DEV_ERROR(&gpu->pdev->dev, "cx gdsc didn't collapse\n"); + + dev_pm_genpd_remove_notifier(gmu->cxpd); + pm_runtime_use_autosuspend(&gpu->pdev->dev); if (active_submits)