2024-05-28 19:20:11

by admiyo

[permalink] [raw]
Subject: [PATCH v2 1/3] mctp pcc: Check before sending MCTP PCC response ACK

From: Adam Young <[email protected]>

Type 4 PCC channels have an option to send back a response
to the platform when they are done processing the request.
The flag to indicate whether or not to respond is inside
the message body, and thus is not available to the pcc
mailbox. Since only one message can be processed at once per
channel, the value of this flag is checked during message processing
and passed back via the channels global structure.

Ideally, the mailbox callback function would return a value
indicating whether the message requires an ACK, but that
would be a change to the mailbox API. That would involve
some change to all (about 12) of the mailbox based drivers,
and the majority of them would not need to know about the
ACK call.

Signed-off-by: Adam Young <[email protected]>
---
drivers/mailbox/pcc.c | 5 ++++-
include/acpi/pcc.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 94885e411085..774727b89693 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -280,6 +280,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
{
struct pcc_chan_info *pchan;
struct mbox_chan *chan = p;
+ struct pcc_mbox_chan *pmchan;
u64 val;
int ret;

@@ -304,6 +305,8 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
if (pcc_chan_reg_read_modify_write(&pchan->plat_irq_ack))
return IRQ_NONE;

+ pmchan = &pchan->chan;
+ pmchan->ack_rx = true; //TODO default to False
mbox_chan_received_data(chan, NULL);

/*
@@ -312,7 +315,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
*
* The PCC master subspace channel clears chan_in_use to free channel.
*/
- if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE)
+ if ((pchan->type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE) && pmchan->ack_rx)
pcc_send_data(chan, NULL);
pchan->chan_in_use = false;

diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h
index 9b373d172a77..297913378c2b 100644
--- a/include/acpi/pcc.h
+++ b/include/acpi/pcc.h
@@ -16,6 +16,7 @@ struct pcc_mbox_chan {
u32 latency;
u32 max_access_rate;
u16 min_turnaround_time;
+ bool ack_rx;
};

/* Generic Communications Channel Shared Memory Region */
--
2.34.1



2024-05-29 03:27:16

by Ratheesh Kannoth

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] mctp pcc: Check before sending MCTP PCC response ACK

On 2024-05-29 at 00:48:21, [email protected] ([email protected]) wrote:
> From: Adam Young <[email protected]>
>
> diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
> index 94885e411085..774727b89693 100644
> --- a/drivers/mailbox/pcc.c
> +++ b/drivers/mailbox/pcc.c
> @@ -280,6 +280,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
> {
> struct pcc_chan_info *pchan;
> struct mbox_chan *chan = p;
> + struct pcc_mbox_chan *pmchan;
Reverse xmas tree.

> u64 val;
> int ret;
>
>

2024-06-03 09:53:28

by Sudeep Holla

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] mctp pcc: Check before sending MCTP PCC response ACK

On Tue, May 28, 2024 at 03:18:21PM -0400, [email protected] wrote:
> From: Adam Young <[email protected]>
>
> Type 4 PCC channels have an option to send back a response
> to the platform when they are done processing the request.
> The flag to indicate whether or not to respond is inside
> the message body, and thus is not available to the pcc
> mailbox. Since only one message can be processed at once per
> channel, the value of this flag is checked during message processing
> and passed back via the channels global structure.
>
> Ideally, the mailbox callback function would return a value
> indicating whether the message requires an ACK, but that
> would be a change to the mailbox API. That would involve
> some change to all (about 12) of the mailbox based drivers,
> and the majority of them would not need to know about the
> ACK call.
>

I don't have all the 3 patches. Is this sent by error or am I expected
to just review this patch while other 2 are not mailbox related ?

> Signed-off-by: Adam Young <[email protected]>
> ---
> drivers/mailbox/pcc.c | 5 ++++-
> include/acpi/pcc.h | 1 +
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
> index 94885e411085..774727b89693 100644
> --- a/drivers/mailbox/pcc.c
> +++ b/drivers/mailbox/pcc.c
> @@ -280,6 +280,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
> {
> struct pcc_chan_info *pchan;
> struct mbox_chan *chan = p;
> + struct pcc_mbox_chan *pmchan;
> u64 val;
> int ret;
>
> @@ -304,6 +305,8 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
> if (pcc_chan_reg_read_modify_write(&pchan->plat_irq_ack))
> return IRQ_NONE;
>
> + pmchan = &pchan->chan;
> + pmchan->ack_rx = true; //TODO default to False

We need to remove this and detect when it can be true if the default expected
is false.

--
Regards,
Sudeep