Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommu/fsl_pamu: hardcode the window address and size in pamu_config_ppaace

The win_addr and win_size parameters are always set to 0 and 1 << 36
respectively, so just hard code them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210401155256.298656-14-hch@lst.de
Signed-off-by: Joerg Roedel <jroedel@suse.de>

authored by

Christoph Hellwig and committed by
Joerg Roedel
57fa44be 151f9414

+7 -29
+4 -19
drivers/iommu/fsl_pamu.c
··· 178 178 * pamu_config_paace() - Sets up PPAACE entry for specified liodn 179 179 * 180 180 * @liodn: Logical IO device number 181 - * @win_addr: starting address of DSA window 182 - * @win-size: size of DSA window 183 181 * @omi: Operation mapping index -- if ~omi == 0 then omi not defined 184 182 * @stashid: cache stash id for associated cpu -- if ~stashid == 0 then 185 183 * stashid not defined ··· 185 187 * 186 188 * Returns 0 upon success else error code < 0 returned 187 189 */ 188 - int pamu_config_ppaace(int liodn, phys_addr_t win_addr, phys_addr_t win_size, 189 - u32 omi, u32 stashid, int prot) 190 + int pamu_config_ppaace(int liodn, u32 omi, u32 stashid, int prot) 190 191 { 191 192 struct paace *ppaace; 192 - 193 - if ((win_size & (win_size - 1)) || win_size < PAMU_PAGE_SIZE) { 194 - pr_debug("window size too small or not a power of two %pa\n", 195 - &win_size); 196 - return -EINVAL; 197 - } 198 - 199 - if (win_addr & (win_size - 1)) { 200 - pr_debug("window address is not aligned with window size\n"); 201 - return -EINVAL; 202 - } 203 193 204 194 ppaace = pamu_get_ppaace(liodn); 205 195 if (!ppaace) ··· 195 209 196 210 /* window size is 2^(WSE+1) bytes */ 197 211 set_bf(ppaace->addr_bitfields, PPAACE_AF_WSE, 198 - map_addrspace_size_to_wse(win_size)); 212 + map_addrspace_size_to_wse(1ULL << 36)); 199 213 200 214 pamu_init_ppaace(ppaace); 201 215 202 - ppaace->wbah = win_addr >> (PAMU_PAGE_SHIFT + 20); 203 - set_bf(ppaace->addr_bitfields, PPAACE_AF_WBAL, 204 - (win_addr >> PAMU_PAGE_SHIFT)); 216 + ppaace->wbah = 0; 217 + set_bf(ppaace->addr_bitfields, PPAACE_AF_WBAL, 0); 205 218 206 219 /* set up operation mapping if it's configured */ 207 220 if (omi < OME_NUMBER_ENTRIES) {
+1 -2
drivers/iommu/fsl_pamu.h
··· 383 383 int pamu_domain_init(void); 384 384 int pamu_enable_liodn(int liodn); 385 385 int pamu_disable_liodn(int liodn); 386 - int pamu_config_ppaace(int liodn, phys_addr_t win_addr, phys_addr_t win_size, 387 - u32 omi, uint32_t stashid, int prot); 386 + int pamu_config_ppaace(int liodn, u32 omi, uint32_t stashid, int prot); 388 387 389 388 u32 get_stash_id(u32 stash_dest_hint, u32 vcpu); 390 389 void get_ome_index(u32 *omi_index, struct device *dev);
+2 -8
drivers/iommu/fsl_pamu_domain.c
··· 78 78 static int pamu_set_liodn(struct fsl_dma_domain *dma_domain, struct device *dev, 79 79 int liodn) 80 80 { 81 - struct iommu_domain *domain = &dma_domain->iommu_domain; 82 - struct iommu_domain_geometry *geom = &domain->geometry; 83 81 u32 omi_index = ~(u32)0; 84 82 unsigned long flags; 85 83 int ret; ··· 93 95 ret = pamu_disable_liodn(liodn); 94 96 if (ret) 95 97 goto out_unlock; 96 - ret = pamu_config_ppaace(liodn, geom->aperture_start, 97 - geom->aperture_end + 1, omi_index, 98 - dma_domain->stash_id, 0); 98 + ret = pamu_config_ppaace(liodn, omi_index, dma_domain->stash_id, 0); 99 99 if (ret) 100 100 goto out_unlock; 101 - ret = pamu_config_ppaace(liodn, geom->aperture_start, 102 - geom->aperture_end + 1, ~(u32)0, 103 - dma_domain->stash_id, 101 + ret = pamu_config_ppaace(liodn, ~(u32)0, dma_domain->stash_id, 104 102 PAACE_AP_PERMS_QUERY | PAACE_AP_PERMS_UPDATE); 105 103 out_unlock: 106 104 spin_unlock_irqrestore(&iommu_lock, flags);