ANDROID: KVM: arm64: Add hyp_smp_processor_id to module ops

Soon, SMMUv3 driver will implement a synchronization mechanism that
relies on the current CPU number, so export it to modules.

Bug: 357781595
Bug: 384432312
Change-Id: I4a0f41148290fe96cdbbbf211f2338d877c236a6
Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
Mostafa Saleh
2024-05-10 22:36:28 +00:00
parent 03ce7b849c
commit d0b6d7deda
2 changed files with 8 additions and 0 deletions
+2
View File
@@ -165,6 +165,7 @@ enum pkvm_psci_notification {
Needed if the code uses linked lists.
* @iommu_donate_pages_atomic: Allocate memory from IOMMU identity pool.
* @iommu_reclaim_pages_atomic: Reclaim memory from iommu_donate_pages_atomic()
* @hyp_smp_processor_id: Current CPU id
*/
struct pkvm_module_ops {
int (*create_private_mapping)(phys_addr_t phys, size_t size,
@@ -231,6 +232,7 @@ struct pkvm_module_ops {
int (*iommu_snapshot_host_stage2)(struct kvm_hyp_iommu_domain *domain);
void * (*iommu_donate_pages_atomic)(u8 order);
void (*iommu_reclaim_pages_atomic)(void *p, u8 order);
int (*hyp_smp_processor_id)(void);
ANDROID_KABI_RESERVE(1);
ANDROID_KABI_RESERVE(2);
ANDROID_KABI_RESERVE(3);
+6
View File
@@ -123,6 +123,11 @@ static int host_stage2_disable_lazy_pte(u64 pfn, u64 nr_pages)
return __pkvm_host_lazy_pte(pfn, nr_pages, false);
}
static int __hyp_smp_processor_id(void)
{
return hyp_smp_processor_id();
}
const struct pkvm_module_ops module_ops = {
.create_private_mapping = __pkvm_create_private_mapping,
.alloc_module_va = __pkvm_alloc_module_va,
@@ -182,6 +187,7 @@ const struct pkvm_module_ops module_ops = {
.iommu_snapshot_host_stage2 = kvm_iommu_snapshot_host_stage2,
.iommu_donate_pages_atomic = kvm_iommu_donate_pages_atomic,
.iommu_reclaim_pages_atomic = kvm_iommu_reclaim_pages_atomic,
.hyp_smp_processor_id = __hyp_smp_processor_id,
};
int __pkvm_init_module(void *module_init)