From mboxrd@z Thu Jan 1 00:00:00 1970 From: vijay.kilari@gmail.com Subject: [PATCH v4 17/17] xen/arm: ITS: Add pci devices in ThunderX Date: Fri, 10 Jul 2015 13:12:52 +0530 Message-ID: <1436514172-3263-18-git-send-email-vijay.kilari@gmail.com> References: <1436514172-3263-1-git-send-email-vijay.kilari@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1436514172-3263-1-git-send-email-vijay.kilari@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian.Campbell@citrix.com, julien.grall@citrix.com, stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com, tim@xen.org, xen-devel@lists.xen.org Cc: Prasun.Kapoor@caviumnetworks.com, Vijaya Kumar K , manish.jaggi@caviumnetworks.com, vijay.kilari@gmail.com List-Id: xen-devel@lists.xenproject.org From: Vijaya Kumar K ITS initialization required for all PCI devices in ThunderX platform are done by calling from specific mapping function. This patch can be reverted once XEN PCI passthrough framework for arm64 is in available. For now all the PCI devices are assigned to Dom0 Signed-off-by: Vijaya Kumar K --- xen/arch/arm/platforms/thunderx.c | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/xen/arch/arm/platforms/thunderx.c b/xen/arch/arm/platforms/thunderx.c index be6f24f..6bd21d2 100644 --- a/xen/arch/arm/platforms/thunderx.c +++ b/xen/arch/arm/platforms/thunderx.c @@ -18,6 +18,82 @@ */ #include +#include + +struct pci_dev_list +{ + uint32_t seg; + uint32_t bus; + uint32_t dev; + uint32_t func; +}; + +#define NUM_DEVIDS 39 + +static struct pci_dev_list bdf[NUM_DEVIDS] = +{ + {0, 0, 2, 0}, /* 1 */ + {0, 0, 6, 0}, + {0, 0, 7, 0}, + {0, 0, 10, 0}, + {0, 0, 11, 0}, + {0, 1, 0, 0}, + {0, 1, 0, 1}, + {0, 1, 0, 5}, + {0, 1, 1, 4}, + {0, 1, 9, 0}, /* 10 */ + {0, 1, 9, 1}, + {0, 1, 9, 2}, + {0, 1, 9, 3}, + {0, 1, 9, 4}, + {0, 1, 9, 5}, + {0, 1, 10, 0}, + {0, 1, 10, 1}, + {0, 1, 10, 2}, + {0, 1, 10, 3}, + {0, 1, 14, 0}, /* 20 */ + {0, 1, 14, 2}, + {0, 1, 14, 4}, + {0, 1, 16, 0}, + {0, 1, 16, 1}, + {0, 2, 0, 0}, + {0, 3, 0, 0}, + {0, 4, 0, 0}, + {1, 0, 8, 0}, + {1, 0, 9, 0}, + {1, 0, 10, 0}, /* 30 */ + {1, 0, 11, 0}, + {2, 0, 1, 0}, + {2, 0, 2, 0}, + {2, 0, 3, 0}, + {2, 1, 0, 0}, + {2, 1, 0, 1}, + {2, 1, 0, 2}, + {2, 1, 0, 3}, + {3, 0, 1, 0}, /* 39 */ +}; + +#define BDF_TO_DEVID(seg, bus, dev, func) (seg << 16 | bus << 8 | dev << 3| func) + +/* TODO: add and assign devices using PCI framework */ +static int thunderx_specific_mapping(struct domain *d) +{ + uint32_t devid, i; + int res; + + for ( i = 0; i < NUM_DEVIDS; i++ ) + { + devid = BDF_TO_DEVID(bdf[i].seg, bdf[i].bus,bdf[i].dev, bdf[i].func); + res = its_add_device(devid); + if ( res ) + return res; + res = its_assign_device(d, devid, devid); + if ( res ) + return res; + } + + return 0; +} static const char * const thunderx_dt_compat[] __initconst = { @@ -27,6 +103,7 @@ static const char * const thunderx_dt_compat[] __initconst = PLATFORM_START(thunderx, "THUNDERX") .compatible = thunderx_dt_compat, + .specific_mapping = thunderx_specific_mapping, .dom0_gnttab_start = 0x40000000000, .dom0_gnttab_size = 0x20000, PLATFORM_END -- 1.7.9.5