Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8735811ybl; Thu, 16 Jan 2020 23:45:12 -0800 (PST) X-Google-Smtp-Source: APXvYqwnniZII8VTeKvnZOb2bsDglsGpPapXiskVqKhHGI9N4rBVv+hqX9Z5I7C8yVswW9QYyGVn X-Received: by 2002:a05:6830:1515:: with SMTP id k21mr4961346otp.177.1579247112002; Thu, 16 Jan 2020 23:45:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1579247111; cv=pass; d=google.com; s=arc-20160816; b=eo5wumRwS1ShcFb4LpKZm72xxo4ssCJGTOu9fMpBX3gFzg4b/KRh9drDi60sOtr3XA Pgq1UYR/dO8BxKe9TFqHjJiCHbhx5DLJuLNPAeQa5tQvOUPwFPzvVTLpdGdThWhMG7rp lYeojoeph3scTOdhiqkJaSybs4Ebk9Okf7wxBHP/lapYMwotQAzXTBHFAIVhs918C93d XDL3AiFtdwG8Lg7IfEZ3DTodKd3ZseICatybq3PO0JN0yi+m8YJtY5KEXPXH7c/n/o33 RurG/6tDPvwN1Gzi1rljKzI4EFv006zol9Al1X+OUcbZVaF2fd8dKq8YNgltUxpsAcFx r7Sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=R4ZmAoJ5SHPqhdVbD2ZMWRl6EnQAXCTAeercScOkxEY=; b=CuZzMeDlpK1rbvOaD7jLrmzSHdXJVecHEldkAJrd6qYIGdvF8n+FmZqJuWx6XTfvKw 28NIn6l0/sQKPtYbhFsCe7lFotf7lgvmL8fMwfcKzLRr9n0YR88EErRBBqtqYOuEiopM YjGpo57owZYpDVMEXuSWX1QuANhiYP0kkHxjDz+PWrNPWEmgPvxh+TyI6c5FURBrHkaP UVCpzochRHPro2YJvz+srWrEJv/tHTbfbSbIPyAanRehXYR+QblZIuchLHfn6TdWK47K EYrY5OVtSUGwPa15zf9GOoR5JajsgGwazTpMOEKTRr3ZeLtUn4e03TKMLoxJhrFXpCZ7 I2iw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=selector1 header.b=ryBSdqRb; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b133si13698562oif.244.2020.01.16.23.44.59; Thu, 16 Jan 2020 23:45:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=selector1 header.b=ryBSdqRb; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729259AbgAQHoG (ORCPT + 99 others); Fri, 17 Jan 2020 02:44:06 -0500 Received: from mail-dm6nam11on2044.outbound.protection.outlook.com ([40.107.223.44]:8462 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727804AbgAQHoF (ORCPT ); Fri, 17 Jan 2020 02:44:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CSf1yzEo+LeQlYZmaE+lRE6hImkowpyXs8F5EQa6B9w4z6r4C7D2EWm7RmzFQu+SjRghAbpdydwHnlaBo4Tqe8VwN1HkbFRjKJJDE2IK9NMXp0HQS8H4i06X8UqdpEvzmqSbA9Z81YggN146Ss3yro7Q+kSpNm/BFAZ5Zb0peuWRQ4fy4pqgYClRtnvATi84aIzBc82XvzWG58/vn2hUJDx04CVnpS7Cc36eGzSXtt7A4YOR9SRjxCenz7nCyO98YFJO4QgNNHx0VLE11X4UKPDD2soXfW0fncDSHh2rsYh1uEuwVhL8YOQ3A8mhjSqgVZELBSB3GNWX0BqxXrgxyA== 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=R4ZmAoJ5SHPqhdVbD2ZMWRl6EnQAXCTAeercScOkxEY=; b=W0XvaiRXD61FtZp26bU9ScQWJI4fL/tUV3JpOxr8xYpLkxTUNgC6sBfsHs1AioMaGXP7ZG7svZCXboTyxdwllpJc2HVHVs4vJ3QObwar/xi3+jR8l316aNguGAHd+0UQZk9uK74/lWNpvltFR8VtumKmb1h5sFpYWmqK/P+rJdZ0Z3/Z+TWBYNqenIXoqqVoQhi+5mL7rx/i8PR1pZLG106SrGxGPznmNMVDBg+15b6VEvNvNNmLlrRep31j9DG6rHk/VoUH0UP7TkrlwEf7rv/20MuV43/yHUjeVhH4FVEutfuC+Vdhb7zzYBPoLwbLB42ZhJ9K1W+1kbTgr9MdfQ== 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=R4ZmAoJ5SHPqhdVbD2ZMWRl6EnQAXCTAeercScOkxEY=; b=ryBSdqRbuCvpv5NrRu0q6O/sLmFf/dVPFla1hRdRCyiyxsOsWPOa8eHnw2qY6nucNAo4QuSQnmmYiR28JCscTJmxDfcMGNItoE1K8cY4fW1WxRScyI1CkE3Fe9LHPbD6Bv7NG6bg7H7OGGFa5ppDZqjdCIlVPOg478/5sc7VMao= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=yash.shah@sifive.com; Received: from CH2PR13MB3368.namprd13.prod.outlook.com (52.132.246.90) by CH2PR13MB3765.namprd13.prod.outlook.com (20.180.15.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.6; Fri, 17 Jan 2020 07:44:03 +0000 Received: from CH2PR13MB3368.namprd13.prod.outlook.com ([fe80::eccb:16ac:e897:85d5]) by CH2PR13MB3368.namprd13.prod.outlook.com ([fe80::eccb:16ac:e897:85d5%3]) with mapi id 15.20.2644.021; Fri, 17 Jan 2020 07:44:03 +0000 From: Yash Shah To: paul.walmsley@sifive.com, palmer@dabbelt.com Cc: aou@eecs.berkeley.edu, allison@lohutok.net, alexios.zavras@intel.com, gregkh@linuxfoundation.org, tglx@linutronix.de, bp@suse.de, anup@brainfault.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, sachin.ghadi@sifive.com, Yash Shah Subject: [PATCH v4 0/2] cacheinfo support to read no. of L2 cache ways enabled Date: Fri, 17 Jan 2020 13:13:36 +0530 Message-Id: <1579247018-6720-1-git-send-email-yash.shah@sifive.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-ClientProxiedBy: BM1PR0101CA0056.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::18) To CH2PR13MB3368.namprd13.prod.outlook.com (2603:10b6:610:2c::26) MIME-Version: 1.0 Received: from dhananjayk-PowerEdge-R620.open-silicon.com (114.143.65.226) by BM1PR0101CA0056.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2644.19 via Frontend Transport; Fri, 17 Jan 2020 07:43:59 +0000 X-Mailer: git-send-email 2.7.4 X-Originating-IP: [114.143.65.226] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2d7090a3-fe10-41eb-984c-08d79b2105ce X-MS-TrafficTypeDiagnostic: CH2PR13MB3765: X-LD-Processed: 22f88e9d-ae0d-4ed9-b984-cdc9be1529f1,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 0285201563 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(346002)(136003)(39850400004)(366004)(396003)(376002)(189003)(199004)(6512007)(2616005)(107886003)(316002)(956004)(5660300002)(52116002)(36756003)(16526019)(1006002)(6666004)(26005)(66476007)(66946007)(66556008)(186003)(966005)(6486002)(86362001)(8936002)(6506007)(44832011)(8676002)(81156014)(81166006)(4326008)(478600001)(7416002)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:CH2PR13MB3765;H:CH2PR13MB3368.namprd13.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: sifive.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1GgEoWgoop3FGJbUiDnlG+7BawdWqoHOvb2q/Jc8TE3yxTaiUjol03LpxnrU5rsPrU5W7HA/YufZa/oi1LFrCzOf+Er9qHWJ0VwDhF+5QRUzsOVXD2O2awWpiHtTWafqDAPNSFA8LVRjBrW/Ha+YB2LcBYOOEfF7vxo9ZlxwKKp+imV5X+jyqgYfNSsidXOUtKk9SERiRVfBSu+BagCZ7mv/EampSnrVcrR7O+NegHB0Qx3sO+3nx1BQLyQjTqHAvXrjSTsZQsC6PRnvxDyZ/xEQloKuHUmtTfspHz1GnbVTuvJ1xUU3vByJP+lILwmAxdCG6Al1o+L/dUl1pycGs9Ne8NkL708ETgbx7V4ssuis7vndibTm4z0YT1auBHi+z6HhSIrwStk9YM+4AtXosHvs7vWgmXmAI6C9PW/OpabaXCJQ31BNDh7VPde/m8Uj2Z7XDcPaqkBXvgQSxMd8Wz38A4DygmpQqbuL73i320Y= X-OriginatorOrg: sifive.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d7090a3-fe10-41eb-984c-08d79b2105ce X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2020 07:44:03.1615 (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: yBcKrqmJO+KbCuGJLPjQAZIbV+PzYyb4vyE2LW+xcl3wVBGUPHBQO/R5I+EnBj4LMpYgJ+okHtN6RTMQLfKsgA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR13MB3765 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patchset includes 2 patches. Patch 1 implements cache_get_priv_group which make use of a generic ops structure to return a private attribute group for custom cacheinfo. Patch 2 implements a private attribute named "number_of_ways_enabled" in the cacheinfo framework. Reading this attribute returns the number of L2 cache ways enabled at runtime, This patchset is based on Linux v5.5-rc6 and tested on HiFive Unleashed board. v4 vs v3: - Rename "sifive_l2_largest_wayenabled" to "l2_largest_wayenabled" and make it a static function v3 vs v2: - As per Anup Patel's suggestion[0], implement a new approach which uses generic ops structure. Hence addition of patch 1 to this series and corresponding changes to patch 2. - Dropped "riscv: dts: Add DT support for SiFive L2 cache controller" patch since it is already merged - Rebased on Linux v5.5-rc6 Changes in v2: - Rebase the series on v5.5-rc3 - Remove the reserved-memory node from DT [0]: https://lore.kernel.org/linux-riscv/CAAhSdy0CXde5s_ya=4YvmA4UQ5f5gLU-Z_FaOr8LPni+s_615Q@mail.gmail.com/ Yash Shah (2): riscv: cacheinfo: Implement cache_get_priv_group with a generic ops structure riscv: Add support to determine no. of L2 cache way enabled arch/riscv/include/asm/cacheinfo.h | 15 ++++++++++++++ arch/riscv/kernel/cacheinfo.c | 17 ++++++++++++++++ drivers/soc/sifive/sifive_l2_cache.c | 38 ++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 arch/riscv/include/asm/cacheinfo.h -- 2.7.4