aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-25acpi, numa: move acpi_numa_slit_init() to common placetopic-numa-erp-20160426.0Hanjun Guo
acpi_numa_slit_init() is used by both x86 and arm64, and the code is the same, move it to common place to simplify the code, and mark it as __weak because the different implimentation for ia64. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-04-25acpi, numa: Enable ACPI based NUMA on ARM64Hanjun Guo
Add function needed for cpu to node mapping, and enable ACPI based NUMA for ARM64 in Kconfig Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-04-25arm64, acpi, numa: NUMA support based on SRAT and SLITHanjun Guo
Introduce a new file to hold ACPI based NUMA information parsing from SRAT and SLIT. SRAT includes the CPU ACPI ID to Proximity Domain mappings and memory ranges to Proximity Domain mapping. SLIT has the information of inter node distances(relative number for access latency). Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-04-25acpi, numa: introduce ACPI_HAS_NUMA_ARCH_FIXUPHanjun Guo
acpi_numa_arch_fixup() is only used for IA64, x86 introduce a dummy function for it, when we came to a new architecture (such as ARM64), we need to introduce another dummy one to make the code compile. That's pretty boring so introduce ACPI_HAS_NUMA_ARCH_FIXUP and select it for IA64, introduce a stub function for acpi_numa_arch_fixup() then it's pretty clean for x86 and ARM64. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-04-25acpi, numa: remove duplicate NULL checkHanjun Guo
The argument "header" for acpi_table_print_srat_entry() is always checked before the function is called, it's duplicate to check it again, remove it. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-04-25acpi, numa: Replace ACPI_DEBUG_PRINT() with pr_debug()Hanjun Guo
ACPI_DEBUG_PRINT is pretty fragile in acpi/numa.c, the first thing is that component ACPI_NUMA(0x80000000) is not described in the Documentation/acpi/debug.txt, and even not defined in the struct acpi_dlayer acpi_debug_layers which we can not dynamically enable/disable it with /sys/modules/acpi/parameters/debug_layer. another thing is that ACPI_DEBUG_OUTPUT is controlled by ACPICA. Replace ACPI_DEBUG_PRINT() with pr_debug() in this patch as pr_debug will do the same thing for debug purpose and it can make the code much cleaner, also remove the related code which not needed anymore if ACPI_DEBUG_PRINT() is gone. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-04-25acpi, numa: Use pr_fmt() instead of printkHanjun Guo
Just do some cleanups to replace printk with pr_fmt(). Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-04-25topology, cleanup: Avoid redefinition of cpumask_of_pcibus in asm header files.Ganapatrao Kulkarni
At present cpumask_of_pcibus is defined for !CONFIG_NUMA and moving out to common will allow to use for numa too. This also avoids redefinition of this macro in respective architecture header files. Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-04-25PCI: generic: Make pci-host-generic driver numa awareGanapatrao Kulkarni
update numa_node of device associated with pci bus. moved down devm_kzalloc to allocate from node memory. Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-04-25arm64, dt, thunderx: Add initial dts for Cavium Thunderx in 2 node topology.Ganapatrao Kulkarni
Adding dt file for Cavium's Thunderx dual socket platform. Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-04-25arm64/arm, numa, dt: adding numa dt binding implementation for arm64 platforms.Ganapatrao Kulkarni
Adding numa dt binding support for arm64 based platforms. dt node parsing for numa topology is done using device property numa-node-id and device node distance-map. Reviewed-by: Robert Richter <rrichter@cavium.com> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-04-25Documentation, dt, arm64/arm: dt bindings for numa.Ganapatrao Kulkarni
DT bindings for numa mapping of memory, cores and IOs. Reviewed-by: Robert Richter <rrichter@cavium.com> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-04-25arm64, numa: adding numa support for arm64 platforms.Ganapatrao Kulkarni
Adding numa support for arm64 based platforms. This patch adds by default the dummy numa node and maps all memory and cpus to node 0. using this patch, numa can be simulated on single node arm64 platforms. Tested-by: Shannon Zhao <shannon.zhao@linaro.org> Reviewed-by: Robert Richter <rrichter@cavium.com> Signed-off-by: Ganapatrao Kulkarni <gkulkarni@caviumnetworks.com>
2016-03-23acpi: pci: fix issue when bus number is not 0topic-pci-fixes-erp-20160426.0Graeme Gregory
Taken from list https://lkml.org/lkml/2016/2/18/293 Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
2016-03-21PCI: ACPI: IA64: fix IO port generic range checkLorenzo Pieralisi
The [0 - 64k] ACPI PCI IO port resource boundary check in: acpi_dev_ioresource_flags() is currently applied blindly in the ACPI resource parsing to all architectures, but only x86 suffers from that IO space limitation. On arches (ie IA64 and ARM64) where IO space is memory mapped, the PCI root bridges IO resource windows are firstly initialized from the _CRS (in acpi_decode_space()) and contain the CPU physical address at which a root bridge decodes IO space in the CPU physical address space with the offset value representing the offset required to translate the PCI bus address into the CPU physical address. The IO resource windows are then parsed and updated in arch code before creating and enumerating PCI buses (eg IA64 add_io_space()) to map in an arch specific way the obtained CPU physical address range to a slice of virtual address space reserved to map PCI IO space, ending up with PCI bridges resource windows containing IO resources like the following on a working IA64 configuration: PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [io 0x1000000-0x100ffff window] (bus address [0x0000-0xffff]) pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000fffff window] pci_bus 0000:00: root bus resource [mem 0x80000000-0x8fffffff window] pci_bus 0000:00: root bus resource [mem 0x80004000000-0x800ffffffff window] pci_bus 0000:00: root bus resource [bus 00] This implies that the [0 - 64K] check in acpi_dev_ioresource_flags() leaves platforms with memory mapped IO space (ie IA64) broken (ie kernel can't claim IO resources since the host bridge IO resource is disabled and discarded by ACPI core code, see log on IA64 with missing root bridge IO resource, silently filtered by current [0 - 64k] check in acpi_dev_ioresource_flags()): PCI host bridge to bus 0000:00 pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000fffff window] pci_bus 0000:00: root bus resource [mem 0x80000000-0x8fffffff window] pci_bus 0000:00: root bus resource [mem 0x80004000000-0x800ffffffff window] pci_bus 0000:00: root bus resource [bus 00] [...] pci 0000:00:03.0: [1002:515e] type 00 class 0x030000 pci 0000:00:03.0: reg 0x10: [mem 0x80000000-0x87ffffff pref] pci 0000:00:03.0: reg 0x14: [io 0x1000-0x10ff] pci 0000:00:03.0: reg 0x18: [mem 0x88020000-0x8802ffff] pci 0000:00:03.0: reg 0x30: [mem 0x88000000-0x8801ffff pref] pci 0000:00:03.0: supports D1 D2 pci 0000:00:03.0: can't claim BAR 1 [io 0x1000-0x10ff]: no compatible bridge window For this reason, the IO port resources boundaries check in generic ACPI parsing code should be guarded with a CONFIG_X86 guard so that more arches (ie ARM64) can benefit from the generic ACPI resources parsing interface without incurring in unexpected resource filtering, fixing at the same time current breakage on IA64. This patch factors out IO ports boundary [0 - 64k] check in generic ACPI code and makes the IO space check X86 specific to make sure that IO space resources are usable on other arches too. Fixes: 3772aea7d6f3 ("ia64/PCI/ACPI: Use common ACPI resource parsing interface for host bridge") Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Hanjun Guo <hanjun.guo@linaro.org> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Tomasz Nowicki <tn@semihalf.com> Cc: Mark Salter <msalter@redhat.com> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
2016-03-16acpi/pci: hack to prevent allocation issuesGraeme Gregory
Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
2016-03-16arm64, pci, acpi: Start using ACPI based PCI host bridge driver for ARM64.topic-pci-erp-20160426.0Tomasz Nowicki
It is perfectly fine to use ACPI_PCI_HOST_GENERIC for ARM64, so lets get rid of PCI init empty stub, related ACPI header and go with full-blown PCI host controller driver. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> TO: Catalin Marinas <catalin.marinas@arm.com> TO: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com> TO: Will Deacon <will.deacon@arm.com> TO: Arnd Bergmann <arnd@arndb.de> CC: Liviu Dudau <Liviu.Dudau@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16arm64, pci, acpi: Assign legacy IRQs once device is enable.Tomasz Nowicki
This is the last step before enabling generic ACPI PCI host controller for ARM64. We need to take care of legacy IRQ mapping for non-MSI(X) PCI devices. pcibios_alloc_irq() evaluation is not sensitive to ACPI device enumeration order, so it is the best place to assign device's IRQs for ACPI boot method. Also, it does not hurt DT to be initialized form the same place. NOTE: *This is going to be temporary solution*. There is ongoing work which aims for cleaning legacy IRQ allocation from arch specific code. We can consider this patch as the necessary evil which will be removed once cleanup series lands in mailnline in the near future. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2016-03-16pci, acpi: Match PCI config space accessors against platfrom specific quirks.Tomasz Nowicki
Some platforms may not be fully compliant with generic set of PCI config accessors. For these cases we implement the way to overwrite accessors set prior to PCI buses enumeration. Algorithm traverses available quirk list, matches against <platform ID (DMI), domain, bus number> tuple and returns corresponding accessors. All quirks can be defined using: DECLARE_ACPI_MCFG_FIXUP() and kept self contained. Example, static const struct dmi_system_id foo_dmi[] = { { .ident = "<Platform ident string>", .callback = <handler>, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "<system vendor>"), DMI_MATCH(DMI_PRODUCT_NAME, "<product name>"), DMI_MATCH(DMI_PRODUCT_VERSION, "product version"), }, }, { } }; static struct pci_ops foo_ecam_pci_ops = { .map_bus = pci_mcfg_dev_base, .read = foo_ecam_config_read, .write = foo_ecam_config_write, }; DECLARE_ACPI_MCFG_FIXUP(foo_dmi, NULL, &foo_ecam_pci_ops, <domain_nr>, <bus_nr>); More custom (non-DMI) matching can be done via an extra call. Note that there is possibility to assign quirk related private data to root->sysdata which will be available along read/wriate accessor, example: static int boo_match(struct pci_mcfg_fixup *fixup, struct acpi_pci_root *root) { return [condition] ? 1 : 0; } int boo_ecam_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) { struct acpi_pci_root *root = bus->sysdata; struct boo_priv_data *boo_data = root->sysdata; [..] } static struct pci_ops boo_ecam_pci_ops = { .map_bus = pci_mcfg_dev_base, .read = boo_ecam_config_read, .write = boo_ecam_config_write, }; DECLARE_ACPI_MCFG_FIXUP(NULL, boo_match, &boo_ecam_pci_ops, <domain_nr>, <bus_nr>); Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16pci, acpi: Support for ACPI based generic PCI host controller initializationTomasz Nowicki
This patch is going to implement generic PCI host controller for ACPI world, similar to what pci-host-generic.c driver does for DT world. All such drivers, which we have seen so far, were implemented within arch/ directory since they had some arch assumptions (x86 and ia64). However, they all are doing similar thing, so it makes sense to find some common code and abstract it into the generic driver. This driver aims to initialize PCI host controller without architecture assumptions. It uses MCFG library to manage PCI config space regions properly. Also, it parses _CRS content to find out host bridge's resources (i.e. MEM/IO). As mentioned in Kconfig help section, ACPI_PCI_HOST_GENERIC choice should made on a per-architecture basis. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Signed-off-by: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com> TO: Bjorn Helgaas <helgaas@kernel.org> TO: Rafael J. Wysocki <rafael@kernel.org> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16drivers: pci: add generic code to claim bus resourcesLorenzo Pieralisi
PCI core code contains a set of functions, eg: pci_assign_unassigned_bus_resources() that allow to assign the PCI resources for a given bus after enumeration. On systems where the PCI BARs are immutable (ie they must not and can not be assigned), PCI resources must be claimed in order to be validated and inserted in the PCI resources tree, but there is no generic PCI kernel function for that purpose and the resource claiming is implemented in an arch specific fashion which resulted in arches implementations that contain duplicated code. This patch, based on the ia64 resource claiming arch implementation, implements a set of functions in core PCI code that provides a PCI core interface for resources claiming for a given PCI bus hierarchy, paving the way for further resource claiming consolidation across architectures. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Yinghai Lu <yinghai@kernel.org>
2016-03-16pci, of: Move the PCI I/O space management to PCI core code.Tomasz Nowicki
No functional changes in this patch. PCI I/O space mapping code does not depend on OF, therefore it can be moved to PCI core code. This way we will be able to use it e.g. in ACPI PCI code. Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Tomasz Nowicki <tn@semihalf.com> CC: Arnd Bergmann <arnd@arndb.de> CC: Liviu Dudau <Liviu.Dudau@arm.com> CC: Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>
2016-03-16acpi, mcfg: Add default PCI config accessors implementation and initial ↵Tomasz Nowicki
support for related quirks. We use generic accessors from access.c by default. However, we already know platforms that need special handling while accessing to PCI config space. These platforms will need different accessors set matched against platform ID, domain, bus touple. Therefore we are going to add (in future) DECLARE_ACPI_MCFG_FIXUP which will register platform specific custom accessors. For now, we let pci_mcfg_get_ops to take acpi_pci_root structure as an arguments and left some space for quirk matching algorithm. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16x86, ia64: Include acpi_pci_{add|remove}_bus to the default ↵Tomasz Nowicki
pcibios_{add|remove}_bus implementation. x86 and ia64 are the only arches that implement pcibios_{add|remove}_bus hooks and implement them in the same way. Moreover ARM64 is going to do the same. So it seems that acpi_pci_{add|remove}_bus is generic enough to be default option for pcibios_{add|remove}_bus hooks. Also, it is always safe to run acpi_pci_{add|remove}_bus as they have empty stubs for !ACPI case and return if ACPI has been switched off in run time. After all we can remove x86 and ia64 pcibios_{add|remove}_bus implementation. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16pci, acpi: Provide generic way to assign bus domain number.Tomasz Nowicki
As we now have valid PCI host bridge device reference we can introduce code that is going to find its bus domain number using ACPI _SEG method. Note that _SEG method is optional, therefore _SEG absence means that all PCI buses belong to domain 0. While at it, for the sake of code clarity we put ACPI and DT domain assign methods into the corresponding helpers. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16pci, acpi, x86, ia64: Move ACPI host bridge device companion assignment to ↵Tomasz Nowicki
core code. Currently we have two platforms (x86 & ia64) capable of PCI ACPI host bridge initialization. They both use arch-specific sysdata to pass down parent device reference and both rely on NULL parent in pci_create_root_bus() to validate sysdata content. It looks hacky and prevents us from getting some firmware specific info for PCI host controller based on its acpi_device structure in generic pci_create_root_bus() function. However, we overcome that blocker by passing down parent device via pci_create_root_bus parameter (as the ACPI device type). Then we use ACPI_COMPANION_SET in core code for ACPI boot method only. ACPI_COMPANION_SET is safe to run for all cases DT, ACPI and DT&ACPI. Since now PCI core code is setting ACPI companion device for us, x86 & ia64 specific ACPI companion device setting turns out to be dead now. We can get rid of it, including related companion reference from PCI sysdata structure. Aslo, PCI_CONTROLLER macro cannot return valid companion device anymore. Therefore we need to convert its usage to ACPI_COMPANION. Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16x86, pci: Cleanup platform specific MCFG data by using ECAM hot_added flag.Tomasz Nowicki
x86 uses lots of arch-specific data to maintain MCFG regions. However, there is no need to. Firstly, information like start_bus, end_bus can be obtained from acpi_pci_root structure. Secondly, mcfg_added flag is already integrated to MCFG library, so it is enough to call pci_mmconfig_insert and pci_mmconfig_delete which are handling hot-plugged MCFG regions internally. This patch implements above improvements, as a results we get much smaller pci_root_info structure. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16pci, acpi, ecam: Add flag to indicate whether ECAM region was hot added or not.Tomasz Nowicki
There are two ways we can get ECAM (aka MCFG) regions using ACPI, first from MCFG static table and second from _CBA method. We cannot remove static regions, however regions coming from _CBA should be removed while removing bridge device. In the light of above we need flag to mark hot added ECAM entries and user to call pci_mmconfig_insert while adding regions from _CBA method. Similarly pci_mmconfig_delete while removing hot added regions. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16arm64, acpi: Use MCFG library and empty PCI config space accessors from ↵Tomasz Nowicki
pci_mcfg.c file. We can now enable MCFG library. Currently, there is no ARM64 use case for RAW pci config accessors, so lets use empty ones for now. At the same time, we can cleanup the old implementation of RAW accessors from arch/arm64/kernel/pci.c Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16acpi, pci, mcfg: Provide default RAW ACPI PCI config space accessors.Tomasz Nowicki
Lets keep RAW ACPI PCI config space accessors empty by default, since we are note sure if they are necessary accross all archs. Once we sort this out, we can provide generic version or let architectures to overwrite, like now x86. Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Tested-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Tested-by: Duc Dang <dhdang@apm.com> Tested-by: Dongdong Liu <liudongdong3@huawei.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Tested-by: Graeme Gregory <graeme.gregory@linaro.org> Tested-by: Sinan Kaya <okaya@codeaurora.org>
2016-03-16ACPI: MCFG: Move mmcfg_list management to drivers/acpiJayachandran C
Move pci_mmcfg_list handling to a drivers/acpi/pci_mcfg.c. This is to share the API and code with ARM64 later. The corresponding declarations are moved from asm/pci_x86.h to linux/pci-acpi.h As a part of this we introduce three functions that can be implemented by the arch code: pci_mmconfig_map_resource() to map a mcfg entry, pci_mmconfig_unmap_resource to do the corresponding unmap and pci_mmconfig_enabled to see if the arch setup of mcfg entries was successful. We also provide weak implementations of these, which will be used from ARM64. On x86, we retain the old logic by providing platform specific implementation. This patch is purely rearranging code, it should not have any impact on the logic of MCFG parsing or list handling. Signed-off-by: Jayachandran C <jchandra@broadcom.com> [Xen parts:] Acked-by: David Vrabel <david.vrabel@citrix.com>
2016-03-16clocksource: arm_arch_timer: Remove arch_timer_get_timecountertopic-kvm-erp-20160426.0Julien Grall
The only call of arch_timer_get_timecounter (in KVM) has been removed. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16KVM: arm/arm64: vgic: Rely on the GIC driver to parse the firmware tablesJulien Grall
Currenlty, the firmware tables are parsed 2 times: once in the GIC drivers, the other time when initializing the vGIC. It means code duplication and make more tedious to add the support for another firmware table (like ACPI). Use the recently introduced helper gic_get_kvm_info() to get information about the virtual GIC. With this change, the virtual GIC becomes agnostic to the firmware table and KVM will be able to initialize the vGIC on ACPI. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16KVM: arm/arm64: arch_timer: Rely on the arch timer to parse the firmware tablesJulien Grall
The firmware table is currently parsed by the virtual timer code in order to retrieve the virtual timer interrupt. However, this is already done by the arch timer driver. To avoid code duplication, use the newly function arch_timer_get_kvm_info() which return all the information required by the virtual timer code. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16irqchip/gic-v3: Parse and export virtual GIC informationJulien Grall
Fill up the recently introduced gic_kvm_info with the virtual GIC information. Signed-off-by: Julien Grall <julien.grall@arm.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Marc Zyngier <marc.zyngier@arm.com>
2016-03-16irqchip/gic-v3: Gather all ACPI specific data in a single structureJulien Grall
Even though all the variables aren't marked with __initdata, they are only used during initialization. So the structure is marked with __initdata. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16irqchip/gic-v2: Parse and export virtual GIC informationJulien Grall
For now, the firmware tables are parsed 2 times: once in the GIC drivers, the other timer when initializing the vGIC. It means code duplication and make more tedious to add the support for another firmware table (like ACPI). Introduce a new structure and set of helpers to get/set the virtual GIC information. Also fill up the structure for GICv2. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16irqchip/gic-v2: Gather ACPI specific data in a single structureJulien Grall
For now, there is only one member. More member will be added later. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16clocksource: arm_arch_timer: Extend arch_timer_kvm_info to get the virtual IRQJulien Grall
Currently, the firmware table is parsed by the virtual timer code in order to retrieve the virtual timer interrupt. However, this is already done by the arch timer driver. To avoid code duplication, extend arch_timer_kvm_info to get the virtual IRQ. Note that the KVM code will be modified in a subsequent patch. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16clocksource: arm_arch_timer: Gather KVM specific information in a structureJulien Grall
Introduce a structure which are filled up by the arch timer driver and used by the virtual timer in KVM. The first member of this structure will be the timecounter. More members will be added later. A stub for the new helper isn't introduced because KVM requires the arch timer for both ARM64 and ARM32. The function arch_timer_get_timecounter is kept for the time being and will be dropped in a subsequent patch. Signed-off-by: Julien Grall <julien.grall@arm.com>
2016-03-16acpi, gicv3, its: Use MADT ITS subtable to do PCI/MSI domain initialization.Tomasz Nowicki
After refactoring DT code, we let ACPI to build ITS PCI MSI domain and do requester ID to device ID translation using IORT table. We have now full PCI MSI domain stack, thus we can enable ITS initialization from GICv3 core driver for ACPI scenario. Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
2016-03-16acpi, gicv3, msi: Factor out code that might be reused for ACPI equivalent.Tomasz Nowicki
Firmware agnostic code lands in separate function which do necessary domain initialization based on unique domain handler. Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
2016-03-16irqchip, gicv3, its: Probe ITS in the ACPI way.Tomasz Nowicki
Since we prepared ITS for being initialized different that via DT, it is now possible to parse MADT and pass mandatory info to firmware-agnostic ITS init call. Note that we are using here IORT lib to keep track of allocated domain handler which will be used to build PCI MSI domain on top in the later patches. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-03-16ARM64, ACPI, PCI: I/O Remapping Table (IORT) initial support.Tomasz Nowicki
IORT shows representation of IO topology for ARM based systems. It describes how various components are connected together on parent-child basis e.g. PCI RC -> SMMU -> ITS. Initial support allows to: - register ITS MSI chip along with ITS translation ID and domain token - find registered domain token based on ITS translation ID - find registered domain token corresponding to given PCI device - find PCI device DeviceID based on its RequesterID Additional features like: - devices to SMMU binding - finding platform device DeviceID based on its RequesterID will be added in next series. Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
2016-03-16irqchip, GICv3, ITS: Refator ITS dt init code to prepare for ACPI.Tomasz Nowicki
Similarly to GICv3 core, we need to extract common code before adding ACPI support. No functional changes. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
2016-03-16irqchip, gicv3, its: Mark its_init() and its children as __initTomasz Nowicki
gicv3_init_bases() is the only caller for its_init(), also it is a __init function, so mark its_init() as __init too, then recursively mark the functions called as __init. This will help to introduce ITS initialization using ACPI tables as we will use acpi_table_parse_entries family functions there which belong to __init section as well. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
2016-03-16irqchip / GICv3: remove gic root node in ITSHanjun Guo
The gic_root_node defined in ITS driver is not actually used, and the ITS driver seems will not use it in the future, so just remove it. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-03-16irqchip,GICv3,ACPI: Add redistributor support via GICC structures.Tomasz Nowicki
Following ACPI spec: On systems supporting GICv3 and above, GICR Base Address in MADT GICC structure holds the 64-bit physical address of the associated Redistributor. If all of the GIC Redistributors are in the always-on power domain, GICR structures should be used to describe the Redistributors instead, and this field must be set to 0. It means that we have two ways to initialize registirbutors map. 1. via GICD structure which can accommodate many redistributors as a region 2. via GICC which is able to describe single redistributor This patch is going to add support for second option. Considering redistributors, GICD and GICC subtables have be mutually exclusive. While discovering and mapping redistributor, we need to know its size in advance. For the GICC case, redistributor can be in a power-domain that is off, thus we cannot relay on GICR TYPER register. Therefore, we get GIC version from distributor register and map 2xSZ_64K for GICv3 and 4xSZ_64K for GICv4. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
2016-03-16irqchip / GICv3: Add ACPI support for GICv3+ initializationTomasz Nowicki
With the refator of gic_of_init(), GICv3/4 can be initialized by gic_init_bases() with gic distributor base address and gic redistributor region(s). So get the redistributor region base addresses from MADT GIC redistributor subtable, and the distributor base address from GICD subtable to init GICv3 irqchip in ACPI way. Note: GIC redistributor base address may also be provided in GICC structures on systems supporting GICv3 and above if the GIC Redistributors are not in the always-on power domain, this patch didn't implement such feature yet. Also, ACPI ITS initialization will be added in the following patches. Signed-off-by: Tomasz Nowicki <tn@semihalf.com> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
2016-03-16irqchip / GICv3: Refactor gic_of_init() for GICv3 driverTomasz Nowicki
Isolate hardware abstraction (FDT) code to gic_of_init(). Rest of the logic goes to gic_init_bases() and expects well defined data to initialize GIC properly. The same solution is used for GICv2 driver. This is needed for ACPI initialization later. Signed-off-by: Tomasz Nowicki <tomasz.nowicki@linaro.org> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>