From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Mike Leach <mike.leach@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org, coresight@lists.linaro.org,
suzuki.poulose@arm.com, leo.yan@linaro.org
Subject: Re: [PATCH v3 4/5] coresight: tools: Add config file write and reader tools
Date: Wed, 1 Jun 2022 10:10:54 -0600 [thread overview]
Message-ID: <20220601161054.GA577493@p14s> (raw)
In-Reply-To: <CAJ9a7VgRjUkzmXpoD6SgkNBP7fNCOmgxvuKbsLexfebY_iRdFw@mail.gmail.com>
[...]
> > > diff --git a/tools/include/uapi/coresight-config-uapi.h b/tools/include/uapi/coresight-config-uapi.h
> > > new file mode 100644
> > > index 000000000000..d051c01ea982
> > > --- /dev/null
> > > +++ b/tools/include/uapi/coresight-config-uapi.h
> > > @@ -0,0 +1,76 @@
> > > +/* SPDX-License-Identifier: GPL-2.0 */
> > > +/*
> > > + * Copyright (c) 2020 Linaro Limited, All rights reserved.
> > > + * Author: Mike Leach <mike.leach@linaro.org>
> > > + */
> > > +
> > > +#ifndef _CORESIGHT_CORESIGHT_CONFIG_UAPI_H
> > > +#define _CORESIGHT_CORESIGHT_CONFIG_UAPI_H
> > > +
> > > +#include <linux/types.h>
> > > +#include <asm-generic/errno-base.h>
> > > +
> > > +#include "coresight-config.h"
> > > +
> > > +/*
> > > + * Userspace versions of the configuration and feature descriptors.
> > > + * Used in the tools/coresight programs.
> > > + *
> > > + * Compatible with structures in coresight-config.h for use in
> > > + * coresight-config-file.c common reader source file.
> > > + */
> > > +
> > > +/**
> > > + * Device feature descriptor - combination of registers and parameters to
> > > + * program a device to implement a specific complex function.
> > > + *
> > > + * UAPI version - removed kernel constructs.
> > > + *
> > > + * @name: feature name.
> > > + * @description: brief description of the feature.
> > > + * @match_flags: matching information if loading into a device
> > > + * @nr_params: number of parameters used.
> > > + * @params_desc: array of parameters used.
> > > + * @nr_regs: number of registers used.
> > > + * @regs_desc: array of registers used.
> > > + */
> > > +struct cscfg_feature_desc {
> > > + const char *name;
> > > + const char *description;
> > > + u32 match_flags;
> > > + int nr_params;
> > > + struct cscfg_parameter_desc *params_desc;
> > > + int nr_regs;
> > > + struct cscfg_regval_desc *regs_desc;
> > > +};
> > > +
> > > +/**
> > > + * Configuration descriptor - describes selectable system configuration.
> > > + *
> > > + * A configuration describes device features in use, and may provide preset
> > > + * values for the parameters in those features.
> > > + *
> > > + * A single set of presets is the sum of the parameters declared by
> > > + * all the features in use - this value is @nr_total_params.
> > > + *
> > > + * UAPI version - removed kernel constructs.
> > > + *
> > > + * @name: name of the configuration - used for selection.
> > > + * @description: description of the purpose of the configuration.
> > > + * @nr_feat_refs: Number of features used in this configuration.
> > > + * @feat_ref_names: references to features used in this configuration.
> > > + * @nr_presets: Number of sets of presets supplied by this configuration.
> > > + * @nr_total_params: Sum of all parameters declared by used features
> > > + * @presets: Array of preset values.
> > > + */
> > > +struct cscfg_config_desc {
> > > + const char *name;
> > > + const char *description;
> > > + int nr_feat_refs;
> > > + const char **feat_ref_names;
> > > + int nr_presets;
> > > + int nr_total_params;
> > > + const u64 *presets; /* nr_presets * nr_total_params */
> > > +};
> >
> > I would call the above cscfg_feature_fs_desc and cscfg_config_fs_desc to make
> > sure they don't get confused with the kernel's internal structures of the same name.
> >
>
> The issue here is that the common reader code expects structs of these names.
>
> The alternative was to put multiple #if _KERNEL__ defines in the
> middle of the structures in the kernel headers to eliminate kernel
> only elements- which you pointed out in your comments to v2 of this
> set was a maintenence issue.
>
> This is a least worst alternative. We have common reader code, there
> are minimal changes to the kernel headers - some of the structures in
> coresight-config.h are backeted by a __KERNEL__ define but those
> without kernel specific elements are used in full.
>
> The cost is maintaining these two structures to be the same as the
> kernel versions - which I believe to be minimal as I do not expect the
> data format to change going forwards.
>
I agree with you - the current implementation is the least intrusive and easiest
to maintain. Unless someone finds an alternative it is better to keep the
current solution.
> > Moreover, I would keep this file private to tools/coresight/ and rename it
> > coresight-config.h.
> >
>
> I can and have moved it.
> Howver this file includes the kernel coresight-config.h, so renaming
> is a non-starter.
>
Yes, you are correct.
> Thanks and Regards
>
> Mike
>
> > > +
> > > +#endif /* _CORESIGHT_CORESIGHT_CONFIG_UAPI_H */
> > > --
> > > 2.17.1
> > >
>
>
>
> --
> Mike Leach
> Principal Engineer, ARM Ltd.
> Manchester Design Centre. UK
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-06-01 16:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-14 6:44 [PATCH v3 0/5] coresight: syscfg: Extend configfs for config load Mike Leach
2022-04-14 6:44 ` [PATCH v3 1/5] coresight: configfs: Add in functionality for load via configfs Mike Leach
2022-05-11 17:58 ` Mathieu Poirier
2022-05-16 12:43 ` Mike Leach
2022-05-12 17:54 ` Mathieu Poirier
2022-05-25 17:38 ` Mathieu Poirier
2022-06-01 8:32 ` Mike Leach
2022-04-14 6:44 ` [PATCH v3 2/5] coresight: configfs: Add in binary attributes to load files Mike Leach
2022-05-25 18:00 ` Mathieu Poirier
2022-05-25 19:30 ` Mathieu Poirier
2022-06-01 8:33 ` Mike Leach
2022-04-14 6:44 ` [PATCH v3 3/5] coresight: configfs: Modify config files to allow userspace use Mike Leach
2022-05-25 19:57 ` Mathieu Poirier
2022-04-14 6:44 ` [PATCH v3 4/5] coresight: tools: Add config file write and reader tools Mike Leach
2022-05-26 17:46 ` Mathieu Poirier
2022-05-27 16:25 ` Mathieu Poirier
2022-06-01 10:56 ` Mike Leach
2022-06-01 16:10 ` Mathieu Poirier [this message]
2022-04-14 6:44 ` [PATCH v3 5/5] Documentation: coresight: docs for config load via configfs Mike Leach
2022-05-26 17:48 ` Mathieu Poirier
2022-05-10 15:39 ` [PATCH v3 0/5] coresight: syscfg: Extend configfs for config load Mathieu Poirier
2022-05-27 16:32 ` Mathieu Poirier
2022-06-01 8:30 ` Mike Leach
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220601161054.GA577493@p14s \
--to=mathieu.poirier@linaro.org \
--cc=coresight@lists.linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).