From: "Daniel Zahka" <daniel.zahka@gmail.com>
To: "Stan Iliev" <stani@google.com>,
"Tony Nguyen" <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
<intel-wired-lan@lists.osuosl.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"David Decotigny" <decot@google.com>,
"Madhu Chittim" <madhu.chittim@intel.com>,
"Emil Tantilov" <emil.s.tantilov@intel.com>,
"Sridhar Samudrala" <sridhar.samudrala@intel.com>,
"Brian Vazquez" <brianvv@google.com>, "Li Li" <boolli@google.com>,
"Alexander Lobakin" <aleksander.lobakin@intel.com>,
"Daniel Zahka" <daniel.zahka@gmail.com>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
"Kees Cook" <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation
Date: Tue, 17 Nov 2026 17:15:07 -0500 [thread overview]
Message-ID: <DMXTZHJA6OGI.3RFGSK5SE9RUF@gmail.com> (raw)
In-Reply-To: <20261117145522.1910636-10-stani@google.com>
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.
> +}
> +
next prev parent reply other threads:[~2026-11-17 22:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 02/15] idpf: wipe mailbox " Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 03/15] idpf: make the mailbox workqueue visible in sysfs Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 04/15] idpf: psp: add psp offload initialization Stan Iliev
2026-11-17 17:34 ` Daniel Zahka
2026-11-17 14:55 ` [PATCH iwl-next 05/15] idpf: psp: add support for crypto capabilities Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 06/15] idpf: psp: add support for psp capabilities Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 07/15] idpf: psp: add support for fips compliance status Stan Iliev
2026-11-17 20:40 ` Daniel Zahka
2026-11-17 14:55 ` [PATCH iwl-next 08/15] idpf: psp: add support for psp rx key allocation Stan Iliev
2026-11-17 20:57 ` Daniel Zahka
2026-11-17 14:55 ` [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation Stan Iliev
2026-11-17 22:15 ` Daniel Zahka [this message]
2026-11-17 14:55 ` [PATCH iwl-next 10/15] idpf: psp: add support for psp statistics Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 11/15] idpf: psp: add psp tx key state Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 14/15] idpf: psp: add support for psp tx key insertion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 15/15] idpf: psp: add psp tx key registration Stan Iliev
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=DMXTZHJA6OGI.3RFGSK5SE9RUF@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=boolli@google.com \
--cc=brianvv@google.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@kernel.org \
--cc=emil.s.tantilov@intel.com \
--cc=gustavoars@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madhu.chittim@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sridhar.samudrala@intel.com \
--cc=stani@google.com \
--cc=willemdebruijn.kernel@gmail.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