From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@amd.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev,
joro@8bytes.org, yi.l.liu@intel.com, kevin.tian@intel.com,
nicolinc@nvidia.com, eric.auger@redhat.com, vasant.hegde@amd.com,
jon.grimm@amd.com, santosh.shukla@amd.com, Dhaval.Giani@amd.com,
pandoh@google.com, loganodell@google.com
Subject: Re: [RFC PATCH 4/6] iommufd: Introduce data struct for AMD nested domain allocation
Date: Fri, 5 Jan 2024 20:39:14 +0700 [thread overview]
Message-ID: <447e7e1b-97ef-4570-80dc-72df618a0b3a@amd.com> (raw)
In-Reply-To: <20231213140359.GU3014157@nvidia.com>
Hi Jason
On 12/13/2023 9:03 PM, Jason Gunthorpe wrote:
> On Tue, Dec 12, 2023 at 10:01:37AM -0600, Suravee Suthikulpanit wrote:
>> Introduce IOMMU_HWPT_DATA_AMD_V2 data type for AMD IOMMU v2 page table,
>> which is used for stage-1 in nested translation. The data structure
>> contains information necessary for setting up the AMD HW-vIOMMU support.
>>
>> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
>> ---
>> include/uapi/linux/iommufd.h | 23 +++++++++++++++++++++++
>> 1 file changed, 23 insertions(+)
>>
>> diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
>> index bf4a1f8ab748..e2240d430dd1 100644
>> --- a/include/uapi/linux/iommufd.h
>> +++ b/include/uapi/linux/iommufd.h
>> @@ -389,14 +389,37 @@ struct iommu_hwpt_vtd_s1 {
>> __u32 __reserved;
>> };
>>
>> +/**
>> + * struct iommu_hwpt_amd_v2 - AMD IOMMU specific user-managed
>> + * v2 I/O page table data
>> + * @gcr3: GCR3 guest physical ddress
>> + * @gid: Guest ID
>> + * @iommu_id: IOMMU host device ID
>> + * @gdev_id: Guest device ID
>> + * @gdom_id: Guest domain ID
>> + * @glx: GCR3 table levels
>> + * @guest_paging_mode: Guest v2 page table paging mode
>> + */
>> +struct iommu_hwpt_amd_v2 {
>> + __aligned_u64 gcr3;
>> + __u32 gid;
>> + __u32 iommu_id;
>> + __u16 gdev_id;
>> + __u16 gdom_id;
>> + __u16 glx;
>> + __u16 guest_paging_mode;
>
> Add explicit padding please
OK
> Also, I'm pretty sure that most of these IDs cannot be here.
>
> These are Ok:
>
> __aligned_u64 gcr3; // table top pointer
> __u16 gdom_id; // virtual cache tag
> __u16 glx; // configuration of radix
> __u16 guest_paging_mode; // configuration of radix
>
> These are confusing, probably incorrect.
>
> + __u32 gid;
> + __u32 iommu_id;
> + __u16 gdev_id;
> iommu_id is the RID of the IOMMU, so definately not. The iommu
> instance to work on is specifed by the generic dev_id which becomes a
> struct device * in the driver callback. Access the target iommu
> instance via dev_iommu_priv_get()/etc
>
> The translation of gdev_id to pdev_dev needs to be connected to some
> future viommu object, so this shouldn't be part of this series, and
> will eventually be provided through some new viommu object API - see
> my long outline email
Got it.
> The viommu object should hold the GID. I'm not sure you need a GID
> right now (can you just issue invalidation on the physical side?), but
> if you do need GID to bridge until the viommu is ready it should
> probably be allocated by and stored in the nesting parent.
Currently, the GID is needed when setting up domain ID mapping table
(and device ID mapping table in future series), which will be moved to
when attaching domain to a device. By that time, we should already have
GID information already stored in other struct (e.g. struct
iommu_dev_data). So it should be alright to get rid of GID from the
struct iommu_hwpt_amd_v2.
Thanks,
Suravee
next prev parent reply other threads:[~2024-01-05 13:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 16:01 [RFC PATCH 0/6] iommu/amd: Introduce hardware info reporting and nested translation support Suravee Suthikulpanit
2023-12-12 16:01 ` [RFC PATCH 1/6] iommu/amd: Update PASID, GATS, and GLX feature related macros Suravee Suthikulpanit
2023-12-12 16:01 ` [RFC PATCH 2/6] iommu/amd: Add support for hw_info for iommu capability query Suravee Suthikulpanit
2023-12-13 13:27 ` Jason Gunthorpe
2024-01-05 13:39 ` Suthikulpanit, Suravee
2023-12-15 7:32 ` Tian, Kevin
2024-01-05 13:40 ` Suthikulpanit, Suravee
2023-12-12 16:01 ` [RFC PATCH 3/6] iommu/amd: Introduce Guest-ID struct amd_iommu_vminfo Suravee Suthikulpanit
2023-12-15 7:35 ` Tian, Kevin
2024-01-05 13:39 ` Suthikulpanit, Suravee
2024-01-05 14:38 ` Jason Gunthorpe
2024-01-09 9:52 ` Suthikulpanit, Suravee
2023-12-12 16:01 ` [RFC PATCH 4/6] iommufd: Introduce data struct for AMD nested domain allocation Suravee Suthikulpanit
2023-12-13 14:03 ` Jason Gunthorpe
2023-12-15 7:38 ` Tian, Kevin
2024-01-05 13:39 ` Suthikulpanit, Suravee [this message]
2023-12-12 16:01 ` [RFC PATCH 5/6] iommu/amd: Introduce helper functions to setup GCR3TRPMode Suravee Suthikulpanit
2023-12-13 13:53 ` Jason Gunthorpe
2023-12-15 7:39 ` Tian, Kevin
2024-01-05 13:56 ` Suthikulpanit, Suravee
2023-12-12 16:01 ` [RFC PATCH 6/6] iommu/amd: Introduce nested translation support Suravee Suthikulpanit
2023-12-13 13:52 ` Jason Gunthorpe
2024-01-05 13:38 ` Suthikulpanit, Suravee
2024-01-05 14:31 ` Jason Gunthorpe
2023-12-15 7:45 ` Tian, Kevin
2024-01-05 13:39 ` Suthikulpanit, Suravee
2024-01-05 14:37 ` Jason Gunthorpe
2024-01-08 6:49 ` Suthikulpanit, Suravee
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=447e7e1b-97ef-4570-80dc-72df618a0b3a@amd.com \
--to=suravee.suthikulpanit@amd.com \
--cc=Dhaval.Giani@amd.com \
--cc=eric.auger@redhat.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=jon.grimm@amd.com \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=loganodell@google.com \
--cc=nicolinc@nvidia.com \
--cc=pandoh@google.com \
--cc=santosh.shukla@amd.com \
--cc=vasant.hegde@amd.com \
--cc=yi.l.liu@intel.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