Nikita Proshkin [Mon, 27 May 2024 15:22:55 +0000 (18:22 +0300)]
pcilmr: Fix margining for ports with Lane reversal
Current implementation interacts only with first Negotiated Link Width
lanes even when Maximum Link Width for the port is bigger than that and
Lane reversal is used. Utility in such situation may try to margin lane
which is not used right now and erroneously fail with
'Error during caps reading' message. Fix that behaviour.
Nikita Proshkin [Wed, 22 May 2024 16:06:33 +0000 (19:06 +0300)]
pcilmr: Apply grading quirk for Ice Lake RC ports
Ice Lake RC ports don't support two side independent timing margining,
however the entire margin across the eye is what is reported by one side
margining. Utility already has quirks for Ice Lake RC, so expand them
based on this grading information.
Nikita Proshkin [Wed, 22 May 2024 16:06:31 +0000 (19:06 +0300)]
pcilmr: Add new grading option
Original version of the utility used values from the Table 8-11 of the
PCIe Base Spec Rev 5.0 to evaluate lanes. But it seems that these values
relate only to the margining equipment and are not relevant to evaluating
the quality of connections.
The PCIe Base Spec Rev 5.0 sets the minimum values for the eye in the
section 8.4.2. Change default grading values in the utility according to
this section.
The specification uses the values of the full width and height of the eye,
so add these values to the output of the utility.
In addition, manufacturers can provide criteria for their devices that
differ from the standard ones. Usually this information falls under the
NDA, so add an option to the utility that will allow the user to set
necessary criteria for evaluating the quality of lanes.
Implement the following syntax for the -g(rading) option:
-g 1t=15ps,f | -g 6v=20
Use passed per link receiver criteria for the eye width (timing - t) or
height (voltage - v) in the utility results.
Additional flag f is for situations when port doesn't support two side
independent margining. In such cases by default calculate EW or EH as a
double one side result. User can add f flag for -g option to tell the
utility that the result in one direction is actually the measurement of
the full eye (for example, Ice Lake RC ports work in this way) and it does
not need to be multiplied.
Nikita Proshkin [Wed, 22 May 2024 16:06:30 +0000 (19:06 +0300)]
pcilmr: Move most of pcilmr arguments parsing logic to the separate file
Also change arguments parsing logic: now link parameters (selected lane
numbers, timing or voltage steps, etc) need to be specified after link port
and will affect only this link margining (previously, one option was
applied to all links).
Nikita Proshkin [Wed, 22 May 2024 16:06:29 +0000 (19:06 +0300)]
pcilmr: Ensure that utility can accept either Downstream or Upstream link port
Previously, the utility expected only the Upstream Port to be input and,
in fact, passing the Downstream Port led to strange and buggy error
messages. Improve arguments parsing logic to accept any side of the link.
It seems that the only use case that will not be available now is margining
the internal links of the switch, but this scenario looks as strange as
possible.
Konrad Sztyber [Wed, 22 May 2024 10:16:44 +0000 (12:16 +0200)]
dump: allow 6-digit domains
The SPDK VMD driver assigns domains for the devices behind a VMD by
concatenating bus/device/function of the VMD, each on a separate byte.
For instance, a device behind a VMD with an address of 5d:05.5 would be
assigned domain 5d0505.
Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
PCIe r6.0, sec 7.9.26.4.2 "Link IDE Stream Status Register defines"
the link state as:
0000b Insecure
0010b Secure
The same definition applies to selective streams as well.
The existing code wrongly assumes "secure" is 0001b, fix that for both
link and selective streams.
While at this, add missing "Selective IDE for Configuration Requests Enable".
Also fix the base and limit parsing for the memory and RID ranges.
Fixes: 42fc4263ec0e ("ls-ecaps: Add decode support for IDE Extended Capability") Signed-off-by: Alexey Kardashevskiy <aik@amd.com>
Pali Rohár [Fri, 29 Mar 2024 20:19:27 +0000 (21:19 +0100)]
windows: Do not show unwanted file-not-found GUI message box
Sometimes SEM_FAILCRITICALERRORS flag (disable critical-error-handler GUI
messages) is not enough for LoadLibrary() and SEM_NOOPENFILEERRORBOX flag
(disable file-not-found GUI messages) is needed too to prevent showing GUI
messages on LoadLibrary() failures.
Pali Rohár [Tue, 27 Feb 2024 23:32:08 +0000 (00:32 +0100)]
libpci: ecam: Fix scanning of Extended BIOS Data Area for ACPI RSDP
At physical address 0x40E (part of BDA) is stored indirect 16-bit paragraph
offset to the EBDA, and not the EBDA itself. Fix it.
ACPI code in linux kernel checks if the EBDA offset in BDA is above
physical address 0x400. Do the same check here. It is for detection if EBDA
is present as it does not have to be on the old computers or in some
virtualised environments.
Pali Rohár [Sun, 25 Feb 2024 02:22:08 +0000 (03:22 +0100)]
Makefile: Pass CFLAGS also when linking executable
Optimization flags like -O2 from $(OPT) passed via $(CFLAGS) used during
compiling individual object files are ignored when gcc's LTO is enabled for
the linking final executable.
Optimization flags used for compiling individual object files should be
same as optimization flags for linking final executable.
Fix propagation of $(CFLAGS) and $(OPT) when LTO is enabled.
PCIe r6.1, sec 7.5.3.3 defines "TEE-IO Supported" in the PCI Express Device
Capabilities Register which indicates that the function implements
the TEE-IO functionality as described by the TEE Device Interface Security
Protocol (TDISP, PCIe r6.1, chapter 11).
ls-ecaps: Add decode support for IDE Extended Capability
IDE (Integrity & Data Encryption) Extended Capability defined in [1]
implements control of the PCI link encryption. The verbose level > 2 prints
offsets of the fields to make running setpci easier.
Pali Rohár [Sat, 24 Feb 2024 15:12:26 +0000 (16:12 +0100)]
libpci: Define STATIC_ALIAS for DLL Windows builds
Windows builds for versioned symbols use inline asm .set directive which in
some cases makes x86-64 LTO compiler to drop the referenced value. Define
STATIC_ALIAS macro with VERSIONED_ABI (used) attribute which forces LTO
compiler to not drop the symbol from the final DLL library.
Pali Rohár [Sat, 24 Feb 2024 15:09:35 +0000 (16:09 +0100)]
libpci: win32-cfgmgr32: Do not include resolver for cfgmgr32 function for MinGW-w64
MinGW-w64 toolchain (as opposite to MinGW32) provides all needed cfgmgr32
functions in import library. Use import library and do not resolve
functions at runtime.
Pali Rohár [Wed, 14 Jun 2023 15:43:21 +0000 (17:43 +0200)]
windows: Fix setting permissions in grant_process_token_dacl_permissions()
Rewrite function to always add a new allow granting permissions at first
position in DACL. Normally all deny permissions are before allow
permissions, so previously allow permission could have been overridden by
explicit deny permission. With this change, our newly added allow
permission override any possible deny permission and always grant access
for asked process user.
Also properly handle automatic inheritance model which is in use since
Windows 2000 and handle also special case when DACL is not present which
gives allow access to everyone.
Pali Rohár [Sun, 1 Jan 2023 18:52:16 +0000 (19:52 +0100)]
windows: Make msvc __readeflags more readable
Semicolon in msvc __asm block means start of the comment, and not end of
the __asm statement, like it is for all other C statements. Also function
which uses msvc inline assembly cannot be inlined to another function
(compiler reports a warning about it, not a fatal error). So add explicit
curly brackets for __asm block, remove misleading semicolons and do not
declare function as inline.
Nikita Proshkin [Wed, 27 Dec 2023 09:45:00 +0000 (14:45 +0500)]
pcilmr: Add the ability to pass multiple links to the utility
* Add support for different utility modes;
* Make the default (now --margin) mode capable to accept several
components and run test for all of them;
* Add --full mode for sequential start of the test on all ready links
in the system;
* The complication of the main function is due to the need to pre-read the
parameters of the devices before starting the tests in order to calculate
Total ETA of the utility.
Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com> Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
Nikita Proshkin [Wed, 27 Dec 2023 09:44:59 +0000 (14:44 +0500)]
pcilmr: Add support for unique hardware quirks
Make it possible to change receiver margining parameters depending on
current hardware specificity.
In our tests Intel Ice Lake CPUs RC ports reported
MaxVoltageOffset = 50 (RxA), which led to results several times bigger
than the results of the hardware debugger.
Looks like in Intel Sapphire Rapids this was fixed, these CPU RC ports
report MaxVoltageOffset = 12 (RxA). To solve the problem it was decided
to hardcode Volt Offset to 12 (120 mV) for Ice Lake RC ports.
In the case of margining a specific link, only information about
Downstream and Upstream ports should be sufficient to decide whether to
use quirks, so the feature was implemented based on a list of devices
(vendor - device - revision triples), whose problems are known.
Back to Ice Lake ports, according to Integrators List on the pci-sig site,
the list of possible RC ports of Ice Lake Xeon's includes at least three
more options (with ids 347B/C/D) besides the one used in this commit, but
we don't have such processors to check the relevance of the MaxVoltageOffset
problem for these ports.
Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com> Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
Nikita Proshkin [Wed, 27 Dec 2023 09:44:57 +0000 (14:44 +0500)]
pcilmr: Add function for default margining results log
Lanes are rated according to the minimum/recommended values.
The minimum values are taken from PCIe Base Spec Rev 5.0 section 8.4.4.
30% UI recommended value for timing is taken from NVIDIA presentation
"PCIe 4.0 Mass Electrical Margins Data Collection".
Receiver lanes are called 'Weird' if all results of all receiver lanes
are equal to the spec minimum value.
Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com> Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>
Nikita Proshkin [Wed, 27 Dec 2023 09:44:56 +0000 (14:44 +0500)]
pcilmr: Add logging functions for margining
* Implement option to turn on/off logging for margining;
* Support systems with several PCI domains;
* margin_log_margining function prints margining in progress log using
one line messages for each Receiver in the form:
"Margining - <direction> - Lanes [<current simultaneous lanes>] - ETA:
<current direction-lanes margining remaining time> Steps: <current
margining steps done> Total ETA: <utility run total remaining time>".
Reviewed-by: Sergei Miroshnichenko <s.miroshnichenko@yadro.com> Signed-off-by: Nikita Proshkin <n.proshkin@yadro.com>