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?


              }
@@ -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);
              }



Reply via email to