mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Adrian Huang12 <ahuang12@lenovo.com>
To: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"iommu@lists.linux.dev" <iommu@lists.linux.dev>
Cc: "joro@8bytes.org" <joro@8bytes.org>,
	"jon.grimm@amd.com" <jon.grimm@amd.com>,
	"vasant.hegde@amd.com" <vasant.hegde@amd.com>,
	"frank.gorishek@amd.com" <frank.gorishek@amd.com>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"santosh.shukla@amd.com" <santosh.shukla@amd.com>,
	Baoquan He <bhe@redhat.com>,
	Jerry Snitselaar <jsnitsel@redhat.com>
Subject: RE: [PATCH v2 2/4] iommu/amd: Do not convert IVMD exclusion range to unity range
Date: Fri, 8 May 2026 07:30:44 +0000	[thread overview]
Message-ID: <TPZP295MB0013F9F7E3C18EE0D7F1D1CBB33D2@TPZP295MB0013.TWNP295.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20260424092213.16976-3-suravee.suthikulpanit@amd.com>

> -----Original Message-----
> From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> Sent: Friday, April 24, 2026 5:22 PM
> To: linux-kernel@vger.kernel.org; iommu@lists.linux.dev
> Cc: joro@8bytes.org; jon.grimm@amd.com; vasant.hegde@amd.com;
> frank.gorishek@amd.com; thomas.lendacky@amd.com;
> santosh.shukla@amd.com; Suravee Suthikulpanit
> <suravee.suthikulpanit@amd.com>; Baoquan He <bhe@redhat.com>; Adrian
> Huang12 <ahuang12@lenovo.com>; Jerry Snitselaar <jsnitsel@redhat.com>
> Subject: [External] [PATCH v2 2/4] iommu/amd: Do not convert IVMD exclusion
> range to unity range
> 
> Original problem was there could be multiple IVMD exclusion entries
> conflicting over a single exclusion range supported in older Linux kernel. The
> fix was first introduced in commit 387caf0b759a ("iommu/amd:
> Treat per-device exclusion ranges as r/w unity-mapped regions") and in
> commit 0bbe4ced53e3 ("iommu/amd: Fix the overwritten field in IVMD
> header") , where IVMD exclusions are converted to separate unity_map_entry
> objects in pci_seg->unity_map so amd_iommu_get_resv_regions() treated
> every such entry as IOMMU_RESV_DIRECT with R/W.
> 
> Since the AMD IOMMU driver no longer support the Exclusion Range
> base/limit registers and rely on Linux kernel to exclude the specified IOVA
> ranges from being mapped this logic is no longer needed.
> 
> Remove the special case that forced e->prot to RW-UNITY mapping (i.e.
> IVMD_FLAG_IW | IVMD_FLAG_IR | IVMD_FLAG_UNITY) whenever
> IVMD_FLAG_EXCL_RANGE was set.
> 
> Fixes: 0bbe4ced53e3 ("iommu/amd: Fix the overwritten field in IVMD
> header")
> Cc: Baoquan He <bhe@redhat.com>
> Cc: Adrian Huang <ahuang12@lenovo.com>
> Cc: Jerry Snitselaar <jsnitsel@redhat.com>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
>  drivers/iommu/amd/init.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c index
> 866249d3673e..2e854f4639a7 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -2644,16 +2644,6 @@ static int __init init_unity_map_range(struct
> ivmd_header *m,
>  	e->address_end = e->address_start + PAGE_ALIGN(m->range_length);
>  	e->prot = m->flags >> 1;
> 
> -	/*
> -	 * Treat per-device exclusion ranges as r/w unity-mapped regions
> -	 * since some buggy BIOSes might lead to the overwritten exclusion
> -	 * range (exclusion_start and exclusion_length members). This
> -	 * happens when there are multiple exclusion ranges (IVMD entries)
> -	 * defined in ACPI table.
> -	 */
> -	if (m->flags & IVMD_FLAG_EXCL_RANGE)
> -		e->prot = (IVMD_FLAG_IW | IVMD_FLAG_IR) >> 1;
> -
>  	DUMP_printk("%s devid_start: %04x:%02x:%02x.%x devid_end: "
>  		    "%04x:%02x:%02x.%x range_start: %016llx range_end:
> %016llx"
>  		    " flags: %x\n", s, m->pci_seg,

Looks good to me.
Reviewed-by: Adrian Huang <ahuang12@lenovo.com>

  reply	other threads:[~2026-05-08  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24  9:22 [PATCH v2 0/4] iommu/amd: IVMD handling cleanup and ivmd= boot override Suravee Suthikulpanit
2026-04-24  9:22 ` [PATCH v2 1/4] iommu/amd: Drop unused global exclusion range fields and init Suravee Suthikulpanit
2026-04-24  9:22 ` [PATCH v2 2/4] iommu/amd: Do not convert IVMD exclusion range to unity range Suravee Suthikulpanit
2026-05-08  7:30   ` Adrian Huang12 [this message]
2026-04-24  9:22 ` [PATCH v2 3/4] iommu/amd: Clean up and simplify IVMD entry handling Suravee Suthikulpanit
2026-04-24  9:22 ` [PATCH v2 4/4] iommu/amd: Introduce boot option ivmd=seg:bus:dev.fun,start,size,flags Suravee Suthikulpanit
2026-07-20 10:01 ` [PATCH v2 0/4] iommu/amd: IVMD handling cleanup and ivmd= boot override Suthikulpanit, Suravee
2026-07-30 12:32   ` Jörg Rödel
2026-10-01  0:56 ` Adam Pelka

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=TPZP295MB0013F9F7E3C18EE0D7F1D1CBB33D2@TPZP295MB0013.TWNP295.PROD.OUTLOOK.COM \
    --to=ahuang12@lenovo.com \
    --cc=bhe@redhat.com \
    --cc=frank.gorishek@amd.com \
    --cc=iommu@lists.linux.dev \
    --cc=jon.grimm@amd.com \
    --cc=joro@8bytes.org \
    --cc=jsnitsel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=santosh.shukla@amd.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=thomas.lendacky@amd.com \
    --cc=vasant.hegde@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

all inboxes | Powered by JetHome®