All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Robbie King <robbiek@xsightlabs.com>
Cc: <linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Huisong Li <lihuisong@huawei.com>,
	Adam Young <admiyo@os.amperecomputing.com>
Subject: Re: [PATCH v2 02/13] mailbox: pcc: Always clear the platform ack interrupt first
Date: Thu, 13 Mar 2025 15:09:48 +0000	[thread overview]
Message-ID: <Z9L1PD8lDjwM7L3l@bogus> (raw)
In-Reply-To: <4ef4df06-c6f8-4151-96e1-78be58f32f54@xsightlabs.com>

On Thu, Mar 13, 2025 at 11:08:04AM -0400, Robbie King wrote:
> On 3/5/2025 11:38 AM, Sudeep Holla wrote:
> > The PCC mailbox interrupt handler (pcc_mbox_irq()) currently checks
> > for command completion flags and any error status before clearing the
> > interrupt.
> > 
> > The below sequence highlights an issue in the handling of PCC mailbox
> > interrupts, specifically when dealing with doorbell notifications and
> > acknowledgment between the OSPM and the platform where type3 and type4
> > channels are sharing the interrupt.
> > 
> > -------------------------------------------------------------------------
> > | T |       Platform Firmware         |    OSPM/Linux PCC driver        |
> > |---|---------------------------------|---------------------------------|
> > | 1 |                                 | Build message in shmem          |
> > | 2 |                                 | Ring Type3 chan doorbell        |
> > | 3 | Receives the doorbell interrupt |                                 |
> > | 4 | Process the message from OSPM   |                                 |
> > | 5 | Build response for the message  |                                 |
> > | 6 | Ring Platform ACK interrupt on  |                                 |
> > |   |  Type3 chan to OSPM             | Received the interrupt          |
> > | 7 | Build Notification in Type4 Chan|                                 |
> > | 8 |                                 | Start processing interrupt in   |
> > |   |                                 |  pcc_mbox_irq() handler         |
> > | 9 |                                 | Enter PCC handler for Type4 chan|
> > |10 |                                 | Check command complete cleared  |
> > |11 |                                 | Read the notification           |
> > |12 |                                 | Clear Platform ACK interrupt    |
> > |   | No effect from the previous step yet as the Platform ACK          |
> > |   |  interrupt has not yet been triggered for this channel            |
> > |13 | Ring Platform ACK interrupt on  |                                 |
> > |   | Type4 chan to OSPM              |                                 |
> > |14 |                                 | Enter PCC handler for Type3 chan|
> > |15 |                                 | Command complete is set.        |
> > |16 |                                 | Read the response.              |
> > |17 |                                 | Clear Platform ACK interrupt    |
> > |18 |                                 | Leave PCC handler for Type3     |
> > |19 |                                 | Leave pcc_mbox_irq() handler    |
> > |20 |                                 | Re-enter pcc_mbox_irq() handler |
> > |21 |                                 | Enter PCC handler for Type4 chan|
> > |22 |                                 | Leave PCC handler for Type4 chan|
> > |23 |                                 | Enter PCC handler for Type3 chan|
> > |24 |                                 | Leave PCC handler for Type3 chan|
> > |25 |                                 | Leave pcc_mbox_irq() handler    |
> > -------------------------------------------------------------------------
> > 
> > The key issue occurs when OSPM tries to acknowledge platform ack
> > interrupt for a notification which is ready to be read and processed
> > but the interrupt itself is not yet triggered by the platform.
> > 
> > This ineffective acknowledgment leads to an issue later in time where
> > the interrupt remains pending as we exit the interrupt handler without
> > clearing the platform ack interrupt as there is no pending response or
> > notification. The interrupt acknowledgment order is incorrect.
> > 
> > To resolve this issue, the platform acknowledgment interrupt should
> > always be cleared before processing the interrupt for any notifications
> > or response.
> > 
> > Reported-by: Robbie King <robbiek@xsightlabs.com>
> > Reviewed-by: Huisong Li <lihuisong@huawei.com>
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> 
> Tested-by: Robbie King <robbiek@xsightlabs.com>
> 

