🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by "Daniel Zahka" Tue, 17 Nov 2026 22:15
Re: [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation
#18150
Author: "Daniel Zahka"
Date: Tue, 17 Nov 2026 22:15
74 lines
14323 bytes
On Tue Nov 17, 2026 at 9:55 AM EST, Stan Iliev wrote:
> Add support for PSP master key rotation:
> - Introduce VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST (563),
>   struct virtchnl2_psp_rotate_keygen_request/_response,
>   VIRTCHNL2_EVENT_PSP_ROTATE_KEY (4) and
>   struct virtchnl2_psp_rotation_event/_data.
> - Implement the key_rotate PSP device op with
>   idpf_psp_rotation_request(), which fails with -EOPNOTSUPP if
>   VIRTCHNL2_CAP_PSP_REQUEST_ROTATION was not granted. The PSP core
>   increments the PSP device generation before calling the op and
>   doesn't restore it if the op fails: the op restores it then.
> - Track the master key of the allocated RX SPIs, to report their
>   generation on receive in a later patch: bit 31 of an SPI selects one
>   of the two master keys of the CP, and the CP master key generation
>   of the allocation tells when a master key was replaced. The packets
>   of a master key get the PSP device generation that was current when
>   its first SPI was allocated, which is the generation of the
>   associations using it. Associations then survive one rotation, as the
>   PSP core expects.
> - Handle VIRTCHNL2_EVENT_PSP_ROTATE_KEY in idpf_recv_event_msg() with
>   idpf_psp_rotation_event(), which logs the new master key generation.
>   The PSP core can't be told about rotations it didn't request, like
>   in mlx5: document the limitation and a possible solution.
>
> Signed-off-by: Stan Iliev <stani@google.com>
> ---

[...]

> +/**
> + * idpf_psp_rx_gen_update - Track the master key of an allocated SPI
> + * @adapter: private data struct
> + * @psd: PSP device, locked
> + * @spi: SPI allocated by the CP
> + * @cp_gen: CP master key generation of @spi
> + *
> + * Bit 31 of an SPI selects one of the two master keys of the CP, a rotation
> + * replaces the older one. The HW doesn't tell which master key decrypted a
> + * packet: report the PSP device generation that was current when the first
> + * SPI of the master key was allocated, which is the generation of the
> + * associations using it, see idpf_psp_rx_process_skb(). The CP master key
> + * generation tells when a master key was replaced, including by a rotation
> + * the PSP core didn't request, see idpf_psp_rotation_event().
> + */
> +static void idpf_psp_rx_gen_update(struct idpf_adapter *adapter,
> +				   struct psp_dev *psd, __be32 spi, u32 cp_gen)
> +{
> +	struct idpf_psp_rx_gen *rx_gen;
> +
> +	lockdep_assert_held(&psd->lock);
> +
> +	rx_gen = &adapter->psp.rx_gen[be32_to_cpu(spi) >> 31];
> +	if (rx_gen->gen != IDPF_PSP_GEN_UNKNOWN && rx_gen->cp_gen == cp_gen)
> +		return;
> +
> +	rx_gen->cp_gen = cp_gen;
> +	WRITE_ONCE(rx_gen->gen, psd->generation);

WRITE_ONCE isn't paired here. I'm guessing the Rx code in series 2 will
copy rx_gen->gen into the psp skb extension, but that would likely not
be correct. The generation field in the extension should be copied from
Rx completion metadata. If such a descriptor field doesn't exist, then
the key_rotate() implementation might as well pin psd->generation = 0
like mlx5 does.

> +}
> +
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads