drivers/vfio/pci/vfio_pci_config.c:1178:16: error: implicit declaration of function 'FIELD_GET'

kernel test robot <[email protected]> Fri, 31 Jul 2026 20:01:30 +0200
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/intel-lab-lkp/linux/commits/Chengwen-Feng/PCI-TPH-Fix-pcie_tph_get_st_table_loc-field-extraction/20260731-191036
head:   e577f39fe33bc6418fdf32ae8285e95107a3ed2d
commit: 3071264b1b7974b90971cab472f711328a207c65 vfio/pci: Implement VFIO_DEVICE_FEATURE_TPH and valid TPH config write support
date:   7 hours ago
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260731/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260731/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

   drivers/vfio/pci/vfio_pci_config.c: In function 'vfio_tph_config_write':
>> drivers/vfio/pci/vfio_pci_config.c:1178:16: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
    1178 |         mode = FIELD_GET(PCI_TPH_CTRL_MODE_SEL_MASK, new_ctrl);
         |                ^~~~~~~~~


vim +/FIELD_GET +1178 drivers/vfio/pci/vfio_pci_config.c

  1147	
  1148	static int vfio_find_cap_start(struct vfio_pci_core_device *vdev, int pos);
  1149	static int vfio_tph_config_write(struct vfio_pci_core_device *vdev, int pos,
  1150					 int count, struct perm_bits *perm,
  1151					 int offset, __le32 val)
  1152	{
  1153		u16 start = vfio_find_cap_start(vdev, pos);
  1154		struct pci_dev *pdev = vdev->pdev;
  1155		u32 org_ctrl, new_ctrl, cap;
  1156		u8 mode, req, org_req;
  1157		__le32 org_val = 0;
  1158		bool extended;
  1159		int ret;
  1160	
  1161		if (!vdev->tph_permit)
  1162			return count;
  1163	
  1164		down_write(&vdev->memory_lock);
  1165	
  1166		org_ctrl = le32_to_cpu(*(__le32 *)&vdev->vconfig[start + PCI_TPH_CTRL]);
  1167		vfio_default_config_read(vdev, pos, count, perm, offset, &org_val);
  1168	
  1169		ret = vfio_default_config_write(vdev, pos, count, perm, offset, val);
  1170		if (ret != count)
  1171			goto out;
  1172	
  1173		new_ctrl = le32_to_cpu(*(__le32 *)&vdev->vconfig[start + PCI_TPH_CTRL]);
  1174		if (new_ctrl == org_ctrl)
  1175			goto out; /* Only care about changes in TPH_CTRL. */
  1176	
  1177		cap = le32_to_cpu(*(__le32 *)&vdev->vconfig[start + PCI_TPH_CAP]);
> 1178		mode = FIELD_GET(PCI_TPH_CTRL_MODE_SEL_MASK, new_ctrl);
  1179		req = FIELD_GET(PCI_TPH_CTRL_REQ_EN_MASK, new_ctrl);
  1180		if (mode > PCI_TPH_ST_DS_MODE || !(cap & (1u << mode)) || req == 0x2 ||
  1181			(req == PCI_TPH_REQ_EXT_TPH && !(cap & PCI_TPH_CAP_EXT_TPH)))
  1182			goto restore; /* Drop invalid or unsupported write value */
  1183	
  1184		org_req = FIELD_GET(PCI_TPH_CTRL_REQ_EN_MASK, org_ctrl);
  1185		if (req == org_req)
  1186			goto out; /* Only care about requester enable */
  1187	
  1188		ret = vfio_pci_set_power_state(vdev, PCI_D0);
  1189		if (ret)
  1190			goto restore; /* Drop this write */
  1191	
  1192		if (req == PCI_TPH_REQ_TPH_ONLY || req == PCI_TPH_REQ_EXT_TPH) {
  1193			extended = !!(req == PCI_TPH_REQ_EXT_TPH);
  1194			ret = pcie_enable_tph_explicit(pdev, mode, extended);
  1195			if (ret)
  1196				goto restore;
  1197		} else if (req == PCI_TPH_REQ_DISABLE) {
  1198			pcie_disable_tph(vdev->pdev);
  1199		}
  1200	
  1201		goto out;
  1202	
  1203	restore:
  1204		vfio_default_config_write(vdev, pos, count, perm, offset, org_val);
  1205	out:
  1206		up_write(&vdev->memory_lock);
  1207		return count;
  1208	}
  1209	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki