Peer-to-Peer Routing DML template reference
PCIe Modeling Library  / 

Integrity & Data Encryption (IDE)

The PCIe IDE library (pcie/ide.dml) provides templates for supporting IDE.

Supported Aspects of IDE

Current Limitations

Internal IDE handling

Use this when the IDE capability lives inside the PCIe device/controller that represents the PCIe device.

Required components

  1. An IDE capability instantiated in pcie_config of function 0.
  2. pcie_ide_internal_handler instantiated on the pcie_device template’s top-level ide_dev group that acts as the IDE handler. It locates the pcie_ide_cap instance in its parent scope automatically and provides the applicable IDE API needed by the PCIe library.
  3. pcie_ide_cap — applied on the IDE capability inside pcie_config, provides stream matching, key validation, and transaction processing logic. The methods get_stream_key(), get_tx_active_key_set(), invalidate_keys_iv() increment_iv() should be implemented. The semantics for doing this is vendor specific.

Simple Example Root Port

dml 1.4;

device test_pcie_root_port;
param classname = "test-pcie-root-port";

import "pcie/common.dml";

param desc = "an IDE PCIe Root Port";
param documentation = "A PCI Express Root Port with IDE support";

is pcie_root_port;
group ide_dev is pcie_ide_internal_handler;

param pcie_version = 6.0;

bank pcie_config {
    is defining_ide_capability;
    param ide_offset = 0x100;
    param ide_next_ptr = 0;
    param ide_num_tcs = 0;
    param ide_num_selective_streams = 1;
    param ide_num_address_associations = 2;
    group ide {
        method get_stream_key(uint8 stream_id, uint4 key_sub_stream,
            uint1 rxtxb, uint1 key_set, bool link_stream, uint8 i) ->
            (pcie_ide_key_t) throws {
            local pcie_ide_key_t key;
            // Actual implementation here
            return key;
        }

        method get_tx_active_key_set(uint8 stream_id, uint4 key_sub_stream,
            bool link_stream, uint8 i) -> (uint1) throws default {
            local uint1 active_key_set;
            // Actual implementation here
            return active_key_set;
        }

        method increment_iv(uint8 stream_id, uint4 key_sub_stream, uint1 rxtxb,
            uint1 key_set, bool link_stream, uint8 i) throws default {
            // Actual implementation here
        }

        method invalidate_keys_iv(uint8 stream_id) throws default {
            // Actual implementation here
        }
    }
}

External IDE Controller

Use this when the IDE capability lives in a separate Simics object (not in the PCIe device. This is useful when the IDE logic is in HW implemented as a standalone controller that is associated with a PCIe device but is not part of the same device.

Required components

In the PCIe device (e.g., endpoint)

  1. pcie_ide_external_handler — instantiated on the top-level ide_dev group of the pcie_device. This template delegates all IDE operations (key validation, transaction processing, flow-through checks) to the external controller via the pcie_external_ide interface.

  2. pcie_ide_controller_subobj — applied on a connect that references the external IDE controller device. This template ensures the controller is automatically instantiated as a sub-object and enforces the instantiated class to implement the pcie_external_ide interface. It also sets a connect attribute in the external controller so that the controller has a reference to its associated PCIe device (more on that in the description of pcie_ide_external_implementation)

  3. A mechanism to forward host configuration space accesses to the endpoint’s outsourced IDE capability (which is implemented in a separate controller).

In the external IDE controller (separate DML device)

  1. pcie_ide_external_implementation — applied at device level. This template:

  2. An IDE capability instantiated in a bank in the device using is defining_ide_capability. Since this is not a PCIe device, but the capability is a PCIe capability, the use_standard_access_templates and use_standard_write_template must be set explicitly. The methods get_stream_key(), get_tx_active_key_set(), invalidate_keys_iv() and increment_iv() must be implemented.

Simple example of external IDE controller

dml 1.4;

provisional explicit_param_decls, explicit_method_decls, explicit_object_extensions;

device test_external_ide_controller;
param classname = "test-external-ide-controller";

param pcie_version = 6;

import "pcie/common.dml";
import "./test-pcie-common.dml";

param desc = "a PCIe IDE Controller";
param documentation = "A PCI Express IDE Controller to connect to the"
    + " test-pcie-endpoint. Used for testing";

is pcie_ide_external_implementation;

bank pcie_config {
    param use_standard_access_templates := true;
    param use_standard_write_templates := true;

    is defining_ide_capability;
    param ide_offset = 0;
    param ide_next_ptr = ide_offset + 0x100;
    param ide_num_tcs = 0;
    param ide_num_selective_streams = 2;
    param ide_num_address_associations = 2;
    group ide is ide_key_provider;
}

The ide_key_provider would in this example be providing an implementation of the aforementioned methods that need a vendor specific implementation.

Peer-to-Peer Routing DML template reference