/drivers/gpu/nvgpu/vgpu/

ss='tabs'> summaryrefslogblamecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
blob: 0fbba3a0073ad65678649d6ccb3a1e5384b292c8 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
  
               
  
                                                                     
  





                                                                             
  









                                                                             

   
                         
                       
                      
                      
                        
                          
                       
                      
                                 
                      
                     
                        
                         
 
                        
                           
                                
                               
                               
 
                           
 

                           
                           

                               
                        
                               





                                               

                                          
                                         
 
                                                  
 



                                                                                





                                                            









                                                       
                                                            























                                
                                                                   


                     
                                                                















                             

                                            
                                                                      

                                              


                       
                                                                

            
                                                                          















                                                                                
                                                                    















                               
                                               







                                                                             



























                                                                                      
                                                                                                 
                         
         
















                                                                                                                  
                                                       



                                                                                                     



                                                                                                    
                                                                                





                                                                                                       
                                                       



                                                                                                         



                                                                                                      
                                                                                  











                                                                                           
 



































                                                                                     
                                                                                           
                         
         
















                                                                                                            
                                                       



                                                                                                  



                                                                                                 
                                                                          





                                                                                                 
                                                       



                                                                                                    



                                                                                                   
                                                                          












                                                                                        
                                                    
 
                               
 





                                                         


















                                                                 

 












                                                                               
                                                















                                                                        

                                                         
                                                        


                                                           
                                                        


                                                                      



                                                      



























                                                                                     
                                                                                           
                         
         
















                                                                                                            
                                                       



                                                                                                  



                                                                                                 
                                                                             





                                                                                                 
                                                       



                                                                                                    



                                                                                                   
                                                                               












                                                                                        























                                                                                     
                                                                                                   
                         
         
















                                                                                                                    
                                                       



                                                                                                       



                                                                                                     
                                                                                 





                                                                                                         
                                                       



                                                                                                           



                                                                                                       
                                                                                   








































                                                                                            
                                                                                                 
                         
         
















                                                                                                                  
                                                       



                                                                                                              



                                                                                                    
                                                                                





                                                                                                       
                                                       



                                                                                                                



                                                                                                      
                                                                                  












                                                                                           
                                                         


                                                                 

                    
 

                                                                                            

                                       



                                                                                         
 





                                                                                             


                   
                                                                    





















                                                                           
                                                                                                   
                         
         





















                                                                                                            



                                                                                             
                                                                         










                                                                                                           



                                                                                               
                                                                           











                                                                                            
                                                                         


                                                                              

                                                                       
                                                                 

                                                     




                                                                             
                                                                              
                           
         





















                                                                                        
                                                          


                                                                       

                                                              


                                                                         
         




                                                                             
                                 
                                                                                                  

                                   
                                                                                                      
         
 
 
                                                                   
                                                                        
                                                                     



                                                                                   
                                                                                        
                                                                          

                                                                                          
                                                                            

                                                                                        
                                                                          

                                                                                          
                                                                            

                                                         
                                                                 
         




                                                                

                                                                            












                                                                              
                    



                                                                     
                                                                    
                           
         









                                                                             










                                                                                           
                                 
                                                          


                                                                          

                                                              


                                                                            
         
 


                                                                                
                                                               
                                                                        
                                                                 
                                                                          


                                                                               
                                                                                  
                                                                       
         
                        
                                                                           
                                                                         
         
                        
                                                                         
                                                                       
         
                        
                                                                           
                                                                         

                                                         
                                                             
         






                                                                          

                                                                        



                   
                                                                  

                                                                          
                                                                     

                                                                               
         


                 
                                                                 

                                                                          
                                                                    

                                                                               
         



                 
                                                    




                                                                

                                                                             

                  

                                                              
 
                                                           
                                                                     

                                                                         

 
                                                                    

                                 
                 

 
                                                                    
                                                              
 


                                             
                                                                

                               

                                    






                                                             
                                                                  


                                                             
              



























                                                               
                                  
                                               
                 



                     
                                                                  


                                                                         

                             
                                                          

                               










                                                                             



                 
                                                      
                                     
 
                                 
                
 

                                              
 


                                                  


                          

                                                  



                                                
 

                                                  


                                                
         
 

                                    
                 



                                                               

 
                                                                   






                                                              
 


                                                      
 
                                                              
                          
                                   
                 
         


                 
                                                   



                                                           
                                                         
























                                                                           
                                                            



                                                         
                                                                 


                
                             





                                                                                   
                                

 
                                                       



                  
                             


















                                                                              
                                                      






















                                                                                       
                                                              
 
                             
 







                                                                                

 
                                                                 





                                                             
                                                                  


                                                                                    
                


                                                                                     
         



                                                             
                                                        

                                                                         
                             
 
                                           

                                                  
                                                                
                              


                                                        


                                                                   




                                  
                                   
                                      
                                                  
                                                                
                              
                                                     

                                                                    
                                                           

                                                                          
                                                




                                                                   


                                                         


                                                        


                                                               


                                                               


                                                                   









                                  
                                                 










                                                                       
                                              


                                     
                                          

                                                                    
         

                                                             



                                                         

 
                                                                       





                                              
                             
 
                                                
                                                  
         


































                                                                                          
                                                                 




                                               
                             
 
                                                  
                                                    
         






















































                                                                                  
                                                           
                                              

                
                                            
 
                             
 
                                                        
                  
                           
         
 

                                        
                                     
                                                       
                                                    

                                               








                               
                                       


                   
                                                       
                                                            






                                                               
                                                                       
                                                                            
         

                                                         
                                                               
                                                                          
         

                                            
                                                                          
                               
         

                                                                             
                                                                                  
                               
         


                                                                   
                                                                     
                               
         

                                   
                                                                   
                               
         

















                                                                                    


                                                                                  







































































                                                                            
                                        

                                      

                                    
                                                     







                                                                                   
                             
 
                                   
                   
                       
         


                              

                                                                              
                                                                   






                                                                              
                                                                   






                                                                             
                                                                 










                                                                             
                                                

                                                                                
                                

                                                                          
                         

                 
                                                                      









                                                                                        
                                                                    
                                                                         






                                                                               
                                                                 
                                                                     
                 
 
                                                                              







                                                                                       
                                                   


                                                                               
                                                   




                                                                               
                                                   



                                                                         
                                                   




                                                                             




                                                             
                                                              


         
                                
 


























































                                                                                    




                                                                            




                                                                       
                                                                      













                                                                  
 
                                                 


                                                        


                                                      



















                                                                            
                                                                    



















                                                                                    
                                                             

                                                                                            
         











                                                                                    
                                                             

                                                                                            
         

















                                                                                          

                                                                   
                                                                     


















                                                                                    



                                                                            























                                                                                       


                                       




                                                   
                     

                                                        
                                                            
                                     
                 





                          
                                                                   







                                                       
                                     
 
                             
 

                                                                            




















                                                                        
                                                


                                 
                                                     

                                                                  
                                                   
 
                    





                                                                                   
                                                      
                                                                         

                                                                  

                           
                                                  
                                                                  
                
                                                                          
         


                                                                                 
                                                                 
 
                                                                                         


                                                                                
                                                                         

                                                                         
                                                                         



                                                                          
                                                              
 

                     
                                             
                       
         







                                                                                

                                                 
                                                                             
 

                                                 
 
                                                                 

 
                                             































                                                                     
                                                                  
                                                                 





                                                 

                                                                   
                           

                                       
                   
                    
 
                                               
                       








                                                                             
         






                                                                                
                   
                                            
         







                                                               



                                                  
                   

 


                                                                              
                             







                                                                      
                                               
                                                                          
                                                   

































                                                                                 
                                       
                                                                  
                                                    





                                                                       
                       
 
 



                                                                               

                              
                                     











                                                                           



                                                    














                                                                     






















                                                                                  



                                                                                                             
                                                      
                                                                       



                                                                          
                                  
                                                            


                                                     
                                                                             
                              



                                 



                                                            
                                                                                 
                                                                               
                                                          
         
 








                                                                  
 

                                                  
                           
                                       
                 

                                                                   
                                                            
         
 
                                                  

                                                                                

                                                   
                                                                                       

                                                                                             
                 
 
                                                                                                    

                                                                                                          
                 
 

                                                                                                



                                                                       
                                                                  


                                                                         

                                                                             
                                                                          


                                                                               

                                                                    


                                                                                     
                                                                          


                                                                  

                                                                         


                                                                     

                                                                            

                                                                       
                                                                  


                                                                 
 
                                                                                                           
                                                                             
                                  
                                                                                                


                                           
                                                                                                    
                                                                                                         
                                                                          


                                                                                
                                                                        

                                                                                                             
                                                                                                            

                         
                                                                  

                                                                       
                                                                    

                                                
                                                                  

                                                                         






                                   


                                                                     

                                                     










                                                                           












                                                                                             
                                                                  

                                                                               

                                                                      


                                                                             
                 






                                                                               



                                                                          
                                                                    
                                                                        
                                                                      

                                                                          



                                                               
                                                                           
                                                                               
                 
                                
                                                                             

                                                                              
                 
                                
                                                                           
                                                                               
                 
                                
                                                                             

                                                                              

                                                                 
                                                                    
                 






                                                                            

                                                                             


         
                                               



                                                                       
                
 
                                                                       
 


                                                        

                                                            
                   

 
                                                                    

                

                                              


                                                                   
                                                  
 
                             
 
                             
                          
         



                                                                         











































                                                                                 
 


                                                                             

























                                                                             
                                                                    



                                                            

                                 
                                              

                                          
                                                                            



                                                            

                                                                            
         
                   

 
                                                 





                                                            
 
                                                          
                                                            





                                                                           

                                                                    



                                                                               
                                                          

                                                                           


                                                                             
                        
                                                                  
                 
 

                                                                      
                              
                 
         


                   




                                                                           
                             























                                                                              
                                             


                                                         
                                       
                                                      
                                      
                                                     
                                      
                                                     

 
                                                                    






                                                            
                                                            
                              
                 









                                                                  
                                                      





                                                                       
                                                                          
                       
 
                                                          
                                             
 
                                                                          
                                                                        





                                                                               
                                              



                                         
                                                                           

                                                                   
                                                                            
                         
                               
         
 










                                                                
                                                    
 
                                                      
                                      
                         













                                                                             
                                                        
                                                                 
         
                                  

                 
 
 
                                                             


                    
                                    
                
                               
 
                             
 
                                           
                  
                           
         
 
                                                    
                  
                           
         
 


                                                                       

                                                  
                                                                          
                                          


                                                                              
                                                                          






                                                     
                                                                              
 
                                           





                            
                             




                                                                       












                                                                               
                                                                               
                                                                         
                                                                           
                                                                   

                                                                                
                                                                           
                                                                              



                 
                                              
                                                                  





                                 
                            
                                                            
                            



                                                               
                                           
                                                                  





                                 
                            
                                                         
                            

                                                            
 
                                            
 












                                                                          
                                                             











                                                                              

 
                                                       



                                                          


                                                    















                                                                              
                                           

                 
                
                                                          
 
                             





                                                                                               


                                                                                  


                                                                    
                                                                             

                                                                   
                                                                            

                                                                  
                                                                    





                                                                       
                                                           





                                                                                           
 




                                                                            
                                                       

                                                         
                                                             

         
                                        
                  
                           
         










                                                                           
 
 
                                                               





                                                                               
                                                  

                                                                    
                                                                  
                                

                                                                  
                                      
         
                                                  


                                                                 
                                                






                                                                        
                                                                   





                                                                                
                                                    





                                                                              
                                                                            



















                                                                 

                                                                        
                                             
                                                                        



                                                  

                                                                            
                                              
                                                                            



                                                   

                                                                           
                                               
                                                                           









                                                                
                                                                     
                                                                              
                                                                     

                                                                              
                                                                       
                                                                                
                                                                       

                                                                                
                                                                      
                                                                               
                                                                      



                                                                               























                                                                         
                                                   
                                                    
                                                                
 
                              
                                 
                                    
                    
                                                             
 
                                    
                          
                               
         


                              

                                                   

                                                                           















                                                        
                                                                              
                
                                                                       
                          
                                          
                 



                                                                         
                                                                        



                                                                       
                                                                      

                              
                                                               









                                                   
                                               

                                                       
                                     



                                                             
                   
                               
         



                                                          
                                            
                                 
                 




































                                                                                
                  
                                                            
         



                            





















                                                                           
                                                                             
                                                               

                  

                                       

                                                                



                                                                       

                                                                  
 

                                                                          


                                                            


                                                  
 



                                             
 

                                                                 
 
            

                                                   
                     
 
 
                                                      





















                                                                                             

                                                                                





                                                                                             
                                                   









                                                                               
                                                    

                                                               
                                                                              
                            
         



                     
                                                

























                                                                                
                                                              







                                                       
                                              






























                                                                                

                                                                        










                                                                        
                                               


































































                                                                                 
                                             































































                                                                                 
                                               

                    
                    




                                                                              



                                                                          





                                    
                                                 










                                                                            
                                                   











                                                                               
                                                                     















                                                                                 



























                                                                                
                      




                                                               
                
                                                            



                                                               
         

 
                                                   










                                                                         
                                                     

                                                  
                                                    



















                                                                                 
                                                              





















                                                                               
                                                                    



                                                                               


                                                                










                                                                               












                                                                        
                                          






                                                                                
                                                    












                                                                                
                                                                     






                                                                                
                                                  




                                                                            
                                                  




                                                                          
                                                      






                                                                               
                                                                          
                         
         

















                                                                                


                                         
                                        
 
                                     
                       
         

































                                                                                 
                                        
 
                                             
                       
         






                                                                              
                                                   









                                                                            
                                                        









                                                                                    
                                                                        





                                                                   
                                                                    









































                                                                              








                                                                       
                                                         









                                                                       






































                                                                         
                                                         




                                                      
                                                          
                                    
                 













                                                                       
                                                                       
                                 
                 

























                                                                       
                                                          











                                                                             


                                                                    

                     
                     
























                                                                              
                                                             
                                                                           
                                                                             
                         









                                                                  


















                                                                              
                                                                  

                                                      
 
                                















                                                                              














                                                                                             
                                 
                                                                                


                                                                     
                                





                                                                             
                                                                              
                                                 
                                 

                                                                








                                                                               
                                                                    
                                         
                                                     
                                                                           


                                                                             
                                        
                                                             

                                                                  
                                                               



                                                                    
                                 
                         
                                                                        


                                                             








                                                                      
                                           



                             
                                           




                                                
                                     













                                                                
                                                     
                                                     
                                                   
                                                     
                                                   
 




                                                   
                 


                             
                                                                      
                                                                 
                
                                                                   
         


                                                 

                                                     






                                                          
                                                               




                                                                            
                                                                        

                                            
                

                                                 
         
 




                                                                      
                

                                   




                                              
 


                                                         
                                                                      
                                                                 
 

                                                                                          
                                                                       
                                              
                                 
 
                                                                      
                                                          
                                 






                                                                            










































































                                                                               


                                                                                 



                                                                                


                                                                                 
























































                                                                                    

















































































































                                                                                



                                                 
                                             
 
                                           
                                                         

                                               
                                                             

                                              
                                                            

                                           
                                                         

                                             
                                                            
         

 









                                                                









                                                            





                                                                    
                                        




                                                              
                                                                      














                                                                    
                        
                                                            
                 
























                                                                            
                                                         
                                                  
                                                            
                                                                     
                                                                   
                                                                     
                 
















































                                                                                
 






                                                                   

                                     
                                                                    













                                                                     
                                                                           
















                                                                               
                                       




                                              



                           
                                                                      



                                                                              
                                                                   
                  
                           
         








                                                                                
                                                                  
                                                                           
                        
                                                    
                 












                                                                              
                                                                        

                                                                            
                                                 



                                                                              
                                 
                         



                                                                             
                                          
                                                   
                                 






                                                                             
                                                                              
                                                 
                                 


































                                                                               
                                                                            





                                                                      
                                                                       
                                                                              

                                                                      
                                                            

                                                                             
                                                            

                                                                             


                                                                             

























                                                                           
                                                                

                                                                    
                                         



                                                                          
                         
                                                                       

                                                                            
                        
                                                    
                 




                           
/*
 * GV11b GPU GR
 *
 * Copyright (c) 2016-2018, NVIDIA CORPORATION.  All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#include <nvgpu/timers.h>
#include <nvgpu/gmmu.h>
#include <nvgpu/dma.h>
#include <nvgpu/log.h>
#include <nvgpu/debug.h>
#include <nvgpu/enabled.h>
#include <nvgpu/fuse.h>
#include <nvgpu/bug.h>
#include <nvgpu/error_notifier.h>
#include <nvgpu/soc.h>
#include <nvgpu/io.h>
#include <nvgpu/utils.h>
#include <nvgpu/bitops.h>

#include "gk20a/gk20a.h"
#include "gk20a/gr_gk20a.h"
#include "gk20a/dbg_gpu_gk20a.h"
#include "gk20a/regops_gk20a.h"
#include "gk20a/gr_pri_gk20a.h"

#include "gm20b/gr_gm20b.h"

#include "gp10b/gr_gp10b.h"

#include "gv11b/gr_gv11b.h"
#include "gv11b/mm_gv11b.h"
#include "gv11b/subctx_gv11b.h"
#include "gv11b/gv11b.h"
#include "gv11b/gr_pri_gv11b.h"

#include <nvgpu/hw/gv11b/hw_gr_gv11b.h>
#include <nvgpu/hw/gv11b/hw_fifo_gv11b.h>
#include <nvgpu/hw/gv11b/hw_proj_gv11b.h>
#include <nvgpu/hw/gv11b/hw_ctxsw_prog_gv11b.h>
#include <nvgpu/hw/gv11b/hw_mc_gv11b.h>
#include <nvgpu/hw/gv11b/hw_ram_gv11b.h>
#include <nvgpu/hw/gv11b/hw_pbdma_gv11b.h>
#include <nvgpu/hw/gv11b/hw_perf_gv11b.h>

#define GFXP_WFI_TIMEOUT_COUNT_IN_USEC_DEFAULT 100

/* ecc scrubbing will done in 1 pri read cycle,but for safety used 10 retries */
#define ECC_SCRUBBING_TIMEOUT_MAX 1000
#define ECC_SCRUBBING_TIMEOUT_DEFAULT 10

