Merge "soc: qcom: Initialize virtio device related resources"
This commit is contained in:
commit
5156461651
@ -78,7 +78,7 @@ static int guestvm_loader_nb_handler(struct notifier_block *this,
|
||||
switch (vm_status) {
|
||||
case HH_RM_VM_STATUS_READY:
|
||||
priv->vm_status = HH_RM_VM_STATUS_READY;
|
||||
ret = hh_rm_populate_hyp_res(vm_status_payload->vmid);
|
||||
ret = hh_rm_populate_hyp_res(vm_status_payload->vmid, priv->vm_name);
|
||||
if (ret < 0) {
|
||||
dev_err(priv->dev, "Failed to get hyp resources for vmid = %d ret = %d\n",
|
||||
vm_status_payload->vmid, ret);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <linux/haven/hh_errno.h>
|
||||
#include <linux/haven/hh_common.h>
|
||||
#include <linux/haven/hh_rm_drv.h>
|
||||
#include <linux/haven/hh_virtio_backend.h>
|
||||
|
||||
#include "hh_rm_drv_private.h"
|
||||
|
||||
@ -732,13 +733,14 @@ static int hh_rm_get_irq(struct hh_vm_get_hyp_res_resp_entry *res_entry)
|
||||
* The function encodes the error codes via ERR_PTR. Hence, the caller is
|
||||
* responsible to check it with IS_ERR_OR_NULL().
|
||||
*/
|
||||
int hh_rm_populate_hyp_res(hh_vmid_t vmid)
|
||||
int hh_rm_populate_hyp_res(hh_vmid_t vmid, const char *vm_name)
|
||||
{
|
||||
struct hh_vm_get_hyp_res_resp_entry *res_entries = NULL;
|
||||
int linux_irq, ret = 0;
|
||||
hh_capid_t cap_id;
|
||||
hh_label_t label;
|
||||
u32 n_res, i;
|
||||
u64 base = 0, size = 0;
|
||||
|
||||
res_entries = hh_rm_vm_get_hyp_res(vmid, &n_res);
|
||||
if (IS_ERR_OR_NULL(res_entries))
|
||||
@ -769,6 +771,10 @@ int hh_rm_populate_hyp_res(hh_vmid_t vmid)
|
||||
|
||||
cap_id = (u64) res_entries[i].cap_id_high << 32 |
|
||||
res_entries[i].cap_id_low;
|
||||
base = (u64) res_entries[i].base_high << 32 |
|
||||
res_entries[i].base_low;
|
||||
size = (u64) res_entries[i].size_high << 32 |
|
||||
res_entries[i].size_low;
|
||||
label = res_entries[i].resource_label;
|
||||
|
||||
/* Populate MessageQ & DBL's cap tables */
|
||||
@ -792,6 +798,10 @@ int hh_rm_populate_hyp_res(hh_vmid_t vmid)
|
||||
ret = hh_dbl_populate_cap_info(label, cap_id,
|
||||
HH_MSGQ_DIRECTION_RX, linux_irq);
|
||||
break;
|
||||
case HH_RM_RES_TYPE_VIRTIO_MMIO:
|
||||
ret = hh_virtio_mmio_init(vm_name, label,
|
||||
cap_id, linux_irq, base, size);
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: Unknown resource type: %u\n",
|
||||
__func__, res_entries[i].res_type);
|
||||
@ -818,7 +828,7 @@ static void hh_rm_get_svm_res_work_fn(struct work_struct *work)
|
||||
pr_err("%s: Unable to get VMID for VM label %d\n",
|
||||
__func__, HH_PRIMARY_VM);
|
||||
else
|
||||
hh_rm_populate_hyp_res(vmid);
|
||||
hh_rm_populate_hyp_res(vmid, NULL);
|
||||
}
|
||||
|
||||
static int hh_vm_probe(struct device *dev, struct device_node *hyp_root)
|
||||
|
@ -210,7 +210,7 @@ int hh_rm_get_vm_name(hh_vmid_t vmid, enum hh_vm_names *vm_name);
|
||||
int hh_rm_vm_start(int vmid);
|
||||
|
||||
/* Client APIs for VM query */
|
||||
int hh_rm_populate_hyp_res(hh_vmid_t vmid);
|
||||
int hh_rm_populate_hyp_res(hh_vmid_t vmid, const char *vm_name);
|
||||
|
||||
/* Client APIs for VM Services */
|
||||
int hh_rm_console_open(hh_vmid_t vmid);
|
||||
@ -308,7 +308,7 @@ static inline int hh_rm_vm_start(int vmid)
|
||||
}
|
||||
|
||||
/* Client APIs for VM query */
|
||||
static inline int hh_rm_populate_hyp_res(hh_vmid_t vmid)
|
||||
static inline int hh_rm_populate_hyp_res(hh_vmid_t vmid, const char *vm_name)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
22
include/linux/haven/hh_virtio_backend.h
Normal file
22
include/linux/haven/hh_virtio_backend.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __HH_VIRTIO_BACKEND_H
|
||||
#define __HH_VIRTIO_BACKEND_H
|
||||
|
||||
#if IS_ENABLED(CONFIG_HH_VIRTIO_BACKEND)
|
||||
int hh_virtio_mmio_init(const char *vm_name, hh_label_t label,
|
||||
hh_capid_t cap_id, int linux_irq, u64 base, u64 size);
|
||||
|
||||
#else
|
||||
static inline int hh_virtio_mmio_init(const char *vm_name, hh_label_t label,
|
||||
hh_capid_t cap_id, int linux_irq, u64 base, u64 size)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user