Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4781801ybl; Mon, 13 Jan 2020 20:54:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxWaSs/E7GIORO6wqkTIRuEUxbfQqBE5ecmRy9zkwLTQXwzlPuzIu42/SiHL1G5QJt933FO X-Received: by 2002:aca:b808:: with SMTP id i8mr14946967oif.66.1578977663583; Mon, 13 Jan 2020 20:54:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578977663; cv=none; d=google.com; s=arc-20160816; b=u4PIHcSHC1HAMAVWlOzVE/uSvFWtOqcsHxJmsFvjYFn+SUtTgiWnW1H0ktJGQmLwnY 761hnS3IO8ryPUrxEH/fxYAhaod20Ko1aNVR25mNPzjQsydeqo6/zS9ZwwZVp4nwwyB/ zhNOZ9LG1btBAruYfFfL60vbP6XArIR7xJ7uMS+NDQ+7ZEuvZFSEjL/51YPJ1KOuOLml f/o0io0ejQeKcYJMdqoTuGS7q6MvGJP00+PdtMsLoWNbX694AKlEDuamudyfOsSPzdJX GK72Dk8+dn5vJEUx7sxAEkCJ7EkGNeA26Myki0cbmu2mPcPAUoHmcZk3JgKlhwwijNSD nmSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Kdjzg/OEJ3U/n4z5ghVCYhNKmhmqsmyxQa/XtrqBQiU=; b=v+FV7Kxe40iBT7TIds456v+3YHUElvjO7Qy612dD6coURvJXDEB9Y3R8+EQAzVLCqD hs5kikG69BbRnIXRdZCpPuUUcQxyPdhjAPEbqybpk2ktCtk0jPBCINtlIs05i+yvA2ap LpAGjHAs1BQqmw/k1bGSMnpV7R+oJrBc//8BuO4DqSmoTCRKvF7l0GD5vggf4+zzd7hn +NzrKrl4AiAUyco83qrgo2PhoLuIw/DALu8+UtCS4AxLwEef8OVH+Ieemy5tEevqnr2O rOAF3p41ME6N6Fv/AB+5XcshEc9fMRehoZeSpiJ/vr/cVWTzDBOWqavEA5p6VVQ9hIYq jRyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=nnWTpEg+; 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 n203si6841577oia.112.2020.01.13.20.54.11; Mon, 13 Jan 2020 20:54:23 -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=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=nnWTpEg+; 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 S1728731AbgANEwa (ORCPT + 99 others); Mon, 13 Jan 2020 23:52:30 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40202 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726121AbgANEwa (ORCPT ); Mon, 13 Jan 2020 23:52:30 -0500 Received: by mail-wm1-f66.google.com with SMTP id t14so12145834wmi.5 for ; Mon, 13 Jan 2020 20:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Kdjzg/OEJ3U/n4z5ghVCYhNKmhmqsmyxQa/XtrqBQiU=; b=nnWTpEg+MgOnuUhZXlIaKchwkY/TwJoS51ktgSnLLxjhRjBlYi+D6OBCmdwyfLdzLe 873MHwbfUdBmKv1qTe1SN6rVUTg0KbSYQXKmTcqDDotrcUDEGA8mz7b3CzAOoMhKt2T3 GglM21MyVfjQd87kNLWNbsWtI5rN9drI5n2jB5xDyS99MQh9m1X1y8FGXk8HAxySqXzT AQU5xfswknreI83h58ZSDJBF0BZJUJlAME7SpQuO2+VKGR1N93RY/Wcypnm7HT8Do8T2 A+J7/jkYCNx9a9k0WmcZtMouAf7u61tdGByBJIJ1nF0lyiFbIjjkKQ8V1UWoesDGPNo9 5SbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Kdjzg/OEJ3U/n4z5ghVCYhNKmhmqsmyxQa/XtrqBQiU=; b=Wa1c/A4DsxT3XXSAfmLL/15VHpTzNjuQZCDWwCf1aFMoPiGLDxCdLc5xDJmko9KhV4 VdHigNXL3+tP82gstIJbnrTeLZGms+lBG/Jdo0hgQZ00Z4FmDVS2VYJxEs6wW9opz7Sy OZ+xeTD4s5M2PGHi0FqKKhyyNVOdIYofXVTGsar5tJnpNDIo7ayTRzPlSYpc4/sEpti/ TYqhex4+64WpI3IhBaD9SbyxDpzoq55HuQEGxMGBPfHEIr9BYPApKIwe17WdAtVf0Uih d8XG94vuZQYdnMzBQkgMiWDc+ba8aSeJapuJs4q2w8FLltLC/dTHO73yR2n8T81bWJJm Ohnw== X-Gm-Message-State: APjAAAUhsVi14X6MVU4PrJIFkQnRv68eDTgI8LrpJoK5S85tHzGJQqqk XojLTea/W0Quey/uGkOzlWF21cYl2ZGdjyCfcNELsw== X-Received: by 2002:a7b:c5d8:: with SMTP id n24mr24014206wmk.124.1578977548667; Mon, 13 Jan 2020 20:52:28 -0800 (PST) MIME-Version: 1.0 References: <1578897500-23897-1-git-send-email-yash.shah@sifive.com> <1578897500-23897-2-git-send-email-yash.shah@sifive.com> In-Reply-To: <1578897500-23897-2-git-send-email-yash.shah@sifive.com> From: Anup Patel Date: Tue, 14 Jan 2020 10:22:17 +0530 Message-ID: Subject: Re: [PATCH v3 1/2] riscv: cacheinfo: Implement cache_get_priv_group with a generic ops structure To: Yash Shah Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Allison Randal , Alexios Zavras , Greg Kroah-Hartman , Thomas Gleixner , bp@suse.de, linux-riscv , "linux-kernel@vger.kernel.org List" , Sachin Ghadi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 13, 2020 at 12:09 PM Yash Shah wrote: > > Implement cache_get_priv_group() that will make use of a generic ops > structure to return a private attribute group for custom cache info. > > Using riscv_set_cacheinfo_ops() users can hook their own custom function > to return the private attribute group for cacheinfo. In future we can > add more ops to this generic ops structure for SOC specific cacheinfo. > > Signed-off-by: Yash Shah > --- > arch/riscv/include/asm/cacheinfo.h | 15 +++++++++++++++ > arch/riscv/kernel/cacheinfo.c | 17 +++++++++++++++++ > 2 files changed, 32 insertions(+) > create mode 100644 arch/riscv/include/asm/cacheinfo.h > > diff --git a/arch/riscv/include/asm/cacheinfo.h b/arch/riscv/include/asm/cacheinfo.h > new file mode 100644 > index 0000000..5d9662e > --- /dev/null > +++ b/arch/riscv/include/asm/cacheinfo.h > @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > + > +#ifndef _ASM_RISCV_CACHEINFO_H > +#define _ASM_RISCV_CACHEINFO_H > + > +#include > + > +struct riscv_cacheinfo_ops { > + const struct attribute_group * (*get_priv_group)(struct cacheinfo > + *this_leaf); > +}; > + > +void riscv_set_cacheinfo_ops(struct riscv_cacheinfo_ops *ops); > + > +#endif /* _ASM_RISCV_CACHEINFO_H */ > diff --git a/arch/riscv/kernel/cacheinfo.c b/arch/riscv/kernel/cacheinfo.c > index 4c90c07..bd0f122 100644 > --- a/arch/riscv/kernel/cacheinfo.c > +++ b/arch/riscv/kernel/cacheinfo.c > @@ -7,6 +7,23 @@ > #include > #include > #include > +#include > + > +static struct riscv_cacheinfo_ops *rv_cache_ops; > + > +void riscv_set_cacheinfo_ops(struct riscv_cacheinfo_ops *ops) > +{ > + rv_cache_ops = ops; > +} > +EXPORT_SYMBOL_GPL(riscv_set_cacheinfo_ops); > + > +const struct attribute_group * > +cache_get_priv_group(struct cacheinfo *this_leaf) > +{ > + if (rv_cache_ops && rv_cache_ops->get_priv_group) > + return rv_cache_ops->get_priv_group(this_leaf); > + return NULL; > +} > > static void ci_leaf_init(struct cacheinfo *this_leaf, > struct device_node *node, > -- > 2.7.4 > LGTM. Reviewed-by: Anup Patel Regards, Anup