VirtualBox

Changeset 81513 in vbox for trunk


Ignore:
Timestamp:
Oct 24, 2019 9:23:02 AM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
134241
Message:

PDM: Documented steps I take when converting a device to the new style. bugref:9218

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/PDM.cpp

    r81406 r81513  
    9797 *
    9898 *
     99 * @subsection sec_pdm_dev_new          New Style (6.1)
     100 *
     101 * VBox 6.1 changes the PDM interface for devices and they have to be converted
     102 * to the new style to continue working (see @bugref{9218}).
     103 *
     104 * Steps for converting a PDM device to the new style:
     105 *
     106 * - State data needs to be split into shared, ring-3, ring-0 and raw-mode
     107 *   structures.  The shared structure shall contains absolutely no pointers.
     108 *
     109 * - Context specific typedefs ending in CC for the structure and pointer to
     110 *   it are required (copy & edit the PRTCSTATECC stuff).
     111 *   The pointer to a context specific structure is obtained using the
     112 *   PDMINS_2_DATA_CC macro.  The PDMINS_2_DATA macro gets the shared one.
     113 *
     114 * - Update the registration structure with sizeof the new structures.
     115 *
     116 * - MMIO handlers to FNIOMMMIONEWREAD and FNIOMMMIONEWRITE form, take care renaming
     117 *   GCPhys to off and really treat it as an offset.   Return status is VBOXSTRICTRC,
     118 *   which should be propagated to worker functions as far as possible.
     119 *
     120 * - I/O handlers to FNIOMIOPORTNEWIN and FNIOMIOPORTNEWOUT form, take care renaming
     121 *   uPort/Port to offPort and really treat it as an offset.   Return status is
     122 *   VBOXSTRICTRC, which should be propagated to worker functions as far as possible.
     123 *
     124 * - MMIO and I/O port registration must be converted, handles stored in the shared structure.
     125 *
     126 * - PCI devices must also update the I/O region registration and corresponding
     127 *   mapping callback.   The latter is generally not needed any more, as the PCI
     128 *   bus does the mapping and unmapping using the handle passed to it during registration.
     129 *
     130 * - If the device contains ring-0 or raw-mode optimizations:
     131 *    - Make sure to replace any R0Enabled, GCEnabled, and RZEnabled with
     132 *      pDevIns->fR0Enabled and pDevIns->fRCEnabled.  Removing CFGM reading and
     133 *      validation of such options as well as state members for them.
     134 *    - Callbacks for ring-0 and raw-mode are registered in a context contructor.
     135 *      Setting up of non-default critical section handling needs to be repeated
     136 *      in the ring-0/raw-mode context constructor too.   See for instance
     137 *      e1kRZConstruct().
     138 *
     139 * - Convert all PDMCritSect calls to PDMDevHlpCritSect.
     140 *   Note! pDevIns should be passed as parameter rather than put in pThisCC.
     141 *
     142 * - Convert all timers to the handle based ones.
     143 *
     144 * - Convert all queues to the handle based ones or tasks.
     145 *
     146 * - Set the PDM_DEVREG_FLAGS_NEW_STYLE in the registration structure.
     147 *
     148 * - Convert all CFGMR3Xxxx calls to pHlp->pfnCFGMXxxx.
     149 *
     150 * - Convert all SSMR3Xxxx calls to pHlp->pfnSSMXxxx.
     151 *
     152 * - Ensure that CFGM values and nodes are validated using PDMDEV_VALIDATE_CONFIG_RETURN()
     153 *
     154 * - Ensure that the first statement in the constructors is
     155 *   @code
     156           PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
     157     @endcode
     158 *   There shall be absolutely nothing preceeding that and it is mandatory.
     159 *
     160 * - Ensure that the first statement in the destructors is
     161 *   @code
     162           PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);
     163     @endcode
     164 *   There shall be absolutely nothing preceeding that and it is mandatory.
     165 *
     166 * - Use 'nm -u' (tools\win.amd64\mingw-w64\r1\bin\nm.exe on windows) to check for
     167 *   VBoxVMM and VMMR0 function you forgot to convert to device help calls or would
     168 *   need adding as device helpers or something.
     169 *
     170 *
    99171 * @section sec_pdm_special_devs    Special Devices
    100172 *
     
    117189 *
    118190 * @see grp_pdm_device
    119  *
    120191 *
    121192 * @section sec_pdm_usbdev  The Pluggable USB Devices
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette