lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc5472ee-cc78-4531-b4df-dc7b621fd222@amperemail.onmicrosoft.com>
Date: Wed, 12 Mar 2025 18:25:56 -0400
From: Adam Young <admiyo@...eremail.onmicrosoft.com>
To: Sudeep Holla <sudeep.holla@....com>, linux-acpi@...r.kernel.org,
 linux-kernel@...r.kernel.org
Cc: Jassi Brar <jassisinghbrar@...il.com>, Huisong Li <lihuisong@...wei.com>,
 Adam Young <admiyo@...amperecomputing.com>,
 Robbie King <robbiek@...ghtlabs.com>
Subject: Re: [PATCH v2 02/13] mailbox: pcc: Always clear the platform ack
 interrupt first


On 3/5/25 11:38, 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@...ghtlabs.com>
> Reviewed-by: Huisong Li <lihuisong@...wei.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@....com>
> ---
>   drivers/mailbox/pcc.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
> index f2e4087281c70eeb5b9b33371596613a371dff4f..4c582fa2b8bf4c9a9368dba8220f567555dba963 100644
> --- a/drivers/mailbox/pcc.c
> +++ b/drivers/mailbox/pcc.c
> @@ -313,6 +313,10 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
>   	int ret;
>   
>   	pchan = chan->con_priv;
> +
> +	if (pcc_chan_reg_read_modify_write(&pchan->plat_irq_ack))
> +		return IRQ_NONE;
> +
>   	if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE &&
>   	    !pchan->chan_in_use)
>   		return IRQ_NONE;
> @@ -330,9 +334,6 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
>   		return IRQ_NONE;
>   	}
>   
> -	if (pcc_chan_reg_read_modify_write(&pchan->plat_irq_ack))
> -		return IRQ_NONE;
> -
>   	/*
>   	 * Clear this flag immediately after updating interrupt ack register
>   	 * to avoid possible race in updatation of the flag from
>

tested-by: admiyo@...amperecomputing.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