]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: ccp/tsm - Enable the root port after the endpoint
authorAlexey Kardashevskiy <aik@amd.com>
Thu, 21 May 2026 07:43:01 +0000 (17:43 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 29 May 2026 06:05:29 +0000 (14:05 +0800)
The PCIe r7.0, chapter "6.33.8 Other IDE Rules" mandates if selective IDE
is enabled for config requersts, a stream must be enabled on the endpoint
before enabling it on the rootport:

===
For Selective IDE, the Stream must not be used until it has been enabled in
both Partner Ports. For cases where one of the Partner Ports is a Root Port
and Selective IDE for Configuration Requests is enabled, the other
Partner Port must be enabled prior to the Root Port. For other scenarios,
the mechanisms to satisfy this requirement are implementation-specific.
===

Do what the spec says.

Fixes: 4be423572da1 ("crypto/ccp: Implement SEV-TIO PCIe IDE (phase1)")
Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/sev-dev-tsm.c

index f303d8f55991b55c1108123c2d4d40c0def08d41..46f2539d2d5ab2bb95d3382a67e423e3bb18236c 100644 (file)
@@ -58,13 +58,13 @@ static int stream_enable(struct pci_ide *ide)
        struct pci_dev *rp = pcie_find_root_port(ide->pdev);
        int ret;
 
-       ret = pci_ide_stream_enable(rp, ide);
-       if (ret)
+       ret = pci_ide_stream_enable(ide->pdev, ide);
+       if (ret && ret != -ENXIO)
                return ret;
 
-       ret = pci_ide_stream_enable(ide->pdev, ide);
-       if (ret)
-               pci_ide_stream_disable(rp, ide);
+       ret = pci_ide_stream_enable(rp, ide);
+       if (ret && ret != -ENXIO)
+               pci_ide_stream_disable(ide->pdev, ide);
 
        return ret;
 }