From: Harsh Prateek Bora <harshpb@linux.ibm.com>
To: Gaurav Batra <gbatra@linux.ibm.com>, maddy@linux.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org, ritesh.list@gmail.com,
donettom@linux.ibm.com, vaibhav@linux.ibm.com,
sbhat@linux.ibm.com
Subject: Re: [PATCH] powerpc/pseries/iommu: Add TCEs for 16GB pages when RAM is pre-mapped
Date: Thu, 7 May 2026 10:14:20 +0530 [thread overview]
Message-ID: <23cc6749-2ebd-4143-b9ad-b7d4b3af233e@linux.ibm.com> (raw)
In-Reply-To: <b03c0960-ee22-4de1-94bf-c1c9eec757af@linux.ibm.com>
On 07/05/26 12:57 am, Gaurav Batra wrote:
>
> On 5/5/26 11:04 PM, Harsh Prateek Bora wrote:
>>
>>
>> On 06/05/26 2:31 am, Gaurav Batra wrote:
>>>
>>> On 5/5/26 1:49 PM, Harsh Prateek Bora wrote:
>>>>
>>>>
>>>> On 05/05/26 2:24 am, Gaurav Batra wrote:
>>>>> @@ -2431,7 +2437,7 @@ static int iommu_mem_notifier(struct
>>>>> notifier_block *nb, unsigned long action,
>>>>> spin_lock(&dma_win_list_lock);
>>>>> list_for_each_entry(window, &dma_win_list, list) {
>>>>> if (window->direct && (arg->start_pfn << PAGE_SHIFT) <
>>>>> - ddw_memory_hotplug_max()) {
>>>>> + pseries_ddw_max_ram) {
>>>>> ret |= tce_setrange_multi_pSeriesLP(arg->start_pfn,
>>>>> arg->nr_pages, window->prop);
>>>>
>>>> I think not only start_pfn, but end_pfn also needs to be within allowed
>>>> range, which may require clamping arg->nr_pages if crossing the limits.
>>> The reason to only check for start_pfn is because the range given
>>> will either be in the RAM or pmemory. It can never cross the boundary
>>
>> Usually as an API, we do not trust the caller, hence the check for
>> start_pfn. However, if at all we need to go ahead with that assumption,
>> may be document that as a code comment and/or in the commit log also?
>
> I will document it. I am wondering, if instead of capping it to
> start+nrpages,
>
> maybe, return an error. If in the future, we get an error, this needs to be
>
> investigated.
>
I am not sure erroring out for crossing RAM/pmem boundary is a right
thing to do here if it can hinder persistent memory onlining (since
there is an existing code comment which says it can get called when
onlining persistent memory as well). In that case, a WARN may be a
better choice.
>>
>>>>
>>>>> }
>>>>> @@ -2444,7 +2450,7 @@ static int iommu_mem_notifier(struct
>>>>> notifier_block *nb, unsigned long action,
>>>>> spin_lock(&dma_win_list_lock);
>>>>> list_for_each_entry(window, &dma_win_list, list) {
>>>>> if (window->direct && (arg->start_pfn << PAGE_SHIFT) <
>>>>> - ddw_memory_hotplug_max()) {
>>>>> + pseries_ddw_max_ram) {
>>>>> ret |= tce_clearrange_multi_pSeriesLP(arg-
>>>>> >start_pfn,
>>>>> arg->nr_pages, window->prop);
>>>>> }
>>>>
>>
prev parent reply other threads:[~2026-05-07 4:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 20:54 [PATCH] powerpc/pseries/iommu: Add TCEs for 16GB pages when RAM is pre-mapped Gaurav Batra
2026-05-05 18:49 ` Harsh Prateek Bora
2026-05-05 21:01 ` Gaurav Batra
2026-05-06 4:04 ` Harsh Prateek Bora
2026-05-06 19:27 ` Gaurav Batra
2026-05-07 4:44 ` Harsh Prateek Bora [this message]
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=23cc6749-2ebd-4143-b9ad-b7d4b3af233e@linux.ibm.com \
--to=harshpb@linux.ibm.com \
--cc=donettom@linux.ibm.com \
--cc=gbatra@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=ritesh.list@gmail.com \
--cc=sbhat@linux.ibm.com \
--cc=vaibhav@linux.ibm.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