1. 09 Aug, 2022 6 commits
    • Frank Li's avatar
      PCI: endpoint: Support NTB transfer between RC and EP · e35f56bb
      Frank Li authored
      Add NTB function driver and virtual PCI Bus and Virtual NTB driver
      to implement communication between PCIe Root Port and PCIe EP devices
      
      ┌────────────┐         ┌─────────────────────────────────────┐
      │            │         │                                     │
      ├────────────┤         │                      ┌──────────────┤
      │ NTB        │         │                      │ NTB          │
      │ NetDev     │         │                      │ NetDev       │
      ├────────────┤         │                      ├──────────────┤
      │ NTB        │         │                      │ NTB          │
      │ Transfer   │         │                      │ Transfer     │
      ├────────────┤         │                      ├──────────────┤
      │            │         │                      │              │
      │  PCI NTB   │         │                      │              │
      │    EPF     │         │                      │              │
      │   Driver   │         │                      │ PCI Virtual  │
      │            │         ├───────────────┐      │ NTB Driver   │
      │            │         │ PCI EP NTB    │◄────►│              │
      │            │         │  FN Driver    │      │              │
      ├────────────┤         ├───────────────┤      ├──────────────┤
      │            │         │               │      │              │
      │  PCI Bus   │ ◄─────► │  PCI EP Bus   │      │  Virtual PCI │
      │            │  PCI    │               │      │     Bus      │
      └────────────┘         └───────────────┴──────┴──────────────┘
      PCIe Root Port                        PCI EP
      
      This driver includes 3 parts:
       1 PCI EP NTB function driver
       2 Virtual PCI bus
       3 PCI virtual NTB driver, which is loaded only by above virtual PCI bus
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      e35f56bb
    • Frank Li's avatar
      NTB: epf: Allow more flexibility in the memory BAR map method · e75d5ae8
      Frank Li authored
      Support the below BAR configuration methods for epf NTB.
      
      BAR 0: config and scratchpad
      BAR 2: doorbell
      BAR 4: memory map windows
      
      Set difference BAR number information into struct ntb_epf_data. So difference
      VID/PID can choose different BAR configurations. There are difference
      BAR map method between epf NTB and epf vNTB Endpoint function.
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      e75d5ae8
    • Frank Li's avatar
      PCI: designware-ep: Allow pci_epc_set_bar() update inbound map address · 4284c88f
      Frank Li authored
      ntb_mw_set_trans() will set memory map window after endpoint function
      driver bind. The inbound map address need be updated dynamically when
      using NTB by PCIe Root Port and PCIe Endpoint connection.
      
      Checking if iatu already assigned to the BAR, if yes, using assigned iatu
      number to update inbound address map and skip set BAR's register.
      Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      4284c88f
    • Dave Jiang's avatar
      ntb: intel: add GNR support for Intel PCIe gen5 NTB · a914fc52
      Dave Jiang authored
      Add Intel Granite Rapids NTB PCI device ID and related enabling.
      Expectation is same hardware interface as Saphire Rapids Xeon platforms.
      Signed-off-by: default avatarDave Jiang <dave.jiang@intel.com>
      Acked-by: default avatarAllen Hubbe <allenbh@gmail.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      a914fc52
    • Dan Carpenter's avatar
      NTB: ntb_tool: uninitialized heap data in tool_fn_write() · 45e1058b
      Dan Carpenter authored
      The call to:
      
      	ret = simple_write_to_buffer(buf, size, offp, ubuf, size);
      
      will return success if it is able to write even one byte to "buf".
      The value of "*offp" controls which byte.  This could result in
      reading uninitialized data when we do the sscanf() on the next line.
      
      This code is not really desigined to handle partial writes where
      *offp is non-zero and the "buf" is preserved and re-used between writes.
      Just ban partial writes and replace the simple_write_to_buffer() with
      copy_from_user().
      
      Fixes: 578b881b ("NTB: Add tool test client")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      45e1058b
    • Justin Stitt's avatar
      ntb: idt: fix clang -Wformat warnings · a44252d5
      Justin Stitt authored
      When building with Clang we encounter these warnings:
      | drivers/ntb/hw/idt/ntb_hw_idt.c:2409:28: error: format specifies type
      | 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]
      | "\t%hhu-%hhu.\t", idx + cnt - 1);
      -
      | drivers/ntb/hw/idt/ntb_hw_idt.c:2438:29: error: format specifies type
      | 'unsigned char' but the argument has type 'int' [-Werror,-Wformat]
      | "\t%hhu-%hhu.\t", idx + cnt - 1);
      -
      | drivers/ntb/hw/idt/ntb_hw_idt.c:2484:15: error: format specifies type
      | 'unsigned char' but the argument has type 'int' [-Werror,-Wformat], src);
      
      For the first two warnings the format specifier used is `%hhu` which
      describes a u8. Both `idx` and `cnt` are u8 as well. However, the
      expression as a whole is promoted to an int as you cannot get
      smaller-than-int from addition. Therefore, to fix the warning, use the
      promoted-to-type's format specifier -- in this case `%d`.
      
      example:
      ``
      uint8_t a = 4, b = 7;
      int size = sizeof(a + b - 1);
      printf("%d\n", size);
      // output: 4
      ```
      
      For the last warning, src is of type `int` while the format specifier
      describes a u8. The fix here is just to use the proper specifier `%d`.
      
      See more:
      (https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules)
      "Integer types smaller than int are promoted when an operation is
      performed on them. If all values of the original type can be represented
      as an int, the value of the smaller type is converted to an int;
      otherwise, it is converted to an unsigned int."
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/378Signed-off-by: default avatarJustin Stitt <justinstitt@google.com>
      Acked-by: default avatarSerge Semin <fancer.lancer@gmail.com>
      Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
      a44252d5
  2. 31 Jul, 2022 6 commits
  3. 30 Jul, 2022 2 commits
  4. 29 Jul, 2022 26 commits