Re: [PATCH] platform/x86/intel/vsec: reset state before re-enumerating
From: Lukas Wunner
Date: Wed Jul 08 2026 - 05:42:59 EST
On Wed, Jul 08, 2026 at 11:26:47AM +0800, Guangshuo Li wrote:
> +++ b/drivers/platform/x86/intel/vsec.c
> @@ -51,6 +51,13 @@ struct vsec_priv {
> unsigned long found_caps;
> };
>
> +static void intel_vsec_reset_state(struct vsec_priv *priv)
> +{
> + memset(priv->suppliers, 0, sizeof(priv->suppliers));
> + memset(priv->state, 0, sizeof(priv->state));
> + priv->found_caps = 0;
> +}
Seems fragile to selectively zero only portions of struct vsec_priv.
If the struct is amended later on with additional fields, it's quite
possible that nobody thinks about zeroing them here.
It's probably more robust to zero the entire struct and re-populate
the info field.
I also don't think a separate function to reset the struct is necessary
as I don't expect additional callers down the road. So I suggest
zeroing the struct inline in intel_vsec_pci_slot_reset().
@David Box: I've asked off-list for reset recovery to be tested,
I'm hereby renewing that request. See section "Software error injection"
in: Documentation/PCI/pcieaer-howto.rst
Thanks,
Lukas