mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-10 01:34:12 +00:00
rtkit: Support usage with SRAM
Will be used by SMC. Signed-off-by: Janne Grunau <j@jannau.net>
This commit is contained in:
parent
41e4e25eed
commit
b65c7d1edc
4 changed files with 22 additions and 6 deletions
|
@ -49,7 +49,7 @@ dcp_dev_t *dcp_init(const char *dcp_path, const char *dcp_dart_path, const char
|
|||
goto out_iovad;
|
||||
}
|
||||
|
||||
dcp->rtkit = rtkit_init("dcp", dcp->asc, dcp->dart_dcp, dcp->iovad_dcp, NULL);
|
||||
dcp->rtkit = rtkit_init("dcp", dcp->asc, dcp->dart_dcp, dcp->iovad_dcp, NULL, false);
|
||||
if (!dcp->rtkit) {
|
||||
printf("dcp: failed to initialize RTKit\n");
|
||||
goto out_iovad;
|
||||
|
|
|
@ -335,7 +335,7 @@ bool nvme_init(void)
|
|||
if (!nvme_sart)
|
||||
goto out_asc;
|
||||
|
||||
nvme_rtkit = rtkit_init("nvme", nvme_asc, NULL, NULL, nvme_sart);
|
||||
nvme_rtkit = rtkit_init("nvme", nvme_asc, NULL, NULL, nvme_sart, false);
|
||||
if (!nvme_rtkit)
|
||||
goto out_sart;
|
||||
|
||||
|
@ -446,7 +446,7 @@ void nvme_ensure_shutdown(void)
|
|||
if (!nvme_sart)
|
||||
goto fail;
|
||||
|
||||
nvme_rtkit = rtkit_init("nvme", nvme_asc, NULL, NULL, nvme_sart);
|
||||
nvme_rtkit = rtkit_init("nvme", nvme_asc, NULL, NULL, nvme_sart, false);
|
||||
if (!nvme_rtkit)
|
||||
goto fail;
|
||||
|
||||
|
|
20
src/rtkit.c
20
src/rtkit.c
|
@ -87,6 +87,7 @@ struct rtkit_dev {
|
|||
dart_dev_t *dart;
|
||||
iova_domain_t *dart_iovad;
|
||||
sart_dev_t *sart;
|
||||
bool sram;
|
||||
|
||||
u64 dva_base;
|
||||
|
||||
|
@ -126,7 +127,7 @@ struct crashlog_entry {
|
|||
};
|
||||
|
||||
rtkit_dev_t *rtkit_init(const char *name, asc_dev_t *asc, dart_dev_t *dart,
|
||||
iova_domain_t *dart_iovad, sart_dev_t *sart)
|
||||
iova_domain_t *dart_iovad, sart_dev_t *sart, bool sram)
|
||||
{
|
||||
if (dart && sart) {
|
||||
printf("rtkit: Cannot use both SART and DART simultaneously\n");
|
||||
|
@ -138,6 +139,11 @@ rtkit_dev_t *rtkit_init(const char *name, asc_dev_t *asc, dart_dev_t *dart,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (sram && (dart || sart)) {
|
||||
printf("rtkit: cannot use SRAM with DART or SART \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rtkit_dev_t *rtk = malloc(sizeof(*rtk));
|
||||
if (!rtk)
|
||||
return NULL;
|
||||
|
@ -153,6 +159,7 @@ rtkit_dev_t *rtkit_init(const char *name, asc_dev_t *asc, dart_dev_t *dart,
|
|||
rtk->dart = dart;
|
||||
rtk->dart_iovad = dart_iovad;
|
||||
rtk->sart = sart;
|
||||
rtk->sram = sram;
|
||||
rtk->iop_power = RTKIT_POWER_OFF;
|
||||
rtk->ap_power = RTKIT_POWER_OFF;
|
||||
rtk->dva_base = 0;
|
||||
|
@ -277,7 +284,16 @@ static bool rtkit_handle_buffer_request(rtkit_dev_t *rtk, struct rtkit_message *
|
|||
size_t sz = n_4kpages << 12;
|
||||
u64 addr = FIELD_GET(MSG_BUFFER_REQUEST_IOVA, msg->msg);
|
||||
|
||||
if (addr) {
|
||||
if (rtk->sram) {
|
||||
if (!addr) {
|
||||
rtkit_printf("SRAM buffers needs to be provided by the IOP\n");
|
||||
return false;
|
||||
}
|
||||
bfr->dva = addr;
|
||||
bfr->bfr = (void *)addr;
|
||||
bfr->sz = sz;
|
||||
return true;
|
||||
} else if (addr) {
|
||||
bfr->dva = addr & ~rtk->dva_base;
|
||||
bfr->sz = sz;
|
||||
bfr->bfr = dart_translate(rtk->dart, bfr->dva & IOVA_MASK);
|
||||
|
|
|
@ -23,7 +23,7 @@ struct rtkit_buffer {
|
|||
};
|
||||
|
||||
rtkit_dev_t *rtkit_init(const char *name, asc_dev_t *asc, dart_dev_t *dart,
|
||||
iova_domain_t *dart_iovad, sart_dev_t *sart);
|
||||
iova_domain_t *dart_iovad, sart_dev_t *sart, bool sram);
|
||||
bool rtkit_quiesce(rtkit_dev_t *rtk);
|
||||
bool rtkit_sleep(rtkit_dev_t *rtk);
|
||||
void rtkit_free(rtkit_dev_t *rtk);
|
||||
|
|
Loading…
Reference in a new issue