From 700611a48025c5a556bb0aa011ac81bb5d1bcbc1 Mon Sep 17 00:00:00 2001 From: Frederic Barrat Date: Tue, 1 Aug 2017 14:36:13 +0200 Subject: phb4: Enable PCI peer-to-peer P9 supports PCI peer-to-peer: a PCI device can write directly to the mmio space of another PCI device. It completely by-passes the CPU. It requires some configuration on the PHBs involved: 1. on the initiating side, the address for the read/write operation is in the mmio space of the target, i.e. well outside the range normally allowed. So we disable range-checking on the TVT entry in bypass mode. 2. on the target side, we need to explicitly enable p2p by setting a bit in a configuration register. It has the side-effect of reserving an outbound (as seen from the CPU) store queue for p2p. Therefore we only enable p2p on the PHBs using it, as we don't want to waste the resource if we don't have to. P9 supports p2p mmio writes. Reads are currently only supported if the two devices are under the same PHB but that is expected to change in the future, and it raises questions about intermediate switches configuration, so we report an error for the time being. The patch adds a new OPAL call to allow the OS to declare a p2p (initiator, target) pair. Signed-off-by: Frederic Barrat Reviewed-by: Russell Currey Signed-off-by: Stewart Smith --- doc/opal-api/opal-pci-set-p2p-157.rst | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 doc/opal-api/opal-pci-set-p2p-157.rst (limited to 'doc/opal-api') diff --git a/doc/opal-api/opal-pci-set-p2p-157.rst b/doc/opal-api/opal-pci-set-p2p-157.rst new file mode 100644 index 0000000..c34630c --- /dev/null +++ b/doc/opal-api/opal-pci-set-p2p-157.rst @@ -0,0 +1,50 @@ +OPAL_PCI_SET_P2P +================ +:: + + #define OPAL_PCI_SET_P2P 157 + + int64_t opal_pci_set_p2p(uint64_t phbid_init, uint64_t phbid_target, + uint64_t desc, uint16_t pe_number) + + /* PCI p2p descriptor */ + #define OPAL_PCI_P2P_ENABLE 0x1 + #define OPAL_PCI_P2P_LOAD 0x2 + #define OPAL_PCI_P2P_STORE 0x4 + +The host calls this function to enable PCI peer-to-peer on the PHBs. + +Parameters +---------- +:: + + uint64_t phbid_init + uint64_t phbid_target + uint64_t desc + uint16_t pe_number + + +``phbid_init`` + is the value from the PHB node ibm,opal-phbid property for the device initiating the p2p operation + +``phbid_target`` + is the value from the PHB node ibm,opal-phbid property for the device targeted by the p2p operation + +``desc`` + tells whether the p2p operation is a store (OPAL_PCI_P2P_STORE) or load (OPAL_PCI_P2P_LOAD). Can be both. + OPAL_PCI_P2P_ENABLE enables/disables the setting + +``pe_number`` + PE number for the initiating device + +Return Values +------------- + +``OPAL_SUCCESS`` + Configuration was successful + +``OPAL_PARAMETER`` + Invalid PHB or mode parameter + +``OPAL_UNSUPPORTED`` + Not supported by hardware -- cgit v1.1