Linux IOMMU Development
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Vasant Hegde <vasant.hegde@amd.com>,
	joro@8bytes.org, iommu@lists.linux.dev
Cc: suravee.suthikulpanit@amd.com
Subject: Re: [PATCH v2 3/6] iommu/amd: Initial support for AMD IOMMU v2 page table
Date: Fri, 15 Jul 2022 12:55:12 +0100	[thread overview]
Message-ID: <3d30d93b-ec12-46b3-576b-c3ac8ebb799f@arm.com> (raw)
In-Reply-To: <20220713053034.12061-4-vasant.hegde@amd.com>

On 2022-07-13 06:30, Vasant Hegde wrote:
[...]
> +static struct io_pgtable *v2_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
> +{
> +	struct amd_io_pgtable *pgtable = io_pgtable_cfg_to_data(cfg);
> +	struct protection_domain *pdom = (struct protection_domain *)cookie;
> +	int ret;
> +
> +	pgtable->pgd = alloc_pgtable_page();
> +	if (!pgtable->pgd)
> +		return NULL;
> +
> +	ret = amd_iommu_domain_set_gcr3(&pdom->domain, 0, iommu_virt_to_phys(pgtable->pgd));
> +	if (ret)
> +		goto err_free_pgd;
> +
> +	pgtable->iop.ops.map          = iommu_v2_map_page;
> +	pgtable->iop.ops.unmap        = iommu_v2_unmap_page;

It would be good to use this opportunity to convert AMD over to 
map_pages/unmap_pages - not only for the future goal of removing 
map/unmap (it's not worth maintaining two interfaces where one is a 
trivial subset of the other), but also since it should be appreciably 
more efficient for you in practice, especially for v2 with the more 
limited set of basic page sizes.

Cheers,
Robin.

> +	pgtable->iop.ops.iova_to_phys = iommu_v2_iova_to_phys;
> +
> +	cfg->pgsize_bitmap = AMD_IOMMU_PGSIZES_V2,
> +	cfg->ias           = IOMMU_IN_ADDR_BIT_SIZE,
> +	cfg->oas           = IOMMU_OUT_ADDR_BIT_SIZE,
> +	cfg->tlb           = &v2_flush_ops;
> +
> +	return &pgtable->iop;
> +
> +err_free_pgd:
> +	free_pgtable_page(pgtable->pgd);
> +
> +	return NULL;
> +}

  reply	other threads:[~2022-07-15 11:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13  5:30 [PATCH v2 0/6] iommu/amd: Add Generic IO Page Table Framework Support for v2 Page Table Vasant Hegde
2022-07-13  5:30 ` [PATCH v2 1/6] iommu/amd: Refactor amd_iommu_domain_enable_v2 to remove locking Vasant Hegde
2022-07-13  5:30 ` [PATCH v2 2/6] iommu/amd: Update sanity check when enable PRI/ATS for IOMMU v1 table Vasant Hegde
2022-07-13  5:30 ` [PATCH v2 3/6] iommu/amd: Initial support for AMD IOMMU v2 page table Vasant Hegde
2022-07-15 11:55   ` Robin Murphy [this message]
2022-07-21 10:52     ` Vasant Hegde
2022-07-13  5:30 ` [PATCH v2 4/6] iommu/amd: Add support for Guest IO protection Vasant Hegde
2022-07-13  5:30 ` [PATCH v2 5/6] iommu/amd: Add support for using AMD IOMMU v2 page table for DMA-API Vasant Hegde
2022-07-13  5:30 ` [PATCH v2 6/6] iommu/amd: Add command-line option to enable different page table Vasant Hegde
2022-07-15  8:49 ` [PATCH v2 0/6] iommu/amd: Add Generic IO Page Table Framework Support for v2 Page Table Joerg Roedel
2022-07-21 10:48   ` Vasant Hegde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d30d93b-ec12-46b3-576b-c3ac8ebb799f@arm.com \
    --to=robin.murphy@arm.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=vasant.hegde@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox