Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Lu Baolu" <baolu.lu@linux.intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 4/5] iommu/vt-d: Add helpers to set up and tear down TDX extensions
Date: Tue, 15 Sep 2026 08:04:49 +0000	[thread overview]
Message-ID: <20260915080449.D960B1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915074235.1219183-5-baolu.lu@linux.intel.com>

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?

> +		return NULL;
> +
> +	array = kzalloc_obj(*array);
> +	if (!array)
> +		return NULL;
> +
> +	array->root = iommu_alloc_pages_node_sz(iommu->node, GFP_KERNEL, SZ_4K);
> +	if (!array->root)
> +		goto free_array;

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915074235.1219183-1-baolu.lu@linux.intel.com?part=4

  reply	other threads:[~2026-09-15  8:04 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 [this message]
2026-09-16  8:37     ` Baolu Lu
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=20260915080449.D960B1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=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