Index: /trunk/include/VBox/vmm/pdmdev.h
===================================================================
--- /trunk/include/VBox/vmm/pdmdev.h	(revision 64843)
+++ /trunk/include/VBox/vmm/pdmdev.h	(revision 64844)
@@ -1857,9 +1857,8 @@
 /** Use the next device configuration number in the sequence (max + 1). */
 # define PDMPCIDEVREG_CFG_NEXT              UINT32_MAX
-/** Same device number as the previous PCI device registered with the PDM device.
- * This is handy when registering multiple PCI device functions and the device
- * number is left up to the PCI bus.  In order to facilitate on PDM device
- * instance for each PCI function, this searches earlier PDM device
- * instances as well. */
+/** Same device number (and bus) as the previous PCI device registered with the PDM device.
+ * This is handy when registering multiple PCI device functions and the device  number
+ * is left up to the PCI bus.  In order to facilitate on PDM device instance for each
+ * PCI function, this searches earlier PDM device  instances as well. */
 # define PDMPCIDEVREG_DEV_NO_SAME_AS_PREV   UINT8_C(0xfd)
 /** Use the first unused device number (all functions must be unused). */
Index: /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
===================================================================
--- /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 64843)
+++ /trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp	(revision 64844)
@@ -1297,8 +1297,12 @@
      */
     uint8_t const uPciDevNoRaw = uPciDevNo;
+    uint32_t      uDefPciBusNo = 0;
     if (uPciDevNo == PDMPCIDEVREG_DEV_NO_SAME_AS_PREV)
     {
         if (pPrevPciDev)
-            uPciDevNo = pPrevPciDev->uDevFn >> 3;
+        {
+            uPciDevNo    = pPrevPciDev->uDevFn >> 3;
+            uDefPciBusNo = pPrevPciDev->Int.s.pPdmBusR3->iBus;
+        }
         else
         {
@@ -1320,5 +1324,6 @@
             while (pOtherPciDev->Int.s.pNextR3)
                 pOtherPciDev = pOtherPciDev->Int.s.pNextR3;
-            uPciDevNo = pOtherPciDev->uDevFn >> 3;
+            uPciDevNo    = pOtherPciDev->uDevFn >> 3;
+            uDefPciBusNo = pOtherPciDev->Int.s.pPdmBusR3->iBus;
         }
     }
@@ -1331,8 +1336,10 @@
      */
     /** @cfgm{/Devices/NAME/XX/[PciCfgYY/]PCIBusNo, uint8_t, 0, 7, 0}
-     * Selects the PCI bus number of a device.
+     * Selects the PCI bus number of a device.  The default value isn't necessarily
+     * zero if the device is registered using PDMPCIDEVREG_DEV_NO_SAME_AS_PREV, it
+     * will then also inherit the bus number from the previously registered device.
      */
     uint8_t u8Bus;
-    int rc = CFGMR3QueryU8Def(pCfg, "PCIBusNo", &u8Bus, 0);
+    int rc = CFGMR3QueryU8Def(pCfg, "PCIBusNo", &u8Bus, (uint8_t)uDefPciBusNo);
     AssertLogRelMsgRCReturn(rc, ("Configuration error: PCIBusNo query failed with rc=%Rrc (%s/%d)\n",
                                  rc, pDevIns->pReg->szName, pDevIns->iInstance), rc);
