Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocxl: Assign a register set to a Logical Partition

Platform specific function to assign a register set to a Logical Partition.
The "ibm,mmio-atsd" property, provided by the firmware, contains the 16
base ATSD physical addresses (ATSD0 through ATSD15) of the set of MMIO
registers (XTS MMIO ATSDx LPARID/AVA/launch/status register).

For the time being, the ATSD0 set of registers is used by default.

Signed-off-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Acked-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201125155013.39955-2-clombard@linux.vnet.ibm.com

authored by

Christophe Lombard and committed by
Michael Ellerman
fc1347b5 91668ab7

+48
+3
arch/powerpc/include/asm/pnv-ocxl.h
··· 28 28 void pnv_ocxl_spa_release(void *platform_data); 29 29 int pnv_ocxl_spa_remove_pe_from_cache(void *platform_data, int pe_handle); 30 30 31 + int pnv_ocxl_map_lpar(struct pci_dev *dev, uint64_t lparid, 32 + uint64_t lpcr, void __iomem **arva); 33 + void pnv_ocxl_unmap_lpar(void __iomem *arva); 31 34 #endif /* _ASM_PNV_OCXL_H */
+45
arch/powerpc/platforms/powernv/ocxl.c
··· 483 483 return rc; 484 484 } 485 485 EXPORT_SYMBOL_GPL(pnv_ocxl_spa_remove_pe_from_cache); 486 + 487 + int pnv_ocxl_map_lpar(struct pci_dev *dev, uint64_t lparid, 488 + uint64_t lpcr, void __iomem **arva) 489 + { 490 + struct pci_controller *hose = pci_bus_to_host(dev->bus); 491 + struct pnv_phb *phb = hose->private_data; 492 + u64 mmio_atsd; 493 + int rc; 494 + 495 + /* ATSD physical address. 496 + * ATSD LAUNCH register: write access initiates a shoot down to 497 + * initiate the TLB Invalidate command. 498 + */ 499 + rc = of_property_read_u64_index(hose->dn, "ibm,mmio-atsd", 500 + 0, &mmio_atsd); 501 + if (rc) { 502 + dev_info(&dev->dev, "No available ATSD found\n"); 503 + return rc; 504 + } 505 + 506 + /* Assign a register set to a Logical Partition and MMIO ATSD 507 + * LPARID register to the required value. 508 + */ 509 + rc = opal_npu_map_lpar(phb->opal_id, pci_dev_id(dev), 510 + lparid, lpcr); 511 + if (rc) { 512 + dev_err(&dev->dev, "Error mapping device to LPAR: %d\n", rc); 513 + return rc; 514 + } 515 + 516 + *arva = ioremap(mmio_atsd, 24); 517 + if (!(*arva)) { 518 + dev_warn(&dev->dev, "ioremap failed - mmio_atsd: %#llx\n", mmio_atsd); 519 + rc = -ENOMEM; 520 + } 521 + 522 + return rc; 523 + } 524 + EXPORT_SYMBOL_GPL(pnv_ocxl_map_lpar); 525 + 526 + void pnv_ocxl_unmap_lpar(void __iomem *arva) 527 + { 528 + iounmap(arva); 529 + } 530 + EXPORT_SYMBOL_GPL(pnv_ocxl_unmap_lpar);