public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH edk2-platforms 0/3] fixes for AMD OverDrive
@ 2019-11-25 18:07 Ard Biesheuvel
  2019-11-25 18:07 ` [PATCH edk2-platforms 1/3] Platform/Overdrive: add missing resolution for FileHandleLib Ard Biesheuvel
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2019-11-25 18:07 UTC (permalink / raw)
  To: devel; +Cc: leif.lindholm, Ard Biesheuvel

Fix some issues in the ACPI and DT descriptions of the SMMU routing,
in particular the routing of the CCP crypto accelerator, which sits
behind an SMMU as well on B1 silicon (but not on B0, strangely enough)

Ard Biesheuvel (3):
  Platform/Overdrive: add missing resolution for FileHandleLib
  Silicon/AMD/Styx: clean up stream ID mappings for SMMU
  Platform/Overdrive: clean up stream ID descriptions in DT

 Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts    |  19 ++-
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc               |   2 +-
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl            |  23 ----
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc           | 137 +++++---------------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl          |  23 ++++
 Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c |   5 +-
 6 files changed, 72 insertions(+), 137 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH edk2-platforms 1/3] Platform/Overdrive: add missing resolution for FileHandleLib
  2019-11-25 18:07 [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Ard Biesheuvel
@ 2019-11-25 18:07 ` Ard Biesheuvel
  2019-11-25 18:07 ` [PATCH edk2-platforms 2/3] Silicon/AMD/Styx: clean up stream ID mappings for SMMU Ard Biesheuvel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2019-11-25 18:07 UTC (permalink / raw)
  To: devel; +Cc: leif.lindholm, Ard Biesheuvel

Changes to the core EDK2 repository have caused the build for
Overdrive to break. Move the existing FileHandleLib resolution
to global scope to get things working again.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index 7369173cc125..5a38b9dd96ae 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -142,6 +142,7 @@ [LibraryClasses.common]
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
 
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
@@ -697,7 +698,6 @@ [Components.common]
       PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
       BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
 
-      FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
       ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
 
     <PcdsFixedAtBuild>
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH edk2-platforms 2/3] Silicon/AMD/Styx: clean up stream ID mappings for SMMU
  2019-11-25 18:07 [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Ard Biesheuvel
  2019-11-25 18:07 ` [PATCH edk2-platforms 1/3] Platform/Overdrive: add missing resolution for FileHandleLib Ard Biesheuvel
