From: kernel test robot <lkp@intel.com>
To: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH 3/3] pseries/iommu: Enable DDW for VFIO TCE create
Date: Thu, 14 Mar 2024 23:10:27 +0800 [thread overview]
Message-ID: <202403142228.8FfmsLis-lkp@intel.com> (raw)
In-Reply-To: <171026728072.8367.13581504605624115205.stgit@linux.ibm.com>
Hi Shivaprasad,
[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:
[auto build test WARNING on v6.8]
[also build test WARNING on linus/master next-20240314]
[cannot apply to powerpc/next powerpc/fixes awilliam-vfio/next awilliam-vfio/for-linus]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shivaprasad-G-Bhat/powerpc-pseries-iommu-Bring-back-userspace-view-for-single-level-TCE-tables/20240313-022030
base: v6.8
patch link: https://lore.kernel.org/r/171026728072.8367.13581504605624115205.stgit%40linux.ibm.com
patch subject: [RFC PATCH 3/3] pseries/iommu: Enable DDW for VFIO TCE create
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20240314/202403142228.8FfmsLis-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 503c55e17037436dcd45ac69dea8967e67e3f5e8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240314/202403142228.8FfmsLis-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403142228.8FfmsLis-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from arch/powerpc/platforms/pseries/iommu.c:16:
In file included from include/linux/mm.h:2188:
include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
509 | item];
| ~~~~
include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
516 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
528 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
537 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/platforms/pseries/iommu.c:1971:20: warning: variable 'pdn' is uninitialized when used here [-Wuninitialized]
1971 | if (fpdn->pdn == pdn) {
| ^~~
arch/powerpc/platforms/pseries/iommu.c:1937:60: note: initialize the variable 'pdn' to silence this warning
1937 | struct device_node *dn = pci_device_to_OF_node(pdev), *pdn;
| ^
| = NULL
6 warnings generated.
vim +/pdn +1971 arch/powerpc/platforms/pseries/iommu.c
1931
1932 static long spapr_tce_create_table(struct iommu_table_group *table_group, int num,
1933 __u32 page_shift, __u64 window_size, __u32 levels,
1934 struct iommu_table **ptbl)
1935 {
1936 struct pci_dev *pdev = iommu_group_get_first_pci_dev(table_group->group);
1937 struct device_node *dn = pci_device_to_OF_node(pdev), *pdn;
1938 struct iommu_table *tbl = table_group->tables[num];
1939 u32 window_shift = order_base_2(window_size);
1940 u32 ddw_avail[DDW_APPLICABLE_SIZE];
1941 struct ddw_create_response create;
1942 struct ddw_query_response query;
1943 unsigned long start = 0, end = 0;
1944 struct failed_ddw_pdn *fpdn;
1945 struct dma_win *window;
1946 struct property *win64;
1947 struct pci_dn *pci;
1948 int len, ret = 0;
1949 u64 win_addr;
1950
1951 if (num > 1)
1952 return -EPERM;
1953
1954 if (tbl && (tbl->it_page_shift == page_shift) &&
1955 (tbl->it_size == (window_size >> page_shift)) &&
1956 (tbl->it_indirect_levels == levels - 1))
1957 goto exit;
1958
1959 if (num == 0)
1960 return -EINVAL; /* Can't modify the default window. */
1961
1962 /* TODO: The SRIO-VFs have only 1 window. */
1963 if (table_group->max_dynamic_windows_supported == 1)
1964 return -EPERM;
1965
1966 mutex_lock(&dma_win_init_mutex);
1967
1968 ret = -ENODEV;
1969 /* If the enable DDW failed for the pdn, dont retry! */
1970 list_for_each_entry(fpdn, &failed_ddw_pdn_list, list) {
> 1971 if (fpdn->pdn == pdn) {
1972 pr_err("%s: %pOF in failed DDW device list\n", __func__, pdn);
1973 goto out_unlock;
1974 }
1975 }
1976
1977 pdn = pci_dma_find(dn, NULL);
1978 if (!pdn || !PCI_DN(pdn)) { /* Niether of 32s|64-bit exist! */
1979 pr_err("%s: No dma-windows exist for the node %pOF\n", __func__, pdn);
1980 goto out_failed;
1981 }
1982
1983 /* The existing ddw didn't match the size/shift */
1984 if (remove_dynamic_dma_windows_locked(table_group, pdev)) {
1985 pr_err("%s: The existing DDW remova failed for node %pOF\n", __func__, pdn);
1986 goto out_failed; /* Could not remove it either! */
1987 }
1988
1989 pci = PCI_DN(pdn);
1990 ret = of_property_read_u32_array(pdn, "ibm,ddw-applicable",
1991 &ddw_avail[0], DDW_APPLICABLE_SIZE);
1992 if (ret) {
1993 pr_err("%s: ibm,ddw-applicable not found\n", __func__);
1994 goto out_failed;
1995 }
1996
1997 ret = query_ddw(pdev, ddw_avail, &query, pdn);
1998 if (ret)
1999 goto out_failed;
2000 ret = -ENODEV;
2001
2002 len = window_shift;
2003 if (query.largest_available_block < (1ULL << (len - page_shift))) {
2004 dev_dbg(&pdev->dev, "can't map window 0x%llx with %llu %llu-sized pages\n",
2005 1ULL << len, query.largest_available_block,
2006 1ULL << page_shift);
2007 ret = -EINVAL; /* Retry with smaller window size */
2008 goto out_unlock;
2009 }
2010
2011 if (create_ddw(pdev, ddw_avail, &create, page_shift, len))
2012 goto out_failed;
2013
2014 win_addr = ((u64)create.addr_hi << 32) | create.addr_lo;
2015 win64 = ddw_property_create(DMA64_PROPNAME, create.liobn, win_addr, page_shift, len);
2016 if (!win64)
2017 goto remove_window;
2018
2019 ret = of_add_property(pdn, win64);
2020 if (ret) {
2021 dev_err(&pdev->dev, "unable to add DMA window property for %pOF: %d",
2022 pdn, ret);
2023 goto free_property;
2024 }
2025 ret = -ENODEV;
2026
2027 window = ddw_list_new_entry(pdn, win64->value);
2028 if (!window)
2029 goto remove_property;
2030
2031 window->direct = false;
2032
2033 if (tbl) {
2034 iommu_table_reset(tbl, pci->phb->bus->number, create.liobn, win_addr,
2035 1UL << len, page_shift, NULL, &iommu_table_lpar_multi_ops);
2036 } else {
2037 tbl = iommu_pseries_alloc_table(pci->phb->node);
2038 if (!tbl) {
2039 dev_err(&pdev->dev, "couldn't create new IOMMU table\n");
2040 goto free_window;
2041 }
2042 iommu_table_setparms_common(tbl, pci->phb->bus->number, create.liobn, win_addr,
2043 1UL << len, page_shift, NULL,
2044 &iommu_table_lpar_multi_ops);
2045 iommu_init_table(tbl, pci->phb->node, start, end);
2046 }
2047
2048 tbl->reset_ddw = true;
2049 pci->table_group->tables[1] = tbl;
2050 set_iommu_table_base(&pdev->dev, tbl);
2051 pdev->dev.archdata.dma_offset = win_addr;
2052
2053 spin_lock(&dma_win_list_lock);
2054 list_add(&window->list, &dma_win_list);
2055 spin_unlock(&dma_win_list_lock);
2056
2057 mutex_unlock(&dma_win_init_mutex);
2058
2059 goto exit;
2060
2061 free_window:
2062 kfree(window);
2063 remove_property:
2064 of_remove_property(pdn, win64);
2065 free_property:
2066 kfree(win64->name);
2067 kfree(win64->value);
2068 kfree(win64);
2069 remove_window:
2070 __remove_dma_window(pdn, ddw_avail, create.liobn);
2071
2072 out_failed:
2073 fpdn = kzalloc(sizeof(*fpdn), GFP_KERNEL);
2074 if (!fpdn)
2075 goto out_unlock;
2076 fpdn->pdn = pdn;
2077 list_add(&fpdn->list, &failed_ddw_pdn_list);
2078
2079 out_unlock:
2080 mutex_unlock(&dma_win_init_mutex);
2081
2082 return ret;
2083 exit:
2084 *ptbl = iommu_tce_table_get(tbl);
2085 return 0;
2086 }
2087
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
parent reply other threads:[~2024-03-14 15:10 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <171026728072.8367.13581504605624115205.stgit@linux.ibm.com>]
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=202403142228.8FfmsLis-lkp@intel.com \
--to=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=sbhat@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;
as well as URLs for NNTP newsgroup(s).