From patchwork Sun Jun 28 14:45:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagar Shrikant Kadam X-Patchwork-Id: 1318592 X-Patchwork-Delegate: uboot@andestech.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; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=selector1 header.b=Bm/OT4+I; 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 49vthv2NdDz9sDX for ; Mon, 29 Jun 2020 00:45:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 410E981EA2; Sun, 28 Jun 2020 16:45:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.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=sifive.com header.i=@sifive.com header.b="Bm/OT4+I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F386A81EA5; Sun, 28 Jun 2020 16:45:22 +0200 (CEST) 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,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0610.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe45::610]) (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 D8B6481E66 for ; Sun, 28 Jun 2020 16:45:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sagar.kadam@sifive.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fxNXBgou2myM6TJMHY3O/uHsNLB3aVdsCG5KpDGC95K66rPXxXR7qZC0I5FYjq0HnvHsmEzAZD1DF47WrTWHh2iXxqLNXaYiJKjwd6BQ4YuM7n/8gxXX6q7md+BGGEdqLBNJNbG9R1qVmLZ8r9zZ8WgSWXpt/O67swXeqBuwlsNDPq+DSa2sdrZqhtgtWDA3gqrXi1iuMb1nTXTKGzFxLHERHFjP6ko8pc6kjMKmp/cfjlwguaXI3LOXrMXXkpN5Wyg69aW8f97iXXteJOl7+rze9vpF0oGLzY8bcnkUTYKnnkLgBXWRGJEyQBDmTWeWzIuLOVP4GP+ochdPdTJIQQ== 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=mmCBKwMWfi1ombAkYianiY+0ginWmElI/sz9XvljkhY=; b=TNsUv/pasLsxZsnV4uYrB1mnu1TX9ofg+xwwIVtlhNF6wEl15ijQjqwtSQ2H+obgXBk3lifrHrpXuoRruFXKV/ZCcTh9Bb0wu9NDuciWRGpUHFU29NN/myoh9iwUm+MrGMXSRH/4aK5vrkYCRW/CugqZt+rWhhY1Hd63o6dHfknqYJZpoTiBlSTk9aJyybNrt5Nd/9tRgQjjiNy0GjHplvS3EtSioTo51abqpgSgp14VL1QI0nPjLlpLCsNJQhOBe5HQgghB5Vy/jvze/ze4b6x0+nl7SmIn/qeWN+McZR9ufEDq8NiwTTPaJ/m7KuDqTjBQI28+LZSpGmjOAYG86g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=sifive.com; dmarc=pass action=none header.from=sifive.com; dkim=pass header.d=sifive.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mmCBKwMWfi1ombAkYianiY+0ginWmElI/sz9XvljkhY=; b=Bm/OT4+IOsJjpl1Te2BRvjofBM84I2iCtJtZc3V/W3OB1UmEw0Hjipxm+c1Fl87wKz8/rHg6bZ58sQDcW/2bYVEuD64R7zIrw1bcUZMjLekUvmEDAU+zCyKZmxCWxNg6b9+flNjS/vrxeY8UaayLenez1B6BShA2dmSVuLwsoV8= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=sifive.com; Received: from BN8PR13MB2611.namprd13.prod.outlook.com (2603:10b6:408:81::17) by BN8PR13MB2689.namprd13.prod.outlook.com (2603:10b6:408:84::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.14; Sun, 28 Jun 2020 14:45:18 +0000 Received: from BN8PR13MB2611.namprd13.prod.outlook.com ([fe80::c1d9:f4ee:80ab:de83]) by BN8PR13MB2611.namprd13.prod.outlook.com ([fe80::c1d9:f4ee:80ab:de83%6]) with mapi id 15.20.3153.016; Sun, 28 Jun 2020 14:45:18 +0000 From: Sagar Shrikant Kadam To: u-boot@lists.denx.de Cc: rick@andestech.com, bin.meng@windriver.com, jagan@amarulasolutions.com, pragnesh.patel@sifive.com, anup.patel@wdc.com, sjg@chromium.org, ye.li@nxp.com, peng.fan@nxp.com, seanga2@gmail.com, Sagar Shrikant Kadam Subject: [PATCH v7 2/4] uclass: cpu: fix to display proper CPU features Date: Sun, 28 Jun 2020 07:45:01 -0700 Message-Id: <1593355503-24938-3-git-send-email-sagar.kadam@sifive.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593355503-24938-1-git-send-email-sagar.kadam@sifive.com> References: <1593355503-24938-1-git-send-email-sagar.kadam@sifive.com> X-ClientProxiedBy: BY5PR17CA0001.namprd17.prod.outlook.com (2603:10b6:a03:1b8::14) To BN8PR13MB2611.namprd13.prod.outlook.com (2603:10b6:408:81::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from gamma07.internal.sifive.com (64.62.193.194) by BY5PR17CA0001.namprd17.prod.outlook.com (2603:10b6:a03:1b8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3131.20 via Frontend Transport; Sun, 28 Jun 2020 14:45:17 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [64.62.193.194] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8274f79-e3f7-43eb-4ac0-08d81b71e01b X-MS-TrafficTypeDiagnostic: BN8PR13MB2689: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 0448A97BF2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: miUk/axvJ4/C8xSKvGYJs06eXObpcz/jQnV+1C8PmwzJ83dtkFXshp8TD5CItbzdhJT6XWogdnHj58a9Wy/TMCA2OjGU0dbPv8wVJ/s+wzpl1B7wUiPmAQ5fobmtm2PJp8dc4xfYQTux36WD9SWsreHE11L9m2yT1Gly9VFFtf0WDAHvqphcSUXSghe8ueVZFIc5wmHg5ojXd5JZ4+Hxyp1QOF4aAnuwnWEYk9WYtRA606w+rnANkm4LBe+JTbuG3mz9NjUobHp447o02yU96RWldH9xS4tTXieYQ1Tk5HUJ3hDDebwcRc9rmmdQXirgbNuzd+yZsxNlZKMeN3aUsg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR13MB2611.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(366004)(376002)(136003)(396003)(346002)(39830400003)(6486002)(86362001)(26005)(5660300002)(6666004)(7696005)(316002)(6916009)(186003)(52116002)(16526019)(478600001)(36756003)(8936002)(8676002)(66556008)(4326008)(107886003)(956004)(2906002)(2616005)(66946007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 0NSv8IsjwLcps0l26Bgtc4qJqUuUPE4bNB4O/fcCEyMbVCpxEyGEP9we/UzKu5dOjBmM9cQHC4hRGtGyVwGmqjxs6qsAgLIjo6jZv3TBKDKDI+O8m5OJartAzsoUjso9QWMa/304jEIwgIhY7jlhAv/4p9pmQ6ytquxI2XzH82lXvzyUFCEvQXXY0C7CzVhFCCrb2bTno7aansywX466/Scxx+dc1tBTDoQtorZtYfWvmcRfSW7+sNkEK51p43gUBPR7oVOCDj8e7oGlS0DAIywZaLFIuYZQ6tFWbBJLmUybXGM2QDLznlt0AzS8TqnOMd4bwQQAv8sQeEn3C4M8+fJD8mytXeGNAiTuK3aaMZwQlCzVs2bGV4J8JhYDG/rrLTBj4rs6TqigMnhI4lm8SIAPwtJZi1a2twsLVEokXY6+U4EJpLwjMLKP6Nvw30qtprVoXx4nWyKv1lRHZ/NLBgoU0z5CSifREqRTOO+HmPA= X-OriginatorOrg: sifive.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8274f79-e3f7-43eb-4ac0-08d81b71e01b X-MS-Exchange-CrossTenant-AuthSource: BN8PR13MB2611.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2020 14:45:18.0603 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nbfc+f0qXfOVEg3Mg61gTbe+PrTxznhliZG2qy/P14oAWKOqLwtJgZ//D7wdJi4GleYredl7xaq7MTbm9w3VQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR13MB2689 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean The cmd "cpu detail" fetches uninitialized cpu feature information and thus displays wrong / inconsitent details as below. For eg: FU540-C000 doesn't have any microcode, yet the cmd display's it. => cpu detail 1: cpu@1 rv64imafdc ID = 1, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 2: cpu@2 rv64imafdc ID = 2, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 3: cpu@3 rv64imafdc ID = 3, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 4: cpu@4 rv64imafdc ID = 4, freq = 999.100 MHz: L1 cache, MMU, Microcode, Device ID Microcode version 0x0 Device ID 0x0 The L1 cache or MMU entry seen above is also displayed inconsistently. So initialize cpu information to zero into cpu-uclass itself so that similar issues can be avoided for other CPU drivers. We now see correct features as: => cpu detail 1: cpu@1 rv64imafdc ID = 1, freq = 999.100 MHz 2: cpu@2 rv64imafdc ID = 2, freq = 999.100 MHz 3: cpu@3 rv64imafdc ID = 3, freq = 999.100 MHz 4: cpu@4 rv64imafdc ID = 4, freq = 999.100 MHz Signed-off-by: Sagar Shrikant Kadam Reviewed-by: Pragnesh Patel Reviewed-by: Bin Meng --- drivers/cpu/cpu-uclass.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c index 7418c26..cbb4419 100644 --- a/drivers/cpu/cpu-uclass.c +++ b/drivers/cpu/cpu-uclass.c @@ -86,6 +86,9 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info) if (!ops->get_info) return -ENOSYS; + /* Init cpu_info to 0 */ + memset(info, 0, sizeof(struct cpu_info)); + return ops->get_info(dev, info); }