The only tool we have for configuring the schema is the 'if' conditional. 'if': 'CONFIG_IOMMUFD' compiles to #if defined(CONFIG_IOMMUFD) ... #endif. Your use of #ifdef CONFIG_IOMMUFD above suggests this is fine here. Symbols that are only defined in target-dependent compiles (see exec/poison.h) can only be used in target-dependent schema modules, i.e. the *-target.json.I'm fresh on Kconfig & qapi, but I have a weak idea: Remove conditional check for backends/iommufd.c, like: system_ss.add(files('iommufd.c')) Then iommufd object is common and always supported, we will not see "invalid object type: iommufd", even for platform other than i386,s390x,arm. On those platform not supporting iommufd, we can create an iommufd object which is dummy, as no one will link to it to open /dev/iommufd
In that case, the management layer would define a crippled vfio-pci device. I'd rather let the error occur or find a way to move the "iommufd" object and properties to a target dependent file. I don't see how this could be done though. Thanks, C.
