sys_spu: Fix SNR and Inbound Mailbox state reset

Also remove bugged ESTAT check at sys_spu_thread_write_spu_mb.
This commit is contained in:
Eladash 2019-10-24 21:03:17 +03:00 committed by Ivan
parent 739f68271f
commit b99992d570
3 changed files with 8 additions and 18 deletions

View File

@ -1050,14 +1050,9 @@ void spu_thread::cpu_init()
ch_stall_stat.data.raw() = {};
ch_atomic_stat.data.raw() = {};
ch_in_mbox.clear();
ch_out_mbox.data.raw() = {};
ch_out_intr_mbox.data.raw() = {};
ch_snr1.data.raw() = {};
ch_snr2.data.raw() = {};
ch_event_mask.raw() = 0;
ch_event_stat.raw() = 0;
interrupts_enabled.raw() = false;
@ -1068,6 +1063,10 @@ void spu_thread::cpu_init()
if (offset >= RAW_SPU_BASE_ADDR)
{
ch_in_mbox.clear();
ch_snr1.data.raw() = {};
ch_snr2.data.raw() = {};
snr_config = 0;
}
@ -1097,6 +1096,7 @@ void spu_thread::cpu_stop()
std::lock_guard lock(group->mutex);
group->stop_count++;
group->run_state = SPU_THREAD_GROUP_STATUS_INITIALIZED;
ch_in_mbox.clear();
if (!group->join_state)
{

View File

@ -547,15 +547,15 @@ public:
spu_channel ch_stall_stat;
spu_channel ch_atomic_stat;
spu_channel_4_t ch_in_mbox;
spu_channel_4_t ch_in_mbox{};
spu_channel ch_out_mbox;
spu_channel ch_out_intr_mbox;
u64 snr_config = 0; // SPU SNR Config Register
spu_channel ch_snr1; // SPU Signal Notification Register 1
spu_channel ch_snr2; // SPU Signal Notification Register 2
spu_channel ch_snr1{}; // SPU Signal Notification Register 1
spu_channel ch_snr2{}; // SPU Signal Notification Register 2
atomic_t<u32> ch_event_mask;
atomic_t<u32> ch_event_stat;

View File

@ -947,11 +947,6 @@ error_code sys_spu_thread_write_spu_mb(ppu_thread& ppu, u32 id, u32 value)
std::lock_guard lock(group->mutex);
if (group->run_state < SPU_THREAD_GROUP_STATUS_WAITING || group->run_state > SPU_THREAD_GROUP_STATUS_RUNNING)
{
return CELL_ESTAT;
}
thread->ch_in_mbox.push(*thread, value);
return CELL_OK;
@ -1016,11 +1011,6 @@ error_code sys_spu_thread_write_snr(ppu_thread& ppu, u32 id, u32 number, u32 val
return CELL_EINVAL;
}
//if (group->state < SPU_THREAD_GROUP_STATUS_WAITING || group->state > SPU_THREAD_GROUP_STATUS_RUNNING) // ???
//{
// return CELL_ESTAT;
//}
thread->push_snr(number, value);
return CELL_OK;