Thanks Robbie for reporting the issue and testing the fix. Much appreciated!

-- 
Regards,
Sudeep

  reply	other threads:[~2025-03-13 15:09 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 16:38 [PATCH v2 00/13] mailbox: pcc: Fixes and cleanup/refactoring Sudeep Holla
2025-03-05 16:38 ` [PATCH v2 01/13] mailbox: pcc: Fix the possible race in updation of chan_in_use flag Sudeep Holla
2025-03-11 11:40   ` lihuisong (C)
2025-03-11 12:02     ` Sudeep Holla
2025-03-11 12:15       ` lihuisong (C)
2025-03-13 15:07   ` Robbie King
2025-03-05 16:38 ` [PATCH v2 02/13] mailbox: pcc: Always clear the platform ack interrupt first Sudeep Holla
2025-03-11 11:19   ` lihuisong (C)
2025-03-12 22:25   ` Adam Young
2025-03-13 15:08   ` Robbie King
2025-03-13 15:09     ` Sudeep Holla [this message]
2025-03-05 16:38 ` [PATCH v2 03/13] mailbox: pcc: Drop unnecessary endianness conversion of pcc_hdr.flags Sudeep Holla
2025-03-11 11:19   ` lihuisong (C)
2025-03-12 22:26   ` Adam Young
2025-03-05 16:38 ` [PATCH v2 04/13] mailbox: pcc: Return early if no GAS register from pcc_mbox_cmd_complete_check Sudeep Holla
2025-03-11 11:20   ` lihuisong (C)
2025-03-12 22:27   ` Adam Young
2025-03-05 16:38 ` [PATCH v2 05/13] mailbox: pcc: Use acpi_os_ioremap() instead of ioremap() Sudeep Holla
2025-03-11 11:21   ` lihuisong (C)
2025-03-12 22:27   ` Adam Young
2025-03-05 16:38 ` [PATCH v2 06/13] mailbox: pcc: Refactor error handling in irq handler into separate function Sudeep Holla
2025-03-11 11:23   ` lihuisong (C)
2025-03-12 22:28   ` Adam Young
2025-03-05 16:38 ` [PATCH v2 07/13] mailbox: pcc: Always map the shared memory communication address Sudeep Holla
2025-03-11 11:32   ` lihuisong (C)
2025-03-11 11:56     ` Sudeep Holla
2025-03-11 12:31       ` lihuisong (C)
2025-03-12 22:29   ` Adam Young
2025-03-05 16:38 ` [PATCH v2 08/13] mailbox: pcc: Refactor and simplify check_and_ack() Sudeep Holla
2025-03-11 11:47   ` lihuisong (C)
2025-03-11 12:08     ` Sudeep Holla
2025-03-11 12:19       ` lihuisong (C)
2025-03-11 12:25         ` Sudeep Holla
2025-03-12 22:29   ` Adam Young
2025-03-05 16:38 ` [PATCH v2 09/13] soc: hisilicon: kunpeng_hccs: Simplify PCC shared memory region handling Sudeep Holla
2025-03-05 16:38 ` [PATCH v2 10/13] i2c: xgene-slimpro: " Sudeep Holla
2025-03-05 16:38 ` [PATCH v2 11/13] hwmon: (xgene-hwmon) " Sudeep Holla
2025-03-05 16:38 ` [PATCH v2 12/13] ACPI: PCC: " Sudeep Holla
2025-03-05 16:38 ` [PATCH v2 13/13] ACPI: CPPC: " Sudeep Holla
2025-03-11 12:10 ` [PATCH v2 00/13] mailbox: pcc: Fixes and cleanup/refactoring Sudeep Holla
2025-03-12 18:04   ` Adam Young
2025-03-12 20:05     ` Sudeep Holla
2025-03-12 20:37       ` Adam Young
2025-03-13  9:38         ` Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9L1PD8lDjwM7L3l@bogus \
    --to=sudeep.holla@arm.com \
    --cc=admiyo@os.amperecomputing.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=lihuisong@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robbiek@xsightlabs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.