From: Jason Gunthorpe <jgg@ziepe.ca>
To: Vasant Hegde <vasant.hegde@amd.com>
Cc: iommu@lists.linux.dev, joro@8bytes.org,
suravee.suthikulpanit@amd.com, wei.huang2@amd.com,
jsnitsel@redhat.com
Subject: Re: [PATCH v5 10/17] iommu: Introduce iommu_group_mutex_assert()
Date: Fri, 19 Jan 2024 15:09:55 -0400 [thread overview]
Message-ID: <20240119190955.GM50608@ziepe.ca> (raw)
In-Reply-To: <20240116165335.6043-11-vasant.hegde@amd.com>
On Tue, Jan 16, 2024 at 04:53:28PM +0000, Vasant Hegde wrote:
> +/**
> + * iommu_group_mutex_assert - Check device group mutex lock
> + * @dev: the device that has group param set
> + *
> + * This function is called by an iommu driver to check whether it holds
> + * group mutex lock for the given device or not.
> + *
> + * Note that this function must be called after device group param is set.
> + */
> +void iommu_group_mutex_assert(struct device *dev)
> +{
> + struct iommu_group *group = dev->iommu_group;
> +
> + lockdep_assert_held(&group->mutex);
> +}
> +EXPORT_SYMBOL_GPL(iommu_group_mutex_assert);
> +
> static struct device *iommu_group_first_dev(struct iommu_group *group)
> {
> lockdep_assert_held(&group->mutex);
> diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> index 7f6342bc71c3..c983b6a1ebce 100644
> --- a/include/linux/iommu.h
> +++ b/include/linux/iommu.h
> @@ -751,6 +751,7 @@ extern int iommu_group_set_name(struct iommu_group *group, const char *name);
> extern int iommu_group_add_device(struct iommu_group *group,
> struct device *dev);
> extern void iommu_group_remove_device(struct device *dev);
> +extern void iommu_group_mutex_assert(struct device *dev);
This shouldn't be unconditional. Like this outside the other ifdefs:
#if IS_ENABLED(CONFIG_LOCKDEP) && IS_ENABLED(CONFIG_IOMMU)
void iommu_group_mutex_assert(struct device *dev);
#else
static inline void iommu_group_mutex_assert(struct device *dev)
{
}
#endif
And a similar ifdef around the implementation I suppose.
Jason
next prev parent reply other threads:[~2024-01-19 19:09 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-16 16:53 [PATCH v5 00/17] iommu/amd: SVA Support (part 3) - refactor support for GCR3 table Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 01/17] iommu/amd: Pass struct iommu_dev_data to set_dte_entry() Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 02/17] iommu/amd: Enable Guest Translation before registering devices Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 03/17] iommu/amd: Introduce get_amd_iommu_from_dev() Vasant Hegde
2024-01-19 19:00 ` Jason Gunthorpe
2024-01-16 16:53 ` [PATCH v5 04/17] iommu/amd: Introduce struct protection_domain.pd_mode Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 05/17] iommu/amd: Introduce per-device GCR3 table Vasant Hegde
2024-01-19 19:03 ` Jason Gunthorpe
2024-01-16 16:53 ` [PATCH v5 06/17] iommu/amd: Use protection_domain.flags to check page table mode Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 07/17] iommu/amd: Introduce per-device domain ID to workaround potential TLB aliasing issue Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 08/17] iommu/amd: Add support for device based TLB invalidation Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 09/17] iommu/amd: Rearrange GCR3 table setup code Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 10/17] iommu: Introduce iommu_group_mutex_assert() Vasant Hegde
2024-01-19 19:09 ` Jason Gunthorpe [this message]
2024-01-22 6:24 ` Vasant Hegde
2024-01-22 18:00 ` Jason Gunthorpe
2024-01-23 5:27 ` Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 11/17] iommu/amd: Refactor helper function for setting / clearing GCR3 Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 12/17] iommu/amd: Refactor attaching / detaching device functions Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 13/17] iommu/amd: Refactor protection_domain helper functions Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 14/17] iommu/amd: Refactor GCR3 table " Vasant Hegde
2024-01-19 19:59 ` Jason Gunthorpe
2024-01-22 10:23 ` Vasant Hegde
2024-01-22 18:26 ` Jason Gunthorpe
2024-01-23 8:54 ` Vasant Hegde
2024-01-25 1:46 ` Jason Gunthorpe
2024-01-25 12:11 ` Vasant Hegde
2024-01-25 15:53 ` Jason Gunthorpe
2024-01-16 16:53 ` [PATCH v5 15/17] iommu/amd: Remove unused flush pasid functions Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 16/17] iommu/amd: Rearrange device flush code Vasant Hegde
2024-01-16 16:53 ` [PATCH v5 17/17] 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=20240119190955.GM50608@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=jsnitsel@redhat.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@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