diff mbox series

[08/16] iommu/fsl: use page allocation function provided by iommu-pages.h

Message ID 20231128204938.1453583-9-pasha.tatashin@soleen.com
State New
Headers show
Series IOMMU memory observability | expand

Commit Message

Pasha Tatashin Nov. 28, 2023, 8:49 p.m. UTC
Convert iommu/fsl_pamu.c to use the new page allocation functions
provided in iommu-pages.h.

Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
 drivers/iommu/fsl_pamu.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Robin Murphy Nov. 28, 2023, 10:53 p.m. UTC | #1
On 2023-11-28 8:49 pm, Pasha Tatashin wrote:
> Convert iommu/fsl_pamu.c to use the new page allocation functions
> provided in iommu-pages.h.

Again, this is not a pagetable. This thing doesn't even *have* pagetables.

Similar to patches #1 and #2 where you're lumping in configuration 
tables which belong to the IOMMU driver itself, as opposed to pagetables 
which effectively belong to an IOMMU domain's user. But then there are 
still drivers where you're *not* accounting similar configuration 
structures, so I really struggle to see how this metric is useful when 
it's so completely inconsistent in what it's counting :/

Thanks,
Robin.

> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
>   drivers/iommu/fsl_pamu.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
> index f37d3b044131..7bfb49940f0c 100644
> --- a/drivers/iommu/fsl_pamu.c
> +++ b/drivers/iommu/fsl_pamu.c
> @@ -16,6 +16,7 @@
>   #include <linux/platform_device.h>
>   
>   #include <asm/mpc85xx.h>
> +#include "iommu-pages.h"
>   
>   /* define indexes for each operation mapping scenario */
>   #define OMI_QMAN        0x00
> @@ -828,7 +829,7 @@ static int fsl_pamu_probe(struct platform_device *pdev)
>   		(PAGE_SIZE << get_order(OMT_SIZE));
>   	order = get_order(mem_size);
>   
> -	p = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
> +	p = __iommu_alloc_pages(GFP_KERNEL, order);
>   	if (!p) {
>   		dev_err(dev, "unable to allocate PAACT/SPAACT/OMT block\n");
>   		ret = -ENOMEM;
> @@ -916,7 +917,7 @@ static int fsl_pamu_probe(struct platform_device *pdev)
>   		iounmap(guts_regs);
>   
>   	if (ppaact)
> -		free_pages((unsigned long)ppaact, order);
> +		iommu_free_pages(ppaact, order);
>   
>   	ppaact = NULL;
>
diff mbox series

Patch

diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index f37d3b044131..7bfb49940f0c 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -16,6 +16,7 @@ 
 #include <linux/platform_device.h>
 
 #include <asm/mpc85xx.h>
+#include "iommu-pages.h"
 
 /* define indexes for each operation mapping scenario */
 #define OMI_QMAN        0x00
@@ -828,7 +829,7 @@  static int fsl_pamu_probe(struct platform_device *pdev)
 		(PAGE_SIZE << get_order(OMT_SIZE));
 	order = get_order(mem_size);
 
-	p = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
+	p = __iommu_alloc_pages(GFP_KERNEL, order);
 	if (!p) {
 		dev_err(dev, "unable to allocate PAACT/SPAACT/OMT block\n");
 		ret = -ENOMEM;
@@ -916,7 +917,7 @@  static int fsl_pamu_probe(struct platform_device *pdev)
 		iounmap(guts_regs);
 
 	if (ppaact)
-		free_pages((unsigned long)ppaact, order);
+		iommu_free_pages(ppaact, order);
 
 	ppaact = NULL;