lkml.org 
[lkml]   [2020]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v4 02/12] iommu/vt-d: Change flags type to unsigned int in binding mm
    Date
    "flags" passed to intel_svm_bind_mm() is a bit mask and should be
    defined as "unsigned int" instead of "int".

    Change its type to "unsigned int".

    Suggested-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
    Reviewed-by: Tony Luck <tony.luck@intel.com>
    ---
    v2:
    - Add this new patch per Thomas' comment.

    drivers/iommu/intel/svm.c | 7 ++++---
    include/linux/intel-iommu.h | 2 +-
    2 files changed, 5 insertions(+), 4 deletions(-)

    diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c
    index 778089d198eb..8a0cf2f0dd54 100644
    --- a/drivers/iommu/intel/svm.c
    +++ b/drivers/iommu/intel/svm.c
    @@ -427,7 +427,8 @@ int intel_svm_unbind_gpasid(struct device *dev, u32 pasid)

    /* Caller must hold pasid_mutex, mm reference */
    static int
    -intel_svm_bind_mm(struct device *dev, int flags, struct svm_dev_ops *ops,
    +intel_svm_bind_mm(struct device *dev, unsigned int flags,
    + struct svm_dev_ops *ops,
    struct mm_struct *mm, struct intel_svm_dev **sd)
    {
    struct intel_iommu *iommu = intel_svm_device_to_iommu(dev);
    @@ -954,7 +955,7 @@ intel_svm_bind(struct device *dev, struct mm_struct *mm, void *drvdata)
    {
    struct iommu_sva *sva = ERR_PTR(-EINVAL);
    struct intel_svm_dev *sdev = NULL;
    - int flags = 0;
    + unsigned int flags = 0;
    int ret;

    /*
    @@ -963,7 +964,7 @@ intel_svm_bind(struct device *dev, struct mm_struct *mm, void *drvdata)
    * and intel_svm etc.
    */
    if (drvdata)
    - flags = *(int *)drvdata;
    + flags = *(unsigned int *)drvdata;
    mutex_lock(&pasid_mutex);
    ret = intel_svm_bind_mm(dev, flags, NULL, mm, &sdev);
    if (ret)
    diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
    index 314a95870e47..4d20f93a5e2d 100644
    --- a/include/linux/intel-iommu.h
    +++ b/include/linux/intel-iommu.h
    @@ -759,7 +759,7 @@ struct intel_svm {
    struct mm_struct *mm;

    struct intel_iommu *iommu;
    - int flags;
    + unsigned int flags;
    u32 pasid;
    int gpasid; /* In case that guest PASID is different from host PASID */
    struct list_head devs;
    --
    2.19.1
    \
     
     \ /
      Last update: 2020-06-25 22:19    [W:4.139 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site