@ 2019-11-25 18:07 ` Ard Biesheuvel
  2019-11-25 18:07 ` [PATCH edk2-platforms 3/3] Platform/Overdrive: clean up stream ID descriptions in DT Ard Biesheuvel
  2019-11-26 11:47 ` [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Leif Lindholm
  3 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2019-11-25 18:07 UTC (permalink / raw)
  To: devel; +Cc: leif.lindholm, Ard Biesheuvel

Tighten the stream ID mappings for the SMMU to only cover the stream IDs
that are actually being issued by the respective masters. This is
mostly just a cleanup exercise, since specifying unused stream IDs does
not typically create any problems. However, the CCP crypto accelerator
on B1 silicon actually uses stream IDs that we assigned to the second
SATA controller, so there this actually fixes a problem.

Since the crypto accelerator is not behind a SMMU on B0 silicon, we need
to either parameterize the IORT using C code, or drop the CCP entirely
from the B0 description. Given that most distros don't even carry the
CCP driver, let's make our lives easier and just move the CCP device
node to the B1-only SSDT.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl   |  23 ----
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc  | 137 +++++---------------
 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl |  23 ++++
 3 files changed, 56 insertions(+), 127 deletions(-)

diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl
index 3a3bdcad627e..6dc29758649e 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl
@@ -266,29 +266,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "AMDINC", "SEATTLE ", 3)
             }
         }
 
-        Device (CCP0)
-        {
-            Name (_HID, "AMDI0C00")  // _HID: Hardware ID
-            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
-            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
-            {
-                Memory32Fixed (ReadWrite,
-                    0xE0100000,         // Address Base
-                    0x00010000,         // Address Length
-                    )
-                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000023, }
-            })
-
-            Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
-            {
-                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
-                Package ()
-                {
-                    Package (0x02) {"amd,zlib-support", 1}
-                }
-            })
-        }
-
         //
         // PCIe Root Bus
         //
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc
index d46be49f0318..8d8a2c693aa6 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc
@@ -46,8 +46,14 @@ typedef struct {
 typedef struct {
   EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE Node;
   CONST CHAR8                               Name[11];
-  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE        RcIdMapping[32];
-} STYX_NC_NODE;
+  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE        RcIdMapping[16];
+} STYX_ETH_NODE;
+
+typedef struct {
+  EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE Node;
+  CONST CHAR8                               Name[11];
+  EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE        RcIdMapping[3];
+} STYX_SATA_NODE;
 
 typedef struct {
   EFI_ACPI_6_0_IO_REMAPPING_TABLE           Iort;
@@ -55,14 +61,15 @@ typedef struct {
   STYX_RC_NODE                              PciRcNode;
 
   STYX_SMMU_NODE                            Eth0SmmuNode;
-  STYX_NC_NODE                              Eth0NamedNode;
+  STYX_ETH_NODE                             Eth0NamedNode;
   STYX_SMMU_NODE                            Eth1SmmuNode;
-  STYX_NC_NODE                              Eth1NamedNode;
+  STYX_ETH_NODE                             Eth1NamedNode;
 
   STYX_SMMU_NODE                            Sata0SmmuNode;
-  STYX_NC_NODE                              Sata0NamedNode;
+  STYX_SATA_NODE                            Sata0NamedNode;
   STYX_SMMU_NODE                            Sata1SmmuNode;
-  STYX_NC_NODE                              Sata1NamedNode;
+  STYX_SATA_NODE                            Sata1NamedNode;
+  STYX_SATA_NODE                            CcpNamedNode;
 } STYX_IO_REMAPPING_STRUCTURE;
 
 #define __STYX_SMMU_NODE(Base, Size, Irq)                   \
@@ -114,15 +121,19 @@ typedef struct {
     EFI_ACPI_IORT_ID_MAPPING_FLAGS_SINGLE                   \
   }
 
-#define __STYX_NAMED_COMPONENT_NODE(Name)                   \
+#define __STYX_NUM_NODES(Type)                              \
+  ((sizeof(Type) - FIELD_OFFSET(Type, RcIdMapping)) /       \
+              sizeof(EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE))
+
+#define __STYX_NAMED_COMPONENT_NODE(Name, Type)             \
     {                                                       \
       {                                                     \
         EFI_ACPI_IORT_TYPE_NAMED_COMP,                      \
-        sizeof(STYX_NC_NODE),                               \
+        sizeof(Type),                                       \
         0x0,                                                \
         0x0,                                                \
-        0x20,                                               \
-        FIELD_OFFSET(STYX_NC_NODE, RcIdMapping),            \
+        __STYX_NUM_NODES(Type),                             \
+        FIELD_OFFSET(Type, RcIdMapping),                    \
       },                                                    \
       0x0,                                                  \
       EFI_ACPI_IORT_MEM_ACCESS_PROP_CCA,                    \
@@ -175,7 +186,7 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
                      STYX_ETH0_SMMU_INTERRUPT)
   }, {
     // Eth0NamedNode
-    __STYX_NAMED_COMPONENT_NODE("\\_SB_.ETH0"),
+    __STYX_NAMED_COMPONENT_NODE("\\_SB_.ETH0", STYX_ETH_NODE),
     {
       __STYX_ID_MAPPING_SINGLE(0x00, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x01, Eth0SmmuNode),
@@ -185,14 +196,6 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
       __STYX_ID_MAPPING_SINGLE(0x05, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x06, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x07, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x08, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x09, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0A, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0B, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0C, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0D, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0E, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0F, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x10, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x11, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x12, Eth0SmmuNode),
@@ -201,14 +204,6 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
       __STYX_ID_MAPPING_SINGLE(0x15, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x16, Eth0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x17, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x18, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x19, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1A, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1B, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1C, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1D, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1E, Eth0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1F, Eth0SmmuNode),
     }
   }, {
     // Eth1SmmuNode
@@ -217,7 +212,7 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
                      STYX_ETH1_SMMU_INTERRUPT)
   }, {
     // Eth1NamedNode
-    __STYX_NAMED_COMPONENT_NODE("\\_SB_.ETH1"),
+    __STYX_NAMED_COMPONENT_NODE("\\_SB_.ETH1", STYX_ETH_NODE),
     {
       __STYX_ID_MAPPING_SINGLE(0x00, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x01, Eth1SmmuNode),
@@ -227,14 +222,6 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
       __STYX_ID_MAPPING_SINGLE(0x05, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x06, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x07, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x08, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x09, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0A, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0B, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0C, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0D, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0E, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0F, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x10, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x11, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x12, Eth1SmmuNode),
@@ -243,14 +230,6 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
       __STYX_ID_MAPPING_SINGLE(0x15, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x16, Eth1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x17, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x18, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x19, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1A, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1B, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1C, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1D, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1E, Eth1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1F, Eth1SmmuNode),
     }
   }, {
     // Sata0SmmuNode
@@ -259,40 +238,11 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
                      STYX_SATA0_SMMU_INTERRUPT)
   }, {
     // Sata0NamedNode
-    __STYX_NAMED_COMPONENT_NODE("\\_SB_.AHC0"),
+    __STYX_NAMED_COMPONENT_NODE("\\_SB_.AHC0", STYX_SATA_NODE),
     {
-      __STYX_ID_MAPPING_SINGLE(0x00, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x01, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x02, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x03, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x04, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x05, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x06, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x07, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x08, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x09, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0A, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0B, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0C, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0D, Sata0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x0E, Sata0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x0F, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x10, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x11, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x12, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x13, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x14, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x15, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x16, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x17, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x18, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x19, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1A, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1B, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1C, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1D, Sata0SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x1E, Sata0SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1F, Sata0SmmuNode),
     }
   }, {
     // Sata1SmmuNode
@@ -301,40 +251,19 @@ STATIC STYX_IO_REMAPPING_STRUCTURE AcpiIort = {
                      STYX_SATA1_SMMU_INTERRUPT)
   }, {
     // Sata1NamedNode
-    __STYX_NAMED_COMPONENT_NODE("\\_SB_.AHC1"),
+    __STYX_NAMED_COMPONENT_NODE("\\_SB_.AHC1", STYX_SATA_NODE),
     {
-      __STYX_ID_MAPPING_SINGLE(0x00, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x01, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x02, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x03, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x04, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x05, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x06, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x07, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x08, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x09, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0A, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0B, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0C, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x0D, Sata1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x0E, Sata1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x0F, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x10, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x11, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x12, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x13, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x14, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x15, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x16, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x17, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x18, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x19, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1A, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1B, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1C, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1D, Sata1SmmuNode),
       __STYX_ID_MAPPING_SINGLE(0x1E, Sata1SmmuNode),
-      __STYX_ID_MAPPING_SINGLE(0x1F, Sata1SmmuNode),
+    }
+  }, {
+    // CcpNamedNode
+    __STYX_NAMED_COMPONENT_NODE("\\_SB_.CCP0", STYX_SATA_NODE),
+    {
+      __STYX_ID_MAPPING_SINGLE(0x00, Sata1SmmuNode),
+      __STYX_ID_MAPPING_SINGLE(0x02, Sata1SmmuNode),
+      __STYX_ID_MAPPING_SINGLE(0x40, Sata1SmmuNode),
     }
   }
 };
diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
index 5c7e87181d10..d44bb9181d87 100644
--- a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
+++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl
@@ -76,5 +76,28 @@ DefinitionBlock ("SsdtB1.aml", "SSDT", 2, "AMDINC", "StyxB1  ", 3)
                 Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x0000018D, }
             })
         }
+
+        Device (CCP0)
+        {
+            Name (_HID, "AMDI0C00")  // _HID: Hardware ID
+            Name (_CCA, 0x01)  // _CCA: Cache Coherency Attribute
+            Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
+            {
+                Memory32Fixed (ReadWrite,
+                    0xE0100000,         // Address Base
+                    0x00010000,         // Address Length
+                    )
+                Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive, ,, ) {0x00000023, }
+            })
+
+            Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
+            {
+                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+                Package ()
+                {
+                    Package (0x02) {"amd,zlib-support", 1}
+                }
+            })
+        }
     }
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH edk2-platforms 3/3] Platform/Overdrive: clean up stream ID descriptions in DT
  2019-11-25 18:07 [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Ard Biesheuvel
  2019-11-25 18:07 ` [PATCH edk2-platforms 1/3] Platform/Overdrive: add missing resolution for FileHandleLib Ard Biesheuvel
  2019-11-25 18:07 ` [PATCH edk2-platforms 2/3] Silicon/AMD/Styx: clean up stream ID mappings for SMMU Ard Biesheuvel
@ 2019-11-25 18:07 ` Ard Biesheuvel
  2019-11-26 11:47 ` [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Leif Lindholm
  3 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2019-11-25 18:07 UTC (permalink / raw)
  To: devel; +Cc: leif.lindholm, Ard Biesheuvel

Align the DT description of the SMMU topology and stream IDs with the
actual routing of the SoC. As with the preceding IORT change, this is
mostly a cleanup exercise, but it does actually fix an issue with the
CCP crypto accelerator on B1 silicon.

This time, let's retain the CCP description for B0 silicon, and just
remove the 'iommus' DT property in this case. Since the SMMU is shared,
it is no longer an error if the SMMU node is missing when attempting to
delete it, so remove the warning that we issue in that case.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts    | 19 +++++++++++++------
 Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c |  5 ++---
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts b/Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts
index 1ba0d403eaf0..ba31240f2e91 100644
--- a/Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts
+++ b/Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts
@@ -86,7 +86,7 @@
 				       */
 				      <0 332 4>,
 				      <0 332 4>;
-			#iommu-cells = <2>;
+			#iommu-cells = <1>;
 			dma-coherent;
 		};
 
@@ -99,7 +99,7 @@
 				       */
 				      <0 331 4>,
 				      <0 331 4>;
-			#iommu-cells = <2>;
+			#iommu-cells = <1>;
 			dma-coherent;
 		};
 
@@ -109,7 +109,9 @@
 			interrupts = <0x0 0x163 0x4>;
 			clocks = <&sata_clk>;
 			dma-coherent;
-			iommus = <&sata0_smmu 0x00 0x1f>; /* 0-31 */
+			iommus = <&sata0_smmu 0x0e>,
+				 <&sata0_smmu 0x0f>,
+				 <&sata0_smmu 0x1e>;
 		};
 
 		sata@e0d00000 {
@@ -119,7 +121,9 @@
 			interrupts = <0x0 0x162 0x4>;
 			clocks = <&sata_clk>;
 			dma-coherent;
-			iommus = <&sata1_smmu 0x00 0x1f>; /* 0-31 */
+			iommus = <&sata1_smmu 0x0e>,
+				 <&sata1_smmu 0x0f>,
+				 <&sata1_smmu 0x1e>;
 		};
 
 		i2c@e1000000 {
@@ -233,6 +237,9 @@
 			interrupts = <0x0 0x3 0x4>;
 			dma-coherent;
 			amd,zlib-support = <0x1>;
+			iommus = <&sata1_smmu 0x00>,
+				 <&sata1_smmu 0x02>,
+				 <&sata1_smmu 0x40>;
 		};
 
 		pcie: pcie@f0000000 {
@@ -409,7 +416,7 @@
 			phy-handle = <&xgmac0_phy>;
 			phy-mode = "xgmii";
 			dma-coherent;
-			iommus = <&xgmac0_smmu 0x00 0x1f>; /* 0-31 */
+			iommus = <&xgmac0_smmu 0x00 0x17>; /* 0-7, 16-23 */
 		};
 
 		xgmac@e0900000 {
@@ -428,7 +435,7 @@
 			phy-handle = <&xgmac1_phy>;
 			phy-mode = "xgmii";
 			dma-coherent;
-			iommus = <&xgmac1_smmu 0x00 0x1f>; /* 0-31 */
+			iommus = <&xgmac1_smmu 0x00 0x17>; /* 0-7, 16-23 */
 		};
 	};
 
diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
index c84c1a81c3ec..5608946a5396 100644
--- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
+++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
@@ -212,8 +212,6 @@ DisableSmmu (
 
   Node = fdt_path_offset (Fdt, SmmuNodeName);
   if (Node <= 0) {
-    DEBUG ((DEBUG_WARN, "%a: Failed to find path %s: %a\n",
-      __FUNCTION__, SmmuNodeName, fdt_strerror (Node)));
     return;
   }
 
@@ -253,8 +251,9 @@ SetSocIdStatus (
     DisableSmmu (Fdt, "iommus", "/smb/smmu@e0200000", "/smb/sata@e0300000");
   }
 
-  if (!PcdGetBool (PcdEnableSmmus) || !IsRevB1 || FixedPcdGet8 (PcdSata1PortCount) == 0) {
+  if (!PcdGetBool (PcdEnableSmmus) || !IsRevB1) {
     DisableSmmu (Fdt, "iommus", "/smb/smmu@e0c00000", "/smb/sata@e0d00000");
+    DisableSmmu (Fdt, "iommus", "/smb/smmu@e0c00000", "/smb/ccp@e0100000");
   }
 
   if (!FixedPcdGetBool (PcdXgbeEnable) || !PcdGetBool (PcdEnableSmmus)) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH edk2-platforms 0/3] fixes for AMD OverDrive
  2019-11-25 18:07 [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Ard Biesheuvel
                   ` (2 preceding siblings ...)
  2019-11-25 18:07 ` [PATCH edk2-platforms 3/3] Platform/Overdrive: clean up stream ID descriptions in DT Ard Biesheuvel
@ 2019-11-26 11:47 ` Leif Lindholm
  2019-11-27 17:35   ` Ard Biesheuvel
  3 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2019-11-26 11:47 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: devel

On Mon, Nov 25, 2019 at 19:07:07 +0100, Ard Biesheuvel wrote:
> Fix some issues in the ACPI and DT descriptions of the SMMU routing,
> in particular the routing of the CCP crypto accelerator, which sits
> behind an SMMU as well on B1 silicon (but not on B0, strangely enough)
> 
> Ard Biesheuvel (3):
>   Platform/Overdrive: add missing resolution for FileHandleLib
>   Silicon/AMD/Styx: clean up stream ID mappings for SMMU
>   Platform/Overdrive: clean up stream ID descriptions in DT

For the series:
Acked-by: Leif Lindholm <leif.lindholm@linaro.org>


>  Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts    |  19 ++-
>  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc               |   2 +-
>  Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl            |  23 ----
>  Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc           | 137 +++++---------------
>  Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl          |  23 ++++
>  Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c |   5 +-
>  6 files changed, 72 insertions(+), 137 deletions(-)
> 
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH edk2-platforms 0/3] fixes for AMD OverDrive
  2019-11-26 11:47 ` [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Leif Lindholm
@ 2019-11-27 17:35   ` Ard Biesheuvel
  0 siblings, 0 replies; 6+ messages in thread
From: Ard Biesheuvel @ 2019-11-27 17:35 UTC (permalink / raw)
  To: Leif Lindholm; +Cc: edk2-devel-groups-io

On Tue, 26 Nov 2019 at 12:47, Leif Lindholm <leif.lindholm@linaro.org> wrote:
>
> On Mon, Nov 25, 2019 at 19:07:07 +0100, Ard Biesheuvel wrote:
> > Fix some issues in the ACPI and DT descriptions of the SMMU routing,
> > in particular the routing of the CCP crypto accelerator, which sits
> > behind an SMMU as well on B1 silicon (but not on B0, strangely enough)
> >
> > Ard Biesheuvel (3):
> >   Platform/Overdrive: add missing resolution for FileHandleLib
> >   Silicon/AMD/Styx: clean up stream ID mappings for SMMU
> >   Platform/Overdrive: clean up stream ID descriptions in DT
>
> For the series:
> Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks. I'm spinning another version of this series, though ...

>
> >  Platform/AMD/OverdriveBoard/DeviceTree/OverdriveBoard.dts    |  19 ++-
> >  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc               |   2 +-
> >  Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Dsdt.asl            |  23 ----
> >  Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/Iort.aslc           | 137 +++++---------------
> >  Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/SsdtB1.asl          |  23 ++++
> >  Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c |   5 +-
> >  6 files changed, 72 insertions(+), 137 deletions(-)
> >
> > --
> > 2.20.1
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-27 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-25 18:07 [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Ard Biesheuvel
2019-11-25 18:07 ` [PATCH edk2-platforms 1/3] Platform/Overdrive: add missing resolution for FileHandleLib Ard Biesheuvel
2019-11-25 18:07 ` [PATCH edk2-platforms 2/3] Silicon/AMD/Styx: clean up stream ID mappings for SMMU Ard Biesheuvel
2019-11-25 18:07 ` [PATCH edk2-platforms 3/3] Platform/Overdrive: clean up stream ID descriptions in DT Ard Biesheuvel
2019-11-26 11:47 ` [PATCH edk2-platforms 0/3] fixes for AMD OverDrive Leif Lindholm
2019-11-27 17:35   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox