From 0736df56df7c457f4cdfe3e4ad85180877d00569 Mon Sep 17 00:00:00 2001 From: Gavin Shan Date: Thu, 11 Aug 2016 12:12:38 +1000 Subject: hw/npu: Use PCI virtual device This rmoves the codes for emulated PCI config space as it can be supported by generic PCI virtual device: * The PCI virtual device and NPU device are created at same time. * Uses PCI virtual device and filter to access NPU (PCI) device's config space. Signed-off-by: Gavin Shan Reviewed-by: Russell Currey Signed-off-by: Stewart Smith --- include/npu.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/npu.h b/include/npu.h index d92d3ed..0768155 100644 --- a/include/npu.h +++ b/include/npu.h @@ -113,20 +113,14 @@ struct npu_dev { struct npu_dev_bar bar; struct phb *phb; - /* Device and function numbers are allocated based on GPU - * association */ - uint32_t bdfn; - /* The link@x node */ struct dt_node *dt_node; - /* The GPU PCI device this NPU device is associated with */ + /* PCI virtual device and the associated GPU device */ + struct pci_virt_device *pvd; struct pci_device *pd; - struct npu *npu; - uint8_t *config[NPU_DEV_CFG_MAX]; struct list_head capabilities; - struct list_head traps; /* Which PHY lanes this device is associated with */ uint16_t lane_mask; @@ -194,15 +188,9 @@ static inline void npu_ioda_sel(struct npu *p, uint32_t table, void npu_scom_init(struct npu_dev *dev); -int64_t npu_dev_procedure_read(struct npu_dev_trap *trap, - uint32_t offset, - uint32_t size, - uint32_t *data); - -int64_t npu_dev_procedure_write(struct npu_dev_trap *trap, - uint32_t offset, - uint32_t size, - uint32_t data); +int64_t npu_dev_procedure(void *dev, struct pci_cfg_reg_filter *pcrf, + uint32_t offset, uint32_t len, uint32_t *data, + bool write); void npu_set_fence_state(struct npu *p, bool fence); -- cgit v1.1