From: kernel test robot <lkp@intel.com>
To: "Habil Eren Türker" <habilerenturker@hotmail.com>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Thomas Gleixner" <tglx@kernel.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Borislav Petkov" <bp@alien8.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, "H . Peter Anvin" <hpa@zytor.com>,
"andriy.shevchenko@intel.com" <andriy.shevchenko@intel.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Habil Eren Türker" <habilerenturker@hotmail.com>
Subject: Re: [PATCH] PCI: Convert pci.c to pci_power_t helpers
Date: Sun, 22 Nov 2026 04:14:23 +0800 [thread overview]
Message-ID: <202611220427.bDq695TB-lkp@intel.com> (raw)
In-Reply-To: <20261121125811.50315-3-habilerenturker@hotmail.com>
Hi Habil,
kernel test robot noticed the following build errors:
[auto build test ERROR on pci/next]
[also build test ERROR on pci/for-linus linus/master v7.4-rc3 next-20261119]
[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/Habil-Eren-T-rker/PCI-Convert-pci-c-to-pci_power_t-helpers/20261121-125915
base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git next
patch link: https://lore.kernel.org/r/20261121125811.50315-3-habilerenturker%40hotmail.com
patch subject: [PATCH] PCI: Convert pci.c to pci_power_t helpers
config: x86_64-rhel-9.4 (https://download.01.org/0day-ci/archive/20261122/202611220427.bDq695TB-lkp@intel.com/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/20261122/202611220427.bDq695TB-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/202611220427.bDq695TB-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/pci/pci.c: In function 'pci_update_current_state':
>> drivers/pci/pci.c:1174:38: error: implicit declaration of function 'pci_power_t_get'; did you mean 'pci_power_name'? [-Wimplicit-function-declaration]
1174 | dev->current_state = pci_power_t_get(pmcsr);
| ^~~~~~~~~~~~~~~
| pci_power_name
drivers/pci/pci.c: In function 'pci_power_up':
>> drivers/pci/pci.c:1372:26: error: implicit declaration of function 'pci_power_t_eq'; did you mean 'pci_power_up'? [-Wimplicit-function-declaration]
1372 | (pci_power_t_eq(pci_power_t_get(pmcsr), PCI_D3hot) ||
| ^~~~~~~~~~~~~~
| pci_power_up
drivers/pci/pci.c: In function 'pci_set_low_power_state':
>> drivers/pci/pci.c:1548:9: error: implicit declaration of function 'pci_power_t_set'; did you mean 'pci_power_name'? [-Wimplicit-function-declaration]
1548 | pci_power_t_set(&pmcsr, state);
| ^~~~~~~~~~~~~~~
| pci_power_name
vim +1174 drivers/pci/pci.c
1149
1150 /**
1151 * pci_update_current_state - Read power state of given device and cache it
1152 * @dev: PCI device to handle.
1153 * @state: State to cache in case the device doesn't have the PM capability
1154 *
1155 * The power state is read from the PMCSR register, which however is
1156 * inaccessible in D3cold. The platform firmware is therefore queried first
1157 * to detect accessibility of the register. In case the platform firmware
1158 * reports an incorrect state or the device isn't power manageable by the
1159 * platform at all, we try to detect D3cold by testing accessibility of the
1160 * vendor ID in config space.
1161 */
1162 void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
1163 {
1164 if (platform_pci_get_power_state(dev) == PCI_D3cold) {
1165 dev->current_state = PCI_D3cold;
1166 } else if (dev->pm_cap) {
1167 u16 pmcsr;
1168
1169 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
1170 if (PCI_POSSIBLE_ERROR(pmcsr)) {
1171 dev->current_state = PCI_D3cold;
1172 return;
1173 }
> 1174 dev->current_state = pci_power_t_get(pmcsr);
1175 } else {
1176 dev->current_state = state;
1177 }
1178 }
1179
1180 /**
1181 * pci_refresh_power_state - Refresh the given device's power state data
1182 * @dev: Target PCI device.
1183 *
1184 * Ask the platform to refresh the devices power state information and invoke
1185 * pci_update_current_state() to update its current PCI power state.
1186 */
1187 void pci_refresh_power_state(struct pci_dev *dev)
1188 {
1189 platform_pci_refresh_power_state(dev);
1190 pci_update_current_state(dev, dev->current_state);
1191 }
1192
1193 /**
1194 * pci_platform_power_transition - Use platform to change device power state
1195 * @dev: PCI device to handle.
1196 * @state: State to put the device into.
1197 */
1198 int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
1199 {
1200 int error;
1201
1202 error = platform_pci_set_power_state(dev, state);
1203 if (!error)
1204 pci_update_current_state(dev, state);
1205 else if (!dev->pm_cap) /* Fall back to PCI_D0 */
1206 dev->current_state = PCI_D0;
1207
1208 return error;
1209 }
1210 EXPORT_SYMBOL_GPL(pci_platform_power_transition);
1211
1212 static int pci_resume_one(struct pci_dev *pci_dev, void *ign)
1213 {
1214 pm_request_resume(&pci_dev->dev);
1215 return 0;
1216 }
1217
1218 /**
1219 * pci_resume_bus - Walk given bus and runtime resume devices on it
1220 * @bus: Top bus of the subtree to walk.
1221 */
1222 void pci_resume_bus(struct pci_bus *bus)
1223 {
1224 if (bus)
1225 pci_walk_bus(bus, pci_resume_one, NULL);
1226 }
1227
1228 static int pci_dev_wait(struct pci_dev *dev, char *reset_type, int timeout)
1229 {
1230 int delay = 1;
1231 bool retrain = false;
1232 struct pci_dev *root, *bridge;
1233
1234 root = pcie_find_root_port(dev);
1235
1236 if (pci_is_pcie(dev)) {
1237 bridge = pci_upstream_bridge(dev);
1238 if (bridge)
1239 retrain = true;
1240 }
1241
1242 /*
1243 * The caller has already waited long enough after a reset that the
1244 * device should respond to config requests, but it may respond
1245 * with Request Retry Status (RRS) if it needs more time to
1246 * initialize.
1247 *
1248 * If the device is below a Root Port with Configuration RRS
1249 * Software Visibility enabled, reading the Vendor ID may return a
1250 * special data value if the device responded with RRS. Read the
1251 * Vendor ID until we get non-RRS status and something other than
1252 * ~0. The Vendor ID of VFs reads ~0, so check their Command
1253 * register instead.
1254 *
1255 * If there's no Root Port or Configuration RRS Software Visibility
1256 * is not enabled, the device may still respond with RRS, but
1257 * hardware may retry the config request. If no retries receive
1258 * Successful Completion, hardware generally synthesizes ~0
1259 * (PCI_ERROR_RESPONSE) data to complete the read. Reading Vendor
1260 * ID for VFs and non-existent devices also returns ~0, so read the
1261 * Command register until it returns something other than ~0.
1262 */
1263 for (;;) {
1264 u32 id;
1265
1266 if (pci_dev_is_disconnected(dev)) {
1267 pci_dbg(dev, "disconnected; not waiting\n");
1268 return -ENOTTY;
1269 }
1270
1271 if (root && root->config_rrs_sv) {
1272 pci_read_config_dword(dev, PCI_VENDOR_ID, &id);
1273 if (!pci_bus_rrs_vendor_id(id)) {
1274 if (PCI_POSSIBLE_ERROR(id) && dev->is_virtfn)
1275 pci_read_config_dword(dev, PCI_COMMAND,
1276 &id);
1277 if (!PCI_POSSIBLE_ERROR(id))
1278 break;
1279 }
1280 } else {
1281 pci_read_config_dword(dev, PCI_COMMAND, &id);
1282 if (!PCI_POSSIBLE_ERROR(id))
1283 break;
1284 }
1285
1286 if (delay > timeout) {
1287 pci_err(dev, "not ready %dms after %s; giving up\n",
1288 delay - 1, reset_type);
1289 return -ENOTTY;
1290 }
1291
1292 if (delay > PCI_RESET_WAIT) {
1293 if (retrain) {
1294 retrain = false;
1295 if (pcie_failed_link_retrain(bridge) == 0) {
1296 delay = 1;
1297 continue;
1298 }
1299 }
1300 pci_info(dev, "not ready %dms after %s; waiting\n",
1301 delay - 1, reset_type);
1302 }
1303
1304 msleep(delay);
1305 delay *= 2;
1306 }
1307
1308 if (delay > PCI_RESET_WAIT)
1309 pci_info(dev, "ready %dms after %s\n", delay - 1,
1310 reset_type);
1311 else
1312 pci_dbg(dev, "ready %dms after %s\n", delay - 1,
1313 reset_type);
1314
1315 return 0;
1316 }
1317
1318 /**
1319 * pci_power_up - Put the given device into D0
1320 * @dev: PCI device to power up
1321 *
1322 * On success, return 0 or 1, depending on whether or not it is necessary to
1323 * restore the device's BARs subsequently (1 is returned in that case).
1324 *
1325 * On failure, return a negative error code. Always return failure if @dev
1326 * lacks a Power Management Capability, even if the platform was able to
1327 * put the device in D0 via non-PCI means.
1328 */
1329 int pci_power_up(struct pci_dev *dev)
1330 {
1331 bool need_restore;
1332 pci_power_t state;
1333 u16 pmcsr;
1334 int ret;
1335
1336 /*
1337 * When setting power state to D0, platform_pci_set_power_state()
1338 * ensures main power is on. If it puts the device in D0, it also
1339 * completes any required delays after the transition; if it leaves
1340 * the device in D1, D2, or D3hot, we use the PM Capability to
1341 * transition to D0.
1342 *
1343 * In all cases, the device is either Configuration-Ready or
1344 * inaccessible upon return.
1345 */
1346 platform_pci_set_power_state(dev, PCI_D0);
1347
1348 if (!dev->pm_cap) {
1349 state = platform_pci_get_power_state(dev);
1350 if (state == PCI_UNKNOWN)
1351 dev->current_state = PCI_D0;
1352 else
1353 dev->current_state = state;
1354
1355 return -EIO;
1356 }
1357
1358 if (pci_dev_is_disconnected(dev)) {
1359 dev->current_state = PCI_D3cold;
1360 return -EIO;
1361 }
1362
1363 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
1364 if (PCI_POSSIBLE_ERROR(pmcsr)) {
1365 pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n",
1366 pci_power_name(dev->current_state));
1367 dev->current_state = PCI_D3cold;
1368 return -EIO;
1369 }
1370
1371 need_restore = !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET) &&
> 1372 (pci_power_t_eq(pci_power_t_get(pmcsr), PCI_D3hot) ||
1373 dev->current_state >= PCI_D3hot);
1374
1375 if (pci_power_t_eq(pci_power_t_get(pmcsr), PCI_D0))
1376 goto end;
1377
1378 /*
1379 * Force the entire word to 0. This doesn't affect PME_Status, disables
1380 * PME_En, and sets PowerState to 0.
1381 */
1382 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, 0);
1383
1384 /* Mandatory transition delays; see PCI PM 1.2. */
1385 if (pci_power_t_eq(pci_power_t_get(pmcsr), PCI_D3hot)) {
1386 pci_dev_d3_sleep(dev);
1387 if (!(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) {
1388 ret = pci_dev_wait(dev, "power up D3hot->D0uninitialized",
1389 PCIE_RESET_READY_POLL_MS);
1390 if (ret) {
1391 dev->current_state = PCI_D3cold;
1392 return -EIO;
1393 }
1394 }
1395 } else if (pci_power_t_eq(pci_power_t_get(pmcsr), PCI_D2)) {
1396 udelay(PCI_PM_D2_DELAY);
1397 }
1398
1399 end:
1400 dev->current_state = PCI_D0;
1401 if (need_restore)
1402 return 1;
1403
1404 return 0;
1405 }
1406
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-11-21 20:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 12:59 [PATCH v3 0/4] PCI: Add pci_power_t helper functions Habil Eren Türker
2026-11-21 12:59 ` [PATCH v3 1/4] " Habil Eren Türker
2026-11-21 12:59 ` [PATCH] PCI: Convert pci.c to pci_power_t helpers Habil Eren Türker
2026-11-21 17:56 ` kernel test robot
2026-11-21 20:14 ` kernel test robot [this message]
2026-11-21 12:59 ` [PATCH v3 3/4] PCI: Convert quirks.c " Habil Eren Türker
2026-11-21 12:59 ` [PATCH v3 4/4] x86/quirks: Use pci_power_t_eq() in apple_airport_reset() Habil Eren Türker
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=202611220427.bDq695TB-lkp@intel.com \
--to=lkp@intel.com \
--cc=andriy.shevchenko@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=habilerenturker@hotmail.com \
--cc=helgaas@kernel.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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®