在 2020/11/5 21:12, Marc Zyngier 写道:
Please don't top-post.
On 2020-11-05 11:54, xuqiang (M) wrote:
The kernel sends three commands in the following sequence:
1.mapd(deviceA, ITT_addr1, valid:1)
2.mapti(deviceA):ITS write ITT_addr1 memory;
3.mapd(deviceA, ITT_addr1, valid:0) and kfree(ITT_addr1);
4.mapd(deviceA, ITT_addr2, valid:1);
5.mapti(deviceA):ITS write ITT_addr2 memory;
In this case, the processor enters the sleep mode. After the kernel
performs the suspend operation, the firmware performs the store
operation and saves GITS_CBASER and GITS_CWRITER registers.
Then, the processor is woken up, and the firmware restores GITS_CBASER
and GITS_CWRITER registers. Because GITS_CWRITER register is not 0,
ITS will read the above command sequence execution from the command
queue, causing ITT_addr1 memory to be trampled.
This cannot work. By doing a memset on the command queue, you are
only feeding crap to the ITS (command 0 simply does not exist).
Consider yourself lucky that it doesn't just lock-up.
What needs to happen is the restore sequence that is already in the
driver, so that the command queue is in a sane state before re-enabling
the ITS.
M.
On my platform, ITS_FLAGS_SAVE_SUSPEND_STATE is not set, thus
the first if condition in its_save_disable under list_for_each_entry goes
to the continue, however, I want to set the GITS_CWRITER to 0 at the
end of list_for_each_entry.
Do you have any suggestions about how to do this?