From patchwork Wed Sep 20 06:47:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 13392172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71F4ECE79AD for ; Wed, 20 Sep 2023 06:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EELyQN55++lZAo6zVYOvbva432e+SSYvTKlsCGh9W1s=; b=jSQfMnHdTb2fJp EraAF5YJKgB6hzlmgj2ij8Jax61dei1hI6tJEd8wGQJW6o6qG3jZyzC0KeLXHNiqPmVl60uO3ZYC4 b2WNhlw/ijhDI6cDH4LUa6yk/q0xBxkBPP9QCwOYTIKGfJBqZSo7mEVw6DGb2ZxWUy092/N0Rm29I y7HXwh/EMkHiP0ofAcL1KRDRmDXN6155ORW1ImuLljP5+P1fdqrBMwtXSxuJEcB80HQdvTfzwSZdQ qFA20ofzvdDkV7C7F3MFQuWm4NApraeU/UZ3dLzVXU9MPNGxHHJc/dyKchG0vOJIkjdQHPYUTyegK ncpDz270cigU1Q6XD9Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qir2s-0024Kr-1N; Wed, 20 Sep 2023 06:50:46 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qir2e-0024HN-1u for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2023 06:50:35 +0000 Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rr8Gg6PMDzVl4Y; Wed, 20 Sep 2023 14:47:23 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 20 Sep 2023 14:50:21 +0800 From: Huisong Li To: , , , CC: , , , , , Subject: [PATCH v2 1/2] mailbox: pcc: export the PCC subspace type Date: Wed, 20 Sep 2023 14:47:02 +0800 Message-ID: <20230920064703.23543-2-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230920064703.23543-1-lihuisong@huawei.com> References: <20230914115753.9064-1-lihuisong@huawei.com> <20230920064703.23543-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_235032_959110_62349007 X-CRM114-Status: GOOD ( 16.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel. So export the PCC subspace type by requesting PCC channel. Signed-off-by: Huisong Li --- drivers/mailbox/pcc.c | 10 ++++------ include/acpi/pcc.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 94885e411085..9742cc7837bd 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -91,7 +91,6 @@ struct pcc_chan_reg { * @cmd_update: PCC register bundle for the command complete update register * @error: PCC register bundle for the error status register * @plat_irq: platform interrupt - * @type: PCC subspace type * @plat_irq_flags: platform interrupt flags * @chan_in_use: this flag is used just to check if the interrupt needs * handling when it is shared. Since only one transfer can occur @@ -108,7 +107,6 @@ struct pcc_chan_info { struct pcc_chan_reg cmd_update; struct pcc_chan_reg error; int plat_irq; - u8 type; unsigned int plat_irq_flags; bool chan_in_use; }; @@ -263,7 +261,7 @@ static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan) * bit 0 indicates that Platform is sending a notification and OSPM * needs to respond this interrupt to process this command. */ - if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE) + if (pchan->chan.type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE) return !val; return !!val; @@ -284,7 +282,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p) int ret; pchan = chan->con_priv; - if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && + if (pchan->chan.type == ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && !pchan->chan_in_use) return IRQ_NONE; @@ -312,7 +310,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->chan.type == ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE) pcc_send_data(chan, NULL); pchan->chan_in_use = false; @@ -766,7 +764,7 @@ static int pcc_mbox_probe(struct platform_device *pdev) pcc_parse_subspace_shmem(pchan, pcct_entry); - pchan->type = pcct_entry->type; + pchan->chan.type = pcct_entry->type; pcct_entry = (struct acpi_subtable_header *) ((unsigned long) pcct_entry + pcct_entry->length); } diff --git a/include/acpi/pcc.h b/include/acpi/pcc.h index 73e806fe7ce7..eddf9f5dfba3 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; + u8 type; }; #define MAX_PCC_SUBSPACES 256 From patchwork Wed Sep 20 06:47:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lihuisong (C)" X-Patchwork-Id: 13392173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 691DECE79AD for ; Wed, 20 Sep 2023 06:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X0jW2AGdojQ0m3zmLMvFFlbEQ07oiHVpD/T/Sjv6KfI=; b=uOEmEaLkDlicwT CDaT/fqbof2mj/Sf+XgmGA6G0UlJLTGbAT5lBCrL8j82rQuytCVDpV3qMVLmxChYTZsugEkNivqR4 ct+aryfvuVk0nFM5lGAvkrOtI+lHN1egqUZ4vPph71de18s7a7tqc89vnnznEqzr47LidyVrXVKeg H8oez1qZaoa7RuZb8yYS8ibVlnZDVgLY/vPzEfsW/1OVs9sEKhfbE+z1qUPnJh/BnIWHIQ+SKNRPd AG9AFyRSCHlQJpHyGeH+WMmAYAbiOGxHqY0M+IHsxyJxXlzlZ1zQDMJgf1BFjP6fwjmJLhuSZC8Dr HV2e75UzALTHjBpjdSLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qir2i-0024J7-1l; Wed, 20 Sep 2023 06:50:36 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qir2d-0024HI-2t for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2023 06:50:33 +0000 Received: from kwepemm600004.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Rr8Fz1Yb8zMlgF; Wed, 20 Sep 2023 14:46:47 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm600004.china.huawei.com (7.193.23.242) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Wed, 20 Sep 2023 14:50:21 +0800 From: Huisong Li To: , , , CC: , , , , , Subject: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type Date: Wed, 20 Sep 2023 14:47:03 +0800 Message-ID: <20230920064703.23543-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230920064703.23543-1-lihuisong@huawei.com> References: <20230914115753.9064-1-lihuisong@huawei.com> <20230920064703.23543-1-lihuisong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600004.china.huawei.com (7.193.23.242) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_235032_125486_C7E311EB X-CRM114-Status: GOOD ( 12.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Currently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5. So this patch adds the check for PCC subspace type. Signed-off-by: Huisong Li --- drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/soc/hisilicon/kunpeng_hccs.c b/drivers/soc/hisilicon/kunpeng_hccs.c index f3810d9d1caa..4ba3bfd45a01 100644 --- a/drivers/soc/hisilicon/kunpeng_hccs.c +++ b/drivers/soc/hisilicon/kunpeng_hccs.c @@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) return rc; } +static int hccs_check_pcc_info(struct hccs_dev *hdev) +{ + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; + + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { + dev_err(hdev->dev, "unsupport for subspace type%u.\n", + pcc_chan->type); + return -EOPNOTSUPP; + } + + return 0; +} + static int hccs_check_chan_cmd_complete(struct hccs_dev *hdev) { struct hccs_mbox_client_info *cl_info = &hdev->cl_info; @@ -1224,6 +1237,10 @@ static int hccs_probe(struct platform_device *pdev) if (rc) return rc; + rc = hccs_check_pcc_info(hdev); + if (rc) + goto unregister_pcc_chan; + rc = hccs_get_dev_caps(hdev); if (rc) goto unregister_pcc_chan;