ANDROID: arm64: kvm: s2mpu: Update address of s2mpu struct
As the the s2mpu el2 driver is loaded at run time, we can't convert its address from kernel to hyp using kern_hyp_va. The kernel module will be responsible of sending the address of the struct as hyp address in s2mpu hypercalls, currently the load address of the modules is returned as the token of the module. Although the passed arguments is the driver struct address, but the address passed is not a kernel address, so pass it as u64 to avoid confusing it as a kernel address. Bug: 261857213 Change-Id: Ieb787f83d7c07ada2c8565f0e34cdc6de71aff6f Signed-off-by: Mostafa Saleh <smostafa@google.com>
This commit is contained in:
@@ -395,8 +395,8 @@ struct pkvm_iommu_driver {
|
||||
atomic_t state;
|
||||
};
|
||||
|
||||
int pkvm_iommu_driver_init(struct pkvm_iommu_driver *drv, void *data, size_t size);
|
||||
int pkvm_iommu_register(struct device *dev, struct pkvm_iommu_driver *drv,
|
||||
int pkvm_iommu_driver_init(u64 drv, void *data, size_t size);
|
||||
int pkvm_iommu_register(struct device *dev, u64 drv,
|
||||
phys_addr_t pa, size_t size, struct device *parent);
|
||||
int pkvm_iommu_suspend(struct device *dev);
|
||||
int pkvm_iommu_resume(struct device *dev);
|
||||
|
||||
@@ -1131,8 +1131,6 @@ static void handle___pkvm_iommu_driver_init(struct kvm_cpu_context *host_ctxt)
|
||||
DECLARE_REG(void *, data, host_ctxt, 2);
|
||||
DECLARE_REG(size_t, size, host_ctxt, 3);
|
||||
|
||||
/* __pkvm_iommu_driver_init expects hyp_va as it can be called from EL2 as a function. */
|
||||
drv = kern_hyp_va(drv);
|
||||
data = kern_hyp_va(data);
|
||||
|
||||
cpu_reg(host_ctxt, 1) = __pkvm_iommu_driver_init(drv, data, size);
|
||||
@@ -1148,8 +1146,6 @@ static void handle___pkvm_iommu_register(struct kvm_cpu_context *host_ctxt)
|
||||
DECLARE_REG(void *, mem, host_ctxt, 6);
|
||||
DECLARE_REG(size_t, mem_size, host_ctxt, 7);
|
||||
|
||||
/* drv_id is the hyp address of the driver. */
|
||||
drv_id = kern_hyp_va(drv_id);
|
||||
cpu_reg(host_ctxt, 1) = __pkvm_iommu_register(dev_id, drv_id, dev_pa,
|
||||
dev_size, parent_id,
|
||||
mem, mem_size);
|
||||
|
||||
@@ -12,12 +12,12 @@ static unsigned long dev_to_id(struct device *dev)
|
||||
return (unsigned long)dev;
|
||||
}
|
||||
|
||||
int pkvm_iommu_driver_init(struct pkvm_iommu_driver *drv, void *data, size_t size)
|
||||
int pkvm_iommu_driver_init(u64 drv, void *data, size_t size)
|
||||
{
|
||||
return kvm_call_hyp_nvhe(__pkvm_iommu_driver_init, drv, data, size);
|
||||
}
|
||||
|
||||
int pkvm_iommu_register(struct device *dev, struct pkvm_iommu_driver *drv, phys_addr_t pa,
|
||||
int pkvm_iommu_register(struct device *dev, u64 drv, phys_addr_t pa,
|
||||
size_t size, struct device *parent)
|
||||
{
|
||||
void *mem;
|
||||
|
||||
Reference in New Issue
Block a user