The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: Jiri Pirko <jiri@resnulli.us>, linux-coco@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
	x86@kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org,
	jgg@ziepe.ca, david.quigley@intel.com, lukas@wunner.de,
	ksinyuk@kernel.org, rodrigo.vivi@intel.com,
	cedric.xing@intel.com, sameo@meta.com, drdeeglaze@gmail.com,
	James.Bottomley@HansenPartnership.com, aik@amd.com,
	jpiotrowski@nvidia.com, qinkun@google.com, pgonda@google.com,
	jic23@kernel.org, alistair.francis@wdc.com, ankita@nvidia.com,
	suzuki.poulose@arm.com, kas@kernel.org,
	rick.p.edgecombe@intel.com, elena.reshetova@intel.com,
	dave.hansen@linux.intel.com,
	sathyanarayanan.kuppuswamy@linux.intel.com, peter.fang@intel.com,
	jarkko@kernel.org, zohar@linux.ibm.com, yeoreum.yun@arm.com,
	dave.jiang@intel.com, nik.borisov@suse.com,
	sergii.dmytruk@3mdeb.com
Subject: Re: [PATCH RFC v2 11/15] ctlv: Add operation dispatch
Date: Fri, 04 Dec 2026 18:33:58 +0530	[thread overview]
Message-ID: <yq5azeul19kx.fsf@kernel.org> (raw)
In-Reply-To: <20261113155515.2510194-12-jiri@resnulli.us>

Jiri Pirko <jiri@resnulli.us> writes:

> From: Jiri Pirko <jiri@nvidia.com>

 [ ... 1027 lines skipped ... ] 

> +/**
> + * ctlv_ext_fill - Delegate an extension-point output record.
> + * @ctx: operation context
> + * @request: validated request root
> + * @record: output record selected by the generated helper
> + *
> + * Return: filling callback result, or 0 for an unfilled point.
> + */
> +int ctlv_ext_fill(struct ctlv_op_ctx *ctx, const struct ctlv_cursor *request,
> +		  struct ctlv_cursor *record)
> +{
> +	const struct ctlv_schema_tree *tree;
> +	u32 index;
> +
> +	if (WARN_ON_ONCE(!record->tree))
> +		return -EINVAL;
> +	tree = record->tree;
> +
> +	for (index = 0; index < tree->ext_schemas_count; index++) {
> +		const struct ctlv_ext_schema *ext_schema = &tree->ext_schemas[index];
> +		const struct ctlv_cursor *filled_request = request;
> +		const struct ctlv_ext_fill_schema *fill_schema;
> +		const struct ctlv_ext_ops *ext_ops;
> +		struct ctlv_cursor filled;
> +		int ret;
> +
> +		if (ext_schema->node != record->node)
> +			continue;
> +		ext_ops = ctlv_ext_ops_find(ctx->ctlv, ext_schema);
> +		if (!ext_ops || !ext_ops->fill)
> +			continue;
> +
> +		if (request) {
> +			fill_schema = ctlv_schema_fill(ctx->family, ext_schema->family_id,
> +						       ext_schema->ext_id);
> +			if (WARN_ON_ONCE(!fill_schema))
> +				return -EINVAL;
> +			filled = *request;
> +			if (ctlv_message_input_rebind(&filled, &fill_schema->members, 0))
> +				filled_request = &filled;
> +			else
> +				filled_request = NULL;
> +		}
> +
> +		ret = ext_ops->fill(ctx->ctlv, ctx, filled_request, record);
> +		if (ret)
> +			return ret;
> +	}
> +	return 0;
> +}
> +EXPORT_SYMBOL_NS_GPL(ctlv_ext_fill, "CTLV");
> +

Could we also add a helper here to select the child family's schema when
decoding a request extension record?

I am using this for the SPDM changes, which extend the common
evidence-get request with device-session-id fields.

  evidence-get:
    type: action
    request:
    .....
      # Optional family-specific collection parameters.
      parameters?: extension evidence-parameters
    reply:
      # Optional family-specific evidence result metadata.
      details?: extension evidence-details

and in ctlv-attestation-spdm.yaml

  evidence-parameters:
    # Connection or lock device session ID this collection belongs to.
    device-session-id: uint
    # Identity slot; captured host evidence requires the selected identity.
    slot?: uint(..7)

  # Fills the common evidence-details reply extension after bundle delivery.
  evidence-details:
    # Connection or lock device session ID of the delivered bundle.
    device-session-id: uint

When evidence-get selects the parameters record, its cursor still uses
the common attestation schema. That schema does not define the SPDM
fields inside the record.

Reading those fields therefore triggers WARN_ON_ONCE() in
ctlv_message_input_slot()

-aneesh

  reply	other threads:[~2026-12-04 13:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 15:54 [PATCH RFC v2 00/15] ctlv: Add a schema-driven TLV uAPI for character devices Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 01/15] ctlv: Add the schema language and generator Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 02/15] ctlv: Add the UAPI message format and family API Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 03/15] ctlv: Add the root family specification and generated files Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 04/15] Documentation: ctlv: Add userspace ABI Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 05/15] ctlv: Prepare message input handling Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 06/15] ctlv: Prepare blob descriptor validation Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 07/15] ctlv: Prepare schema validation Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 08/15] ctlv: Prepare message output handling Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 09/15] ctlv: Prepare VA blob handling Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 10/15] ctlv: Prepare runtime introspection Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 11/15] ctlv: Add operation dispatch Jiri Pirko
2026-12-04 13:03   ` Aneesh Kumar K.V [this message]
2026-11-13 15:55 ` [PATCH RFC v2 12/15] ctlv: Add character device nodes Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 13/15] Documentation: ctlv: Describe how to write a family Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 14/15] tools/ctlv: Add the userspace library Jiri Pirko
2026-11-13 15:55 ` [PATCH RFC v2 15/15] tools/ctlv: Add ctlvctl Jiri Pirko
2026-12-04  8:23   ` Aneesh Kumar K.V
2026-11-25 18:42 ` [PATCH RFC v2 00/15] ctlv: Add a schema-driven TLV uAPI for character devices Yeoreum Yun

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=yq5azeul19kx.fsf@kernel.org \
    --to=aneesh.kumar@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=aik@amd.com \
    --cc=alistair.francis@wdc.com \
    --cc=ankita@nvidia.com \
    --cc=cedric.xing@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=david.quigley@intel.com \
    --cc=drdeeglaze@gmail.com \
    --cc=elena.reshetova@intel.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jic23@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=jpiotrowski@nvidia.com \
    --cc=kas@kernel.org \
    --cc=ksinyuk@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=nik.borisov@suse.com \
    --cc=peter.fang@intel.com \
    --cc=pgonda@google.com \
    --cc=qinkun@google.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=sameo@meta.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=sergii.dmytruk@3mdeb.com \
    --cc=suzuki.poulose@arm.com \
    --cc=x86@kernel.org \
    --cc=yeoreum.yun@arm.com \
    --cc=zohar@linux.ibm.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