Re: [PATCH v3 02/25] iommu/amd: Drop IOVA cookie management

2021-08-05 Thread Robin Murphy

On 2021-08-04 18:15, Robin Murphy wrote:

The core code bakes its own cookies now.

Signed-off-by: Robin Murphy 

---

v3: Also remove unneeded include
---
  drivers/iommu/amd/iommu.c | 13 -
  1 file changed, 13 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 52fe2326042a..92f7cbe3d14a 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -20,7 +20,6 @@
  #include 
  #include 
  #include 
-#include 


Oh dear, how embarrassing... I went through all the drivers making that 
decision based on iommu_dma* references but totally forgot about 
iommu_setup_dma_ops() here. And then of course fell into the trap of 
"such a minor change I don't need to re-rest it" hubris... sigh, roll 
back to v2 for this one.


Apologies,
Robin.


  #include 
  #include 
  #include 
@@ -1918,16 +1917,7 @@ static struct iommu_domain 
*amd_iommu_domain_alloc(unsigned type)
domain->domain.geometry.aperture_end   = ~0ULL;
domain->domain.geometry.force_aperture = true;
  
-	if (type == IOMMU_DOMAIN_DMA &&

-   iommu_get_dma_cookie(&domain->domain) == -ENOMEM)
-   goto free_domain;
-
return &domain->domain;
-
-free_domain:
-   protection_domain_free(domain);
-
-   return NULL;
  }
  
  static void amd_iommu_domain_free(struct iommu_domain *dom)

@@ -1944,9 +1934,6 @@ static void amd_iommu_domain_free(struct iommu_domain 
*dom)
if (!dom)
return;
  
-	if (dom->type == IOMMU_DOMAIN_DMA)

-   iommu_put_dma_cookie(&domain->domain);
-
if (domain->flags & PD_IOMMUV2_MASK)
free_gcr3_table(domain);
  


___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu


Re: [PATCH v3 02/25] iommu/amd: Drop IOVA cookie management

2021-08-05 Thread kernel test robot
Hi Robin,

I love your patch! Yet something to improve:

[auto build test ERROR on iommu/next]
[also build test ERROR on rockchip/for-next sunxi/sunxi/for-next linus/master 
v5.14-rc4 next-20210804]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Robin-Murphy/iommu-Refactor-DMA-domain-strictness/20210805-011913
base:   https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# 
https://github.com/0day-ci/linux/commit/33b83e4adc16220361ed42c229e8cd37f8a2a3aa
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Robin-Murphy/iommu-Refactor-DMA-domain-strictness/20210805-011913
git checkout 33b83e4adc16220361ed42c229e8cd37f8a2a3aa
# save the attached .config to linux build tree
make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   drivers/iommu/amd/iommu.c: In function 'amd_iommu_probe_finalize':
>> drivers/iommu/amd/iommu.c:1757:3: error: implicit declaration of function 
>> 'iommu_setup_dma_ops'; did you mean 'arch_setup_dma_ops'? 
>> [-Werror=implicit-function-declaration]
1757 |   iommu_setup_dma_ops(dev, 0, U64_MAX);
 |   ^~~
 |   arch_setup_dma_ops
   cc1: some warnings being treated as errors


vim +1757 drivers/iommu/amd/iommu.c

1ac4cbbc5eb56d arch/x86/kernel/amd_iommu.c Joerg Roedel  2008-12-10  
1749  
dce8d6964ebdb3 drivers/iommu/amd_iommu.c   Joerg Roedel  2020-04-29  
1750  static void amd_iommu_probe_finalize(struct device *dev)
dce8d6964ebdb3 drivers/iommu/amd_iommu.c   Joerg Roedel  2020-04-29  
1751  {
dce8d6964ebdb3 drivers/iommu/amd_iommu.c   Joerg Roedel  2020-04-29  
1752   struct iommu_domain *domain;
ac1534a55d1e87 drivers/iommu/amd_iommu.c   Joerg Roedel  2012-06-21  
1753  
07ee86948c9111 drivers/iommu/amd_iommu.c   Joerg Roedel  2015-05-28  
1754   /* Domains are initialized for this device - have a look what we 
ended up with */
07ee86948c9111 drivers/iommu/amd_iommu.c   Joerg Roedel  2015-05-28  
1755   domain = iommu_get_domain_for_dev(dev);
57f9842e488406 drivers/iommu/amd_iommu.c   Joerg Roedel  2020-04-29  
1756   if (domain->type == IOMMU_DOMAIN_DMA)
ac6d704679d343 drivers/iommu/amd/iommu.c   Jean-Philippe Brucker 2021-06-18 
@1757   iommu_setup_dma_ops(dev, 0, U64_MAX);
d6177a6556f853 drivers/iommu/amd/iommu.c   Jean-Philippe Brucker 2021-04-22  
1758   else
d6177a6556f853 drivers/iommu/amd/iommu.c   Jean-Philippe Brucker 2021-04-22  
1759   set_dma_ops(dev, NULL);
e275a2a0fc9e21 arch/x86/kernel/amd_iommu.c Joerg Roedel  2008-12-10  
1760  }
e275a2a0fc9e21 arch/x86/kernel/amd_iommu.c Joerg Roedel  2008-12-10  
1761  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip
___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH v3 02/25] iommu/amd: Drop IOVA cookie management

2021-08-04 Thread Robin Murphy
The core code bakes its own cookies now.

Signed-off-by: Robin Murphy 

---

v3: Also remove unneeded include
---
 drivers/iommu/amd/iommu.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index 52fe2326042a..92f7cbe3d14a 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1918,16 +1917,7 @@ static struct iommu_domain 
*amd_iommu_domain_alloc(unsigned type)
domain->domain.geometry.aperture_end   = ~0ULL;
domain->domain.geometry.force_aperture = true;
 
-   if (type == IOMMU_DOMAIN_DMA &&
-   iommu_get_dma_cookie(&domain->domain) == -ENOMEM)
-   goto free_domain;
-
return &domain->domain;
-
-free_domain:
-   protection_domain_free(domain);
-
-   return NULL;
 }
 
 static void amd_iommu_domain_free(struct iommu_domain *dom)
@@ -1944,9 +1934,6 @@ static void amd_iommu_domain_free(struct iommu_domain 
*dom)
if (!dom)
return;
 
-   if (dom->type == IOMMU_DOMAIN_DMA)
-   iommu_put_dma_cookie(&domain->domain);
-
if (domain->flags & PD_IOMMUV2_MASK)
free_gcr3_table(domain);
 
-- 
2.25.1

___
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu