mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 07:50:04 +00:00
Revert "remoteproc: Merge table_ptr and cached_table pointers"
Following any fw_rsc_vdev entries in the resource table are two variable length arrays, the first one reference vring resources and the second one is the virtio config space. The virtio config space is used by virtio to communicate status and configuration changes and must as such be shared with the remote. The reverted commit incorrectly made any changes to the virtio config space only affect the local copy, in an attempt to allowing memory protection of the shared resource table. This reverts commit cda8529346935fc86f476999ac4fbfe4e17abf11. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
parent
c81c0e0710
commit
a0c10687ec
@ -886,13 +886,15 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
|
|||||||
/*
|
/*
|
||||||
* Create a copy of the resource table. When a virtio device starts
|
* Create a copy of the resource table. When a virtio device starts
|
||||||
* and calls vring_new_virtqueue() the address of the allocated vring
|
* and calls vring_new_virtqueue() the address of the allocated vring
|
||||||
* will be stored in the table_ptr. Before the device is started,
|
* will be stored in the cached_table. Before the device is started,
|
||||||
* table_ptr will be copied into device memory.
|
* cached_table will be copied into device memory.
|
||||||
*/
|
*/
|
||||||
rproc->table_ptr = kmemdup(table, tablesz, GFP_KERNEL);
|
rproc->cached_table = kmemdup(table, tablesz, GFP_KERNEL);
|
||||||
if (!rproc->table_ptr)
|
if (!rproc->cached_table)
|
||||||
goto clean_up;
|
goto clean_up;
|
||||||
|
|
||||||
|
rproc->table_ptr = rproc->cached_table;
|
||||||
|
|
||||||
/* reset max_notifyid */
|
/* reset max_notifyid */
|
||||||
rproc->max_notifyid = -1;
|
rproc->max_notifyid = -1;
|
||||||
|
|
||||||
@ -911,16 +913,18 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The starting device has been given the rproc->table_ptr as the
|
* The starting device has been given the rproc->cached_table as the
|
||||||
* resource table. The address of the vring along with the other
|
* resource table. The address of the vring along with the other
|
||||||
* allocated resources (carveouts etc) is stored in table_ptr.
|
* allocated resources (carveouts etc) is stored in cached_table.
|
||||||
* In order to pass this information to the remote device we must copy
|
* In order to pass this information to the remote device we must copy
|
||||||
* this information to device memory. We also update the table_ptr so
|
* this information to device memory. We also update the table_ptr so
|
||||||
* that any subsequent changes will be applied to the loaded version.
|
* that any subsequent changes will be applied to the loaded version.
|
||||||
*/
|
*/
|
||||||
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
|
loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
|
||||||
if (loaded_table)
|
if (loaded_table) {
|
||||||
memcpy(loaded_table, rproc->table_ptr, tablesz);
|
memcpy(loaded_table, rproc->cached_table, tablesz);
|
||||||
|
rproc->table_ptr = loaded_table;
|
||||||
|
}
|
||||||
|
|
||||||
/* power up the remote processor */
|
/* power up the remote processor */
|
||||||
ret = rproc->ops->start(rproc);
|
ret = rproc->ops->start(rproc);
|
||||||
@ -948,7 +952,8 @@ stop_rproc:
|
|||||||
clean_up_resources:
|
clean_up_resources:
|
||||||
rproc_resource_cleanup(rproc);
|
rproc_resource_cleanup(rproc);
|
||||||
clean_up:
|
clean_up:
|
||||||
kfree(rproc->table_ptr);
|
kfree(rproc->cached_table);
|
||||||
|
rproc->cached_table = NULL;
|
||||||
rproc->table_ptr = NULL;
|
rproc->table_ptr = NULL;
|
||||||
|
|
||||||
rproc_disable_iommu(rproc);
|
rproc_disable_iommu(rproc);
|
||||||
@ -1182,7 +1187,8 @@ void rproc_shutdown(struct rproc *rproc)
|
|||||||
rproc_disable_iommu(rproc);
|
rproc_disable_iommu(rproc);
|
||||||
|
|
||||||
/* Free the copy of the resource table */
|
/* Free the copy of the resource table */
|
||||||
kfree(rproc->table_ptr);
|
kfree(rproc->cached_table);
|
||||||
|
rproc->cached_table = NULL;
|
||||||
rproc->table_ptr = NULL;
|
rproc->table_ptr = NULL;
|
||||||
|
|
||||||
/* if in crash state, unlock crash handler */
|
/* if in crash state, unlock crash handler */
|
||||||
|
@ -408,7 +408,8 @@ enum rproc_crash_type {
|
|||||||
* @crash_comp: completion used to sync crash handler and the rproc reload
|
* @crash_comp: completion used to sync crash handler and the rproc reload
|
||||||
* @recovery_disabled: flag that state if recovery was disabled
|
* @recovery_disabled: flag that state if recovery was disabled
|
||||||
* @max_notifyid: largest allocated notify id.
|
* @max_notifyid: largest allocated notify id.
|
||||||
* @table_ptr: our copy of the resource table
|
* @table_ptr: pointer to the resource table in effect
|
||||||
|
* @cached_table: copy of the resource table
|
||||||
* @has_iommu: flag to indicate if remote processor is behind an MMU
|
* @has_iommu: flag to indicate if remote processor is behind an MMU
|
||||||
*/
|
*/
|
||||||
struct rproc {
|
struct rproc {
|
||||||
@ -440,6 +441,7 @@ struct rproc {
|
|||||||
bool recovery_disabled;
|
bool recovery_disabled;
|
||||||
int max_notifyid;
|
int max_notifyid;
|
||||||
struct resource_table *table_ptr;
|
struct resource_table *table_ptr;
|
||||||
|
struct resource_table *cached_table;
|
||||||
bool has_iommu;
|
bool has_iommu;
|
||||||
bool auto_boot;
|
bool auto_boot;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user