From patchwork Thu Oct 23 15:36:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 5141501 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1A0349F349 for ; Thu, 23 Oct 2014 15:36:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 198892022A for ; Thu, 23 Oct 2014 15:36:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECBB320256 for ; Thu, 23 Oct 2014 15:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751615AbaJWPgq (ORCPT ); Thu, 23 Oct 2014 11:36:46 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:38893 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755415AbaJWPgo (ORCPT ); Thu, 23 Oct 2014 11:36:44 -0400 Received: by mail-wg0-f52.google.com with SMTP id a1so1396935wgh.11 for ; Thu, 23 Oct 2014 08:36:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Jw2vNyxhsr2UHdCeI1KBvAX+DHVFnaqxsu1dWX85AYM=; b=WpUi9GDhbSo+uOZT24cZqse8ZEmL7YuyWU5qsEpoL8OxK6rxhjTMXovb1Gyx19LkYM ntAa9R6Oi3fd+AYLT0o9/UM64YZ1d/TyxeI5UyDsjRJFMFLV9rWu8Qah7u1FIzO7crBQ OLU0Yj9vgnsXNhAXquWAwB1gGZOmJlCYkbtrsqE2hGqTD4iwGQCbQ6I1KrkBl+NBc9Cq cCO9i8VsBo8jzD8nzjdTH9gCYljNMMFV96dyQPo01590YFayhFHG59hgjzzQEIMgKmwz HZX18mYqBmFA5Imn949cB17lQAqU1wUw09f+VB6FePiaTwZ1fonKJs7JLdAYH+pYt+1m v+7Q== X-Gm-Message-State: ALoCoQltqdACEL4/t7L149dm9F6eC2MTOEat8zW3jvSSi4bLHemnvXpwUHEoHjhy7KKSv0zvUpN+ MIME-Version: 1.0 X-Received: by 10.180.79.228 with SMTP id m4mr13909497wix.26.1414078602907; Thu, 23 Oct 2014 08:36:42 -0700 (PDT) Received: by 10.216.171.68 with HTTP; Thu, 23 Oct 2014 08:36:42 -0700 (PDT) In-Reply-To: <1412972037-12793-2-git-send-email-ashwin.chaugule@linaro.org> References: <1412972037-12793-1-git-send-email-ashwin.chaugule@linaro.org> <1412972037-12793-2-git-send-email-ashwin.chaugule@linaro.org> Date: Thu, 23 Oct 2014 11:36:42 -0400 Message-ID: Subject: Re: [PATCH v9] Mailbox: Add support for Platform Communication Channel From: Ashwin Chaugule To: Mark Brown Cc: "Zheng, Lv" , "linaro-acpi@lists.linaro.org" , Patch Tracking , linux acpi , "Rafael J. Wysocki" , Arnd Bergmann , Ashwin Chaugule Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, On 10 October 2014 16:13, Ashwin Chaugule wrote: > ACPI 5.0+ spec defines a generic mode of communication > between the OS and a platform such as the BMC. This medium > (PCC) is typically used by CPPC (ACPI CPU Performance management), > RAS (ACPI reliability protocol) and MPST (ACPI Memory power > states). > > This patch adds PCC support as a Mailbox Controller. > > Reviewed-by: Mark Brown > Signed-off-by: Ashwin Chaugule > --- > drivers/mailbox/Kconfig | 12 ++ > drivers/mailbox/Makefile | 2 + > drivers/mailbox/mailbox.c | 4 +- > drivers/mailbox/mailbox.h | 16 ++ > drivers/mailbox/pcc.c | 369 ++++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 400 insertions(+), 3 deletions(-) > create mode 100644 drivers/mailbox/mailbox.h > create mode 100644 drivers/mailbox/pcc.c > > diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig > index 9fd9c67..c04fed9 100644 > --- a/drivers/mailbox/Kconfig > +++ b/drivers/mailbox/Kconfig > @@ -33,4 +33,16 @@ config OMAP_MBOX_KFIFO_SIZE > Specify the default size of mailbox's kfifo buffers (bytes). > This can also be changed at runtime (via the mbox_kfifo_size > module parameter). > + > +config PCC > + bool "Platform Communication Channel Driver" > + depends on ACPI > + help > + ACPI 5.0+ spec defines a generic mode of communication > + between the OS and a platform such as the BMC. This medium > + (PCC) is typically used by CPPC (ACPI CPU Performance management), > + RAS (ACPI reliability protocol) and MPST (ACPI Memory power > + states). Select this driver if your platform implements the > + PCC clients mentioned above. > + > endif Looks like Linus has agreed to pull in the Mailbox framework in 3.18 [1], so I was hoping we could move this patch forward. When I started working on the PCC driver, I based it off of ACPI v5.0. Since then the spec moved to v5.1 and added a trivial change to the PCC section. This change adds a new subtable to support systems that dont have an SCI for the doorbell irq. The new structure declaration is already in mainline [2]. Given that there were no existing users of PCC so far and that the future users are more likely to use the new subtable, I'd like to include it here and make it the default from the start. SCI support can be added later if it is needed. The change to do this is also trivial and the diff is below. Mark, are you okay with squashing this diff into the original patch [v9] and keeping your reviewed-by tag? I can then send a git pull request. Arnd, Rafael, if there are no further comments on this patch, kindly advise which tree to rebase on for the git pull. --------------------8<----------------------- doorbell = pcct_ss->doorbell_register; @@ -219,8 +217,7 @@ static int pcc_send_data(struct mbox_chan *chan, void *data) acpi_write((doorbell_val & doorbell_preserve) | doorbell_write, &doorbell); -out_err: - return ret; + return 0; } static struct mbox_chan_ops pcc_chan_ops = { @@ -241,12 +238,12 @@ static struct mbox_chan_ops pcc_chan_ops = { static int parse_pcc_subspace(struct acpi_subtable_header *header, const unsigned long end) { - struct acpi_pcct_subspace *pcct_ss; + struct acpi_pcct_hw_reduced *pcct_ss; if (pcc_mbox_ctrl.num_chans <= MAX_PCC_SUBSPACES) { - pcct_ss = (struct acpi_pcct_subspace *) header; + pcct_ss = (struct acpi_pcct_hw_reduced *) header; - if (pcct_ss->header.type != ACPI_PCCT_TYPE_GENERIC_SUBSPACE) { + if (pcct_ss->header.type != ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE) { pr_err("Incorrect PCC Subspace type detected\n"); return -EINVAL; } @@ -287,7 +284,7 @@ static int __init acpi_pcc_probe(void) count = acpi_table_parse_entries(ACPI_SIG_PCCT, sizeof(struct acpi_table_pcct), - ACPI_PCCT_TYPE_GENERIC_SUBSPACE, + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE, parse_pcc_subspace, MAX_PCC_SUBSPACES); if (count <= 0) { ---------------8------------------------ Thanks, Ashwin [1] - https://lkml.org/lkml/2014/10/21/660 [2] - https://lkml.org/lkml/2014/7/30/9 --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 0006fc3..592c6fa 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -130,7 +130,7 @@ EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); */ static bool pcc_tx_done(struct mbox_chan *chan) { - struct acpi_pcct_subspace *pcct_ss = chan->con_priv; + struct acpi_pcct_hw_reduced *pcct_ss = chan->con_priv; struct acpi_pcct_shared_memory *generic_comm_base = (struct acpi_pcct_shared_memory *) pcct_ss->base_address; u16 cmd_delay = pcct_ss->min_turnaround_time; @@ -182,7 +182,7 @@ static int get_subspace_id(struct mbox_chan *chan) */ static int pcc_send_data(struct mbox_chan *chan, void *data) { - struct acpi_pcct_subspace *pcct_ss = chan->con_priv; + struct acpi_pcct_hw_reduced *pcct_ss = chan->con_priv; struct acpi_pcct_shared_memory *generic_comm_base = (struct acpi_pcct_shared_memory *) pcct_ss->base_address; struct acpi_generic_address doorbell; @@ -191,14 +191,12 @@ static int pcc_send_data(struct mbox_chan *chan, void *data) u64 doorbell_write; u16 cmd = *(u16 *) data; u16 ss_idx = -1; - int ret = 0; ss_idx = get_subspace_id(chan); if (ss_idx < 0) { pr_err("Invalid Subspace ID from PCC client\n"); - ret = -EINVAL; - goto out_err; + return -EINVAL; }