/*
 * Each gpc can have maximum 32 tpcs, so each tpc index need
 * 5 bits. Each map register(32bits) can hold 6 tpcs info.
 */
#define GR_TPCS_INFO_FOR_MAPREGISTER 6

/*
 * There are 4 TPCs in GV11b ranging from TPC0 to TPC3
 * There are two PES in GV11b each controlling two TPCs
 * PES0 is linked to TPC0 & TPC2
 * PES1 is linked to TPC1 & TPC3
 */
#define TPC_MASK_FOR_PESID_0   (u32) 0x5
#define TPC_MASK_FOR_PESID_1   (u32) 0xa


bool gr_gv11b_is_valid_class(struct gk20a *g, u32 class_num)
{
	bool valid = false;

	switch (class_num) {
	case VOLTA_COMPUTE_A:
	case VOLTA_A:
	case VOLTA_DMA_COPY_A:
		valid = true;
		break;

	case MAXWELL_COMPUTE_B:
	case MAXWELL_B:
	case FERMI_TWOD_A:
	case KEPLER_DMA_COPY_A:
	case MAXWELL_DMA_COPY_A:
	case PASCAL_COMPUTE_A:
	case PASCAL_A:
	case PASCAL_DMA_COPY_A:
		valid = true;
		break;

	default:
		break;
	}
	nvgpu_log_info(g, "class=0x%x valid=%d", class_num, valid);
	return valid;
}

