@@ -700,6 +700,80 @@ static const struct attribute *media_perf_power_attrs[] = {
700
700
NULL
701
701
};
702
702
703
+ static ssize_t
704
+ rps_up_threshold_pct_show (struct kobject * kobj , struct kobj_attribute * attr ,
705
+ char * buf )
706
+ {
707
+ struct intel_gt * gt = intel_gt_sysfs_get_drvdata (kobj , attr -> attr .name );
708
+ struct intel_rps * rps = & gt -> rps ;
709
+
710
+ return sysfs_emit (buf , "%u\n" , intel_rps_get_up_threshold (rps ));
711
+ }
712
+
713
+ static ssize_t
714
+ rps_up_threshold_pct_store (struct kobject * kobj , struct kobj_attribute * attr ,
715
+ const char * buf , size_t count )
716
+ {
717
+ struct intel_gt * gt = intel_gt_sysfs_get_drvdata (kobj , attr -> attr .name );
718
+ struct intel_rps * rps = & gt -> rps ;
719
+ int ret ;
720
+ u8 val ;
721
+
722
+ ret = kstrtou8 (buf , 10 , & val );
723
+ if (ret )
724
+ return ret ;
725
+
726
+ ret = intel_rps_set_up_threshold (rps , val );
727
+
728
+ return ret == 0 ? count : ret ;
729
+ }
730
+
731
+ static struct kobj_attribute rps_up_threshold_pct =
732
+ __ATTR (rps_up_threshold_pct ,
733
+ 0664 ,
734
+ rps_up_threshold_pct_show ,
735
+ rps_up_threshold_pct_store );
736
+
737
+ static ssize_t
738
+ rps_down_threshold_pct_show (struct kobject * kobj , struct kobj_attribute * attr ,
739
+ char * buf )
740
+ {
741
+ struct intel_gt * gt = intel_gt_sysfs_get_drvdata (kobj , attr -> attr .name );
742
+ struct intel_rps * rps = & gt -> rps ;
743
+
744
+ return sysfs_emit (buf , "%u\n" , intel_rps_get_down_threshold (rps ));
745
+ }
746
+
747
+ static ssize_t
748
+ rps_down_threshold_pct_store (struct kobject * kobj , struct kobj_attribute * attr ,
749
+ const char * buf , size_t count )
750
+ {
751
+ struct intel_gt * gt = intel_gt_sysfs_get_drvdata (kobj , attr -> attr .name );
752
+ struct intel_rps * rps = & gt -> rps ;
753
+ int ret ;
754
+ u8 val ;
755
+
756
+ ret = kstrtou8 (buf , 10 , & val );
757
+ if (ret )
758
+ return ret ;
759
+
760
+ ret = intel_rps_set_down_threshold (rps , val );
761
+
762
+ return ret == 0 ? count : ret ;
763
+ }
764
+
765
+ static struct kobj_attribute rps_down_threshold_pct =
766
+ __ATTR (rps_down_threshold_pct ,
767
+ 0664 ,
768
+ rps_down_threshold_pct_show ,
769
+ rps_down_threshold_pct_store );
770
+
771
+ static const struct attribute * const gen6_gt_rps_attrs [] = {
772
+ & rps_up_threshold_pct .attr ,
773
+ & rps_down_threshold_pct .attr ,
774
+ NULL
775
+ };
776
+
703
777
static ssize_t
704
778
default_min_freq_mhz_show (struct kobject * kobj , struct kobj_attribute * attr , char * buf )
705
779
{
@@ -722,9 +796,37 @@ default_max_freq_mhz_show(struct kobject *kobj, struct kobj_attribute *attr, cha
722
796
static struct kobj_attribute default_max_freq_mhz =
723
797
__ATTR (rps_max_freq_mhz , 0444 , default_max_freq_mhz_show , NULL );
724
798
799
+ static ssize_t
800
+ default_rps_up_threshold_pct_show (struct kobject * kobj ,
801
+ struct kobj_attribute * attr ,
802
+ char * buf )
803
+ {
804
+ struct intel_gt * gt = kobj_to_gt (kobj -> parent );
805
+
806
+ return sysfs_emit (buf , "%u\n" , gt -> defaults .rps_up_threshold );
807
+ }
808
+
809
+ static struct kobj_attribute default_rps_up_threshold_pct =
810
+ __ATTR (rps_up_threshold_pct , 0444 , default_rps_up_threshold_pct_show , NULL );
811
+
812
+ static ssize_t
813
+ default_rps_down_threshold_pct_show (struct kobject * kobj ,
814
+ struct kobj_attribute * attr ,
815
+ char * buf )
816
+ {
817
+ struct intel_gt * gt = kobj_to_gt (kobj -> parent );
818
+
819
+ return sysfs_emit (buf , "%u\n" , gt -> defaults .rps_down_threshold );
820
+ }
821
+
822
+ static struct kobj_attribute default_rps_down_threshold_pct =
823
+ __ATTR (rps_down_threshold_pct , 0444 , default_rps_down_threshold_pct_show , NULL );
824
+
725
825
static const struct attribute * const rps_defaults_attrs [] = {
726
826
& default_min_freq_mhz .attr ,
727
827
& default_max_freq_mhz .attr ,
828
+ & default_rps_up_threshold_pct .attr ,
829
+ & default_rps_down_threshold_pct .attr ,
728
830
NULL
729
831
};
730
832
@@ -752,6 +854,12 @@ static int intel_sysfs_rps_init(struct intel_gt *gt, struct kobject *kobj)
752
854
if (IS_VALLEYVIEW (gt -> i915 ) || IS_CHERRYVIEW (gt -> i915 ))
753
855
ret = sysfs_create_file (kobj , vlv_attr );
754
856
857
+ if (is_object_gt (kobj ) && !intel_uc_uses_guc_slpc (& gt -> uc )) {
858
+ ret = sysfs_create_files (kobj , gen6_gt_rps_attrs );
859
+ if (ret )
860
+ return ret ;
861
+ }
862
+
755
863
return ret ;
756
864
}
757
865
0 commit comments