From: Baolu Lu <baolu.lu@linux.intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: baolu.lu@linux.intel.com, kvm@vger.kernel.org
Subject: Re: [PATCH 4/5] iommu/vt-d: Add helpers to set up and tear down TDX extensions
Date: Wed, 16 Sep 2026 16:37:02 +0800 [thread overview]
Message-ID: <5fae68ba-1fcc-4817-8ed3-3f724a9f807d@linux.intel.com> (raw)
In-Reply-To: <20260915080449.D960B1F000FF@smtp.kernel.org>
On 9/15/2026 4:04 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] iommu: bounds check uses PAGE_SIZE while allocation uses SZ_4K
> --
>
> commit 4edc662d667d9a3f034b902dc510d5238c7c24a5
> Author: Lu Baolu<baolu.lu@linux.intel.com>
>
> iommu/vt-d: Add helpers to set up and tear down TDX extensions
>
> This commit implements per-IOMMU TDX Connect bring-up and tear-down helpers.
> It allocates and populates the IOMMU_MT parameter layout required by
> TDH.IOMMU.SETUP, and handles initialization completion and rollback.
>
>> diff --git a/drivers/iommu/intel/tdxc.c b/drivers/iommu/intel/tdxc.c
>> index 559c752a15273..b5dfdeeb23dba 100644
>> --- a/drivers/iommu/intel/tdxc.c
>> +++ b/drivers/iommu/intel/tdxc.c
> [ ... ]
>
>> +static struct tdxc_pages *tdxc_alloc_mt_pages(struct intel_iommu *iommu,
>> + unsigned int nr_mt_pages)
>> +{
>> + unsigned int nr_entries = nr_mt_pages + IQ_BUFFERS_NUM;
>> + struct tdxc_pages *array;
>> +
>> + if (!nr_mt_pages || nr_mt_pages > (PAGE_SIZE / sizeof(u64) - IQ_BUFFERS_NUM))
> [Severity: Low]
> Does this bounds check use the wrong size macro? It restricts nr_mt_pages
> based on PAGE_SIZE, but the corresponding root array allocation below is
> hardcoded to SZ_4K. Should this check use SZ_4K to match the allocation size?
I'll use SZ_4K instead of PAGE_SIZE here. The size is fixed at 4KB by
the TDX module ABI, so it should not be expressed in terms of the host
page size, even though this file is x86-only and PAGE_SIZE == SZ_4K
unconditionally. No functional change.
Thanks,
baolu
next prev parent reply other threads:[~2026-09-16 8:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 7:42 [PATCH 0/5] iommu/vt-d: Introduce trusted DMA initialization support Lu Baolu
2026-09-15 7:42 ` [PATCH 1/5] x86/virt/tdx: Add SEAMCALL wrappers for IOMMU setup/clear Lu Baolu
2026-09-15 7:42 ` [PATCH 2/5] x86/virt/tdx: Read global metadata for trusted IOMMU Lu Baolu
2026-09-15 7:42 ` [PATCH 3/5] iommu/vt-d: Add interfaces for trusted DMA initialization Lu Baolu
2026-09-15 7:42 ` [PATCH 4/5] iommu/vt-d: Add helpers to set up and tear down TDX extensions Lu Baolu
2026-09-15 8:04 ` sashiko-bot
2026-09-16 8:37 ` Baolu Lu [this message]
2026-09-15 7:42 ` [PATCH 5/5] iommu/vt-d: Reserve MSB of domain ID space for TDX module Lu Baolu
2026-09-15 8:11 ` sashiko-bot
2026-09-16 8:25 ` Baolu Lu
2026-09-18 2:30 ` [PATCH 0/5] iommu/vt-d: Introduce trusted DMA initialization support Tian, Kevin
2026-09-19 4:04 ` Baolu Lu
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=5fae68ba-1fcc-4817-8ed3-3f724a9f807d@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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