Hey there. I can probably help here.
So what you've got is two two-player cabinets, and you want the ability to link them up for three and four player action, correct? This is what I have.
Instead of a KVM, if you network them (even with a cross over cable) you can use RetroArch Netplay to do this instead. And BigBox has a RetroArch Netplay browser built into the front end to launch the games. I use the Final Burn Neo (FBNEO) core to to do this with MAME Arcade Games. (and other console platforms).
If you want the 2nd cab to automatically launch into the game when the 1st cab launches the game, this can be done with some simple AHK automation. I can provide the details if you want.
The reason I did NOT use a KVM, was that the keyboard encoder (Ultimarc IPac Ultimate in my cabinets) have the same keyboard bindings - so this would never work unless you remap everything on the 2nd cab, including the emulators. In order to align to "default" mame keyboard mappings (just to keep it simple), RetroArch will auto-map Player 1/2/3/4 over Netplay to avoid this conflict.