From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org> Cc: Ashok Raj <ashok.raj@intel.com>, Jacob Pan <jacob.jun.pan@linux.intel.com>, Guo Kaijie <Kaijie.Guo@intel.com>, Liu Yi L <yi.l.liu@intel.com>, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Lu Baolu <baolu.lu@linux.intel.com> Subject: [PATCH 1/5] iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb() Date: Thu, 31 Dec 2020 08:53:19 +0800 [thread overview] Message-ID: <20201231005323.2178523-1-baolu.lu@linux.intel.com> (raw) Use IS_ALIGNED() instead. Otherwise, an unaligned address will be ignored. Fixes: 33cd6e642d6a7 ("iommu/vt-d: Flush PASID-based iotlb for iova over first level") Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/iommu/intel/dmar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index b46dbfa6d0ed..004feaed3c72 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -1461,8 +1461,8 @@ void qi_flush_piotlb(struct intel_iommu *iommu, u16 did, u32 pasid, u64 addr, int mask = ilog2(__roundup_pow_of_two(npages)); unsigned long align = (1ULL << (VTD_PAGE_SHIFT + mask)); - if (WARN_ON_ONCE(!ALIGN(addr, align))) - addr &= ~(align - 1); + if (WARN_ON_ONCE(!IS_ALIGNED(addr, align))) + addr = ALIGN_DOWN(addr, align); desc.qw0 = QI_EIOTLB_PASID(pasid) | QI_EIOTLB_DID(did) | -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org> Cc: Ashok Raj <ashok.raj@intel.com>, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Guo Kaijie <Kaijie.Guo@intel.com> Subject: [PATCH 1/5] iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb() Date: Thu, 31 Dec 2020 08:53:19 +0800 [thread overview] Message-ID: <20201231005323.2178523-1-baolu.lu@linux.intel.com> (raw) Use IS_ALIGNED() instead. Otherwise, an unaligned address will be ignored. Fixes: 33cd6e642d6a7 ("iommu/vt-d: Flush PASID-based iotlb for iova over first level") Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> --- drivers/iommu/intel/dmar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index b46dbfa6d0ed..004feaed3c72 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -1461,8 +1461,8 @@ void qi_flush_piotlb(struct intel_iommu *iommu, u16 did, u32 pasid, u64 addr, int mask = ilog2(__roundup_pow_of_two(npages)); unsigned long align = (1ULL << (VTD_PAGE_SHIFT + mask)); - if (WARN_ON_ONCE(!ALIGN(addr, align))) - addr &= ~(align - 1); + if (WARN_ON_ONCE(!IS_ALIGNED(addr, align))) + addr = ALIGN_DOWN(addr, align); desc.qw0 = QI_EIOTLB_PASID(pasid) | QI_EIOTLB_DID(did) | -- 2.25.1 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2020-12-31 1:03 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-31 0:53 Lu Baolu [this message] 2020-12-31 0:53 ` [PATCH 1/5] iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb() Lu Baolu 2020-12-31 0:53 ` [PATCH 2/5] iommu/vt-d: Fix unaligned addresses for intel_flush_svm_range_dev() Lu Baolu 2020-12-31 0:53 ` Lu Baolu 2021-01-05 19:03 ` Will Deacon 2021-01-05 19:03 ` Will Deacon 2021-01-06 1:09 ` Lu Baolu 2021-01-06 1:09 ` Lu Baolu 2021-01-07 23:52 ` Lu Baolu 2021-01-07 23:52 ` Lu Baolu 2021-01-08 14:09 ` Will Deacon 2021-01-08 14:09 ` Will Deacon 2021-01-08 14:30 ` Lu Baolu 2021-01-08 14:30 ` Lu Baolu 2020-12-31 0:53 ` [PATCH 3/5] iommu/vt-d: Remove unused dma map/unmap trace events Lu Baolu 2020-12-31 0:53 ` Lu Baolu 2021-01-05 19:04 ` Will Deacon 2021-01-05 19:04 ` Will Deacon 2021-01-06 1:14 ` Lu Baolu 2021-01-06 1:14 ` Lu Baolu 2021-01-07 14:40 ` Will Deacon 2021-01-07 14:40 ` Will Deacon 2021-01-08 0:00 ` Lu Baolu 2021-01-08 0:00 ` Lu Baolu 2020-12-31 0:53 ` [PATCH 4/5] Revert "iommu: Add quirk for Intel graphic devices in map_sg" Lu Baolu 2020-12-31 0:53 ` Lu Baolu 2020-12-31 0:53 ` [PATCH 5/5] iommu/vt-d: Fix lockdep splat in sva bind()/unbind() Lu Baolu 2020-12-31 0:53 ` Lu Baolu 2021-01-07 14:22 ` [PATCH 1/5] iommu/vt-d: Fix misuse of ALIGN in qi_flush_piotlb() Will Deacon 2021-01-07 14:22 ` Will Deacon
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=20201231005323.2178523-1-baolu.lu@linux.intel.com \ --to=baolu.lu@linux.intel.com \ --cc=Kaijie.Guo@intel.com \ --cc=ashok.raj@intel.com \ --cc=iommu@lists.linux-foundation.org \ --cc=jacob.jun.pan@linux.intel.com \ --cc=joro@8bytes.org \ --cc=linux-kernel@vger.kernel.org \ --cc=will@kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.