Extended Capabilities templates Simics Commands
PCIe Modeling Library  /  DML template reference  / 

Error templates

Error Reporting Structures

typedef struct {
    uint8                err;
    pcie_ecs_t           subclass;
    atom_t               *msg_extra_atoms;
    pcie_aer_log_entry_t log_entry;
} corr_error_t;

typedef struct {
    pcie_uncorrectable_error_t err;
    atom_t                     *msg_extra_atoms;
    pcie_aer_log_entry_t       log_entry;
} unc_error_t;

typedef corr_error_t unc_anf_error_t;

Instances of these structures are passed to the submit_correctable_error(), submit_uncorrectable_error(), submit_uncorrectable_error_advisory_non_fatal() methods respectively. For subclass in corr_error_t, if the message does not support subclasses, the value can be left to 0 (PCIE_ECS_Legacy). For err in corr-error_ret_t, it can hold values of the enums pcie_correctable_error_t and pcie_uncorrectable_error_t if it is advisory non-fatal error. In all cases:

In a pcie_aer_log_entry_t entry, the is_flit field indicates whether the the log entry is of a flit or a non-flit TLP. pcie_aer_log_entry_tlp_t is then a union and based on the value of the is_flit, either the non_flit_tlp or the flit_tlp_header field should be populated.

typedef struct {
    bool is_flit;
    pcie_aer_log_entry_tlp_t tlp_log_entry;
} pcie_aer_log_entry_t;

typedef union {
    pcie_aer_non_flit_tlp_t non_flit_tlp;
    const bytes_t *flit_tlp_header;
} pcie_aer_log_entry_tlp_t;

typedef struct {
    const bytes_t *prefix;
    const bytes_t *header;
} pcie_aer_non_flit_tlp_t;

pcie_error_reporter

The pcie_error_reporter is template that is instantiated by all PCIe function that inherit the config_bank template.

It provides utility methods for PCIe error signaling. The submission methods will update the relevant status register and send a PCIe message to the Root complex if applicable conditions are met. The registers updated and the conditions checked by default are described below:

Updated registers:

Conditions checked:

Methods

The entry methods for submitting a PCIe error are submit_correctable_error(), submit_uncorrectable_error() and submit_uncorrectable_error_advisory_non_fatal(). All of the methods described below are however overridable, which can be useful if there are device specific status registers that should be set or conditions that apply to the PCIe function to determine whether or to transmit a message.

The error values can be retrieved from the pcie_uncorrectable_error_t and pcie_correctable_error_t enums that are defined in the top-level of the PCIe library in the error.dml file. These are accessed using for example local pcie_correctable_error_t err = PCIE_Err_Cor_Internal_Error;.

submit_correctable_error(const corr_error_t *e) -> (bool, pcie_error_t)

Submits a correctable PCIe error. Returns two values (message_was_sent, error), where message_was_sent is set to true if the message was sent to the RC. If the message was sent, error holds a value of the pcie_error_t enum. Otherwise error holds a value of -1 if an error is encountered, or 0 if the message was not sent due to configuration reasons.

submit_uncorrectable_error(const unc_error_t *e) -> (bool, pcie_error_t)

Submits an uncorrectable PCIe error. Returns two values (message_was_sent, error), where message_was_sent is set to true if the message was sent to the RC. If the message was sent, error holds a value of the pcie_error_t enum. Otherwise error holds a value of -1 if an error is encountered, or 0 if the message was not sent due to configuration reasons.

submit_uncorrectable_error_advisory_non_fatal(const unc_anf_error_t *e) -> (bool, pcie_error_t)

Submits an uncorrectable PCIe error that is advisory non fatal. Returns two values (message_was_sent, error), where message_was_sent is set to true if the message was sent to the RC. If the message was sent, error holds a value of the pcie_error_t enum. Otherwise error holds a value of -1 if an error is encountered, or 0 if the message was not sent due to configuration reasons.

get_severity(pcie_uncorrectable_error_t err) -> (uint8)

Returns the severity of an uncorrectable error. Throws an error if the error is not valid. Can be overridden if custom severity is needed.

Error Message conditions for sending

These methods checks if the PCIe function should send an error message to the Root Complex. They return true if the conditions are met, otherwise false.

Override this methods to add additional conditions that should be met for correctable errors.

send_error_message(pcie_error_severity_t severity, atom_t *extra_atoms) -> (bool, int)

Sends a PCIe error. Returns two values (message_was_sent, error), where message_was_sent is set to true if the message was sent to the RC. If the message was sent, error holds a value of pcie_error_t enum. Otherwise error holds a value of -1 if an error is encountered, or 0 if the message was not sent due to configuration reasons.

transmit_error_message(pcie_error_severity_t severity, atom_t *extra_atoms) -> (pcie_error_t)

Transmits the PCIe error message. The default behavior is to send it upstream. In root ports, the default behavior is to send it to it self for internal handling.

Override this method to issue the error message transaction somewhere else.

handling_err_messages

Methods for an root port receiving PCIe Error messages. Inherits handling_messages.

Should only be used a Root Port’s message handling port. The pcie_config parameter must be set to the pcie_config bank of the root port.

handle_error_message(transaction_t *t, uint64 addr, pcie_message_type_t type) -> (pcie_error_t)

Called when an error is received. Device model has to override the default implementation to do additional processing of the message.

Extended Capabilities templates Simics Commands