iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Vasant Hegde <vasant.hegde@amd.com>
To: <iommu@lists.linux.dev>, <joro@8bytes.org>
Cc: <suravee.suthikulpanit@amd.com>, <wei.huang2@amd.com>,
	<jsnitsel@redhat.com>, <jgg@ziepe.ca>,
	Vasant Hegde <vasant.hegde@amd.com>
Subject: [PATCH v4 00/16] iommu/amd: SVA Support (part 3) - refactor support for GCR3 table
Date: Tue, 12 Dec 2023 08:52:08 +0000	[thread overview]
Message-ID: <20231212085224.6985-1-vasant.hegde@amd.com> (raw)

This is part 3 of the 4-part series to introduce Share Virtual
Address (SVA) support, which focuses on refactoring GCR3 table.
This moves GCR3 related information from protection domain
structure to iommu_dev_data (per device) structure.

It contains the following enhancements:

* Patch 1 - 3:
  Cleanup and introduce helper function

* Patch 4 - 13:
  Introduce per device GCR3 table, per device domain ID, invalidation based
  on per device and code refactoring

* Patch 14 - 16:
  Remove unused variable, rearrange functions to make it easy to maintain

This patch series is based on top of iommu/next branch (commit bd19c7637024).

This is also available at github :
  https://github.com/AMDESE/linux/tree/iommu_sva_part3_v4_v6.7_rc5

Thanks Jason for reviewing previous versions and providing valuable feedbacks.


Changes from v3 -> v4:
  - Added new patch to enable IOMMU GT feature early
  - Fixed dirty tracking path to use get_amd_iommu_from_dev()
  - Fixed duplicate flush issue in do_attach() path
  - Removed gcr3_info->giov variable. Instead we use domain page table mode to decide
    DTE[GIOV] bit.
  - Free gcr3_table before calling set_dte_entry (otherwise there is a possibility
    of its setting up gcr3 table with glx 0)
  - Adjusted gfp_t flag for GCR3 table allocation (GPF_ATOMIC -> GFP_KERNEL)
  - Moved below patches from invalidation improvement series to this series
    * Remove unused flush_pasid() related functions
      (Originally it was part of Invalidation improvement series, I had to push it to
       this series as set_gcr3() was still using __amd_iommu_flush_tlb()).
    * Added patch to Rearrange device flush code

v3 : https://lore.kernel.org/linux-iommu/20231013151652.6008-1-vasant.hegde@amd.com/T/#t

Changes from v2 -> v3:
  - Dropped "iommu/amd: Use struct protection_domain in helper functions" as flush related
    functions are already fixed and set_gcr3 related functions is reworked in this series.
  - Removed moving to_pdomain() function from this series. It will be introduced
    in SVA series where it will be used.
  - Added per device domain ID and per device invalidation functions
  - Added functions to flush TLB for the given device
  - Added Review-by tags

v2 : https://lore.kernel.org/linux-iommu/20230816174031.634453-1-vasant.hegde@amd.com/T/#t

Changes from v1 - v2:
  - Dropped iommu_v2 module related support as newly introduced Part2
    removed iommu_v2 module.
  - Moved Patch 'Use struct protection_domain in helper functions' from Part1 to
    Part3
  - Updated get_amd_iommu_from_dev() to retrieve iommu from device structure
  - Removed 'PD_MODE_PT'

v1 : https://lore.kernel.org/linux-iommu/20230808100232.5977-1-vasant.hegde@amd.com/T/#t

Suravee Suthikulpanit (8):
  iommu/amd: Introduce get_amd_iommu_from_dev()
  iommu/amd: Introduce struct protection_domain.pd_mode
  iommu/amd: Introduce per-device GCR3 table
  iommu/amd: Refactor helper function for setting / clearing GCR3
  iommu/amd: Refactor attaching / detaching device functions
  iommu/amd: Refactor protection_domain helper functions
  iommu/amd: Refactor GCR3 table helper functions
  iommu/amd: Remove unused GCR3 table parameters from struct
    protection_domain

