mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 07:07:34 +07:00
c6aed238b7
Current version of rproc_alloc_vring function supports only dynamic vring allocation. This patch allows to allocate vrings based on memory region declatation. Vrings are now manage like memory carveouts, to communize memory management code in rproc_alloc_registered_carveouts(). Allocated buffer is retrieved in rp_find_vq() thanks to rproc_find_carveout_by_name() functions for. This patch sets vrings names to vdev"x"vring"y" with x vdev index in resource table and y vring index in vdev. This will be updated when name will be associated to vdev in firmware resource table. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
112 lines
3.2 KiB
C
112 lines
3.2 KiB
C
/*
|
|
* Remote processor framework
|
|
*
|
|
* Copyright (C) 2011 Texas Instruments, Inc.
|
|
* Copyright (C) 2011 Google, Inc.
|
|
*
|
|
* Ohad Ben-Cohen <ohad@wizery.com>
|
|
* Brian Swetland <swetland@google.com>
|
|
*
|
|
* This software is licensed under the terms of the GNU General Public
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
* may be copied, distributed, and modified under those terms.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#ifndef REMOTEPROC_INTERNAL_H
|
|
#define REMOTEPROC_INTERNAL_H
|
|
|
|
#include <linux/irqreturn.h>
|
|
#include <linux/firmware.h>
|
|
|
|
struct rproc;
|
|
|
|
/* from remoteproc_core.c */
|
|
void rproc_release(struct kref *kref);
|
|
irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id);
|
|
void rproc_vdev_release(struct kref *ref);
|
|
|
|
/* from remoteproc_virtio.c */
|
|
int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id);
|
|
void rproc_remove_virtio_dev(struct rproc_vdev *rvdev);
|
|
|
|
/* from remoteproc_debugfs.c */
|
|
void rproc_remove_trace_file(struct dentry *tfile);
|
|
struct dentry *rproc_create_trace_file(const char *name, struct rproc *rproc,
|
|
struct rproc_mem_entry *trace);
|
|
void rproc_delete_debug_dir(struct rproc *rproc);
|
|
void rproc_create_debug_dir(struct rproc *rproc);
|
|
void rproc_init_debugfs(void);
|
|
void rproc_exit_debugfs(void);
|
|
|
|
/* from remoteproc_sysfs.c */
|
|
extern struct class rproc_class;
|
|
int rproc_init_sysfs(void);
|
|
void rproc_exit_sysfs(void);
|
|
|
|
void rproc_free_vring(struct rproc_vring *rvring);
|
|
int rproc_alloc_vring(struct rproc_vdev *rvdev, int i);
|
|
|
|
void *rproc_da_to_va(struct rproc *rproc, u64 da, int len);
|
|
int rproc_trigger_recovery(struct rproc *rproc);
|
|
|
|
int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw);
|
|
u32 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw);
|
|
int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
|
|
int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw);
|
|
struct resource_table *rproc_elf_find_loaded_rsc_table(struct rproc *rproc,
|
|
const struct firmware *fw);
|
|
struct rproc_mem_entry *
|
|
rproc_find_carveout_by_name(struct rproc *rproc, const char *name, ...);
|
|
|
|
static inline
|
|
int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
|
|
{
|
|
if (rproc->ops->sanity_check)
|
|
return rproc->ops->sanity_check(rproc, fw);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline
|
|
u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
|
|
{
|
|
if (rproc->ops->get_boot_addr)
|
|
return rproc->ops->get_boot_addr(rproc, fw);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline
|
|
int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
|
|
{
|
|
if (rproc->ops->load)
|
|
return rproc->ops->load(rproc, fw);
|
|
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline int rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
|
|
{
|
|
if (rproc->ops->parse_fw)
|
|
return rproc->ops->parse_fw(rproc, fw);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static inline
|
|
struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,
|
|
const struct firmware *fw)
|
|
{
|
|
if (rproc->ops->find_loaded_rsc_table)
|
|
return rproc->ops->find_loaded_rsc_table(rproc, fw);
|
|
|
|
return NULL;
|
|
}
|
|
|
|
#endif /* REMOTEPROC_INTERNAL_H */
|