bool gr_gv11b_is_valid_gfx_class(struct gk20a *g, u32 class_num)
{
	bool valid = false;

	switch (class_num) {
	case VOLTA_A:
	case PASCAL_A:
	case MAXWELL_B:
		valid = true;
		break;

	default:
		break;
	}
	return valid;
}

void gr_gv11b_powergate_tpc(struct gk20a *g)
{
	u32 tpc_pg_status = g->ops.fuse.fuse_status_opt_tpc_gpc(g, 0);

	if (tpc_pg_status == g->tpc_pg_mask) {
		return;
	}

	g->ops.fuse.fuse_ctrl_opt_tpc_gpc(g, 0, g->tpc_pg_mask);

	do {
		tpc_pg_status = g->ops.fuse.fuse_status_opt_tpc_gpc(g, 0);
	} while (tpc_pg_status != g->tpc_pg_mask);

	gk20a_writel(g, gr_fe_tpc_pesmask_r(), gr_fe_tpc_pesmask_req_send_f() |
			gr_fe_tpc_pesmask_action_write_f() |
			gr_fe_tpc_pesmask_pesid_f(0) |
			gr_fe_tpc_pesmask_gpcid_f(0) |
			((~g->tpc_pg_mask & (u32) 0xf) & TPC_MASK_FOR_PESID_0));
	gk20a_writel(g, gr_fe_tpc_pesmask_r(), gr_fe_tpc_pesmask_req_send_f() |
			gr_fe_tpc_pesmask_action_write_f() |
			gr_fe_tpc_pesmask_pesid_f(1) |
			gr_fe_tpc_pesmask_gpcid_f(0) |
			((~g->tpc_pg_mask & (u32) 0xf) & TPC_MASK_FOR_PESID_1));

	return;
}

