From: admiyo@os.amperecomputing.com
To: Sudeep Holla <sudeep.holla@arm.com>,
Jassi Brar <jassisinghbrar@gmail.com>,
Robert Moore <robert.moore@intel.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Len Brown <lenb@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeremy Kerr <jk@codeconstruct.com.au>,
Matt Johnston <matt@codeconstruct.com.au>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Huisong Li <lihuisong@huawei.com>
Subject: [PATCH v4 1/3] mctp pcc: Check before sending MCTP PCC response ACK
Date: Tue, 2 Jul 2024 18:58:43 -0400 [thread overview]
Message-ID: <20240702225845.322234-2-admiyo@os.amperecomputing.com> (raw)
In-Reply-To: <20240702225845.322234-1-admiyo@os.amperecomputing.com>
From: Adam Young <admiyo@os.amperecomputing.com>
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.
In order to read the flag, this patch maps the shared
buffer to virtual memory.
Signed-off-by: Adam Young <admiyo@os.amperecomputing.com>
---
drivers/mailbox/pcc.c | 31 +++++++++++++++++++++++--------
include/acpi/pcc.h | 8 ++++++++
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 94885e411085..cad6b5bc4b04 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -107,6 +107,7 @@ struct pcc_chan_info {
struct pcc_chan_reg cmd_complete;
struct pcc_chan_reg cmd_update;
struct pcc_chan_reg error;
+ void __iomem *shmem_base_addr;
int plat_irq;
u8 type;
unsigned int plat_irq_flags;
@@ -269,6 +270,24 @@ static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan)
return !!val;
}
+static void check_and_ack(struct pcc_chan_info *pchan, struct mbox_chan *chan)
+{
+ struct pcc_extended_type_hdr pcc_hdr;
+
+ if (pchan->type != ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE)
+ return;
+ memcpy_fromio(&pcc_hdr, pchan->shmem_base_addr,
+ sizeof(struct pcc_extended_type_hdr));
+ /*
+ * The PCC slave subspace channel needs to set the command complete bit
+ * and ring doorbell after processing message.
+ *
+ * The PCC master subspace channel clears chan_in_use to free channel.
+ */
+ if (!!le32_to_cpup(&pcc_hdr.flags) & PCC_ACK_FLAG_MASK)
+ pcc_send_data(chan, NULL);
+}
+
/**
* pcc_mbox_irq - PCC mailbox interrupt handler
* @irq: interrupt number
@@ -306,14 +325,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
mbox_chan_received_data(chan, NULL);
- /*
- * The PCC slave subspace channel needs to set the command complete bit
- * and ring doorbell after processing message.
- *
- * The PCC master subspace channel clears chan_in_use to free channel.
- */
- if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE)
- pcc_send_data(chan, NULL);
+ check_and_ack(pchan, chan);
pchan->chan_in_use = false;
return IRQ_HANDLED;
@@ -352,6 +364,9 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)
if (rc)
return ERR_PTR(rc);
+ pchan->shmem_base_addr = devm_ioremap(chan->mbox->dev,
+ pchan->chan.shmem_base_addr,
+ pchan->chan.shmem_size);
return &pchan->chan;
}
EXPORT_SYMBOL_GPL(pcc_mbox_request_channel);
diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h
index 9b373d172a77..6cb21f29d343 100644
--- a/include/acpi/pcc.h
+++ b/include/acpi/pcc.h
@@ -18,6 +18,13 @@ struct pcc_mbox_chan {
u16 min_turnaround_time;
};
+struct pcc_extended_type_hdr {
+ __le32 signature;
+ __le32 flags;
+ __le32 length;
+ char command[4];
+};
+
/* Generic Communications Channel Shared Memory Region */
#define PCC_SIGNATURE 0x50434300
/* Generic Communications Channel Command Field */
@@ -31,6 +38,7 @@ struct pcc_mbox_chan {
#define PCC_CMD_COMPLETION_NOTIFY BIT(0)
#define MAX_PCC_SUBSPACES 256
+#define PCC_ACK_FLAG_MASK 0x1
#ifdef CONFIG_PCC
extern struct pcc_mbox_chan *
--
2.34.1
next prev parent reply other threads:[~2024-07-02 22:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 22:58 [PATCH v4 0/3] MCTP over PCC admiyo
2024-07-02 22:58 ` admiyo [this message]
2024-07-03 19:52 ` [PATCH v4 1/3] mctp pcc: Check before sending MCTP PCC response ACK Simon Horman
2024-07-04 2:44 ` kernel test robot
2024-07-04 8:53 ` kernel test robot
2024-07-04 9:40 ` Jeremy Kerr
2024-07-02 22:58 ` [PATCH v4 2/3] mctp pcc: Allow PCC Data Type in MCTP resource admiyo
2024-07-02 22:58 ` [PATCH v4 3/3] mctp pcc: Implement MCTP over PCC Transport admiyo
2024-07-03 19:53 ` Simon Horman
2024-07-04 5:43 ` kernel test robot
2024-07-04 6:08 ` kernel test robot
2024-07-04 10:23 ` Jeremy Kerr
2024-07-08 22:16 ` Adam Young
2024-07-11 16:57 ` [PATCH v4 0/3] MCTP over PCC Dan Williams
2024-07-15 18:21 ` Adam Young
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=20240702225845.322234-2-admiyo@os.amperecomputing.com \
--to=admiyo@os.amperecomputing.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jassisinghbrar@gmail.com \
--cc=jk@codeconstruct.com.au \
--cc=kuba@kernel.org \
--cc=lenb@kernel.org \
--cc=lihuisong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=robert.moore@intel.com \
--cc=sudeep.holla@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®