Vasant Hegde (8):
  iommu/amd: Pass struct iommu_dev_data to set_dte_entry()
  iommu/amd: Enable Guest Translation before registering devices
  iommu/amd: Use protection_domain.flags to check page table mode
  iommu/amd: Introduce per-device domain ID to workaround potential TLB
    aliasing issue
  iommu/amd: Add support for device based TLB invalidation
  iommu/amd: Rearrange GCR3 table setup code
  iommu/amd: Remove unused flush pasid functions
  iommu/amd: Rearrange device flush code

 drivers/iommu/amd/amd_iommu.h       |  25 +-
 drivers/iommu/amd/amd_iommu_types.h |  27 +-
 drivers/iommu/amd/init.c            |   6 +-
 drivers/iommu/amd/io_pgtable_v2.c   |  21 +-
 drivers/iommu/amd/iommu.c           | 646 ++++++++++++++--------------
 include/linux/iommu.h               |  13 +
 6 files changed, 371 insertions(+), 367 deletions(-)

-- 
2.31.1


             reply	other threads:[~2023-12-12  8:52 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  8:52 Vasant Hegde [this message]
2023-12-12  8:52 ` [PATCH v4 01/16] iommu/amd: Pass struct iommu_dev_data to set_dte_entry() Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 02/16] iommu/amd: Enable Guest Translation before registering devices Vasant Hegde
2024-01-05 18:17   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 03/16] iommu/amd: Introduce get_amd_iommu_from_dev() Vasant Hegde
2024-01-05 18:27   ` Jason Gunthorpe
2024-01-10 12:07     ` Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 04/16] iommu/amd: Introduce struct protection_domain.pd_mode Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 05/16] iommu/amd: Introduce per-device GCR3 table Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 06/16] iommu/amd: Use protection_domain.flags to check page table mode Vasant Hegde
2024-01-05 18:28   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 07/16] iommu/amd: Introduce per-device domain ID to workaround potential TLB aliasing issue Vasant Hegde
2024-01-05 18:55   ` Jason Gunthorpe
2024-01-11 11:18     ` Vasant Hegde
2024-01-11 13:59       ` Jason Gunthorpe
2024-01-12 12:45         ` Vasant Hegde
2024-01-12 14:59           ` Jason Gunthorpe
2024-01-16 10:52             ` Vasant Hegde
2024-01-16 14:00               ` Jason Gunthorpe
2024-01-16 17:08                 ` Vasant Hegde
2024-01-16 17:22                   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 08/16] iommu/amd: Add support for device based TLB invalidation Vasant Hegde
2024-01-05 19:03   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 09/16] iommu/amd: Rearrange GCR3 table setup code Vasant Hegde
2024-01-05 19:04   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 10/16] iommu/amd: Refactor helper function for setting / clearing GCR3 Vasant Hegde
2024-01-05 19:12   ` Jason Gunthorpe
2024-01-11 11:52     ` Vasant Hegde
2024-01-11 13:26       ` Jason Gunthorpe
2024-01-12  9:00         ` Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 11/16] iommu/amd: Refactor attaching / detaching device functions Vasant Hegde
2024-01-05 19:14   ` Jason Gunthorpe
2024-01-11 10:06     ` Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 12/16] iommu/amd: Refactor protection_domain helper functions Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 13/16] iommu/amd: Refactor GCR3 table " Vasant Hegde
2024-01-05 19:21   ` Jason Gunthorpe
2024-01-11  5:39     ` Vasant Hegde
2023-12-12  8:52 ` [PATCH v4 14/16] iommu/amd: Remove unused flush pasid functions Vasant Hegde
2024-01-05 19:22   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 15/16] iommu/amd: Rearrange device flush code Vasant Hegde
2024-01-05 19:22   ` Jason Gunthorpe
2023-12-12  8:52 ` [PATCH v4 16/16] iommu/amd: Remove unused GCR3 table parameters from struct protection_domain 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=20231212085224.6985-1-vasant.hegde@amd.com \
    --to=vasant.hegde@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=joro@8bytes.org \
    --cc=jsnitsel@redhat.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=wei.huang2@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;
as well as URLs for NNTP newsgroup(s).