Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2146913ybt; Fri, 3 Jul 2020 01:58:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVlnav8Ihxeo1hG1heZVpP0yxcqxtLBnd/8yBNJYc6b/iYOY/1N6yi2f8tCqM2ivGxqt3E X-Received: by 2002:a05:6402:706:: with SMTP id w6mr38358507edx.326.1593766731908; Fri, 03 Jul 2020 01:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593766731; cv=none; d=google.com; s=arc-20160816; b=lmPkFSln2+pqkYCAswrLDZ7FwDNxNXwywdUqa+uU2F9AzSsNn82ubY70pdfYSzxqy2 KJb1VavvvX3hkK9XzPzAG3pnsxo0Cf1O7BNZzWnb8nMOlfdNECO5T0sWv2H6ViaME9Sv yHRb2img0JklbvIVOJKx3HrVAqwcIacR3YLCp5rHNQXfJXv7BqVmZWn+qTdaBt2zAxT+ TDIUWB7wfgicpBoFvrawaUBQ6Ziyy4zZ8nawkk44KThB5Skm5VBpt5FIDo7h3deVXLsi SLEaNWqlUyG8N1pOD7IgmIFlnzcBI2A27l35/5CUNPSyVIq7+76p0V07IWtP516AqkOG xULQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=l5krbZyzVlqtJlOtCzvF9lWot4EaX2wFJODMLjpfT4I=; b=Yf9j05W+ECJZ15UetTvSmqYFujmQmuIuRbPlaLOvRbndL5dhV7zcb39GambmeAAaTq VWLrBS4imai/j086z2kXjfQIGafBEjlOVdoJPOfV86QWAXWRNEVb+OThxNcqGMAf7Qb1 lNUEoOTy5Xm0FXke5xngU/oCyT36jvYnBygRrpV7AQjWfot9DE4L5ydnSbD3eA8PEzAT Qt02KrhAx7poo/AfE2SHocxdbYjFoHXiMREjRnHHowLc/3UklcSuPrqJLHIoqdkrmaDz Rp2LgiI8uOk5TBVAzEgWcNFVOs79s9MaS9MVvH85HaQPFx6Y3HWgvEHwGU+uRnUFYcyl Iwkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=UYyFvt0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l8si6609888ejc.665.2020.07.03.01.58.28; Fri, 03 Jul 2020 01:58:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=UYyFvt0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726287AbgGCI6C (ORCPT + 99 others); Fri, 3 Jul 2020 04:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725648AbgGCI6A (ORCPT ); Fri, 3 Jul 2020 04:58:00 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 248FBC08C5C1 for ; Fri, 3 Jul 2020 01:58:00 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id mn17so319645pjb.4 for ; Fri, 03 Jul 2020 01:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=l5krbZyzVlqtJlOtCzvF9lWot4EaX2wFJODMLjpfT4I=; b=UYyFvt0yHy8s+GaHXFDWNpCmUSIIUi1ARn1Nol8baUVBhpIIPAvw//y55ov/JDYZ9E DcIzzfh7GLHhx7zBBS2T/noiqaLvQdRYIVsvbapYFWozPXkRSqMdDYptpp/J68qPJbVs PuZlS69ZvO2fuKtpWKI9YGWVG293nIWvJGUQ8M0yySw1WJhkPDKsxKY3cSrbVK7RX6Wx 40MeCtPwwA25KJ4/SF9fp8Xa2f7vZr46RMz9dzrcvdRpNkfsz0CXSBgTAJ/G2zyJYBhY dl/8a9rInKt8BA9505EvF6SVg9U9MgQLAMJbQVeGdEsxJH+PsbIzskM1fdx+ctoHn8hs wPSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=l5krbZyzVlqtJlOtCzvF9lWot4EaX2wFJODMLjpfT4I=; b=qsKsLKEIsmVZRk7qcUXCBaphHtyCc4co1uRV/i1cF+gO3zvuIxfo44ETFqgCX1efk/ FxKJAbHsjQGbPHIIie4mqL+Cd4eSWiYdfeigy0aqlYKCiEpBdMKWA5+Wqgmk43+c7aNo 6LcwAZezdDYj261PlYzrBFZi67Xw/WHQHtAnti+jygONKpMRzXIyjucOnQG7wBR5qG7L tMRF0QtUiSa2cjusmBxc4NWg8d+NNrKHrQ4yAwvOC1Nu7jKiYXWrRR7pG2fQ70zMna5k JVceKQQLIa/NpRh72rudaufqPN4ey29SOTOVY4zsBVJZBZxkm4TDNpI5BUv4MnvGcTsj pefA== X-Gm-Message-State: AOAM5311tUcfHZBZgOf5JXbfeijOO3ywbRlZHf+Ww+yK7YLJYkm/NSsm tz7l89e7gQAwN5HEQ86Pp88Fo/bh9zI= X-Received: by 2002:a17:90b:1386:: with SMTP id hr6mr35394676pjb.93.1593766679662; Fri, 03 Jul 2020 01:57:59 -0700 (PDT) Received: from hsinchu02.internal.sifive.com (114-34-229-221.HINET-IP.hinet.net. [114.34.229.221]) by smtp.gmail.com with ESMTPSA id l23sm2126287pjy.45.2020.07.03.01.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 01:57:59 -0700 (PDT) From: Zong Li To: palmer@dabbelt.com, paul.walmsley@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Zong Li Subject: [PATCH 0/3] Get cache information from userland Date: Fri, 3 Jul 2020 16:57:52 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no standard CSR registers to provide cache information, the way for RISC-V is to get this information from DT. Currently, AT_L1I_X, AT_L1D_X and AT_L2_X are present in glibc header, and sysconf syscall could use them to get information of cache through AUX vector. We exploit 'struct cacheinfo' to obtain the information of cache, then we don't need additional variable or data structure to record it. We also need some works in glibc, but we have to support the function in kernel first by rule of glibc, then post the patch to glibc site. The result of 'getconf -a' as follows: LEVEL1_ICACHE_SIZE 32768 LEVEL1_ICACHE_ASSOC 8 LEVEL1_ICACHE_LINESIZE 64 LEVEL1_DCACHE_SIZE 32768 LEVEL1_DCACHE_ASSOC 8 LEVEL1_DCACHE_LINESIZE 64 LEVEL2_CACHE_SIZE 2097152 LEVEL2_CACHE_ASSOC 32 LEVEL2_CACHE_LINESIZE 64 Zong Li (3): riscv: Set more data to cacheinfo riscv: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO riscv: Add cache information in AUX vector arch/riscv/include/asm/cacheinfo.h | 14 +++++ arch/riscv/include/asm/elf.h | 13 ++++ arch/riscv/include/uapi/asm/auxvec.h | 24 ++++++++ arch/riscv/kernel/cacheinfo.c | 92 +++++++++++++++++++++++----- 4 files changed, 127 insertions(+), 16 deletions(-) create mode 100644 arch/riscv/include/asm/cacheinfo.h -- 2.27.0