ANDROID: KVM: arm64: Add __pkvm_iommu_init HVC to initialize IOMMU driver
IOMMU drivers so far have been initialized by directly assigning EL2 variables before __pkvm_init. That's not possible for out-of-tree drivers that can only be initialized from early modules running between __pkvm_init and __pkvm_prot_finalize. Add a new HVC that can only be called before __pkvm_prot_finalize to set the EL2 variables that way. Also add an argument for kvm_iommu_ops.init so as to allow passing dynamic arguments (such as location of config struct) to the driver. @smostafa Merge with new IOMMU EL1 code Apply new calls to SMMUv3 driver This commit changes the init flow of KVM IOMMU driver and it might differ between builtin and modules(not supported yet). For a builtin driver: - An early initcall as core_initcall would call kvm_iommu_register_driver which mainly registers a EL1 driver with KVM. - When pKVM is still privileged and before it drops it, it calls the driver Init callback, which then probes the driver and call kvm_iommu_init_hyp. - kvm_iommu_init_hyp would call the EL2 driver init, which expects the EL1 driver to be probed and IOMMU are existing in the driver specific shared structs. We need the extra step for the callback because we need to know when pKVM is ready to have the IOMMU hypercalls, and unlike EL2 modules builtin driver are not loaded by KVM. For modules in the module init it can both porbe and init the hyp HVC and ignore the drop privilege callback. Signed-off-by:David Brazdil <dbrazdil@google.com> Signed-off-by:
Mostafa Saleh <smostafa@google.com> Bug: 277989609 Bug: 278749606 Change-Id: Iba683e7a26f2944407587661dc3ab1b0d098bdc7
Loading
Please sign in to comment