bool gr_gv11b_is_valid_compute_class(struct gk20a *g, u32 class_num)
{
	bool valid = false;

	switch (class_num) {
	case VOLTA_COMPUTE_A:
	case PASCAL_COMPUTE_A:
	case MAXWELL_COMPUTE_B:
		valid = true;
		break;

	default:
		break;
	}
	return valid;
}

u32 gv11b_gr_sm_offset(struct gk20a *g, u32 sm)
{

	u32 sm_pri_stride = nvgpu_get_litter_value(g, GPU_LIT_SM_PRI_STRIDE);
	u32 sm_offset = sm_pri_stride * sm;

	return sm_offset;
}

static int gr_gv11b_handle_l1_tag_exception(struct gk20a *g, u32 gpc, u32 tpc,
			bool *post_event, struct channel_gk20a *fault_ch,
			u32 *hww_global_esr)
{
	u32 gpc_stride = nvgpu_get_litter_value(g, GPU_LIT_GPC_STRIDE);
	u32 tpc_in_gpc_stride = nvgpu_get_litter_value(g, GPU_LIT_TPC_IN_GPC_STRIDE);
	u32 offset = gpc_stride * gpc + tpc_in_gpc_stride * tpc;
	u32 l1_tag_ecc_status, l1_tag_ecc_corrected_err_status = 0;
	u32 l1_tag_ecc_uncorrected_err_status = 0;
	u32 l1_tag_corrected_err_count_delta = 0;
	u32 l1_tag_uncorrected_err_count_delta = 0;
	bool is_l1_tag_ecc_corrected_total_err_overflow = 0;
	bool is_l1_tag_ecc_uncorrected_total_err_overflow = 0;

	/* Check for L1 tag ECC errors. */
	l1_tag_ecc_status = gk20a_readl(g,
		gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_r() + offset);
	l1_tag_ecc_corrected_err_status = l1_tag_ecc_status &
		(gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_corrected_err_el1_0_m() |
		 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_corrected_err_el1_1_m() |
		 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_corrected_err_pixrpf_m() |
		 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_corrected_err_miss_fifo_m());
	l1_tag_ecc_uncorrected_err_status = l1_tag_ecc_status &
		(gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_uncorrected_err_el1_0_m() |
		 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_uncorrected_err_el1_1_m() |
		 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_uncorrected_err_pixrpf_m() |
		 gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_uncorrected_err_miss_fifo_m());

	if ((l1_tag_ecc_corrected_err_status == 0) && (l1_tag_ecc_uncorrected_err_status == 0)) {
		return 0;
	}

	l1_tag_corrected_err_count_delta =
		gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_total_v(
			gk20a_readl(g,
				gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_r() +
				offset));
	l1_tag_uncorrected_err_count_delta =
		gr_pri_gpc0_tpc0_sm_l1_tag_ecc_uncorrected_err_count_total_v(
			gk20a_readl(g,
				gr_pri_gpc0_tpc0_sm_l1_tag_ecc_uncorrected_err_count_r() +
				offset));
	is_l1_tag_ecc_corrected_total_err_overflow =
		gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_corrected_err_total_counter_overflow_v(l1_tag_ecc_status);
	is_l1_tag_ecc_uncorrected_total_err_overflow =
		gr_pri_gpc0_tpc0_sm_l1_tag_ecc_status_uncorrected_err_total_counter_overflow_v(l1_tag_ecc_status);

	if ((l1_tag_corrected_err_count_delta > 0) || is_l1_tag_ecc_corrected_total_err_overflow) {
		nvgpu_log(g, gpu_dbg_fn | gpu_dbg_intr,
			"corrected error (SBE) detected in SM L1 tag! err_mask [%08x] is_overf [%d]",
			l1_tag_ecc_corrected_err_status, is_l1_tag_ecc_corrected_total_err_overflow);

		/* HW uses 16-bits counter */
		if (is_l1_tag_ecc_corrected_total_err_overflow) {
			l1_tag_corrected_err_count_delta +=
				BIT32(gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_total_s());
		}
		g->ecc.gr.sm_l1_tag_ecc_corrected_err_count[gpc][tpc].counter +=
							l1_tag_corrected_err_count_delta;
		gk20a_writel(g,
			gr_pri_gpc0_tpc0_sm_l1_tag_ecc_corrected_err_count_r() + offset,
			0);
	}
	if ((l1_tag_uncorrected_err_count_delta > 0) || is_l1_tag_ecc_uncorrected_total_err_overflow) {
		nvgpu_log(g, gpu_dbg_fn | gpu_dbg_intr,