From patchwork Fri Mar 5 02:21:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Z.Q. Hou" X-Patchwork-Id: 1447595 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector2 header.b=PgrElpDC; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DsBBl6mvcz9sW1 for ; Fri, 5 Mar 2021 13:14:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 14F1380A51; Fri, 5 Mar 2021 03:14:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="PgrElpDC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0E8BF80F58; Fri, 5 Mar 2021 03:14:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060a.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::60a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 049D9806F1 for ; Fri, 5 Mar 2021 03:14:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=zhiqiang.hou@nxp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NZUtIISNepBJDdSZOa8X3QEYPxttvnHzbv//sv5V+Q6pRdTSP8IaZlQ8uOcL52CghHdOrCcN9tVAJJ1Z6lLfkzLZasQResb6yi4OuKYY4MBNG34Oxw+T9bEAYChG6msUGJ2J1q6U8HSTvmfMl/bI7wwGI7DBLJjPEYD5jj9JtYTVtbYU+fbp5HyYd5TBTZmPeQYbep5YDrXRLFhoL7cSVQHhIJeBk0R6vm9XJBNDYQAhnTCfahp2TgXXPSVTUs5ECeuO48g+q+Y9qTAnxxROkYGTl87eLAs2s509bkgLilgg2DDKGuGLmuGxpB+jEWuDVmPacFjdguPFcek456GMMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ttjU8FKtw+g5CyrEQeqPhw6UTAhkE/IdSdIN6sPBkCk=; b=HhT9nq8F4C2gyF8El9OWjN1w7cfgBg+Sqf/fFljETab81FWFoDLujYmrDL/gNbPvnHYOjdIy/NopmvErRVSF/65nZVDG6YnaBfg0VFiwa4fBDe54jzNYGcDc1N86RQce0LejrSNz/eMo2JKY7LIsv5PPYV8sYJoL6Eh31jkpcq5OJZe2WMoqsca2UciH6acOVQRbmR2hWNFJsey60l3avGRR+UVx2ptjMsI63KU9FiKx15uCm7roEnvF8CZiDN0M+P3BZfkjg9YyoBhJ5qxacn6S4OsRFAnTAPvdrWKjMuE0VPN4DA86CVlZlbFlpPwwMqEDrFoQc0T3ESCIyS2CQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ttjU8FKtw+g5CyrEQeqPhw6UTAhkE/IdSdIN6sPBkCk=; b=PgrElpDCUyW9AI7Sbxa/xp7BQtLeMGao6muDnnB0mwGYabSYBObXPs7By0GbcYorrl6tU4ML3QqBQMrEbHokyZtLyp8kDL/OOGkp6pcSxwjDXkmzwGaQYshWEMaAazXQTftnRYQkryi6aj+AFSAVin5oNNfbxYU57UdRpRAYcCo= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=nxp.com; Received: from HE1PR0402MB3371.eurprd04.prod.outlook.com (2603:10a6:7:85::27) by HE1PR0402MB2891.eurprd04.prod.outlook.com (2603:10a6:3:df::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.28; Fri, 5 Mar 2021 02:14:28 +0000 Received: from HE1PR0402MB3371.eurprd04.prod.outlook.com ([fe80::d9e4:fae5:834f:93e8]) by HE1PR0402MB3371.eurprd04.prod.outlook.com ([fe80::d9e4:fae5:834f:93e8%7]) with mapi id 15.20.3890.031; Fri, 5 Mar 2021 02:14:27 +0000 From: Zhiqiang Hou To: u-boot@lists.denx.de Cc: sjg@chromium.org, rayagonda.kokatanur@broadcom.com, priyanka.jain@nxp.com, Hou Zhiqiang Subject: [PATCHv2] arm64: gic-v3-its: Clear the Pending table before enabling LPIs Date: Fri, 5 Mar 2021 10:21:45 +0800 Message-Id: <20210305022145.13551-1-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.73] X-ClientProxiedBy: HK2PR02CA0149.apcprd02.prod.outlook.com (2603:1096:202:16::33) To HE1PR0402MB3371.eurprd04.prod.outlook.com (2603:10a6:7:85::27) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.73) by HK2PR02CA0149.apcprd02.prod.outlook.com (2603:1096:202:16::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Fri, 5 Mar 2021 02:14:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 594df422-3380-48bf-1176-08d8df7c672a X-MS-TrafficTypeDiagnostic: HE1PR0402MB2891: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ntdsA41Qs1ppf9v6pr24rE4jgsHoJJC5EPzbLZ0cwYxnYDyp8VJzU8v98+KGByprVsL7hPYVeP+ho3ayXVkZ2iXdiVCtcmPqtUowO5/YLBmPkbzFA8k8hV6LImVvR6xORA8BTZhsPQvtUPv8PGc+gf8slipaFz1CTr1naD22UY4vZTES3iQ0MLSU5xBsFSq/XiTxWxbL5DAEVlrTLU+tnxW8qyDBx01MdLr9oro3ZqQnz3P3I5Vs7UZcOvrAPqB817jwW7xPqyM9EULE4BTMVGWr/KBS4XTwQPXl9p8KNeXBFAi+CS90Zemx6WBiMeHCaqCAeeVm4GKZTX54UvEsG3G1zb0YA9111umG+SrWJyC5fsK3r3yuXcJ4spoBMo+UUbsGzJ3bL7feg4455mSEqza9M5s3+oKhoCPUcWMRIzYsCW8eWnG0HQURw53ERcr/VbQ0WX//XgwOeGl4W3hELxKh5lJunxO55PHMzSBDCEQUPrnjBv4icJiLUGU+QEBFlqajFDPUCev5PMfjQAgAdq5T2ofYe8L5hIvdHBxswzcUSYBz5Qk6gzKsCuLG2Eqefn65KR9ezc+WgpWCe0LhNA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0402MB3371.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(136003)(376002)(39860400002)(346002)(26005)(316002)(6916009)(8936002)(69590400012)(83380400001)(956004)(478600001)(2906002)(4326008)(8676002)(2616005)(36756003)(66946007)(66476007)(66556008)(6486002)(52116002)(6666004)(1076003)(16526019)(5660300002)(6506007)(6512007)(86362001)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Xo8Suom+flmW2zRBXtqOi568F+XA+s4FtMrnaQ5mL6YL5fvm3rd2F3w5i0iBjXa+TzpEo0esho5TmCnXoKRv244+KmIsnvjR09pc/QNsvsv2svTK//0i7QYnMUp6KJsFAvon3YUexQ6D7nqrpg4Ao8FH/vcAnwXsVkC4t2IlrBIH3kBn8POhq1jgpb87Oog5sGDHzFTY3Kz9yvZ/5i4mspFFkpozUoaUgwL1XKn8YHy4GyzmE6qARO6oAOK9e/fFE6fF5T1e5KKLvAYW8eCx1o3hLzArxagOHwDs4l9V0qNSxe1oBVWJOYtefp36Nwbz+RnpYEigDR1MPka1YSoAlD0F+lltKr7H5PYv08t3iRm1/11C2JhGhaZwMe0Fjcrg7XjsiLzxDHNXsgXkk+BGlKyJOIPVQqos29HDe2duGKFDEauFsWjl9AD5LtuMH75xYqOqU5OChmvAHgUvnD23yI3qCHGdBPZnB/rlgk41etx06LIDN1rsZvRECAWeSqMPz2JlmusM3xh8fvUKzID8ry+QgSrVfuIaN0QhHxuSGYT4TDiB6a83uN4y/7XcnoEWVFXd+Q/2wSRpyfILmVAE8or0EjixNDeAqR2zszuZYp6+9+RU1fEWYpsPhN6qoQW/GCPjgC7mRMpyeBgt/XxlBRIaeRw3cjfkgMeViHyf4NE/u1Ob6Zgrbq3gEc8jEZDKTAxW1xn0DungbBieJ13MjShSxNHRxQHiUiBHTnKprxECiM4+/HLs3EEIT12hExtWVSu7ocApv/MTjqf/0BlwM6ijyNyloXhlFmBMfacwXrP7NHs1rV4WKMAd/iGn8pF55PHnm+KF56eXmwh9UQQCkdMwFrT72807Ji2sNvAKGtn5NR/yXwh0d39ishLvukX+a8qPW4Wf/Hqb/j/foGG3XvcLOJu1hNFWz3IsRMZQaVXqjpMgapBHM5g0QqVVNwccXwxBhFTkWuEGalfqazUBXQJuJ4J6srAaep5hH8z3xy3MHx4UDnMb8B9W1Qs3Xkp93I5/Pz9B5HZyeV7YEr6SMMP7BrHxJn+TI1MUjAJTVpIZHSdy8Jo88sdg+GLg3GisfnqwHMo3/MWG6TFmaXo86+mbZOsC2JB00DwJkDmfMaBV1+3GbV4TlymMZEU5lp/cfNhsJUcJhH9O2+bzotu1G8vRfP7L5BEyqzo55ta9HlRrTb8Pe6yNOAv3+Pulp5yXMKa3KHGS0qoeDVL24IsmtfEjAomJyREcYWAYkDCzdJDfnBO7FClWfj/HVCIiV6No4JBxJgHrf9VNlCO7g71Q69W2zwPEknRFnGLU3D+klCbDDe/WOXFu3OTEp/4+N/VV X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 594df422-3380-48bf-1176-08d8df7c672a X-MS-Exchange-CrossTenant-AuthSource: HE1PR0402MB3371.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2021 02:14:27.7851 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PJAfMsym8oMnYkt3cseU/NG8ZO33TPo5VVvSgW+r0v7wdKUj4N/xJn+z2JvraLjmHA5y1K4THn+Y4xercM4v5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0402MB2891 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean From: Hou Zhiqiang The GICv3 RM requires "The first 1KB of memory for the LPI Pending tables must contain only zeros on initial allocation, and this must be visible to the Redistributors, or else the effect is UNPREDICTABLE". And as the following statement, we here clear the whole Pending tables instead of the first 1KB. "An LPI Pending table that contains only zeros, including in the first 1KB, indicates that there are no pending LPIs. The first 1KB of the LPI Pending table is IMPLEMENTATION DEFINED. However, if the first 1KB of the LPI Pending table and the rest of the table contain only zeros, this must indicate that there are no pending LPIs." And there isn't any pending LPI under U-Boot, so it's unnecessary to load the contents of the Pending table during the enablement, then set the GICR_PENDBASER.PTZ flag. Signed-off-by: Hou Zhiqiang --- V2: - Clear the Pending tables using virtual address. - Correct some typos in the change log. arch/arm/lib/gic-v3-its.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c index f5a921b3d1..2dadc48a50 100644 --- a/arch/arm/lib/gic-v3-its.c +++ b/arch/arm/lib/gic-v3-its.c @@ -3,6 +3,7 @@ * Copyright 2019 Broadcom. */ #include +#include #include #include #include @@ -108,6 +109,8 @@ int gic_lpi_tables_init(void) int i; u64 redist_lpi_base; u64 pend_base; + ulong pend_tab_total_sz; + void *pend_tab_va; if (gic_v3_its_get_gic_addr(&priv)) return -EINVAL; @@ -160,7 +163,12 @@ int gic_lpi_tables_init(void) } } - redist_lpi_base = priv.lpi_base + LPI_PROPBASE_SZ; + pend_tab_total_sz = priv.num_redist * LPI_PENDBASE_SZ; + pend_tab_va = map_physmem(redist_lpi_base, pend_tab_total_sz, + MAP_NOCACHE); + memset(pend_tab_va, 0, pend_tab_total_sz); + flush_cache((ulong)pend_tab_va, pend_tab_total_sz); + unmap_physmem(pend_tab_va, MAP_NOCACHE); pend_base = priv.gicr_base + GICR_PENDBASER; for (i = 0; i < priv.num_redist; i++) { @@ -168,7 +176,8 @@ int gic_lpi_tables_init(void) val = ((redist_lpi_base + (i * LPI_PENDBASE_SZ)) | GICR_PENDBASER_INNERSHAREABLE | - GICR_PENDBASER_RAWAWB); + GICR_PENDBASER_RAWAWB | + GICR_PENDBASER_PTZ); writeq(val, (uintptr_t)(pend_base + offset)); tmp = readq((uintptr_t)(pend_base + offset));