@@ -419,7 +419,7 @@ static void iommu_set_device_table(struct amd_iommu *iommu)
419419}
420420
421421/* Generic functions to enable/disable certain features of the IOMMU. */
422- static void iommu_feature_enable (struct amd_iommu * iommu , u8 bit )
422+ void iommu_feature_enable (struct amd_iommu * iommu , u8 bit )
423423{
424424 u64 ctrl ;
425425
@@ -746,9 +746,9 @@ static int __init alloc_command_buffer(struct amd_iommu *iommu)
746746 * Interrupt handler has processed all pending events and adjusted head
747747 * and tail pointer. Reset overflow mask and restart logging again.
748748 */
749- static void amd_iommu_restart_log (struct amd_iommu * iommu , const char * evt_type ,
750- u8 cntrl_intr , u8 cntrl_log ,
751- u32 status_run_mask , u32 status_overflow_mask )
749+ void amd_iommu_restart_log (struct amd_iommu * iommu , const char * evt_type ,
750+ u8 cntrl_intr , u8 cntrl_log ,
751+ u32 status_run_mask , u32 status_overflow_mask )
752752{
753753 u32 status ;
754754
@@ -789,17 +789,6 @@ void amd_iommu_restart_ga_log(struct amd_iommu *iommu)
789789 MMIO_STATUS_GALOG_OVERFLOW_MASK );
790790}
791791
792- /*
793- * This function restarts ppr logging in case the IOMMU experienced
794- * PPR log overflow.
795- */
796- void amd_iommu_restart_ppr_log (struct amd_iommu * iommu )
797- {
798- amd_iommu_restart_log (iommu , "PPR" , CONTROL_PPRINT_EN ,
799- CONTROL_PPRLOG_EN , MMIO_STATUS_PPR_RUN_MASK ,
800- MMIO_STATUS_PPR_OVERFLOW_MASK );
801- }
802-
803792/*
804793 * This function resets the command buffer if the IOMMU stopped fetching
805794 * commands from it.
@@ -848,8 +837,8 @@ static void __init free_command_buffer(struct amd_iommu *iommu)
848837 free_pages ((unsigned long )iommu -> cmd_buf , get_order (CMD_BUFFER_SIZE ));
849838}
850839
851- static void * __init iommu_alloc_4k_pages (struct amd_iommu * iommu ,
852- gfp_t gfp , size_t size )
840+ void * __init iommu_alloc_4k_pages (struct amd_iommu * iommu , gfp_t gfp ,
841+ size_t size )
853842{
854843 int order = get_order (size );
855844 void * buf = (void * )__get_free_pages (gfp , order );
@@ -904,42 +893,6 @@ static void __init free_event_buffer(struct amd_iommu *iommu)
904893 free_pages ((unsigned long )iommu -> evt_buf , get_order (EVT_BUFFER_SIZE ));
905894}
906895
907- /* allocates the memory where the IOMMU will log its events to */
908- static int __init alloc_ppr_log (struct amd_iommu * iommu )
909- {
910- iommu -> ppr_log = iommu_alloc_4k_pages (iommu , GFP_KERNEL | __GFP_ZERO ,
911- PPR_LOG_SIZE );
912-
913- return iommu -> ppr_log ? 0 : - ENOMEM ;
914- }
915-
916- static void iommu_enable_ppr_log (struct amd_iommu * iommu )
917- {
918- u64 entry ;
919-
920- if (iommu -> ppr_log == NULL )
921- return ;
922-
923- iommu_feature_enable (iommu , CONTROL_PPR_EN );
924-
925- entry = iommu_virt_to_phys (iommu -> ppr_log ) | PPR_LOG_SIZE_512 ;
926-
927- memcpy_toio (iommu -> mmio_base + MMIO_PPR_LOG_OFFSET ,
928- & entry , sizeof (entry ));
929-
930- /* set head and tail to zero manually */
931- writel (0x00 , iommu -> mmio_base + MMIO_PPR_HEAD_OFFSET );
932- writel (0x00 , iommu -> mmio_base + MMIO_PPR_TAIL_OFFSET );
933-
934- iommu_feature_enable (iommu , CONTROL_PPRLOG_EN );
935- iommu_feature_enable (iommu , CONTROL_PPRINT_EN );
936- }
937-
938- static void __init free_ppr_log (struct amd_iommu * iommu )
939- {
940- free_pages ((unsigned long )iommu -> ppr_log , get_order (PPR_LOG_SIZE ));
941- }
942-
943896static void free_ga_log (struct amd_iommu * iommu )
944897{
945898#ifdef CONFIG_IRQ_REMAP
@@ -1683,7 +1636,7 @@ static void __init free_iommu_one(struct amd_iommu *iommu)
16831636 free_cwwb_sem (iommu );
16841637 free_command_buffer (iommu );
16851638 free_event_buffer (iommu );
1686- free_ppr_log (iommu );
1639+ amd_iommu_free_ppr_log (iommu );
16871640 free_ga_log (iommu );
16881641 iommu_unmap_mmio_space (iommu );
16891642}
@@ -2099,7 +2052,7 @@ static int __init iommu_init_pci(struct amd_iommu *iommu)
20992052 amd_iommu_max_glx_val = min (amd_iommu_max_glx_val , glxval );
21002053 }
21012054
2102- if (check_feature (FEATURE_PPR ) && alloc_ppr_log (iommu ))
2055+ if (check_feature (FEATURE_PPR ) && amd_iommu_alloc_ppr_log (iommu ))
21032056 return - ENOMEM ;
21042057
21052058 if (iommu -> cap & (1UL << IOMMU_CAP_NPCACHE )) {
@@ -2845,7 +2798,7 @@ static void enable_iommus_v2(void)
28452798 struct amd_iommu * iommu ;
28462799
28472800 for_each_iommu (iommu )
2848- iommu_enable_ppr_log (iommu );
2801+ amd_iommu_enable_ppr_log (iommu );
28492802}
28502803
28512804static void enable_iommus_vapic (void )
0 commit comments