On Fri, Mar 03, 2023 at 09:50:00AM +0800, lihuisong (C) wrote:Ok, I will fix it as mentioned above.
在 2023/3/2 21:52, Sudeep Holla 写道:Right, sorry for missing that.
On Thu, Mar 02, 2023 at 09:57:35AM +0800, lihuisong (C) wrote:Return true in advance for the type without the cmd_complete register.
在 2023/3/1 21:24, Sudeep Holla 写道:[...]
IIUC, your concern is about returning true for type 4 when the register+static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan)we indeed already check if cmd_complete register is exist.
+{
+ u64 val;
+ int ret;
+
+ ret = pcc_chan_reg_read(&pchan->cmd_complete, &val);
+ if (ret)
+ return false;
+
IMO, it can simply the code logic and reduce the risk of problems if we
return true here for the type without this register.
what do you think?
doesn't exist, right ?
If support the register, we judge if the channel should respond the
interrupt based on the value of cmd_complete, like bellow.
-->8Yes we need the above check.
+static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan)
+{
+ u64 val;
+ int ret;
+
+ ret = pcc_chan_reg_read(&pchan->cmd_complete, &val);
+ if (ret)
+ return false;
+
+ if (!pchan->cmd_complete.gas)
+ return true;
+
+ /*Understood now.
+ * Judge if the channel respond the interrupt based on the value of
+ * command complete.
+ */
+ val &= pchan->cmd_complete.status_mask;
+ /*
+ * If this is PCC slave subspace channel, then the command complete
+ * bit 0 indicates that Platform is sending a notification and OSPM
+ * needs to respond this interrupt to process this command.
+ */
+ if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE)
+ return !val;
+ else
+ return !!val;
+}
I am saying it won't happen as we bail out if there is no GAS registerYes, what you say is also ok. Just wondering if it is better to simply the
from pcc_chan_reg_init(). Or am I missing something here ?
logic.
Agreed as mentioned above, we need to bail out with true return if no GAS isSorry for my mistake.Sorry I don't understand what you mean by that.+ val &= pchan->cmd_complete.status_mask;This else branch is not applicable to type 3. type 3 will cannot respond
+
+ /*
+ * If this is PCC slave subspace channel, then the command complete
+ * bit 0 indicates that Platform is sending a notification and OSPM
+ * needs to respond this interrupt to process this command.
+ */
+ if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE)
+ return !val;
+ else
+ return !!val;
interrupt.
I meant that the type2 channel always return false in this function and
never respond the interrupt if no check for the GAS register.
Because the 'val' for the type without the register is zero.
found.
.