Thinking out loud here,
Done a lot of miles in the XM recently but today i had something similar to an old issue i thought i had cured and probably have but im not sure.
From time to time i used to get a warm restart issue, if anyone who follows my blog on clubxm will remember this was tracked to low fuel delivery pressure, this issue never gave an EML if i remember correctly though and would be woolly with no fuel smell when it did start.
Today i had a similar issue, a warm restart (20 ish miles driven, stopped for 30mins) went back to the car to start and it just cranked for longer than usual and no start, cranked again for about 7 seconds which is an eternity for this car, still nothing so while still cranking i gave it some right foot and it just started, no splutter or farting just fired right up, it smelled of fuel something awefull though as i reversed through the exhaust so nothing like the fuel pressure issue, as soon as it fired i also got the EML light on and it stayed on for the half hour drive 5 or 6 miles crawling through the roadworks to the office but it ran like it was submersed in honey. Restarted fine straight away as a test and again half hour later when i went home with no EML light in sight after turning the engine off the first time.
Now it sat a while as my diag laptop died and i had to take that apart and tighten down the CPU to get it to work (not relevant), plugged the car in and no fault code, everything is fault code clean which is damn annoying.
Im thinking it was getting fuel due to the smell so its got to be ignition related but then why would it run fine? the silky idle after the issue would suggest a duff sensor the ecu was ignoring on the drive back to the office but that would surely log as a fault on the ecu, and it hasnt? so its got to be a sensor that gives variable reading (air temp, coolant temp) that the ecu wouldnt see as faulty but given wrong info the ecu may have trouble starting and not know why hence the EML with no actual fault logged.
Coolant and air temp sensors are giving believable reading though as seen on live data screen of Lexia.............. im going to sleep on it, or ignor it and wait another year to see if it happens again
Since you probably fell asleep 3 paragraphs back anyway, im also wondering why a dinosaur of an engine management system such as the XM's would be being fed gear selection info from the gearbox
D